Configure ol.interaction.KeyboardPan with options

This commit is contained in:
Tom Payne
2013-04-22 15:33:25 +02:00
parent d1b2e4e483
commit cc33727fad
3 changed files with 6 additions and 5 deletions

View File

@@ -203,6 +203,7 @@
/**
* @typedef {Object} ol.interaction.KeyboardPanOptions
* @property {ol.interaction.ConditionType|undefined} condition Condition.
* @property {number|undefined} pixelDelta Pixel delta
*/

View File

@@ -72,8 +72,7 @@ ol.interaction.defaults = function(opt_options, opt_interactions) {
var keyboard = goog.isDef(options.keyboard) ?
options.keyboard : true;
if (keyboard) {
interactions.push(new ol.interaction.KeyboardPan(
ol.interaction.condition.noModifierKeys));
interactions.push(new ol.interaction.KeyboardPan());
interactions.push(new ol.interaction.KeyboardZoom(
ol.interaction.condition.noModifierKeys));
}

View File

@@ -9,6 +9,7 @@ goog.require('ol.View2D');
goog.require('ol.coordinate');
goog.require('ol.interaction.ConditionType');
goog.require('ol.interaction.Interaction');
goog.require('ol.interaction.condition');
/**
@@ -21,10 +22,9 @@ ol.interaction.KEYBOARD_PAN_DURATION = 100;
/**
* @constructor
* @extends {ol.interaction.Interaction}
* @param {ol.interaction.ConditionType} condition Condition.
* @param {ol.interaction.KeyboardPanOptions=} opt_options Options.
*/
ol.interaction.KeyboardPan = function(condition, opt_options) {
ol.interaction.KeyboardPan = function(opt_options) {
goog.base(this);
@@ -34,7 +34,8 @@ ol.interaction.KeyboardPan = function(condition, opt_options) {
* @private
* @type {ol.interaction.ConditionType}
*/
this.condition_ = condition;
this.condition_ = goog.isDef(options.condition) ?
options.condition : ol.interaction.condition.noModifierKeys;
/**
* @private