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() -> ScrollPhysics
pub fn with_tuning( decay_per_60hz: f32, stop_velocity: f32, input_activate_velocity: f32, ) -> ScrollPhysics
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.
pub fn tick_integrate( &mut self, current: f32, min: f32, max: f32, ) -> Option<f32>
pub fn is_animating(&self) -> bool
Trait Implementations§
Source§impl Clone for ScrollPhysics
impl Clone for ScrollPhysics
Source§fn clone(&self) -> ScrollPhysics
fn clone(&self) -> ScrollPhysics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more