mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Drag-and-drop: keep cursor set by user, if any (#5467)
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`.
This commit is contained in:
@@ -57,7 +57,13 @@ impl DragAndDrop {
|
|||||||
if abort_dnd_due_to_mouse_release {
|
if abort_dnd_due_to_mouse_release {
|
||||||
Self::clear_payload(ctx);
|
Self::clear_payload(ctx);
|
||||||
} else {
|
} 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;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user