[英]Stop event propagation in Bonsai.js
How do I stop a mousedown
event from propagating to the stage? 如何阻止
mousedown
事件传播到舞台?
stage.addListener("pointerdown", startDrawing);
rect = Path.rect(x, y, 100, 100);
stage.addChild rect;
rect.addListener("pointerdown", selectHandler);
startDrawing
gets called each time after selectHandler
每次在
selectHandler
之后调用startDrawing
Curiously though, I had the answer to the question all along, was just tricked into thinking it wasn't working. 奇怪的是,我一直都对这个问题有答案,只是被骗到认为它没有用。
Stop the event in the selectHandler: 在selectHandler中停止事件:
function selectHandler(e) {
e.stop();
};
PS You can see my work in progress here: http://codepen.io/zinkkrysty/pen/iyrjG?editors=001 附言:您可以在这里查看我的作品: http : //codepen.io/zinkkrysty/pen/iyrjG?editors=001
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.