Struct ScrollMomentum
pub struct ScrollMomentum { /* private fields */ }Expand description
Deterministic single-axis momentum used by virtualized collection widgets. Wheel input moves immediately; line-wheel impulses additionally feed this decay curve so detented wheels can traverse long collections without requiring one event per row.
Implementations§
§impl ScrollMomentum
impl ScrollMomentum
pub fn new() -> ScrollMomentum
pub fn push(&mut self, delta: f64) -> f64
pub fn push(&mut self, delta: f64) -> f64
Add a logical-pixel wheel impulse. Return the immediate delta so the caller can apply it in the same input frame.
pub fn fling(&mut self, velocity: f64)
pub fn fling(&mut self, velocity: f64)
Continue from a content-space drag velocity after pointer release. The velocity is clamped to the same ceiling as accumulated wheel impulses, keeping a bad timestamp or synthetic pointer from launching the viewport an unbounded distance.
pub fn tick(&mut self, elapsed: Duration) -> f64
pub fn tick(&mut self, elapsed: Duration) -> f64
Advance the curve and return the logical-pixel displacement.
pub fn stop(&mut self)
pub fn wheel(
&mut self,
delta: &MouseScrollDelta,
phase: TouchPhase,
reduce_motion: bool,
) -> WheelStep
pub fn wheel( &mut self, delta: &MouseScrollDelta, phase: TouchPhase, reduce_motion: bool, ) -> WheelStep
Classify one vertical wheel event. Line (detented) wheels accelerate
through Self::push; pixel (touchpad, touchscreen) deltas track
the finger exactly and, when the gesture’s Ended phase arrives
while still moving, continue as a fling. reduce_motion keeps every
movement 1:1 with the input.
pub fn wheel_applied(&mut self, delta: f64, moved: bool)
pub fn wheel_applied(&mut self, delta: f64, moved: bool)
Report whether the WheelStep::Scroll delta moved the content. A
refused delta (at an edge) stops momentum and forgets the gesture so
an outer scroll region can take it over, fling included.
pub fn is_active(&self) -> bool
Trait Implementations§
§impl Clone for ScrollMomentum
impl Clone for ScrollMomentum
§fn clone(&self) -> ScrollMomentum
fn clone(&self) -> ScrollMomentum
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ScrollMomentum
impl Debug for ScrollMomentum
§impl Default for ScrollMomentum
impl Default for ScrollMomentum
§fn default() -> ScrollMomentum
fn default() -> ScrollMomentum
Auto Trait Implementations§
impl Freeze for ScrollMomentum
impl RefUnwindSafe for ScrollMomentum
impl Send for ScrollMomentum
impl Sync for ScrollMomentum
impl Unpin for ScrollMomentum
impl UnsafeUnpin for ScrollMomentum
impl UnwindSafe for ScrollMomentum
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more