From f54675e867808b37b451442132b8106ccfbc415b Mon Sep 17 00:00:00 2001 From: Dennis Sen Date: Fri, 11 Sep 2026 12:40:08 +0200 Subject: [PATCH] fix(core): use DragPan default condition on Desktop --- src/core/utils/interactions.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/core/utils/interactions.ts b/src/core/utils/interactions.ts index 9f99b5d2f45..4d3cde13fdd 100644 --- a/src/core/utils/interactions.ts +++ b/src/core/utils/interactions.ts @@ -1,6 +1,10 @@ import type { MapBrowserEvent } from 'ol' -import { platformModifierKeyOnly } from 'ol/events/condition' +import { + noModifierKeys, + platformModifierKeyOnly, + primaryAction, +} from 'ol/events/condition' import { DragPan, KeyboardPan, @@ -30,9 +34,11 @@ export function createPanAndZoomInteractions( } return [ new DragPan({ - condition: function () { - // @ts-expect-error | As the DragPan is added to the interactions of the map, the 'this' context of the condition function should always be defined. - return hasSmallScreen ? this.getPointerCount() > 1 : true + condition: function (e) { + return hasSmallScreen + ? // @ts-expect-error | As the DragPan is added to the interactions of the map, the 'this' context of the condition function should always be defined. + this.getPointerCount() > 1 + : noModifierKeys(e) && primaryAction(e) }, }), new MouseWheelZoom({