Skip to content

Commit

Permalink
Add DragAndDrop::ClearPayload
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jan 26, 2024
1 parent 95157b6 commit 547d8e8
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 @@ -50,6 +50,14 @@ impl DragAndDrop {
});
}

/// Clears the payload, setting it to `None`.
pub fn clear_poayload(ctx: &Context) {
ctx.data_mut(|data| {
let state = data.get_temp_mut_or_default::<Self>(Id::NULL);
state.payload = None;
});
}

/// Retrieve the payload, if any.
///
/// Returns `None` if there is no payload, or if it is not of the requested type.
Expand Down

0 comments on commit 547d8e8

Please sign in to comment.