diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 9668d01d99..2c955719c8 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -170,6 +170,11 @@ * click. */ +/** + * @typedef {Object} ol.interaction.DragRotateOptions + * @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/dragrotateinteraction.js b/src/ol/interaction/dragrotateinteraction.js index e922a31454..681c86c654 100644 --- a/src/ol/interaction/dragrotateinteraction.js +++ b/src/ol/interaction/dragrotateinteraction.js @@ -6,6 +6,7 @@ goog.require('ol.ViewHint'); goog.require('ol.interaction.ConditionType'); goog.require('ol.interaction.Drag'); goog.require('ol.interaction.Interaction'); +goog.require('ol.interaction.condition'); /** @@ -18,9 +19,11 @@ ol.interaction.DRAGROTATE_ANIMATION_DURATION = 250; /** * @constructor * @extends {ol.interaction.Drag} - * @param {ol.interaction.ConditionType} condition Condition. + * @param {ol.interaction.DragRotateOptions=} opt_options Options. */ -ol.interaction.DragRotate = function(condition) { +ol.interaction.DragRotate = function(opt_options) { + + var options = goog.isDef(opt_options) ? opt_options : {}; goog.base(this); @@ -28,7 +31,8 @@ ol.interaction.DragRotate = function(condition) { * @private * @type {ol.interaction.ConditionType} */ - this.condition_ = condition; + this.condition_ = goog.isDef(options.condition) ? + options.condition : ol.interaction.condition.altShiftKeysOnly; /** * @private diff --git a/src/ol/interaction/interactiondefaults.js b/src/ol/interaction/interactiondefaults.js index f1f26a1069..077bbd1fab 100644 --- a/src/ol/interaction/interactiondefaults.js +++ b/src/ol/interaction/interactiondefaults.js @@ -31,8 +31,7 @@ ol.interaction.defaults = function(opt_options, opt_interactions) { var altShiftDragRotate = goog.isDef(options.altShiftDragRotate) ? options.altShiftDragRotate : true; if (altShiftDragRotate) { - interactions.push(new ol.interaction.DragRotate( - ol.interaction.condition.altShiftKeysOnly)); + interactions.push(new ol.interaction.DragRotate()); } var doubleClickZoom = goog.isDef(options.doubleClickZoom) ?