pub enum ScrollPhysics {
Momentum {
friction: f32,
},
Clamped,
Paged {
page_size: f32,
},
Bounce {
friction: f32,
spring_stiffness: f32,
},
}Expand description
Physics model that governs how a [ScrollView] responds to input and decelerates.
Variants§
Momentum
Natural momentum with friction decay. friction in (0.0, 1.0) — 0.92 is a natural feel.
Clamped
Stops immediately on release.
Paged
Snaps to page boundaries.
Bounce
Momentum with rubber-band overscroll (D108/Phase 26 Step 2) — content
can be dragged past its edge (resisted) and springs back once
released, the iOS scroll feel. friction decays velocity same as
ScrollPhysics::Momentum; spring_stiffness governs how quickly
an out-of-bounds offset eases back to the nearest bound once
velocity has settled (see ScrollController::settle_bounce) — an
exponential ease, the same shape PaintCtx::animate_to already uses
elsewhere in this codebase, not a full mass-spring simulation.
Trait Implementations§
Source§impl Clone for ScrollPhysics
impl Clone for ScrollPhysics
Source§fn clone(&self) -> ScrollPhysics
fn clone(&self) -> ScrollPhysics
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ScrollPhysics
Source§impl Debug for ScrollPhysics
impl Debug for ScrollPhysics
Auto Trait Implementations§
impl Freeze for ScrollPhysics
impl RefUnwindSafe for ScrollPhysics
impl Send for ScrollPhysics
impl Sync for ScrollPhysics
impl Unpin for ScrollPhysics
impl UnsafeUnpin for ScrollPhysics
impl UnwindSafe for ScrollPhysics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more