Struct egui_dnd::DragDropResponse
source · pub struct DragDropResponse {
pub update: Option<DragUpdate>,
/* private fields */
}
Expand description
Response containing state of the drag & drop list and a potential update to the source list. The update can be applied immediately or at latest when DragDropResponse::is_drag_finished returns true.
Fields§
§update: Option<DragUpdate>
Contains ongoing information about which index is currently being dragged where. You can use this to consistently update the source list while the drag & drop event is ongoing. If you only want to update the source list when the drag & drop event has finished, use DragDropResponse::final_update instead.
Implementations§
source§impl DragDropResponse
impl DragDropResponse
sourcepub fn is_evaluating_drag(&self) -> bool
pub fn is_evaluating_drag(&self) -> bool
Returns true if we are currently evaluating whether a drag should be started.
sourcepub fn is_dragging(&self) -> bool
pub fn is_dragging(&self) -> bool
Returns true if we are currently dragging an item.
sourcepub fn dragged_item_id(&self) -> Option<Id>
pub fn dragged_item_id(&self) -> Option<Id>
Returns the id of the item that is currently being dragged.
sourcepub fn is_drag_finished(&self) -> bool
pub fn is_drag_finished(&self) -> bool
Returns true if the drag & drop event has finished and the item has been dropped. The update should be applied to the source list.
sourcepub fn update_vec<T>(&self, vec: &mut [T])
pub fn update_vec<T>(&self, vec: &mut [T])
Utility function to update a Vec with the current drag & drop state. You can use this to consistently update the source list while the drag & drop event is ongoing.
sourcepub fn final_update(&self) -> Option<DragUpdate>
pub fn final_update(&self) -> Option<DragUpdate>
Returns the update if the drag & drop event has finished and the item has been dropped. Useful for the if let syntax.
sourcepub fn cancellation_reason(&self) -> Option<&'static str>
pub fn cancellation_reason(&self) -> Option<&'static str>
Returns a Option<&str> with the reason if a drag & drop event was cancelled.
Trait Implementations§
source§impl Clone for DragDropResponse
impl Clone for DragDropResponse
source§fn clone(&self) -> DragDropResponse
fn clone(&self) -> DragDropResponse
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more