Search code examples
drag-and-dropkineticjs

Drag and drop from kinetic.stage to another


Is it possible to do the drag and drop from stage1 to stage2 ? stage1 would be containing the draggable shapes, and stage2 would be the target.


Solution

  • Yes, you can, with something like this:

    image.on('dragmove', function() {
        if ((!stage.getPointerPosition()) && image.getParent() !== layer2) {
    
          image.stopDrag();
    
          image.moveTo(layer2);
          image.position(stage2.getPointerPosition());
          image.startDrag();
          layer.draw();
          layer2.draw();      
        }
    })
    

    DEMO