GDevelop
GDevelop copied to clipboard
Drag&Drop For Grouping Objects
Hello,
I have mentioned this issue on discord before and Alex suggested me to open a Github issue.
If the development team can add the feature of dragging the objects from the objects list and dropping them to groups list for adding the object to a group, grouping would be much easier. There is a recording below to explain myself better:
https://user-images.githubusercontent.com/78256103/183881910-ece3e3ef-5c11-48e8-bbee-4124f8b556c1.mp4
Thanks for opening the issue!
Sumup of my investigation:
- Each list use a SortableVirtualizedItemList.
- Those lists use an instance of react dnd with a different type
GD_OBJECT_WITH_CONTEXT
andGD_GROUP_WITH_CONTEXT
- What we want to do is to add new targets for the objects list drag and drop or to have the same type for both list.
The issue is that the canDrop
callback does not have context on the dragged object (that's to say the canMoveSelectionToItem
given to SortableVirtualizedItemList
by ObjectGroupsList
would not be aware that the dragged item is either an object or an objects group).
We would need to store the dragged object at the scene editor level.
Or we could change our drag and drop implementation so that the canDrop
callback becomes aware of the dragged item(s).