Struct Gesture
pub struct Gesture {
pub overscroll_reach_frac: f32,
pub detent_magnet_frac: f32,
pub fling_projection_ms: u32,
}Expand description
Tuning for direct-manipulation gestures — the numbers that decide how a dragged surface resists, catches and coasts. Shared for the same reason the springs are: two controls that resist differently read as two unrelated machines.
Each value is a fraction of the surface’s own reference extent rather than an absolute distance, so one number covers a scroll viewport and a detented wheel alike. The caller supplies the extent.
Fields§
§overscroll_reach_frac: f32Ceiling on overscroll past an end, as a multiple of the surface’s reference extent — the pull approaches this and never reaches it.
Big enough that first contact reads as give rather than a stop, small enough the surface never leaves its region: slightly over one extent means you can pull an end clear of where it rests, see nothing beyond it, and be unable to pull further.
detent_magnet_frac: f32Peak strength of the corrective pull toward the nearest detent while dragging, as a fraction of one detent.
What makes notches felt rather than merely landed on: crossing between two is a small acceleration then resistance. Zero would be a smooth slide; too large and the surface fights the hand and can’t be held between notches.
fling_projection_ms: u32How long a release’s residual velocity is projected forward when choosing where a flick lands — the coast time the projection assumes; the settle spring supplies the actual deceleration. A flick should carry: distance travelled after release is what separates throwing something from pushing it.
Trait Implementations§
impl Copy for Gesture
impl StructuralPartialEq for Gesture
Auto Trait Implementations§
impl Freeze for Gesture
impl RefUnwindSafe for Gesture
impl Send for Gesture
impl Sync for Gesture
impl Unpin for Gesture
impl UnsafeUnpin for Gesture
impl UnwindSafe for Gesture
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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