Move ol.DRAGROTATE_ANIMATION_DURATION const to a constructor option

This commit is contained in:
Frederic Junod
2015-04-13 15:25:23 +02:00
parent a94a87323d
commit 6c33f84798
3 changed files with 16 additions and 9 deletions

View File

@@ -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),

View File

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

View File

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