diff --git a/externs/olx.js b/externs/olx.js index 3bbf468d92..69926dedb3 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -2277,7 +2277,8 @@ olx.interaction.DragRotateAndZoomOptions.prototype.duration; /** - * @typedef {{condition: (ol.events.ConditionType|undefined)}} + * @typedef {{condition: (ol.events.ConditionType|undefined), + * duration: (number|undefined)}} * @api */ olx.interaction.DragRotateOptions; @@ -2293,6 +2294,14 @@ olx.interaction.DragRotateOptions; olx.interaction.DragRotateOptions.prototype.condition; +/** + * Animation duration in milliseconds. Default is `250`. + * @type {number|undefined} + * @api + */ +olx.interaction.DragRotateOptions.prototype.duration; + + /** * @typedef {{condition: (ol.events.ConditionType|undefined), * duration: (number|undefined), diff --git a/src/ol/interaction/dragrotateinteraction.js b/src/ol/interaction/dragrotateinteraction.js index 877aa227dc..476cf1778f 100644 --- a/src/ol/interaction/dragrotateinteraction.js +++ b/src/ol/interaction/dragrotateinteraction.js @@ -1,6 +1,5 @@ goog.provide('ol.interaction.DragRotate'); -goog.require('ol'); goog.require('ol.ViewHint'); goog.require('ol.events.ConditionType'); goog.require('ol.events.condition'); @@ -45,6 +44,11 @@ ol.interaction.DragRotate = function(opt_options) { */ this.lastAngle_ = undefined; + /** + * @private + * @type {number} + */ + this.duration_ = goog.isDef(options.duration) ? options.duration : 250; }; goog.inherits(ol.interaction.DragRotate, ol.interaction.Pointer); @@ -92,7 +96,7 @@ ol.interaction.DragRotate.handleUpEvent_ = function(mapBrowserEvent) { view.setHint(ol.ViewHint.INTERACTING, -1); var rotation = view.getRotation(); ol.interaction.Interaction.rotate(map, view, rotation, - undefined, ol.DRAGROTATE_ANIMATION_DURATION); + undefined, this.duration_); return false; }; diff --git a/src/ol/ol.js b/src/ol/ol.js index 9351c16161..4b507a5ec9 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 animation duration. - */ -ol.DRAGROTATE_ANIMATION_DURATION = 250; - - /** * @define {number} Hysteresis pixels. */