pub struct ScrollState { /* private fields */ }Expand description
Inertial scroll state (single axis Y).
Implementations§
Source§impl ScrollState
impl ScrollState
pub fn new() -> Self
Sourcepub fn set_overscroll_enabled(&mut self, enabled: bool)
pub fn set_overscroll_enabled(&mut self, enabled: bool)
Enable or disable the overscroll rubber-band effect (enabled by default).
Sourcepub fn overscroll_offset(&self) -> f32
pub fn overscroll_offset(&self) -> f32
Returns the current overscroll offset (negative = pulled down past top, positive = pulled up past bottom).
Sourcepub fn set_nested_scroll_parent(&self, conn: NestedScrollConnection)
pub fn set_nested_scroll_parent(&self, conn: NestedScrollConnection)
Set a parent nested scroll connection for coordinated scrolling. This enables parent-child scroll coordination (e.g., collapsing toolbars, pull-to-refresh). Call this before the scroll area is first composed.
Sourcepub fn set_show_scrollbar(&self, show: bool)
pub fn set_show_scrollbar(&self, show: bool)
Enable or disable the scrollbar (enabled by default).
pub fn set_viewport_height(&self, h: f32)
pub fn set_content_height(&self, h: f32)
Sourcepub fn set_overscroll(&self, val: f32)
pub fn set_overscroll(&self, val: f32)
Set the overscroll value directly. Used by pull-to-refresh to reset overscroll when the refresh completes.
pub fn set_offset(&self, off: f32)
pub fn get(&self) -> f32
Sourcepub fn scroll_immediate(&self, dy: f32) -> f32
pub fn scroll_immediate(&self, dy: f32) -> f32
Consume dy (pixels), clamp to bounds, return leftover. When overscroll is enabled and the scroll boundary is reached, applies rubber-band resistance instead of returning leftover.