Fix button behavior in editor

Stop event propagation of mouse up / down events.
This commit is contained in:
Markus Koch 2020-05-08 17:18:10 +02:00
parent e936b0c35b
commit cf5dccbc3a
2 changed files with 9 additions and 3 deletions

View File

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

View File

@ -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,8 +157,10 @@ 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 () {
.on(link, 'click', function (e) {
window.LAYER = this.options.callback.call(map.editTools);
}, this);
return container;