Merge pull request #3549 from fredj/keyboard_pan_duration
Move ol.*_DURATION const to a constructor option
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
goog.provide('ol.interaction.DragRotateAndZoom');
|
||||
|
||||
goog.require('goog.math.Vec2');
|
||||
goog.require('ol');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.events.ConditionType');
|
||||
goog.require('ol.events.condition');
|
||||
@@ -60,6 +59,12 @@ ol.interaction.DragRotateAndZoom = function(opt_options) {
|
||||
*/
|
||||
this.lastScaleDelta_ = 0;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = goog.isDef(options.duration) ? options.duration : 400;
|
||||
|
||||
};
|
||||
goog.inherits(ol.interaction.DragRotateAndZoom, ol.interaction.Pointer);
|
||||
|
||||
@@ -120,8 +125,7 @@ ol.interaction.DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) {
|
||||
var direction = this.lastScaleDelta_ - 1;
|
||||
ol.interaction.Interaction.rotate(map, view, viewState.rotation);
|
||||
ol.interaction.Interaction.zoom(map, view, viewState.resolution,
|
||||
undefined, ol.DRAGROTATEANDZOOM_ANIMATION_DURATION,
|
||||
direction);
|
||||
undefined, this.duration_, direction);
|
||||
this.lastScaleDelta_ = 0;
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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_);
|
||||
};
|
||||
|
||||
@@ -4,7 +4,6 @@ goog.require('goog.asserts');
|
||||
goog.require('goog.events.KeyCodes');
|
||||
goog.require('goog.events.KeyHandler.EventType');
|
||||
goog.require('goog.functions');
|
||||
goog.require('ol');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.events.ConditionType');
|
||||
goog.require('ol.events.condition');
|
||||
@@ -45,6 +44,12 @@ ol.interaction.KeyboardPan = function(opt_options) {
|
||||
goog.functions.and(ol.events.condition.noModifierKeys,
|
||||
ol.events.condition.targetNotEditable);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = goog.isDef(options.duration) ? options.duration : 100;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
@@ -89,8 +94,7 @@ ol.interaction.KeyboardPan.handleEvent = function(mapBrowserEvent) {
|
||||
}
|
||||
var delta = [deltaX, deltaY];
|
||||
ol.coordinate.rotate(delta, viewState.rotation);
|
||||
ol.interaction.Interaction.pan(
|
||||
map, view, delta, ol.KEYBOARD_PAN_DURATION);
|
||||
ol.interaction.Interaction.pan(map, view, delta, this.duration_);
|
||||
mapBrowserEvent.preventDefault();
|
||||
stopEvent = true;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ goog.provide('ol.interaction.PinchRotate');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.functions');
|
||||
goog.require('goog.style');
|
||||
goog.require('ol');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.ViewHint');
|
||||
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;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = goog.isDef(options.duration) ? options.duration : 250;
|
||||
|
||||
};
|
||||
goog.inherits(ol.interaction.PinchRotate, ol.interaction.Pointer);
|
||||
|
||||
@@ -131,7 +136,7 @@ ol.interaction.PinchRotate.handleUpEvent_ = function(mapBrowserEvent) {
|
||||
if (this.rotating_) {
|
||||
var rotation = view.getRotation();
|
||||
ol.interaction.Interaction.rotate(
|
||||
map, view, rotation, this.anchor_, ol.ROTATE_ANIMATION_DURATION);
|
||||
map, view, rotation, this.anchor_, this.duration_);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user