lucasmerlin / hello_egui

A collection of useful crates for egui
https://lucasmerlin.github.io/hello_egui/
MIT License
272 stars 24 forks source link

Dragging in and out of nested items #11

Open trumank opened 1 year ago

trumank commented 1 year ago

I have an interface very similar to the nested example and would like to be able to drag items between layers. I'm imagining creating a dnd widget over an iterator that returns a flattened version of the tree, but there would need to be a way to indicate which elements fall inside a nested a container.

Are there any existing ideas or plans to add this functionality? I might take a swing at it but would have to familiarize myself with the crate internals.

lucasmerlin commented 1 year ago

That would be really cool. If we support that, we should also be able to support dragging between different lists.

I imagine there would need to be some sort of global / parent drag drop context where the different DragDropUis register themselves and then when dragging an item it checks in which DragDropUi it should be dropped.

I think ideally this would be a separate module without having to make many changes to state.rs but that might not be possible. Feel free to take a swing at it, let me know if you need anything!