mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.36k stars 1.33k forks source link

LatLngBounds bounds are invalid sometimes #16458

Closed bssandeshbs closed 4 years ago

bssandeshbs commented 4 years ago

Mapbox provides a API to get the latlong bounds of the visible region. mapboxMap.projection.visibleRegion.latLngBounds

However if the user scrolls horizontally to the left of the world map. The bounds are going out of range. Basically, the longitudeWest and longitudeEast are changed to values greater than 180.

Platform: Android Mapbox SDK version: 9.0.0

Steps to trigger behavior

  1. Load mapbox map on android
  2. get latlong bounds from visible region on onCameraIdle callback or any other callback.
  3. Observe when the map is between California and Japan. The latlongbounds east and west reset to positive values. Ideally it should have negative values

Expected behavior

  1. Latlong -> east value should be proper. It should go to negative values as panned left.

Actual behavior

  1. Described in step 3
bssandeshbs commented 4 years ago

Found out this is a not an issue since the east co-ordinate is always fixed.. Can derive west co-ordinate from east co-ordinate