0
我正在嘗試進行拖放操作。當我在矩形上釋放圓時,似乎不能註冊掉。我該如何解決這個問題?無論我把它放在舞臺上還是在矩形上,我的目標都是空的。Createjs拖放目標未註冊
var rectangle = new createjs.Container();
rect = new createjs.Shape();
rect.graphics.beginFill("blue").drawRect(50, 50, 250, 210);
rect.name = "rectangle";
rect.x = 300;
rect.y = 300;
rectangle.addChild(rect);
stage.addChild(rectangle);
circle = new createjs.Shape();
circle.name = "mycircle";
circle.graphics.beginFill("red").drawCircle(15, 15, 15);
circle.x = 15;
circle.y = 80;
var dragger = new createjs.Container();
dragger.addChild(circle);
dragger.name = "dragger1";
stage.addChild(dragger);
dragger.on("pressmove", function (evt) {
evt.currentTarget.x = evt.stageX;
evt.currentTarget.y = evt.stageY;
stage.update();
});
dragger.on("pressup", function (evt) {
var target = dragger.getObjectUnderPoint(evt.rawX, evt.rawY, 0);
console.log("this is my target");
console.log(target);
});
謝謝!這真的有幫助 – CsharpBeginner