Don't show context menu when right-clicking controls

This commit is contained in:
James Lyne 2021-05-28 19:26:42 +01:00
parent e1351d566a
commit 54742f90f9

View File

@ -153,6 +153,11 @@ export default defineComponent({
props.leaflet.on('zoomstart', closeContextMenu); props.leaflet.on('zoomstart', closeContextMenu);
props.leaflet.on('contextmenu', (e: LeafletMouseEvent) => { 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.stopImmediatePropagation();
e.originalEvent.preventDefault(); e.originalEvent.preventDefault();
event.value = e; event.value = e;