Stop event propagation in Bonsai.js

79 Views Asked by At

How do I stop a mousedown event from propagating to the stage?

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

1

There are 1 best solutions below

0
On BEST ANSWER

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:

function selectHandler(e) {
  e.stop();
};

P.S You can see my work in progress here: http://codepen.io/zinkkrysty/pen/iyrjG?editors=001