Skip to content

Support leaflet v1+ fractional zooms#44

Open
louh wants to merge 1 commit into
mlevans:masterfrom
louh:fractional-zoom
Open

Support leaflet v1+ fractional zooms#44
louh wants to merge 1 commit into
mlevans:masterfrom
louh:fractional-zoom

Conversation

@louh

@louh louh commented Sep 20, 2016

Copy link
Copy Markdown

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

pnorman commented Mar 30, 2018

Copy link
Copy Markdown

ping @mlevans

@jcphill

jcphill commented Sep 18, 2021

Copy link
Copy Markdown

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