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
When trying to use map.fitScreenCoordinates() to fit a point pair to the map view, the results end up with the bounding box for the pair only occupying the central 9th of the map view (approximately), roughly a a zoom order of 1 lower than it should be and not quite centred correctly.
The bounding box is drawn in red with p0 being the top left corner, p1 the bottom right.
The issue is there whether the pitch and/or bearing are zero or not and unrelated to initial position or zoom level before issuing fitScreenCoordinates().
map.getPadding() confirms the padding is zero and not related to the issue.
I've seen the related issue #11795 that states this can be related to using the globe projection in place of mercator. I changed the style projection to mercator and passed this in the Map options (confirmed with map.getProjection()) - this made no difference.
When trying to use
map.fitScreenCoordinates()
to fit a point pair to the map view, the results end up with the bounding box for the pair only occupying the central 9th of the map view (approximately), roughly a a zoom order of 1 lower than it should be and not quite centred correctly.mapbox-gl-js version: 3.8
browser: Firefox/Chrome latest
Steps to Trigger Behavior
The bounding box is drawn in red with
p0
being the top left corner,p1
the bottom right.The issue is there whether the pitch and/or bearing are zero or not and unrelated to initial position or zoom level before issuing
fitScreenCoordinates()
.map.getPadding()
confirms the padding is zero and not related to the issue.I've seen the related issue #11795 that states this can be related to using the globe projection in place of mercator. I changed the style projection to mercator and passed this in the Map options (confirmed with
map.getProjection()
) - this made no difference.Codepen
https://codepen.io/enzedonline/pen/emOdGbx
NB: use your token in the code to get working example
Expected Behavior
Zoom and map position should be such that the bounding box fills the map view area taking any padding into consideration.
Actual Behavior
Map is not properly centred, zoom level is approximately an order of 1 smaller than it should be to fill the map view area.
The text was updated successfully, but these errors were encountered: