Files
MapLibreParticleLab/platform/android/docs/camera/gesture-detector.md
Bart Louwers c79b6dcf52 Add end-of-file-fixer pre-commit hook (#3176)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-24 20:43:50 +01:00

1.3 KiB

Gesture Detector

The gesture detector of MapLibre Android is encapsulated in the maplibre-gestures-android package.

Gesture Listeners

You can add listeners for move, rotate, scale and shove gestures. For example, adding a move gesture listener with MapLibreMap.addOnRotateListener:

--8<-- "MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/camera/GestureDetectorActivity.kt:addOnMoveListener"

Refer to the full example below for examples of listeners for the other gesture types.

Settings

You can access an UISettings object via MapLibreMap.uiSettings. Available settings include:

  • Toggle Quick Zoom. You can double tap on the map to use quick zoom. You can toggle this behavior on and off (UiSettings.isQuickZoomGesturesEnabled).
  • Toggle Velocity Animations. By default flicking causes the map to continue panning (while decelerating). You can turn this off with UiSettings.isScaleVelocityAnimationEnabled.
  • Toggle Rotate Enabled. Use uiSettings.isRotateGesturesEnabled.
  • Toggle Zoom Enabled. Use uiSettings.isZoomGesturesEnabled.

Full Example Activity

--8<-- "MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/camera/GestureDetectorActivity.kt"