Closed khalld closed 3 years ago
Solved, hope that can be useful to someone
Trigger the second click automaticcally to complete the shape
mymap.on(L.Draw.Event.DRAWVERTEX, function (e) {
const layerIds = Object.keys(e.layers._layers);
if (layerIds.length > 1) {
const secondVertex = e.layers._layers[layerIds[1]]._icon;
requestAnimationFrame(() => secondVertex.click());
}
});
when I draw a line using the polyne drawing I would like the "drawing" mode to be deactivated immediately as soon as I select the second point of the line (as I do in line 101 of the code). How do I make a library event propagate? And above all on what element should I have it emitted?
https://codesandbox.io/s/romantic-jepsen-7esnz
How to reproduce