diff --git a/crates/egui/src/drag_and_drop.rs b/crates/egui/src/drag_and_drop.rs index 5c5bd496ad8..d2cc73fbdfc 100644 --- a/crates/egui/src/drag_and_drop.rs +++ b/crates/egui/src/drag_and_drop.rs @@ -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::(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