diff options
| author | diogo464 <[email protected]> | 2024-10-02 10:06:11 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2024-10-02 10:06:11 +0100 |
| commit | 987f6fbbe4ffabd5dca60bdb7a828049603ae0db (patch) | |
| tree | 5ca1b888997088bdd0e907141f4347b3415e024c | |
| parent | 09599bbf58492ea5bb27d1c6ae1980dc925b3d41 (diff) | |
allow creation of vertices inside polygon
| -rw-r--r-- | content/static/main.js | 9 |
1 files 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) { | |||
| 300 | if (positions.length >= 3) { | 300 | if (positions.length >= 3) { |
| 301 | const opacity = state.selected_shape == shape ? 0.2 : 0.04; | 301 | const opacity = state.selected_shape == shape ? 0.2 : 0.04; |
| 302 | const select = () => page_shape__ui_shape_select(state, shape); | 302 | const select = () => page_shape__ui_shape_select(state, shape); |
| 303 | const poly = L.polygon(positions, { color: color, fillOpacity: opacity, bubblingMouseEvents: false }) | 303 | const poly = L.polygon(positions, { color: color, fillOpacity: opacity }) |
| 304 | .on('click', (e) => { if (e.originalEvent.shiftKey) { select(); } }) | 304 | .on('click', (ev) => { if (ev.originalEvent.shiftKey) { L.DomEvent.stopPropagation(ev); select(); } }) |
| 305 | .on('dblclick', select) | 305 | .on('dblclick', (ev) => { |
| 306 | L.DomEvent.stopPropagation(ev); | ||
| 307 | select(); | ||
| 308 | }) | ||
| 306 | .addTo(state.map); | 309 | .addTo(state.map); |
| 307 | shape.layers.push(poly); | 310 | shape.layers.push(poly); |
| 308 | } | 311 | } |
