Move ol.KEYBOARD_PAN_DURATION const to a constructor option
This commit is contained in:
@@ -2385,6 +2385,7 @@ olx.interaction.DrawOptions.prototype.condition;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{condition: (ol.events.ConditionType|undefined),
|
* @typedef {{condition: (ol.events.ConditionType|undefined),
|
||||||
|
* duration: (number|undefined),
|
||||||
* pixelDelta: (number|undefined)}}
|
* pixelDelta: (number|undefined)}}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -2402,6 +2403,14 @@ olx.interaction.KeyboardPanOptions;
|
|||||||
olx.interaction.KeyboardPanOptions.prototype.condition;
|
olx.interaction.KeyboardPanOptions.prototype.condition;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animation duration in milliseconds. Default is `100`.
|
||||||
|
* @type {number|undefined}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
olx.interaction.KeyboardPanOptions.prototype.duration;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pixel The amount to pan on each key press. Default is `128` pixels.
|
* Pixel The amount to pan on each key press. Default is `128` pixels.
|
||||||
* @type {number|undefined}
|
* @type {number|undefined}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ goog.require('goog.asserts');
|
|||||||
goog.require('goog.events.KeyCodes');
|
goog.require('goog.events.KeyCodes');
|
||||||
goog.require('goog.events.KeyHandler.EventType');
|
goog.require('goog.events.KeyHandler.EventType');
|
||||||
goog.require('goog.functions');
|
goog.require('goog.functions');
|
||||||
goog.require('ol');
|
|
||||||
goog.require('ol.coordinate');
|
goog.require('ol.coordinate');
|
||||||
goog.require('ol.events.ConditionType');
|
goog.require('ol.events.ConditionType');
|
||||||
goog.require('ol.events.condition');
|
goog.require('ol.events.condition');
|
||||||
@@ -45,6 +44,12 @@ ol.interaction.KeyboardPan = function(opt_options) {
|
|||||||
goog.functions.and(ol.events.condition.noModifierKeys,
|
goog.functions.and(ol.events.condition.noModifierKeys,
|
||||||
ol.events.condition.targetNotEditable);
|
ol.events.condition.targetNotEditable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
this.duration_ = goog.isDef(options.duration) ? options.duration : 100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {number}
|
* @type {number}
|
||||||
@@ -89,8 +94,7 @@ ol.interaction.KeyboardPan.handleEvent = function(mapBrowserEvent) {
|
|||||||
}
|
}
|
||||||
var delta = [deltaX, deltaY];
|
var delta = [deltaX, deltaY];
|
||||||
ol.coordinate.rotate(delta, viewState.rotation);
|
ol.coordinate.rotate(delta, viewState.rotation);
|
||||||
ol.interaction.Interaction.pan(
|
ol.interaction.Interaction.pan(map, view, delta, this.duration_);
|
||||||
map, view, delta, ol.KEYBOARD_PAN_DURATION);
|
|
||||||
mapBrowserEvent.preventDefault();
|
mapBrowserEvent.preventDefault();
|
||||||
stopEvent = true;
|
stopEvent = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,12 +170,6 @@ ol.IS_LEGACY_IE = goog.userAgent.IE &&
|
|||||||
!goog.userAgent.isVersionOrHigher('9.0') && goog.userAgent.VERSION !== '';
|
!goog.userAgent.isVersionOrHigher('9.0') && goog.userAgent.VERSION !== '';
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @define {number} Keyboard pan duration.
|
|
||||||
*/
|
|
||||||
ol.KEYBOARD_PAN_DURATION = 100;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @define {number} The maximum size in pixels of atlas images. Default is
|
* @define {number} The maximum size in pixels of atlas images. Default is
|
||||||
* `-1`, meaning it is not used (and `ol.WEBGL_MAX_TEXTURE_SIZE` is
|
* `-1`, meaning it is not used (and `ol.WEBGL_MAX_TEXTURE_SIZE` is
|
||||||
|
|||||||
Reference in New Issue
Block a user