question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fitBounds with padding zooms the map really far out

See original GitHub issue

I am not sure if this is a regression or not, but I have experienced that since the RC1 release the map fitBounds function with padding 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 small L.point(0.001, 0.001).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:27 (11 by maintainers)

github_iconTop GitHub Comments

17reactions
ghybscommented, Feb 12, 2018

Hi @eldamsheety, @aalsiuser and @qwertypool,

Thank you for your interest in Leaflet! Sorry for not getting back to you earlier.

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. Avoid commenting on closed threads, as you may remain unnoticed, unless what you have to say is absolutely relevant to the thread (e.g. when the bug is actually not fixed). And even in that case, it is probably better opening a new issue and mentioning the closed thread.

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! 😄

10reactions
dianjincommented, May 3, 2016

I would love to do this! Thanks for the guide, I’ll follow it and let you know my results. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mapbox: Zooming Out One Level After Using fitBounds Re ...
The problem is, it zooms in too close and the map needs a bit of padding. So, I'm trying to back out the...
Read more >
Remove The Padding From The Google Map API v3 fitBounds ...
Remove The Padding From The Google Map API v3 fitBounds() Method ... the map appears to be zoomed out too far for what...
Read more >
fitBounds does something strange - Google Groups
just that. Because you've made the map canvas smaller, it has to zoom out one more level to fit the bounds in. At...
Read more >
Fit a map to a bounding box | Mapbox GL JS
It uses the JavaScript addEventListener method to attach a click listener to the 'Fit to Kenya' button so that when a user clicks...
Read more >
Map | MapLibre GL JS Docs
When the map is zoomed out far enough that a single representation of the world does not fill the map's entire container, there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found