EaselJS中透明矩形的点击事件

6

是否有可能使透明的矩形可点击?我不想填充它,所以它看起来像

     shape.graphics.setStrokeStyle(2).beginStroke("#000").rect(0, 0, 100, 100)
1个回答

13

这是我实现它的代码:

var shape = new createjs.Shape();    
shape.graphics.setStrokeStyle(2).beginStroke("#000").rect(0, 0, 100, 100);
var hit = new createjs.Shape();
hit.graphics.beginFill("#000").rect(0, 0, 100, 100);
shape.hitArea = hit;

2
更多细节:EaselJS将根据显示对象的可见、非透明像素计算鼠标点击。...您可以为您的对象分配任何其他显示对象作为其hitArea...不会可见。请参阅http://createjs.com/tutorials/Mouse%20Interaction/上的文档和演示。 - Avatar

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接