When dragging a widget (e.g. a slider), and letting the cursor move outside the slider, egui should not highlight that other widget:

egui implements this by never setting response.hovered for a widget if another widget is being dragged.
There is a weird exception to this though: if the other widget is not interactive (doesn't sense any clicks or drags), then it will still have response.hovered(). This usually doesn't matter, because a widget that that is not interactive has no hover-effect anyway.
This has implications for drag-and-drop: if the drop-target area has Sense::hover() then it will sense hovers while the user is dragging something else, so the user can do if drag_target_response.hovered() { … to highlight the drop-area. But if the drop-area itself is sensitive to clicks and drags, .hovered() will always be false while something is being dragged. This means it is really tricky to implement drag-and-drop reordering of a list, because usually you'd want to implement that by having each list item sense drags and be a drop-target, to sense how to reorder the items.
A work-around it to use ui.rect_contains_pointer instead of response.hovered(), but this feels hacky.
So: we should figure out:
- Should
response.hovered() be true when something else is being dragged or not?
- Should we have a special
drop-target Sense?
When dragging a widget (e.g. a slider), and letting the cursor move outside the slider, egui should not highlight that other widget:
egui implements this by never setting
response.hoveredfor a widget if another widget is being dragged.There is a weird exception to this though: if the other widget is not interactive (doesn't sense any clicks or drags), then it will still have
response.hovered(). This usually doesn't matter, because a widget that that is not interactive has no hover-effect anyway.This has implications for drag-and-drop: if the drop-target area has
Sense::hover()then it will sense hovers while the user is dragging something else, so the user can doif drag_target_response.hovered() { …to highlight the drop-area. But if the drop-area itself is sensitive to clicks and drags,.hovered()will always be false while something is being dragged. This means it is really tricky to implement drag-and-drop reordering of a list, because usually you'd want to implement that by having each list item sense drags and be a drop-target, to sense how to reorder the items.A work-around it to use
ui.rect_contains_pointerinstead ofresponse.hovered(), but this feels hacky.So: we should figure out:
response.hovered()be true when something else is being dragged or not?drop-targetSense?