From 54742f90f9b8f86cde00f06540da9d86e75cbf38 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Fri, 28 May 2021 19:26:42 +0100 Subject: [PATCH] Don't show context menu when right-clicking controls --- src/components/map/MapContextMenu.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/map/MapContextMenu.vue b/src/components/map/MapContextMenu.vue index 39b0368..2a70567 100644 --- a/src/components/map/MapContextMenu.vue +++ b/src/components/map/MapContextMenu.vue @@ -153,6 +153,11 @@ export default defineComponent({ props.leaflet.on('zoomstart', closeContextMenu); props.leaflet.on('contextmenu', (e: LeafletMouseEvent) => { + //Ignore right-clicks on controls + if(e.originalEvent.target && (e.originalEvent.target as HTMLElement).closest('.leaflet-control')) { + return; + } + e.originalEvent.stopImmediatePropagation(); e.originalEvent.preventDefault(); event.value = e;