Camera controls detached after releaseDrag

Hi All-

This playground shows a drag behavior attached to a mesh that does an immediate releaseDrag() unless the top of the box is being dragged.

During the drag the camera controls are detached. When the drag is ended normally by releasing the mouse button the camera controls are reattached and start working but the camera controls are not reattached when the drag is ended via releaseDrag().

To see the problem:
Drag the top of the box. Camera controls resume working after releasing button.
Drag a side of the box. Camera controls do not resume working after releasing button.

Is this a bug or am I missing something?

Thanks in advance for any thoughts.


Instead of calling releaseDrag, is it possible to cancel the drag entirely, like by calling e.preventDefault or returning false does for html events? I have a feeling that the problem lies in the overlapping observable subscriptions; the onDragStart is attempting to release drag, but onDragObservable is still being handled due to the timing of event emission and handler invocation.

Maybe you can add a isCancelled flag in the onDragStart and read that in onDrag to determine whether to process the event or not?


Sure! Not the prettiest code in the world:

Thanks, jelster.