From 987f6fbbe4ffabd5dca60bdb7a828049603ae0db Mon Sep 17 00:00:00 2001 From: diogo464 Date: Wed, 2 Oct 2024 10:06:11 +0100 Subject: allow creation of vertices inside polygon --- content/static/main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/content/static/main.js b/content/static/main.js index 3817460..aa8759b 100644 --- a/content/static/main.js +++ b/content/static/main.js @@ -300,9 +300,12 @@ function page_shape__ui_shape_add(state, shape) { if (positions.length >= 3) { const opacity = state.selected_shape == shape ? 0.2 : 0.04; const select = () => page_shape__ui_shape_select(state, shape); - const poly = L.polygon(positions, { color: color, fillOpacity: opacity, bubblingMouseEvents: false }) - .on('click', (e) => { if (e.originalEvent.shiftKey) { select(); } }) - .on('dblclick', select) + const poly = L.polygon(positions, { color: color, fillOpacity: opacity }) + .on('click', (ev) => { if (ev.originalEvent.shiftKey) { L.DomEvent.stopPropagation(ev); select(); } }) + .on('dblclick', (ev) => { + L.DomEvent.stopPropagation(ev); + select(); + }) .addTo(state.map); shape.layers.push(poly); } -- cgit