Merge pull request #2836 from AndreyGeonya/master
#2501, optional wheel debounce time
This commit is contained in:
commit
a3066bde24
@ -3,7 +3,8 @@
|
||||
*/
|
||||
|
||||
L.Map.mergeOptions({
|
||||
scrollWheelZoom: true
|
||||
scrollWheelZoom: true,
|
||||
wheelDebounceTime: 40
|
||||
});
|
||||
|
||||
L.Map.ScrollWheelZoom = L.Handler.extend({
|
||||
@ -25,6 +26,7 @@ L.Map.ScrollWheelZoom = L.Handler.extend({
|
||||
|
||||
_onWheelScroll: function (e) {
|
||||
var delta = L.DomEvent.getWheelDelta(e);
|
||||
var debounce = this._map.options.wheelDebounceTime;
|
||||
|
||||
this._delta += delta;
|
||||
this._lastMousePos = this._map.mouseEventToContainerPoint(e);
|
||||
@ -33,7 +35,7 @@ L.Map.ScrollWheelZoom = L.Handler.extend({
|
||||
this._startTime = +new Date();
|
||||
}
|
||||
|
||||
var left = Math.max(40 - (+new Date() - this._startTime), 0);
|
||||
var left = Math.max(debounce - (+new Date() - this._startTime), 0);
|
||||
|
||||
clearTimeout(this._timer);
|
||||
this._timer = setTimeout(L.bind(this._performZoom, this), left);
|
||||
|
Loading…
Reference in New Issue
Block a user