Limited zoom change on a single mouse wheel movement, closes #149

This commit is contained in:
Mourner 2011-07-20 15:54:22 +03:00
parent f7c282ae7f
commit 1ff1edb7b0

View File

@ -17,7 +17,8 @@ L.Handler.ScrollWheelZoom = L.Handler.extend({
},
_onWheelScroll: function(e) {
this._delta += L.DomEvent.getWheelDelta(e);
var delta = L.DomEvent.getWheelDelta(e);
this._delta += delta;
this._lastMousePos = this._map.mouseEventToContainerPoint(e);
clearTimeout(this._timer);
@ -28,6 +29,7 @@ L.Handler.ScrollWheelZoom = L.Handler.extend({
_performZoom: function() {
var delta = Math.round(this._delta);
delta = Math.max(Math.min(delta, 4), -4);
this._delta = 0;
if (!delta) { return; }