Drag & Drop

The dizmoViewer supports drag and drop. If a dizmo is moved across the viewer, dragStart and dragEnd Events are generated. Your dizmo can listen and react to those.

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
});

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

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