Skip to main content

Module scroll

Module scroll 

Source

Structs§

HorizontalScrollState
X-only state
ScrollAxisBinding
Callbacks for a single-axis (vertical or horizontal) scroll container.
ScrollBothBinding
Callbacks for a 2D (both-axis) scroll container.
ScrollPhysics
Handles velocity estimation from input deltas, frame-rate-independent exponential decay, edge snapping, and animation state tracking.
ScrollState
Inertial scroll state (single axis Y).
ScrollStateXY
2D state
ScrollbarStyle

Enums§

ScrollAxis
Axis (or axes) a scroll modifier operates on.
ScrollBinding

Constants§

SCROLL_DECAY_PER_60HZ
Per-60Hz-frame velocity decay at low speed. Higher stops the fling sooner.
SCROLL_FLING_ACTIVATE_VELOCITY
A gesture must exceed this speed (px/s) to leave a fling behind.
SCROLL_OVERSROLL_BAND_MAX
Rubber-band asymptote: overscroll never stretches past this many px.
SCROLL_RELEASE_VELOCITY_HORIZON_MS
How recently the finger must have moved for its velocity to seed a fling. Compose’s VelocityTracker computes from samples inside a 100ms horizon, so a short pause before lifting still coasts. A tighter cutoff drops the fling on any dropped frame on a busy screen.
SCROLL_STOP_VELOCITY
Fling is abandoned once speed falls below this (px/s).

Functions§

cancel_flings
Pre-empt in-flight flings when a touch gesture commits to scrolling. Compose does this through scroll(MutatePriority.UserInput) on the scrollable that receives the drag, not on unrelated surfaces.
os_scroll_axis
Fold leftover into one axis’s rubber band after the nested parent chain has declined it. Returns whatever is still unconsumed.
rubber_band
Asymptotic rubber band: never reaches max, so pulling harder always moves a little more without ever running away.
run_post_scroll
Dispatch leftover scroll to the parent chain and return what remains after the chain’s consumption. consumed is the amount already consumed before reaching this helper (by pre-scroll and by this scroller).
run_post_scroll_zero
Compatibility wrapper for callers that have no consumption to report.
run_pre_scroll
scroll_delta_to_reveal
Scroll delta that brings target inside viewport on the given axes.
set_touch_gesture_active
Mark the start/end of a touch drag so scroll surfaces stop flinging while the finger is down. Compose holds the surface still mid-drag and only starts a fling when the drag stops.
tick_os_axis
Decay one axis’s rubber band back to rest. Returns true while it is active.
touch_gesture_active