gpt4 book ai didi

javascript - 是否可以允许点击路径/项目?

转载 作者:行者123 更新时间:2023-12-01 00:01:59 25 4
gpt4 key购买 nike

如果我有两个带有填充的路径/项目(路径 A 和路径 B),并且路径 A 位于路径 B 之上...有没有办法让您单击路径 A 并获取路径 B单击处理程序来触发?

示例 here 。我希望在单击 topPath 的重叠 Angular 时能够看到“底部单击”日志。

最佳答案

<强> DEMO

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';

关于javascript - 是否可以允许点击路径/项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60660741/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com