lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js in leaflet-js-0.6.beta4 vs lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js in leaflet-js-0.7.0

- old
+ new

@@ -7,15 +7,17 @@ }); L.Map.ScrollWheelZoom = L.Handler.extend({ addHooks: function () { L.DomEvent.on(this._map._container, 'mousewheel', this._onWheelScroll, this); + L.DomEvent.on(this._map._container, 'MozMousePixelScroll', L.DomEvent.preventDefault); this._delta = 0; }, removeHooks: function () { L.DomEvent.off(this._map._container, 'mousewheel', this._onWheelScroll); + L.DomEvent.off(this._map._container, 'MozMousePixelScroll', L.DomEvent.preventDefault); }, _onWheelScroll: function (e) { var delta = L.DomEvent.getWheelDelta(e); @@ -47,10 +49,14 @@ this._delta = 0; this._startTime = null; if (!delta) { return; } - map.setZoomAround(this._lastMousePos, zoom + delta); + if (map.options.scrollWheelZoom === 'center') { + map.setZoom(zoom + delta); + } else { + map.setZoomAround(this._lastMousePos, zoom + delta); + } } }); L.Map.addInitHook('addHandler', 'scrollWheelZoom', L.Map.ScrollWheelZoom);