Drag & drop

The dizmoViewer supports drag and drop to allow users to, for example, organize dizmos hierarchically. When a user moves a dizmo across the dizmoViewer, dragStart and dragEnd Events are generated. Your dizmo can listen and react to those events.

var subscrId = dizmo.onDragStart(function() {
        // the dizmo has started to be dragged by the user
});
var subscrId = dizmo.onDragEnd(function() {
     // the dizmo has stopped being dragged by the user
});

The onDragEnd is called directly. However, when a drag ends, the dizmo could still be moving over the screen (for example, when it is flicked). If you want to check for a new parent after the user has dragged the dizmo, you want to subscribe to onParentChanged instead, as the parent is only updated after the dizmo has stopped moving.

var subscrId = dizmo.onParentChanged(function(){
        //  check the new position of the dizmo
});