pub struct HandleGrabOffset { /* private fields */ }Expand description
Finger-to-handle relationship for one drag. The first phase preserves the captured offset exactly, the second shifts the handle above the finger, and the third preserves that final offset exactly. Progress is based on the furthest displacement from the grab, so event cadence and small reversals cannot change the result.
Implementations§
Source§impl HandleGrabOffset
impl HandleGrabOffset
Sourcepub fn begin(handle_tip_y: f32, finger_y: f32) -> Self
pub fn begin(handle_tip_y: f32, finger_y: f32) -> Self
Starts a drag from a handle whose tip is at handle_tip_y while the pointer is at
finger_y, both in the same vertical coordinates in logical pixels. The handle drifts into
view as the pointer moves down.
Sourcepub fn begin_for(handle_tip_y: f32, finger_y: f32, drifts: bool) -> Self
pub fn begin_for(handle_tip_y: f32, finger_y: f32, drifts: bool) -> Self
Like Self::begin, but with drifts set to false the handle keeps the starting offset
for the whole drag.
Sourcepub fn track(&mut self, finger_y: f32) -> f32
pub fn track(&mut self, finger_y: f32) -> f32
Takes the pointer’s current finger_y and returns the updated offset from the pointer to
the handle tip.
Sourcepub fn bias(&self) -> f32
pub fn bias(&self) -> f32
Returns the current offset from the pointer to the handle tip, in logical pixels.
Sourcepub fn drift_progress(&self) -> f32
pub fn drift_progress(&self) -> f32
Returns how far the offset has moved from its starting value to the fully visible one, from 0.0 to 1.0.
Trait Implementations§
Source§impl Clone for HandleGrabOffset
impl Clone for HandleGrabOffset
impl Copy for HandleGrabOffset
Source§impl Debug for HandleGrabOffset
impl Debug for HandleGrabOffset
Source§impl PartialEq for HandleGrabOffset
impl PartialEq for HandleGrabOffset
impl StructuralPartialEq for HandleGrabOffset
Auto Trait Implementations§
impl Freeze for HandleGrabOffset
impl RefUnwindSafe for HandleGrabOffset
impl Send for HandleGrabOffset
impl Sync for HandleGrabOffset
impl Unpin for HandleGrabOffset
impl UnsafeUnpin for HandleGrabOffset
impl UnwindSafe for HandleGrabOffset
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> ErasedDestructor for Twhere
T: 'static,
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