Skip to content

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