pub struct ScrollStore { /* private fields */ }Expand description
The retained scroll state of one window, owned by Core. Reach it
through Core::scroll_offset, Core::set_scroll and
Core::scroll_geometry rather than directly.
Implementations§
Source§impl ScrollStore
impl ScrollStore
pub fn is_empty(&self) -> bool
pub fn offset(&self, key: Key) -> Vec2
pub fn geometry(&self, key: Key) -> Option<ScrollGeometry>
Sourcepub fn scroll_by(&mut self, key: Key, delta: Vec2)
pub fn scroll_by(&mut self, key: Key, delta: Vec2)
Adds a delta (positive = scroll content further down/right). Clamping happens in the next layout pass.
Sourcepub fn scroll_by_smooth(&mut self, key: Key, delta: Vec2)
pub fn scroll_by_smooth(&mut self, key: Key, delta: Vec2)
The same, from a programmatic source — a reveal, an app’s
set_scroll — which a container declaring a transition eases
into rather than jumping.
pub fn set(&mut self, key: Key, offset: Vec2)
Sourcepub fn set_smooth(&mut self, key: Key, offset: Vec2)
pub fn set_smooth(&mut self, key: Key, offset: Vec2)
The same, from a programmatic source; see
scroll_by_smooth.
Sourcepub fn animating(&self) -> bool
pub fn animating(&self) -> bool
Whether an eased offset was still mid-flight at the last layout, so the driver owes another frame.
Sourcepub fn resolve(
&mut self,
key: Key,
rect: Rect,
content: Size,
max: Vec2,
smooth: Option<Transition>,
) -> Vec2
pub fn resolve( &mut self, key: Key, rect: Rect, content: Size, max: Vec2, smooth: Option<Transition>, ) -> Vec2
What layout calls on a scroll container: records the geometry it
resolved, clamps the stored offset to [0, max] per axis, and
returns it. max is passed rather than derived from rect and
content because an axis that does not scroll has no travel however
far its content overflows.