From 009a1ccba63d8f6e07dd0ddbb948bb2cad686435 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Fri, 13 Jan 2023 03:49:22 +0100 Subject: [PATCH] Enable left-clicking on lines and areas again, fix #1231 --- UI/Base/MinimapImplementation.ts | 2 +- UI/ShowDataLayer/ShowDataLayerImplementation.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/UI/Base/MinimapImplementation.ts b/UI/Base/MinimapImplementation.ts index ebb46f033..22972f35f 100644 --- a/UI/Base/MinimapImplementation.ts +++ b/UI/Base/MinimapImplementation.ts @@ -404,7 +404,7 @@ export default class MinimapImplementation extends BaseUIElement implements Mini if (this._options.lastClickLocation) { const lastClickLocation = this._options.lastClickLocation - map.on("click", function (e: LeafletMouseEvent) { + map.addEventListener("click", function (e: LeafletMouseEvent) { if (e.originalEvent["dismissed"]) { return } diff --git a/UI/ShowDataLayer/ShowDataLayerImplementation.ts b/UI/ShowDataLayer/ShowDataLayerImplementation.ts index 2db66af1c..0f3d9e19f 100644 --- a/UI/ShowDataLayer/ShowDataLayerImplementation.ts +++ b/UI/ShowDataLayer/ShowDataLayerImplementation.ts @@ -340,6 +340,7 @@ export default class ShowDataLayerImplementation { const self = this function activate(event: LeafletMouseEvent) { + Utils.preventDefaultOnMouseEvent(event) if (infobox === undefined) { const tags = self.allElements?.getEventSourceById(key) ?? @@ -383,8 +384,9 @@ export default class ShowDataLayerImplementation { leafletLayer.on({ dblclick: activate, contextmenu: activate, - click: activate, + // click: activate, }) + leafletLayer.addEventListener("click", activate) // Add the feature to the index to open the popup when needed this.leafletLayersPerId.set(key, { feature: feature,