Skip to content

Commit

Permalink
Support leaflet v1+ fractional zooms
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Rudolph <[email protected]>
  • Loading branch information
louh authored and wattnpapa committed Sep 28, 2016
1 parent 146eefc commit c69df0c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/leaflet-hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
var args = hash.split("/");
if (args.length == 3) {
var zoom = parseInt(args[0], 10),
var zoom = (L.version >= '1.0.0') ? parseFloat(args[0]) : parseInt(args[0], 10),
lat = parseFloat(args[1]),
lon = parseFloat(args[2]);
if (isNaN(zoom) || isNaN(lat) || isNaN(lon)) {
Expand All @@ -40,7 +40,7 @@
zoom = map.getZoom(),
precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));

return "#" + [zoom,
return "#" + [(L.version >= '1.0.0') ? zoom.toFixed(precision) : zoom,
center.lat.toFixed(precision),
center.lng.toFixed(precision)
].join("/");
Expand Down

0 comments on commit c69df0c

Please sign in to comment.