Skip to content
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

Support leaflet v1+ fractional zooms #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

louh
Copy link

@louh louh commented Sep 20, 2016

Leaflet v1 supports fractional zooms and reports zooms such as 12.45 from map.getZoom(), which leaflet-hash does not expect. As a result, leaflet-hash will display hashes such as #11.375325620188496/40.7154/-73.9275 but only sets the view at zoom 11. This PR fixes this behavior if the Leaflet version detected is v1+:

  • Hash display is now set at the same precision level as lat/lng for more sensible looking URLs.
  • Hash is parsed as a float instead of as an integer, so that the map view is set to the correct zoom.

This behavior is not changed on Leaflet versions before v1 (zoom 12 will not start showing up with unnecessary precision, such as 12.0000 for example).

@pnorman
Copy link

pnorman commented Mar 30, 2018

ping @mlevans

@jcphill
Copy link

jcphill commented Sep 18, 2021

This would be a nice upgrade - a small change with a clear improvement in functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants