You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The geolocateControl currently sets the zoom, bearing and pitch to default fixed values on success.
This works for a limited use cases (imagine a map of the world and you want to see what country you're in and it zooms to street level).
You can set the zoom level on the geolocate event, but I'd argue that should be the exception not the norm.
Currently retaining the same zoom after a geolocate is difficult (impossible?) as you have to get the zoom level before the geolocate event is fired, and since it uses a normal zoom function there is no way to differentiate it from other zoom events.
Design Alternatives
Remove the default settings from the success function so the map retains zoom, bearing and pitch by default.
The user get the same functionality as the current hard coded values using
I think this is fixed by #3737#3781, although to be honest I haven't checked that fitBounds respects the bearing and pitch.
UPDATE: I've tested this, fitBounds will respect the pitch but resets bearing to 0, so when #3737#3781 lands it will respect pitch but not bearing. It won't respect zoom but it will respect the maxZoom option.
I couldn't find an existing issue for fitBounds respecting bearing. That said, the geolocation control shouldn't use fitBounds rather it should fit to the center + radius so that at 45deg bearings the map fits the real accuracy circle.
I couldn't find an existing issue for fitBounds respecting bearing. That said, the geolocation control shouldn't use fitBounds rather it should fit to the center + radius so that at 45deg bearings the map fits the real accuracy circle.
Motivation
The geolocateControl currently sets the zoom, bearing and pitch to default fixed values on success.
This works for a limited use cases (imagine a map of the world and you want to see what country you're in and it zooms to street level).
You can set the zoom level on the geolocate event, but I'd argue that should be the exception not the norm.
Currently retaining the same zoom after a geolocate is difficult (impossible?) as you have to get the zoom level before the geolocate event is fired, and since it uses a normal zoom function there is no way to differentiate it from other zoom events.
Design Alternatives
The user get the same functionality as the current hard coded values using
Implementation
for
change this
to this
mapbox-gl-js version:
v0.30.0
The text was updated successfully, but these errors were encountered: