diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 31d3ac326c..c4620ddd0d 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -180,6 +180,11 @@ * @property {ol.interaction.ConditionType|undefined} condition Condition. */ +/** + * @typedef {Object} ol.interaction.DragZoomOptions + * @property {ol.interaction.ConditionType|undefined} condition Condition. + */ + /** * Interactions for the map. Default is true for all options. * @typedef {Object} ol.interaction.DefaultsOptions diff --git a/src/ol/interaction/dragzoominteraction.js b/src/ol/interaction/dragzoominteraction.js index 87a293b168..6155de3ecb 100644 --- a/src/ol/interaction/dragzoominteraction.js +++ b/src/ol/interaction/dragzoominteraction.js @@ -10,6 +10,7 @@ goog.require('ol.control.DragBox'); goog.require('ol.extent'); goog.require('ol.interaction.ConditionType'); goog.require('ol.interaction.Drag'); +goog.require('ol.interaction.condition'); /** @@ -30,17 +31,20 @@ ol.SHIFT_DRAG_ZOOM_HYSTERESIS_PIXELS_SQUARED = /** * @constructor * @extends {ol.interaction.Drag} - * @param {ol.interaction.ConditionType} condition Condition. + * @param {ol.interaction.DragZoomOptions=} opt_options Options. */ -ol.interaction.DragZoom = function(condition) { +ol.interaction.DragZoom = function(opt_options) { goog.base(this); + var options = goog.isDef(opt_options) ? opt_options : {}; + /** * @private * @type {ol.interaction.ConditionType} */ - this.condition_ = condition; + this.condition_ = goog.isDef(options.condition) ? + options.condition : ol.interaction.condition.shiftKeyOnly; /** * @type {ol.control.DragBox} diff --git a/src/ol/interaction/interactiondefaults.js b/src/ol/interaction/interactiondefaults.js index 1e34390262..097f621ae7 100644 --- a/src/ol/interaction/interactiondefaults.js +++ b/src/ol/interaction/interactiondefaults.js @@ -87,8 +87,7 @@ ol.interaction.defaults = function(opt_options, opt_interactions) { var shiftDragZoom = goog.isDef(options.shiftDragZoom) ? options.shiftDragZoom : true; if (shiftDragZoom) { - interactions.push( - new ol.interaction.DragZoom(ol.interaction.condition.shiftKeyOnly)); + interactions.push(new ol.interaction.DragZoom()); } if (goog.isDef(opt_interactions)) {