Configure ol.interaction.DragZoom with options
This commit is contained in:
@@ -180,6 +180,11 @@
|
|||||||
* @property {ol.interaction.ConditionType|undefined} condition Condition.
|
* @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.
|
* Interactions for the map. Default is true for all options.
|
||||||
* @typedef {Object} ol.interaction.DefaultsOptions
|
* @typedef {Object} ol.interaction.DefaultsOptions
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ goog.require('ol.control.DragBox');
|
|||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.interaction.ConditionType');
|
goog.require('ol.interaction.ConditionType');
|
||||||
goog.require('ol.interaction.Drag');
|
goog.require('ol.interaction.Drag');
|
||||||
|
goog.require('ol.interaction.condition');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,17 +31,20 @@ ol.SHIFT_DRAG_ZOOM_HYSTERESIS_PIXELS_SQUARED =
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.interaction.Drag}
|
* @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);
|
goog.base(this);
|
||||||
|
|
||||||
|
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.interaction.ConditionType}
|
* @type {ol.interaction.ConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = condition;
|
this.condition_ = goog.isDef(options.condition) ?
|
||||||
|
options.condition : ol.interaction.condition.shiftKeyOnly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.control.DragBox}
|
* @type {ol.control.DragBox}
|
||||||
|
|||||||
@@ -87,8 +87,7 @@ ol.interaction.defaults = function(opt_options, opt_interactions) {
|
|||||||
var shiftDragZoom = goog.isDef(options.shiftDragZoom) ?
|
var shiftDragZoom = goog.isDef(options.shiftDragZoom) ?
|
||||||
options.shiftDragZoom : true;
|
options.shiftDragZoom : true;
|
||||||
if (shiftDragZoom) {
|
if (shiftDragZoom) {
|
||||||
interactions.push(
|
interactions.push(new ol.interaction.DragZoom());
|
||||||
new ol.interaction.DragZoom(ol.interaction.condition.shiftKeyOnly));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (goog.isDef(opt_interactions)) {
|
if (goog.isDef(opt_interactions)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user