Move MOUSEWHEELZOOM_MAXDELTA to the mouse wheel zoom interaction

This commit is contained in:
Tim Schaub
2017-12-12 16:29:31 -07:00
parent 7725bc37bc
commit 34c132a67e
2 changed files with 9 additions and 10 deletions

View File

@@ -62,13 +62,6 @@ export var ENABLE_WEBGL = true;
export var DEBUG_WEBGL = true;
/**
* TODO: move this to MouseWheelZoom.js
* @type {number} Maximum mouse wheel delta.
*/
export var MOUSEWHEELZOOM_MAXDELTA = 1;
/**
* TODO: move this to OverviewMap.js
* @type {number} Maximum width and/or height extent ratio that determines
@@ -234,7 +227,6 @@ export default {
ENABLE_RASTER_REPROJECTION: ENABLE_RASTER_REPROJECTION,
ENABLE_WEBGL: ENABLE_WEBGL,
DEBUG_WEBGL: DEBUG_WEBGL,
MOUSEWHEELZOOM_MAXDELTA: MOUSEWHEELZOOM_MAXDELTA,
OVERVIEWMAP_MAX_RATIO: OVERVIEWMAP_MAX_RATIO,
OVERVIEWMAP_MIN_RATIO: OVERVIEWMAP_MIN_RATIO,
RASTER_REPROJECTION_MAX_SUBDIVISION: RASTER_REPROJECTION_MAX_SUBDIVISION,

View File

@@ -1,7 +1,7 @@
/**
* @module ol/interaction/MouseWheelZoom
*/
import {MOUSEWHEELZOOM_MAXDELTA, inherits} from '../index.js';
import {inherits} from '../index.js';
import _ol_ViewHint_ from '../ViewHint.js';
import _ol_easing_ from '../easing.js';
import _ol_events_EventType_ from '../events/EventType.js';
@@ -9,6 +9,13 @@ import _ol_has_ from '../has.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import _ol_math_ from '../math.js';
/**
* @type {number} Maximum mouse wheel delta.
*/
var MAX_DELTA = 1;
/**
* @classdesc
* Allows the user to zoom the map by scrolling the mouse wheel.
@@ -252,7 +259,7 @@ _ol_interaction_MouseWheelZoom_.prototype.handleWheelZoom_ = function(map) {
if (view.getAnimating()) {
view.cancelAnimations();
}
var maxDelta = MOUSEWHEELZOOM_MAXDELTA;
var maxDelta = MAX_DELTA;
var delta = _ol_math_.clamp(this.delta_, -maxDelta, maxDelta);
_ol_interaction_Interaction_.zoomByDelta(view, -delta, this.lastAnchor_,
this.duration_);