Any plans to add drag and drop observables for the gui?

I just finished rolling my own and it’s not difficult but I was just wondering if onPointerDragStart and onPointerDragStop will be added at some point. Thanks!

1 Like

I think that would be a nice adding. Particularly if it could be somehow integrated in the Editor (flaging a control as dragable and a receiving container also flaged as the host for a dragable control). Both would keep with their ‘initial’ state/integrity no matter if the child (drag) is moved outside or placed back inside the container. It would make building things like ‘inventory’ a fun thing to do and would increase productivity on this a lot. Though, it might not be that ez to implement, is it?

1 Like

I’m using it for an inventory!

In onPointerDown for the gui item I set a flag _isPointerDown and save the position in _pointerDownPoisiton.
In onPointerMove for the gui item I check for _isPointerDown && !_isDragging and if the mouse has traveled a small distance and at the point call startDragging.
In startDragging I make a copy of the visual of the inventory item and put it in GlobalDragObject and have mouse move move that around and i disable the inventory item while dragging.
onPointerUp sets _isPointerDown and _isDragging to false and disables GlobalDragObject.

That’s the basic gist of what I’m doing.

I haven’t studied the babylon gui code enough to have a good solution for general gui objects.

1 Like

cc @carolhmj

If you’d like it added as a feature you can post a topic on #features to generate discussion about it and all :smiley: