Skip to content
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

Closed
samfader opened this issue Jun 4, 2018 · 1 comment
Closed

fitBounds resets heading/bearing to 0 on Android #12059

samfader opened this issue Jun 4, 2018 · 1 comment
Labels
Android Mapbox Maps SDK for Android

Comments

@samfader
Copy link
Contributor

samfader commented Jun 4, 2018

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

  1. This can be reproduced in the example React Native app simply by setting a non-zero heading prop value in the FitBounds demo/example and pressing any of the given controls.

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.

@samfader samfader added the Android Mapbox Maps SDK for Android label Jun 4, 2018
@tobrun tobrun added this to the android-v6.3.0 milestone Jul 6, 2018
@tobrun
Copy link
Member

tobrun commented Jul 6, 2018

LatLngBounds will now take in account the defined bounds, padding, tilt and bearing.
Available to test in 6.3.0-alpha.2.

@tobrun tobrun closed this as completed Jul 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

2 participants