slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.71k stars 614 forks source link

Rename Flickable/Scrollview viewport vs. content properties #1443

Open tronical opened 2 years ago

tronical commented 2 years ago

The Flickable/ScrollView allows showing content that is larger than the size of the Flickable/Scrollview element.

The current API uses the following terms and properties:

Flickable.width/Flickable.height: The size of the Flickable element.
viewport_width/viewport_height/viewport_x/viewport_y: The size of the content.

The use of the term "viewport" is inconsistent with other toolkits such as Flutter or Qt, where the Flickable/Scrollview is the view port. Similarly, Wikipedia says that the "viewport is a region of the screen used to display a portion of the total image to be shown" or " the viewport is the visible portion of a 2D area which is larger than the visualization device". Therefore it is misleading to call viewport_height the height of the larger content area.

I propose we rename

`viewport_*`

to

`content_*`
ogoffart commented 2 years ago

We can rename and keep the older one as deprecated, so it's not a breaking change.

Enyium commented 3 weeks ago

MDN article on the topic: Viewport concepts

Key take-aways: