-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 padding not being cleared -> fitBounds is summing it up with it's own padding argument. #11831
Comments
+1 |
Yes, i ran into same problem, and did a quick fix myself. Note that i assume that map is initialized with default
|
We have also had this issue but in reverse. Using
Our temporary solution is to wait for the camera to stop moving using |
Both They then utilize Line 999 in 7bbf2e9
However, A temporary solution would be to call |
Although confusing, this seems to be the intended behavior according to a unit test. I think this should either be documented or the behavior should be normalized. mapbox-gl-js/test/unit/ui/camera.test.js Line 2294 in 184421e
|
Another solution: replace the line I linked with the following. if (options.padding) extend(this.transform.padding, options.padding); I tried to implement this myself, but I couldn't get testing to work and I don't have the time to spend troubleshooting. |
I don't know if the question is related, but we have the problem that calling Instead the center of the map after the |
The map has a global padding which has get/set methods If you pass a padding option to If you call If you call Neither of these calls to In my view, it's unexpected that Given the current behaviour would have worked it's way into applications, any changes would be breaking changes imo, but would the confusion. |
bump 😢 |
Same... |
1 similar comment
Same... |
@stepankuzmin Could you elaborate why this issue is closed? It got fixed in recent releases? Could you link PR/Release notes for that? 🙏 |
Yes, this was fixed, and GitHub automatically closed the issue. It will be available in the next v3.2.0 release. |
Is this actually fixed? I can't get flyTo to work with padding properly at all anymore. The padding doesn't animate and doesn't seem to go to the right values. |
Hi, @timcreatedit. Could you please make a repro? I've tried the original repo with v3.2.0, which seems to be working. The changelog for v3.2.0 is available here https://github.com/mapbox/mapbox-gl-js/releases/tag/v3.2.0 |
@stepankuzmin @timcreatedit is right. Right now first invocation See: https://codepen.io/kamil-sienkiewicz-asi/pen/BaEZmam Click "Fly" wait for map till complete stop and then click |
Actually it seems like |
Yes, also here happening that the flyTo is not respecting the padding property anymore, this issue has been happening for more than a month |
@ricardoweiss yep, tracking this in #13152... |
mapbox-gl-js version: 2.8.2 but also present in 2.7.1
browser: Google Chrome 100.0.4896.127 64-bit
Steps to Trigger Behavior
map.FlyTo
with padding ->map.fitBounds
->Link to Demonstration
https://codepen.io/sienki-jenki/pen/xxpvPza
Mapbox.flyTo.fitBounds.padding.bug.-.27.April.2022.mp4
When you open site, calling
fitBounds
will work correctly, however if you callflyTo
, padding is getting saved in some state and is never cleared, meaningfitBounds
is somehow summing up padding passed toflyTo
with it's own passed paddings as argument. As you can see on video, 50px of top padding is added tofitBounds
even when 0 is an argument.Expected Behavior
Map fits linestring to view without padding, because
padding: 0
.Actual Behavior
Map firts linestring to view with sum of paddings, meaning paddings passed to
flyTo
function are added to paddings offitBounds
.The text was updated successfully, but these errors were encountered: