How to disable map rotation or map tilt during finger-based gesture control of the map. (SDK 4.x)

Disable/restrict map rotation or map tilt during finger-based gesture control of the map.

Problem

SDK provides gestures.disableDefaultAction to disable GestureType.PINCH_ROTATE. It disables a pinch and rotate behavior at the same time together.

But it only needs to disable a rotation behavior.

Solution

You can achieve it to control MapCameraLimits utilizing setBearingRange method .

Code example

<br />import com.here.sdk.core.AngleRange;import com.here.sdk.mapview.MapCameraLimits;import com.here.sdk.mapview.MapView;// Assuming you have initialized MapView somewhere in your code.MapView mapView = ... // your MapView instance// Get the MapCameraLimits instance from MapCamera.MapCameraLimits mapCameraLimits = mapView.getCamera().getLimits();// Create an AngleRange to set the bearing range.// Here, the range is set to allow bearings from 0 to 0 degrees.// You can adjust these values according to your requirements.AngleRange angleRange = new AngleRange(0, 0);// Set the bearing range.mapCameraLimits.setBearingRange(angleRange);// Now the camera's bearing will be limited to the range you specified.<br />

The same to disable for tilt behavior is setTiltRange

API reference for iOS and Flutter

iOS (MapCameraLimits)
Flutter (MapCameraLimits)