editor: Make polyline clearable

This commit is contained in:
Markus Koch 2020-04-19 20:42:45 +02:00
parent a598403c5f
commit 8ca10033f9
1 changed files with 4 additions and 2 deletions

View File

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