是否可以允许点击 path/item?
Is it possible to allow a path/item to be clicked through?
如果我有两个 paths/items 填充(路径 A 和路径 B),并且路径 A 在路径 B 之上...有没有一种方法可以让您点击路径 A 和让路径 B 点击处理程序触发?
示例here。我希望在单击 topPath 的重叠角时能够看到 "bottom clicked" 日志。
http://paperjs.org/reference/path/#locked
Specifies whether the item is locked. When set to true, item interactions with the mouse are disabled.
const bottom = new Rectangle(new Point(10,10), new Point(100,100));
const bottomPath = new Path.Rectangle(bottom);
bottomPath.fillColor = '#999999';
bottomPath.onClick = () => console.log('bottom clicked');
const top = new Rectangle(new Point(60,60), new Point(150,150));
const topPath = new Path.Rectangle({
rectangle: top,
locked: true
});
topPath.fillColor = '#cccccc';
如果我有两个 paths/items 填充(路径 A 和路径 B),并且路径 A 在路径 B 之上...有没有一种方法可以让您点击路径 A 和让路径 B 点击处理程序触发?
示例here。我希望在单击 topPath 的重叠角时能够看到 "bottom clicked" 日志。
http://paperjs.org/reference/path/#locked
Specifies whether the item is locked. When set to true, item interactions with the mouse are disabled.
const bottom = new Rectangle(new Point(10,10), new Point(100,100));
const bottomPath = new Path.Rectangle(bottom);
bottomPath.fillColor = '#999999';
bottomPath.onClick = () => console.log('bottom clicked');
const top = new Rectangle(new Point(60,60), new Point(150,150));
const topPath = new Path.Rectangle({
rectangle: top,
locked: true
});
topPath.fillColor = '#cccccc';