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
{{ message }}
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.
I am trying using this library to calculate the initial zoom/center for a map before it’s being drawn. I have a bounding box and the dimensions for the map container. I also have some padding and an offset.
Sadly, all I get is a failed assertion, whereas Mapbox’s fitBounds and flyTo work as expected with the same parameters.
The problem seems to be with the following code. padding is being subtracted from the dimensions, as well as the offset * 2. This results in height being less than zero, throwing the assertion.
I had a similar issue in React when using react-map-gl with viewport-mercator-project. My goal was set my map initially to a fixed bounding box. My problem was that the viewport width and height weren't set in the initial state (and can't be set in the initial state for some reason).
I solved this by creating a method setInitialBounds() and using window.innerWidth and window.innerHeight to force a 100%-sized bounding box. I then call this function in componentDidMount(). Sample code:
Hello!
I am trying using this library to calculate the initial zoom/center for a map before it’s being drawn. I have a bounding box and the dimensions for the map container. I also have some padding and an offset.
Sadly, all I get is a failed assertion, whereas Mapbox’s
fitBounds
andflyTo
work as expected with the same parameters.The problem seems to be with the following code.
padding
is being subtracted from the dimensions, as well as theoffset * 2
. This results inheight
being less than zero, throwing the assertion.Code to reproduce the issue:
The text was updated successfully, but these errors were encountered: