我正在尝试实现类似于下面的代码。当用户位于矩形的边缘时,光标指向指针,否则光标是箭头。
shape.graphics.beginStroke("#000").beginFill("#daa").drawRect(50, 150, 250, 250);
shape.on("mousemove", function(evt) {
if (isOnEdges(evt)) {
evt.target.cursor = "pointer";
} else {
evt.target.cursor = "arrow";
}
});上述代码的问题是:
发布于 2014-01-15 13:50:29
您可以简单地设置形状上的光标,并确保您在舞台上enableMouseOver:
var shape = new Shape();
shape.graphics.beginStroke("#000").beginFill("#daa").drawRect(50, 150, 250, 250);
shape.cursor = "pointer";
stage.enableMouseOver();EaselJS将自动确定何时超出形状的界限。
发布于 2016-03-23 14:35:24
我也有一个类似的问题:
container.on("pressmove", function (evt) {
this.x = evt.stageX + this.offset.x;
this.y = evt.stageY + this.offset.y;
if (this.allowDrop(board)) {
this.cursor = "pointer";
}
else {
this.cursor = "no-drop";
}
});这段代码不会在运行时更改我的游标。我用滴答器更新舞台。所以这不是问题所在。
https://stackoverflow.com/questions/21137776
复制相似问题