diff options
author | Markus Koch <markus@notsyncing.net> | 2020-04-19 20:42:45 +0200 |
---|---|---|
committer | Markus Koch <markus@notsyncing.net> | 2020-04-19 20:42:45 +0200 |
commit | 8ca10033f92924581b3713291bec90cb8b91cb4c (patch) | |
tree | 4109b5b9779799386473b28260af226c9ee3008b /htdocs | |
parent | a598403c5fca4d2e0b55b59b42e0fe76e1cabbaf (diff) | |
download | lifomapserver-8ca10033f92924581b3713291bec90cb8b91cb4c.tar.gz lifomapserver-8ca10033f92924581b3713291bec90cb8b91cb4c.tar.bz2 lifomapserver-8ca10033f92924581b3713291bec90cb8b91cb4c.zip |
editor: Make polyline clearable
Diffstat (limited to 'htdocs')
-rw-r--r-- | htdocs/streeteditor.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/htdocs/streeteditor.js b/htdocs/streeteditor.js index 5d69d0b..fea2b36 100644 --- a/htdocs/streeteditor.js +++ b/htdocs/streeteditor.js @@ -41,6 +41,10 @@ if (editor_mode) { } function onLoad(interactive = 1) { + if (polyline) { + polyline.remove(mymap); + polyline = undefined; + } if (interactive) { str = prompt("Instructions: \n" + "* Click the scribble-icon in the top left to start or continue drawing.\n" + @@ -57,8 +61,6 @@ if (editor_mode) { for (var i = 0; i < coords.length; i++) { coords[i] = [coords[i][1], coords[i][0]]; } - if (polyline) - polyline.remove(mymap); polyline = L.polyline(coords).addTo(mymap); // polyline.on('dragend', onDragEnd); // TODO: Doesn't work, see "workaround" below polyline.enableEdit(); |