Cristian
Cristian

Reputation: 6085

Stop event propagation in Bonsai.js

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

Upvotes: 0

Views: 75

Answers (1)

Cristian
Cristian

Reputation: 6085

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

Upvotes: 0

Related Questions