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
Use map with "maxBounds" option
var map = new mapboxgl.Map({
center: [0, 20],
maxBounds: [[-180, 85], [180, -85]]
});
Pan the map to the far left part of the map
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
The text was updated successfully, but these errors were encountered:
mapbox-gl-js version: 0.22
Steps to Trigger Behavior
var map = new mapboxgl.Map({
center: [0, 20],
maxBounds: [[-180, 85], [180, -85]]
});
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
The text was updated successfully, but these errors were encountered: