Move ol.ROTATE_ANIMATION_DURATION const to a constructor option

This commit is contained in:
Frederic Junod
2015-04-13 15:05:35 +02:00
parent 2fcdc48d20
commit 1daf4628b7
3 changed files with 17 additions and 9 deletions

View File

@@ -2534,12 +2534,21 @@ olx.interaction.MouseWheelZoomOptions.prototype.duration;
/** /**
* @typedef {{threshold: (number|undefined)}} * @typedef {{threshold: (number|undefined),
* duration: (number|undefined)}}
* @api * @api
*/ */
olx.interaction.PinchRotateOptions; olx.interaction.PinchRotateOptions;
/**
* The duration of the animation in milliseconds. Default is `250`.
* @type {number|undefined}
* @api
*/
olx.interaction.PinchRotateOptions.prototype.duration;
/** /**
* Minimal angle in radians to start a rotation. Default is `0.3`. * Minimal angle in radians to start a rotation. Default is `0.3`.
* @type {number|undefined} * @type {number|undefined}

View File

@@ -3,7 +3,6 @@ goog.provide('ol.interaction.PinchRotate');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions'); goog.require('goog.functions');
goog.require('goog.style'); goog.require('goog.style');
goog.require('ol');
goog.require('ol.Coordinate'); goog.require('ol.Coordinate');
goog.require('ol.ViewHint'); goog.require('ol.ViewHint');
goog.require('ol.interaction.Interaction'); goog.require('ol.interaction.Interaction');
@@ -61,6 +60,12 @@ ol.interaction.PinchRotate = function(opt_options) {
*/ */
this.threshold_ = goog.isDef(options.threshold) ? options.threshold : 0.3; this.threshold_ = goog.isDef(options.threshold) ? options.threshold : 0.3;
/**
* @private
* @type {number}
*/
this.duration_ = goog.isDef(options.duration) ? options.duration : 250;
}; };
goog.inherits(ol.interaction.PinchRotate, ol.interaction.Pointer); goog.inherits(ol.interaction.PinchRotate, ol.interaction.Pointer);
@@ -131,7 +136,7 @@ ol.interaction.PinchRotate.handleUpEvent_ = function(mapBrowserEvent) {
if (this.rotating_) { if (this.rotating_) {
var rotation = view.getRotation(); var rotation = view.getRotation();
ol.interaction.Interaction.rotate( ol.interaction.Interaction.rotate(
map, view, rotation, this.anchor_, ol.ROTATE_ANIMATION_DURATION); map, view, rotation, this.anchor_, this.duration_);
} }
return false; return false;
} else { } else {

View File

@@ -198,12 +198,6 @@ ol.OVERVIEWMAP_MAX_RATIO = 0.75;
ol.OVERVIEWMAP_MIN_RATIO = 0.1; ol.OVERVIEWMAP_MIN_RATIO = 0.1;
/**
* @define {number} Rotate animation duration.
*/
ol.ROTATE_ANIMATION_DURATION = 250;
/** /**
* @define {number} Tolerance for geometry simplification in device pixels. * @define {number} Tolerance for geometry simplification in device pixels.
*/ */