This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
fitBounds resets heading/bearing to 0 on Android #12059
Labels
Android
Mapbox Maps SDK for Android
Milestone
Previously investigated at nitaliano/react-native-mapbox-gl#1218 by @cworsley4
Platform: Mapbox React Native SDK (but the problem is upstream with the Android SDK)
Mapbox SDK version: The Mapbox React Native SDK is using version 5.4.1 of the Android SDK
I think that this ticket is somewhat related to #2259, but #2259 has the map pitched, and in this example the map is not pitched.
Steps to trigger behavior
Expected behavior
The bearing should not be reset to 0 when calling fitBounds.
Actual behavior
The behavior is this. When calling fitBounds, our heading/bearing is reset to 0 from the heading/bearing we set via the heading prop.
fitBounds is an abstraction of setCamera as is flyTo. In our app, we use both but we only experience an issue when using fitBounds. The difference I see between the two is that in one there is a central point with flyTo and not with fitBounds.
I've traced the issue down to the underlying Android SDK. Specifically, where the SDK is getting the updated camera position.
In Transform.java#134 the given parameter mapboxMap has property of transform.cameraPosition.bearing which is set correctly.
Where I'm thinking it goes wrong is when update.getCameraPosition(mapboxMap) (on that same line) is executed the resulting CameraPosition object has a bearing of 0 and just a couple lines down mapView.flyTo is called that presumably, visually updates the map, with the wrong bearing value.
The text was updated successfully, but these errors were encountered: