是否可以使透明矩形可点击?我不想填充它,所以它看起来像
shape.graphics.setStrokeStyle(2).beginStroke("#000").rect(0, 0, 100, 100)
这是我如何执行的代码:
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;
只需编辑Misha的答案。由于形状需要具有填充色才能起作用,因此设置hit.visible = false
将起到透明度的作用。