pub struct ScrollGeometry {
pub rect: Rect,
pub content: Size,
pub offset: Vec2,
pub max_offset: Vec2,
}Expand description
What the last layout resolved for a scroll container: where the container
landed, how big its content came out, and the offset it clamped. All
logical px, in the same viewport coordinates on_layout reports.
This is the geometry a view needs to build only the rows that can be seen
— it is read during the next frame’s build, so it describes the frame
before. See Core::scroll_geometry for what that costs and
widgets::uniform_list for the uniform-row case done for you.
The four numbers describe one moment, which is what makes arithmetic on
them safe: offset is always within max_offset, even immediately after
a set_scroll wrote something wilder (the documented “a huge value jumps
to the end” would otherwise hand a view an index a million rows past its
data).
Fields§
§rect: RectThe container’s own box, as the last layout placed and sized it —
the same rect an on_layout on that node would have reported.
content: SizeIts laid-out content, padding included. Bigger than rect on an axis
exactly when that axis has somewhere left to scroll.
offset: Vec2Where the container is scrolled to (positive = content moved up /
left): the retained offset clamped to max_offset, which is what the
next layout will resolve it to unless the content changes size in the
same frame. Core::scroll_offset is the unclamped retained number.
max_offset: Vec2How far offset can travel on each axis — zero on an axis that does
not scroll, or whose content fits. offset == max_offset is “at the
end”, which is how a log view asks whether it is still tailing.