From cf5dccbc3a59163feda5d094755b571f6e24e830 Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Fri, 8 May 2020 17:18:10 +0200 Subject: Fix button behavior in editor Stop event propagation of mouse up / down events. --- htdocs/mapscript.js | 2 ++ htdocs/streeteditor.js | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/mapscript.js b/htdocs/mapscript.js index 87991ce..d33e9e7 100644 --- a/htdocs/mapscript.js +++ b/htdocs/mapscript.js @@ -577,6 +577,8 @@ L.MyControl = L.Control.extend({ link.href = '#'; link.title = this.options.title; link.innerHTML = this.options.html; + L.DomEvent.on(link, 'mousedown', L.DomEvent.stop); + L.DomEvent.on(link, 'mouseup', L.DomEvent.stop); L.DomEvent.on(link, 'click', L.DomEvent.stop) .on(link, 'click', function () { window.LAYER = this.options.callback.call(); diff --git a/htdocs/streeteditor.js b/htdocs/streeteditor.js index d5f29b7..8117014 100644 --- a/htdocs/streeteditor.js +++ b/htdocs/streeteditor.js @@ -134,6 +134,8 @@ if (editor_mode) { } function show_location_string(e) { + if (polyline) + polyline.editor.cancelDrawing(); prompt("Copy this string back into the Wiki and wait for the server to refresh the maps:", get_location_string()); } @@ -155,10 +157,12 @@ if (editor_mode) { link.href = '#'; link.title = this.options.title; link.innerHTML = this.options.html; + L.DomEvent.on(link, 'mousedown', L.DomEvent.stop); + L.DomEvent.on(link, 'mouseup', L.DomEvent.stop); L.DomEvent.on(link, 'click', L.DomEvent.stop) - .on(link, 'click', function () { - window.LAYER = this.options.callback.call(map.editTools); - }, this); + .on(link, 'click', function (e) { + window.LAYER = this.options.callback.call(map.editTools); + }, this); return container; } }); -- cgit v1.2.3