如何禁用createjs中的拖放

时间:2022-09-17 14:27:03

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

完成后我必须禁用拖放活动。我试过draggableContainer.enable = false;没有运气。

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;

1 个解决方案

#1


0  

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;

但是,您可以通过设置draggableContainer.mouseEnabled = false获得所需的结果;

#1


0  

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;

但是,您可以通过设置draggableContainer.mouseEnabled = false获得所需的结果;