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();