How to stop mapview from rotating when you are zooming in/out?
You may have encountered an issue where you just want to zoom in/out of the mapview without rotating the actual mapview. If yes, this knowledge base will be helpful for you and if no, you will be aware in the future.
This issue can be fixed using the bearing angle property of the camera. Here’s an implementation on how you can achieve it –
Android –
// Get the MapCameraLimits instance from MapCamera.
val mapCameraLimits = mapView.camera.limits;
// Create an AngleRange to set the bearing range (0,0) .
val angleRange = AngleRange(0.0, 0.0);
// Set the bearing range.
mapCameraLimits.bearingRange = angleRange;
Flutter –<br />MapCameraLimits mapCameraLimits = hereMapController.camera.limits; <br />AngleRange angleRange = AngleRange(0.0 , 0.0); <br />mapCameraLimits.bearingRange = angleRange;<br />
iOS –let mapCameraLimit = mapView.camera.limits
let bearingRange = AngleRange(start:0.0,extent:0.0)
mapCameraLimit.bearingRange = bearingRange