触发鼠标位置事件时遇到问题。当我拖动对象时,对象正在移动,但在我单击舞台时却没有。我应该怎么办?(当然,我正在添加一个舞台和图层之类的东西;)提前非常感谢!
function rotateAlltoMouse(layer3) {
for(var n = 0; n < layer3.getChildren().length; n++) {
var shape = layer3.getChildren()[n];
var stage = shape.getStage();
var mousePos = stage.getMousePosition();
var xd = shape.getPosition().x - mousePos.x;
var yd = shape.getPosition().y - mousePos.y ;
var theta = Math.atan2(yd, xd);
var degree = theta / (Math.PI / 180) - 45;
shape.setRotationDeg(degree);
}
}
$('#container').bind('mousemove touchstart', function() {
rotateAlltoMouse(layer3);
});