pub struct WheelAccelerator { /* private fields */ }Expand description
Cadence-based wheel accelerator over discrete line notches.
State is tiny (Copy); keep one per scroll surface. The accelerator never
touches rendering or scroll state — callers apply WheelAccelerator::line_notch’s
returned distance themselves.
Implementations§
Source§impl WheelAccelerator
impl WheelAccelerator
Sourcepub fn line_notch(&mut self, dy: f32, fast: bool) -> Pixels
pub fn line_notch(&mut self, dy: f32, fast: bool) -> Pixels
Processes one discrete wheel notch and returns the extra scroll distance to apply beyond the base scroll the framework already made.
Sign follows wheel convention: negative means scroll down. The boost
ramps linearly over WHEEL_ACCEL_NOTCHES_TO_FULL same-direction
notches toward WHEEL_ACCEL_MAX_MULTIPLIER, so the first notch of a
burst contributes a small ramp-in boost and later ones contribute up
to the full multiplier minus one. A pause longer than
WHEEL_ACCEL_DECAY_SECONDS (see WheelAccelerator::rest) or a
direction reversal restarts the ramp. fast applies the
WHEEL_FAST_SENSITIVITY Alt-multiplier instead of
WHEEL_SENSITIVITY.
Trait Implementations§
Source§impl Clone for WheelAccelerator
impl Clone for WheelAccelerator
Source§fn clone(&self) -> WheelAccelerator
fn clone(&self) -> WheelAccelerator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for WheelAccelerator
Source§impl Debug for WheelAccelerator
impl Debug for WheelAccelerator
Auto Trait Implementations§
impl Freeze for WheelAccelerator
impl RefUnwindSafe for WheelAccelerator
impl Send for WheelAccelerator
impl Sync for WheelAccelerator
impl Unpin for WheelAccelerator
impl UnsafeUnpin for WheelAccelerator
impl UnwindSafe for WheelAccelerator
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Span], returning an
Instrumented wrapper.§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§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
Subscriber to this type, returning a
[WithDispatch] wrapper.