pub enum DragSourceEvent {
Start(DragStartEvent),
Move(DragMoveEvent),
Enter(DragEnterEvent),
Leave(DragLeaveEvent),
End(DragEndEvent),
Cancel(DragCancelEvent),
}Expand description
Events sent to the element being dragged during a drag operation.
These events track the lifecycle of the drag from the perspective of the source element:
- Starting and moving
- Entering and leaving potential drop targets
- Completing with either a drop or cancellation
The dragged element receives all these events and can use them to provide visual feedback, track what targets are being hovered over, and respond to the outcome of the drag.
Variants§
Start(DragStartEvent)
Drag operation started - sent when the pointer has moved beyond the drag threshold while the button is held down.
Move(DragMoveEvent)
Pointer moved during drag - sent as the pointer moves while dragging.
Enter(DragEnterEvent)
The dragged element entered a potential drop target.
other_element is the target that was entered.
Leave(DragLeaveEvent)
The dragged element left a potential drop target.
other_element is the target that was left.
End(DragEndEvent)
Drag ended — sent when the pointer is released.
other_element is Some(target_id) if the pointer was released over a drop target,
or None if released without a drop target under the pointer.
Note: DragTargetEvent::Drop is dispatched simultaneously when other_element is Some.
Cancel(DragCancelEvent)
Drag was cancelled — sent when the drag is aborted by a PointerCancel event
(e.g., touch interrupted, window lost focus during touch drag).
Implementations§
Source§impl DragSourceEvent
impl DragSourceEvent
Sourcepub fn current_state(&self) -> &PointerState
pub fn current_state(&self) -> &PointerState
Get the current pointer state for this drag event.
Sourcepub fn current_state_mut(&mut self) -> &mut PointerState
pub fn current_state_mut(&mut self) -> &mut PointerState
Get a mutable reference to the current pointer state for this drag event.
Sourcepub fn start_state(&self) -> &PointerState
pub fn start_state(&self) -> &PointerState
Get the pointer state from when the drag started.
Get the pointer button that initiated this drag.
Sourcepub fn start_state_mut(&mut self) -> &mut PointerState
pub fn start_state_mut(&mut self) -> &mut PointerState
Get a mutable reference to the pointer state from when the drag started.
Trait Implementations§
Source§impl Clone for DragSourceEvent
impl Clone for DragSourceEvent
Source§fn clone(&self) -> DragSourceEvent
fn clone(&self) -> DragSourceEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DragSourceEvent
impl !RefUnwindSafe for DragSourceEvent
impl !Send for DragSourceEvent
impl !Sync for DragSourceEvent
impl Unpin for DragSourceEvent
impl UnsafeUnpin for DragSourceEvent
impl !UnwindSafe for DragSourceEvent
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> 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