Move ol.DRAGZOOM_ANIMATION_DURATION const to a constructor option

This commit is contained in:
Frederic Junod
2015-04-13 14:59:39 +02:00
parent 3eb22559d6
commit 2fcdc48d20
3 changed files with 16 additions and 8 deletions

View File

@@ -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_);
};

View File

@@ -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.
*/