pub struct ScrollPhysics { /* private fields */ }Expand description
Handles velocity estimation from input deltas, frame-rate-independent exponential decay, edge snapping, and animation state tracking.
Implementations§
Source§impl ScrollPhysics
impl ScrollPhysics
pub fn new() -> Self
pub fn with_tuning( decay_per_60hz: f32, stop_velocity: f32, input_activate_velocity: f32, ) -> Self
Sourcepub fn record_user_input(&mut self, consumed: f32)
pub fn record_user_input(&mut self, consumed: f32)
Feed a delta that arrived from real user input.
A first sample adopts its velocity outright, and a delta opposing an
in-flight fling takes over from it. Both mirror Compose, where a new
scroll(MutatePriority.UserInput) cancels the fling coroutine holding
the MutatorMutex so the drag wins. Smoothing only applies between
samples of one gesture: averaging up from zero on every frame would
leave every flick at a fraction of its real speed.
Sourcepub fn record_nested_input(&mut self, consumed: f32)
pub fn record_nested_input(&mut self, consumed: f32)
Feed a delta that arrived as leftover from a nested child. Never takes
over an in-flight fling: Compose’s dispatchRawDelta bypasses mutual
exclusion precisely so a parent keeps coasting.