Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/core/utils/interactions.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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({
Expand Down
Loading