pub struct Drag {
pub phase: DragPhase,
pub location: Point,
pub translation: Point,
}Expand description
Drag info delivered to a shape’s .on_drag handler.
translation is cumulative from where the pointer went down; location is where it is
now, in the piece’s own coordinates. The two are not redundant, because Began does not
always arrive at the press: a backend whose recognizer has to watch a few events before it
calls the gesture a drag (appkit raises Began on the first drag event) reports where it
recognized the drag, with the translation from the press already applied. So the press is
location - translation, on every backend and in every phase; take the anchor that way
rather than from Began’s location, or a gesture measured from the anchor trails the
pointer by however far it moved before the recognizer engaged.
Fields§
§phase: DragPhase§location: Point§translation: PointTrait Implementations§
Auto Trait Implementations§
impl Freeze for Drag
impl RefUnwindSafe for Drag
impl Send for Drag
impl Sync for Drag
impl Unpin for Drag
impl UnsafeUnpin for Drag
impl UnwindSafe for Drag
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
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> ⓘ
Converts
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> ⓘ
Converts
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