Drag & Drop (internal)
WeirdConstructor opened this issue · comments
I would love some internal drag & drop support.
The requirements would be:
- The drag source needs some way to signal a drag process started, to collect some context information from the source. Something like an
on_drag_start
callback or maybe event? for this would be nice. - Possibly every widget could be a destination, but I my concrete use case would be dragging from a button or something similar (maybe just a widget, with
set_drag_source(true)
) to my custom hex grid widget. - If the mouse drags over a widget, an event should be sent to the widget, like
OnDragOver(SourceEntity)
. The destination widget could then figure out if it wants to show that it can be dropped to.- I am unsure if there should be some generic state to apply styling to for showing a valid drop zone. So that one could apply styling to that widget specific to this. Similar to
hover
something likedrop_hover
? I am unsure if this is over designing at this point. - And maybe the source widget should stay in an activated state while that is being done, so that the user can track where they dragged from. Or alternatively a
drag_hover
state?
- I am unsure if there should be some generic state to apply styling to for showing a valid drop zone. So that one could apply styling to that widget specific to this. Similar to
- Dropping on a widget is something I am unsure about. I would love a callback (
on_drop
?) that is called with the position where it was dropped, and the source entity that was originally dragged from. Not sure if an event might be more suitable for this.
My use case is: On some panel there is a set of buttons, each button is representing a DSP node type. And the user can directly drag from that to the hex grid, and drop it on some hex tile to instanciate a new node there. The hex grid would need to know what was being dropped. That could be tracked outside of tuix itself if there is a on_drag_start
callback or event, then I could set some global flag/information where the drag started.
Ideally I would love some visual feedback on the mouse cursor, to show that something is being dragged, but I doubt that this can be done at the moment easily or cheaply, as you would have to redraw the whole GUI on every mouse movement.