Leaflet.draw icon indicating copy to clipboard operation
Leaflet.draw copied to clipboard

Mouse events are not firing when drawing

Open artuska opened this issue 3 years ago • 1 comments

When i create some drawing shape i subscribe to the mouse events and then start drawing:

let drawingShape = new Leaflet.Draw.Rectangle(map, drawingOptions)

map.on('mousedown', handleDrawingMouseDownEvent);
map.on('mousemove', handleDrawingMouseMoveEvent);

drawingShape.enable();

But when i press-and-hold the mouse and then move my mouse to draw a rectangle none of mousedown or mousemove events are firing.

So, it seems when the drawing starts all mouse events are defaultPrevented and stopPropagated and not firing to the map.

What should i do to catch all those mouse events?

I need mousedown event to know Rectangle's starting point coordinates and mousemove event to know the last point of the Rectangle while drawing.

artuska avatar Nov 17 '21 09:11 artuska

I'm having the same issue.

Let me know if you found a workaround @artuska

Thanks!

mithi-datature avatar Dec 21 '22 10:12 mithi-datature