Handling dblclick event in Konva

36 Views Asked by At

I am trying to perform various operations in case of mousedown, mousemove, mouseup, click and dblclick event. Like i use mousedown event to initialize a rectangle, and on mousemove i want to expand that rectangle shape, on mouseup it will finish drawing rectangle shape.

On click event, i want to select the shape using konva.transformer.

Now what i noticed when i want to select the shape, i use click, and this also trigger the mousedown and mouseup event. When i want to use dblclick, it actually trigger the click, mousedown, and mouseup events.

How can i stop propagating the events and avoid this conflict ? When i click, it should only execute the click event.

I tried using e.evt.stopPropagation(), e.cancelBubble but none of them worked.

1

There are 1 best solutions below

0
Vanquished Wombat On

You need

evt.cancelBubble = true;

See https://konvajs.org/docs/events/Cancel_Propagation.html