-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
fitBounds with padding zooms the map really far out #4528
Comments
Sounds like a perfect chance for a simple unit test and some git bisecting... |
The culprit seems to be this line: boundsSize = this.project(se, zoom).subtract(this.project(nw, zoom)).add(padding), That's getting the size (in pixels) of the bounds to fit, at the current zoom level, then adding the padding. What we really want is to have the padding at the destination zoom level, not at the original zoom level. |
A possible solution would be to subtract I think this is a rather self-contained, explained bug, so I think any newbie can try fixing this. (Hello, @yourfirstpr!). Things to be done:
|
👋 Thanks so much for another wonderful guide, @IvanSanchez! Will post this out to @yourfirstpr shortly :) |
@IvanSanchez Looks like this is related then #4172 |
Tried subtract |
I would love to do this! Thanks for the guide, I'll follow it and let you know my results. 😄 |
I'd just like to add to the list:
For development of fitBounds I believe the best is to use zoomSnap: 0, as snapping to an integer zoom level will usually add a big padding on it's own. |
Here's what I have so far: #4532 Please let me know if I did everything correctly! |
@dianjin code looks good for me, wrote a comment about the test. Feel free to tick the completed checkboxes on this page. |
Closed via #4532 |
Thanks again for fixing the issue 👍 |
how could I start joining an open source here? |
As Iam new to open source community so how can i help you in contributing over here? |
hello, how may i join and start contributing to this open source ?? |
Hi @eldamsheety, @aalsiuser and @qwertypool, Thank you for your interest in Leaflet! There are many ways of contributing to this project, and to Open Source projects in general. This thread is already closed, since the bug it describes has already been fixed in PR #4532. As for contributing, you could have a look at threads with label "help wanted" and/or "good first issue". Keep up the good work and feel free to ask! 😄 |
Hi I am new to this open source community projects. So, how can i start contributing in the projects? |
👾 I would like to contribute ! |
Hi I am new to this open source community projects. So, how can i start contributing in the projects, how can i learn as well as contribute ? |
I am new here, will like to contribute. |
I guess I'm late to the party... I'm new to the open source community and how do i contribute |
I'm new to the open-source community and how can I contribute. |
Hi, I would like to contribute to the open-source community, how can i get started ? |
Hi @johnd0e, I am taking the liberty to draw your attention on this closed thread, which seems to be for some reason the landing page of potential new contributors. Please what kind of entry point do you think could be more appropriate, so that newcomers can receive better information? They may also be interested in the Hacktoberfest event, which you can leverage by tagging issues that you would like contributors to work on with a new "hacktoberfest" label, and tagging meaningful Pull Requests with a new "hacktoberfest-accepted" label (see https://hacktoberfest.digitalocean.com/details#rules). I hope this can be helpful somehow! |
The point of entry should be https://github.com/Leaflet/Leaflet/blob/master/CONTRIBUTING.md . Maybe there's a need to rewrite parts of that. Regarding the hacktoberfest thing, I've read that it has spawned vandalism, so I'm kinda against that. |
Hi @ghybs.
And I really doubt that these strange people are really able to be useful for Leaflet. P.S. |
The reason people are coming to this issue is probably the link from https://opensource.guide/how-to-contribute/ . This (at least the first few comments) is a good example of how a (good-ish) bug report looks like. So, to any lost souls coming here: if you want to do something with Leaflet specifically, read https://github.com/Leaflet/Leaflet/blob/master/CONTRIBUTING.md , see the list of open bugs, go fix something. For general stuff about FLOSS, go read https://www.gnu.org/philosophy/floss-and-foss.en.html and https://opensource.org/resources and the parts of the https://opensource.guide/ thing that you skipped. Read. I'm locking the issue to prevent any further comments from newbies. |
I am not sure if this is a regression or not, but I have experienced that since the RC1 release the map
fitBounds
function withpadding
option does not work the same way as it worked before.Some examples:
Leaflet 0.7.5 http://playground-leaflet.rhcloud.com/niv/edit?html,output
Leaflet 1.0.0-beta.2 http://playground-leaflet.rhcloud.com/jasi/edit?html,output
Leaflet 1.0.0-rc.1 http://playground-leaflet.rhcloud.com/cipe/edit?html,output
The padding is just really big and the map is zoomed far out. We have used this function with the padding on layer containing SVG polygon also and since RC1 that also started to act strange by zooming the map really far out.
I can get the same result on RC1 by setting the
padding
option on a point that is really smallL.point(0.001, 0.001)
.The text was updated successfully, but these errors were encountered: