Leaflet.draw
Leaflet.draw copied to clipboard
Mouse events are not firing when drawing
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.
I'm having the same issue.
Let me know if you found a workaround @artuska
Thanks!