简体   繁体   中英

How to disable drag and drop in createjs

I have to disable a drag and drop activity once they complete it. I tried draggableContainer.enable = false; with no luck.

How would I disable it with out removing it from the screen?

 draggableContainer.on('mousedown', function (e) {
      //Hold on to the item being dragged
       var thingBeingDragged = e.currentTarget;
       var parent = thingBeingDragged.parent;
      //Remove it from stage and readd it.
        parent.removeChild(thingBeingDragged);
        parent.addChild(thingBeingDragged);

        thingBeingDragged.scaleX = 1.05;
        thingBeingDragged.scaleY = 1.05;

        var posX = e.stageX;
        var posY = e.stageY;
        startPositionX = e.stageX;
        startPositionY = e.stageY;
        this.offset = { x: this.x - posX, y: this.y - posY };
   });

  draggableContainer.enable = false;

I'm not totally clear on your question, and it seems as though you are not showing some of your code, since there is no drag and drop logic present.

However, you could probably get the results you want by setting draggableContainer.mouseEnabled = false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM