diff --git a/externs/olx.js b/externs/olx.js index 4b3c65a68d..3bbf468d92 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -2251,7 +2251,8 @@ olx.interaction.DragPanOptions.prototype.kinetic; /** - * @typedef {{condition: (ol.events.ConditionType|undefined)}} + * @typedef {{condition: (ol.events.ConditionType|undefined), + * duration: (number|undefined)}} * @api */ olx.interaction.DragRotateAndZoomOptions; @@ -2267,6 +2268,14 @@ olx.interaction.DragRotateAndZoomOptions; olx.interaction.DragRotateAndZoomOptions.prototype.condition; +/** + * Animation duration in milliseconds. Default is `400`. + * @type {number|undefined} + * @api + */ +olx.interaction.DragRotateAndZoomOptions.prototype.duration; + + /** * @typedef {{condition: (ol.events.ConditionType|undefined)}} * @api diff --git a/src/ol/interaction/dragrotateandzoominteraction.js b/src/ol/interaction/dragrotateandzoominteraction.js index 4c31e8f3a6..83ecc0f5f2 100644 --- a/src/ol/interaction/dragrotateandzoominteraction.js +++ b/src/ol/interaction/dragrotateandzoominteraction.js @@ -1,7 +1,6 @@ goog.provide('ol.interaction.DragRotateAndZoom'); goog.require('goog.math.Vec2'); -goog.require('ol'); goog.require('ol.ViewHint'); goog.require('ol.events.ConditionType'); goog.require('ol.events.condition'); @@ -60,6 +59,12 @@ ol.interaction.DragRotateAndZoom = function(opt_options) { */ this.lastScaleDelta_ = 0; + /** + * @private + * @type {number} + */ + this.duration_ = goog.isDef(options.duration) ? options.duration : 400; + }; goog.inherits(ol.interaction.DragRotateAndZoom, ol.interaction.Pointer); @@ -120,8 +125,7 @@ ol.interaction.DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) { var direction = this.lastScaleDelta_ - 1; ol.interaction.Interaction.rotate(map, view, viewState.rotation); ol.interaction.Interaction.zoom(map, view, viewState.resolution, - undefined, ol.DRAGROTATEANDZOOM_ANIMATION_DURATION, - direction); + undefined, this.duration_, direction); this.lastScaleDelta_ = 0; return false; }; diff --git a/src/ol/ol.js b/src/ol/ol.js index b0af1db4cb..9351c16161 100644 --- a/src/ol/ol.js +++ b/src/ol/ol.js @@ -48,12 +48,6 @@ ol.DEFAULT_TILE_SIZE = 256; ol.DEFAULT_WMS_VERSION = '1.3.0'; -/** - * @define {number} Drag-rotate-zoom animation duration. - */ -ol.DRAGROTATEANDZOOM_ANIMATION_DURATION = 400; - - /** * @define {number} Drag-rotate animation duration. */