Skip to content

Explicitely set map interactions#79

Merged
thekid merged 2 commits intomainfrom
feature/map-interactions
Dec 15, 2025
Merged

Explicitely set map interactions#79
thekid merged 2 commits intomainfrom
feature/map-interactions

Conversation

@thekid
Copy link
Copy Markdown
Owner

@thekid thekid commented Dec 14, 2025

This pull request revises the solution found in #64 which also prevents moving the map using touch without previously having to focus the map (e.g. by touching it or clicking) and overwriting the default map interactions (see below) as follows:

Touch

  • Swipe to move
  • Pinch to zoom

Mouse / trackpad

  • Ctrl + mouse wheel to zoom (default: mouse wheel zooms)
  • Drag to move

Rotating the map is disabled.

Keyboard (on focus)

  • Arrow keys to pan
  • + and - to zoom in and out

The default set of interactions, in sequence, is:

  • DragRotate
  • DoubleClickZoom
  • DragPan
  • PinchRotate
  • PinchZoom
  • KeyboardPan
  • KeyboardZoom
  • MouseWheelZoom
  • DragZoom

See https://openlayers.org/en/latest/apidoc/module-ol_interaction_defaults

@thekid
Copy link
Copy Markdown
Owner Author

thekid commented Dec 14, 2025

@kiesel can you verify this still works as expected for you with the mouse scrolling?

@kiesel
Copy link
Copy Markdown

kiesel commented Dec 14, 2025

This now works as expected!

@thekid thekid added the enhancement New feature or request label Dec 15, 2025
@thekid thekid merged commit 6c28b7c into main Dec 15, 2025
15 checks passed
@thekid thekid deleted the feature/map-interactions branch December 15, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants