Skip to content

Commit

Permalink
Add DragAndDrop::clear_payload()
Browse files Browse the repository at this point in the history
  • Loading branch information
abey79 committed Jan 26, 2024
1 parent 547d8e8 commit bc31f5f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/egui/src/drag_and_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ impl DragAndDrop {
})
}

/// Clear the payload, if any.
pub fn clear_payload(ctx: &Context) {
ctx.data_mut(|data| {
let state = data.get_temp_mut_or_default::<Self>(Id::NULL);
state.payload = None;
});
}

/// Are we carrying a payload of the given type?
///
/// Returns `true` both during a drag and on the frame the pointer is released
Expand Down

0 comments on commit bc31f5f

Please sign in to comment.