Skip to content

Commit

Permalink
Drag-and-drop: keep cursor set by user, if any (emilk#5467)
Browse files Browse the repository at this point in the history
We used to always set the cursor to `Grabbing` when a drag and drop
payload is set, but this shadows user code trying to set an alternative
cursor (e.g. `NoDrop`). This PR no only change the cursor to `Grabbing`
if is way previously set to `Default`.
  • Loading branch information
abey79 authored Dec 12, 2024
1 parent ea89c29 commit ba060a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/egui/src/drag_and_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ impl DragAndDrop {
if abort_dnd_due_to_mouse_release {
Self::clear_payload(ctx);
} else {
ctx.set_cursor_icon(CursorIcon::Grabbing);
// We set the cursor icon only if its default, as the user code might have
// explicitly set it already.
ctx.output_mut(|o| {
if o.cursor_icon == CursorIcon::Default {
o.cursor_icon = CursorIcon::Grabbing;
}
});
}
}
}
Expand Down

0 comments on commit ba060a2

Please sign in to comment.