Joesy_Mosk
Joesy_Mosk

Reputation: 123

Can't setup fractional zoom on Leaflet 1.0.2 and 1.1-dev

Here is super simple 6-line example of the issue:

http://jsfiddle.net/erqwqctf/1/

HTML:

<div id="map" style="height: 400px; width: 400px;"></div>

JS:

var map = L.map('map', {
  center: [51.505, -0.09],
  zoom: 14.3
})
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(map);

This example uses Leaflet 1.0.2, and docs are here http://leafletjs.com/reference-1.0.2.html, but it doesn't appear to support fractional zoom as it should. Same issue on 1.1-dev. What am I doing wrong?

Thanks!

EDIT: it works well with leaflet-1.0.0-b1 for some reason...

Upvotes: 1

Views: 996

Answers (2)

DivideByZero
DivideByZero

Reputation: 151

For me it only works if a further parameter: zoomDelta is also set to a small value. For example:

var map = L.map('map', {
  center: [51.505, -0.09],
  zoom: 14.26,
  zoomSnap: 0.1,
  zoomDelta: 0.1
})

Upvotes: 0

Joesy_Mosk
Joesy_Mosk

Reputation: 123

Found an answer - should of set zoomSnap to 0 or something small. Result - http://jsfiddle.net/erqwqctf/5/

var map = L.map('map', {
  center: [51.505, -0.09],
  zoom: 14.26,
  zoomSnap: 0
})

Upvotes: 2

Related Questions