pub struct ScrollState { /* private fields */ }Expand description
Inertial scroll state (single axis Y).
Implementations§
Source§impl ScrollState
impl ScrollState
pub fn new() -> Self
pub fn set_overscroll_enabled(&self, enabled: bool)
pub fn overscroll_offset(&self) -> f32
pub fn set_nested_scroll_parent(&self, conn: NestedScrollConnection)
Sourcepub fn connection(&self) -> NestedScrollConnection
pub fn connection(&self) -> NestedScrollConnection
Use it to wire a child scrollable to a parent scroll container
explicitly: child_state.set_nested_scroll_parent(parent_state.connection()).
pub fn set_show_scrollbar(&self, show: bool)
Sourcepub fn set_reversed(&self, reversed: bool)
pub fn set_reversed(&self, reversed: bool)
Reverse layout (Compose reverseLayout): offset 0 sits at the end of
the track and the thumb mapping runs backwards. Call before
to_binding; the binding snapshots the flag like show_scrollbar.
pub fn set_viewport_height(&self, h: f32)
pub fn set_content_height(&self, h: f32)
pub fn set_overscroll(&self, val: f32)
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
Apply a scroll delta from real user input. Pre-empts any in-flight
fling, matching Compose where a new scroll(UserInput) cancels the
fling coroutine holding the MutatorMutex.
Sourcepub fn scroll_nested(&self, dy: f32) -> f32
pub fn scroll_nested(&self, dy: f32) -> f32
Apply a delta that arrived as leftover from a nested child. This is
Compose’s dispatchRawDelta: it bypasses mutual exclusion, so it must
not cancel this container’s own fling.
Sourcepub fn apply_overscroll(&self, leftover: f32) -> f32
pub fn apply_overscroll(&self, leftover: f32) -> f32
Feed leftover (after the nested parent chain has had its chance via post-scroll) into the rubber-band overscroll. Returns the amount still unconsumed. Overscroll deliberately runs LAST so parents get first dibs.
pub fn tick(&self) -> bool
pub fn show_scrollbar(&self) -> bool
Sourcepub fn to_binding(&self) -> ScrollBinding
pub fn to_binding(&self) -> ScrollBinding
Build a ScrollBinding::Vertical from this state for use with Modifier::vertical_scroll.