Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map.flyTo() allows zooming past maxZoom #4724

Closed
IvanSanchez opened this issue May 19, 2017 · 0 comments · Fixed by #4726
Closed

Map.flyTo() allows zooming past maxZoom #4724

IvanSanchez opened this issue May 19, 2017 · 0 comments · Fixed by #4726

Comments

@IvanSanchez
Copy link
Contributor

Bug report. The flyTo() functionality doesn't perform a sanity check on the requested zoom, so that a user can zoom past the map's maxZoom.

The final zoom level is the map's maxZoom, but the map center jumps to an arbitrary location.

Minimal reproducible case:

<div id='map'></div>
<button id='fly'>Fly!</button> 
<script>
var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v9',
    center: [0, 0],
    zoom: 0
});
  
fly.addEventListener('click', ()=>{ map.flyTo({
  center: [10.39170933059438, 63.4309997568285],
  zoom: 22.5   // 22.5 is greater than the default maxZoom of 20
}) });
</script>

I've put that code in a jsbin over here. That jsbin uses v0.37.0.

Expected behaviour: final state of the map's camera would be zoom = map's maxzoom, center ≃ [10.39, 63.43].

Actual behaviour: final state of the map's camera would be zoom = map's maxzoom, center ≃ [89.25, 38.99] (more than 10000km away from expected center).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant