Configure ol.interaction.KeyboardZoom with options

This commit is contained in:
Tom Payne
2013-04-22 15:41:00 +02:00
parent cc33727fad
commit 48d4554317
3 changed files with 8 additions and 5 deletions

View File

@@ -209,6 +209,7 @@
/**
* @typedef {Object} ol.interaction.KeyboardZoomOptions
* @property {ol.interaction.ConditionType|undefined} condition Condition.
* @property {number|undefined} delta Delta.
*/

View File

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

View File

@@ -6,6 +6,7 @@ goog.require('goog.asserts');
goog.require('goog.events.KeyHandler.EventType');
goog.require('ol.interaction.ConditionType');
goog.require('ol.interaction.Interaction');
goog.require('ol.interaction.condition');
/**
@@ -17,11 +18,10 @@ ol.interaction.KEYBOARD_ZOOM_DURATION = 100;
/**
* @constructor
* @param {ol.interaction.ConditionType} condition Condition.
* @param {ol.interaction.KeyboardZoomOptions=} opt_options Options.
* @extends {ol.interaction.Interaction}
*/
ol.interaction.KeyboardZoom = function(condition, opt_options) {
ol.interaction.KeyboardZoom = function(opt_options) {
goog.base(this);
@@ -31,7 +31,8 @@ ol.interaction.KeyboardZoom = 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