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

flyTo / easeTo / fitBounds bug when using maxBounds in a Map #3212

Closed
ilyatrunov opened this issue Sep 18, 2016 · 1 comment
Closed

flyTo / easeTo / fitBounds bug when using maxBounds in a Map #3212

ilyatrunov opened this issue Sep 18, 2016 · 1 comment

Comments

@ilyatrunov
Copy link

mapbox-gl-js version: 0.22

Steps to Trigger Behavior

  1. Use map with "maxBounds" option
    var map = new mapboxgl.Map({
    center: [0, 20],
    maxBounds: [[-180, 85], [180, -85]]
    });
    1. Pan the map to the far left part of the map
    2. Call map.fitBounds, with bounds at the far right of the map

Expected Behavior

Map fly to the right and zooms into the bounds

Actual Behavior

Map fly to the left, and get stuck there (since the map is not wrapped)

Explanation: when the map is panned to a location A, and the flyTo/easeTo/fitBounds target location is closer to the "second map" (when the map is wrapped), Mapbox tries to pan to the "second map", but there is no one, since we limited the bounds in map constructor!

My workaround was to call map.jumpTo first (with center option set to the center of the bounds), and call map.fitBound after it. But now I can't use the cool flying effect.

Thank you

@1ec5
Copy link
Contributor

1ec5 commented Sep 18, 2016

Duplicate of #2521.

@1ec5 1ec5 closed this as completed Sep 18, 2016
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

No branches or pull requests

2 participants