editor: Make polyline clearable
This commit is contained in:
parent
a598403c5f
commit
8ca10033f9
@ -41,6 +41,10 @@ if (editor_mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onLoad(interactive = 1) {
|
function onLoad(interactive = 1) {
|
||||||
|
if (polyline) {
|
||||||
|
polyline.remove(mymap);
|
||||||
|
polyline = undefined;
|
||||||
|
}
|
||||||
if (interactive) {
|
if (interactive) {
|
||||||
str = prompt("Instructions: \n" +
|
str = prompt("Instructions: \n" +
|
||||||
"* Click the scribble-icon in the top left to start or continue drawing.\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++) {
|
for (var i = 0; i < coords.length; i++) {
|
||||||
coords[i] = [coords[i][1], coords[i][0]];
|
coords[i] = [coords[i][1], coords[i][0]];
|
||||||
}
|
}
|
||||||
if (polyline)
|
|
||||||
polyline.remove(mymap);
|
|
||||||
polyline = L.polyline(coords).addTo(mymap);
|
polyline = L.polyline(coords).addTo(mymap);
|
||||||
// polyline.on('dragend', onDragEnd); // TODO: Doesn't work, see "workaround" below
|
// polyline.on('dragend', onDragEnd); // TODO: Doesn't work, see "workaround" below
|
||||||
polyline.enableEdit();
|
polyline.enableEdit();
|
||||||
|
Loading…
Reference in New Issue
Block a user