diff --git a/externs/olx.js b/externs/olx.js index f5152ecb0b..5035b7d904 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -2286,6 +2286,7 @@ olx.interaction.DragRotateOptions.prototype.condition; /** * @typedef {{condition: (ol.events.ConditionType|undefined), + * duration: (number|undefined), * style: ol.style.Style}} * @api */ @@ -2302,6 +2303,14 @@ olx.interaction.DragZoomOptions; olx.interaction.DragZoomOptions.prototype.condition; +/** + * Animation duration in milliseconds. Default is `200`. + * @type {number|undefined} + * @api + */ +olx.interaction.DragZoomOptions.prototype.duration; + + /** * Style for the box. * @type {ol.style.Style} diff --git a/src/ol/interaction/dragzoominteraction.js b/src/ol/interaction/dragzoominteraction.js index fb2c7ce8ad..30398002c6 100644 --- a/src/ol/interaction/dragzoominteraction.js +++ b/src/ol/interaction/dragzoominteraction.js @@ -1,7 +1,6 @@ goog.provide('ol.interaction.DragZoom'); goog.require('goog.asserts'); -goog.require('ol'); goog.require('ol.events.condition'); goog.require('ol.extent'); goog.require('ol.interaction.DragBox'); @@ -28,6 +27,12 @@ ol.interaction.DragZoom = function(opt_options) { var condition = goog.isDef(options.condition) ? options.condition : ol.events.condition.shiftKeyOnly; + /** + * @private + * @type {number} + */ + this.duration_ = goog.isDef(options.duration) ? options.duration : 200; + /** * @private * @type {ol.style.Style} @@ -61,5 +66,5 @@ ol.interaction.DragZoom.prototype.onBoxEnd = function() { goog.asserts.assert(goog.isDef(size), 'size should be defined'); ol.interaction.Interaction.zoom(map, view, view.getResolutionForExtent(extent, size), - center, ol.DRAGZOOM_ANIMATION_DURATION); + center, this.duration_); }; diff --git a/src/ol/ol.js b/src/ol/ol.js index 30f4bee455..0bcaa08976 100644 --- a/src/ol/ol.js +++ b/src/ol/ol.js @@ -60,12 +60,6 @@ ol.DRAGROTATEANDZOOM_ANIMATION_DURATION = 400; ol.DRAGROTATE_ANIMATION_DURATION = 250; -/** - * @define {number} Drag-zoom animation duration. - */ -ol.DRAGZOOM_ANIMATION_DURATION = 200; - - /** * @define {number} Hysteresis pixels. */