Add support for passing interactions as an array for consistency.
This commit is contained in:
@@ -57,9 +57,8 @@
|
|||||||
* @typedef {Object} ol.MapOptions
|
* @typedef {Object} ol.MapOptions
|
||||||
* @property {ol.Collection|Array.<ol.control.Control>|undefined} controls
|
* @property {ol.Collection|Array.<ol.control.Control>|undefined} controls
|
||||||
* Controls initially added to the map.
|
* Controls initially added to the map.
|
||||||
* @property {ol.Collection|undefined} interactions A collection of
|
* @property {ol.Collection|Array.<ol.interaction.Interaction>|undefined}
|
||||||
* {@link ol.interaction|ol.interaction.Interaction} instances that allow the user to interact with
|
* interactions Interactions that are initially added to the map.
|
||||||
* the map.
|
|
||||||
* @property {Array.<ol.layer.Base>|ol.Collection|undefined} layers Layers.
|
* @property {Array.<ol.layer.Base>|ol.Collection|undefined} layers Layers.
|
||||||
* @property {ol.Collection|Array.<ol.Overlay>|undefined} overlays
|
* @property {ol.Collection|Array.<ol.Overlay>|undefined} overlays
|
||||||
* Overlays initially added to the map.
|
* Overlays initially added to the map.
|
||||||
|
|||||||
@@ -1274,8 +1274,17 @@ ol.Map.createOptionsInternal = function(options) {
|
|||||||
controls = ol.control.defaults();
|
controls = ol.control.defaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
var interactions = goog.isDef(options.interactions) ?
|
var interactions;
|
||||||
options.interactions : ol.interaction.defaults();
|
if (goog.isDef(options.interactions)) {
|
||||||
|
if (goog.isArray(options.interactions)) {
|
||||||
|
interactions = new ol.Collection(goog.array.clone(options.interactions));
|
||||||
|
} else {
|
||||||
|
goog.asserts.assertInstanceof(options.interactions, ol.Collection);
|
||||||
|
interactions = options.interactions;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
interactions = ol.interaction.defaults();
|
||||||
|
}
|
||||||
|
|
||||||
var overlays;
|
var overlays;
|
||||||
if (goog.isDef(options.overlays)) {
|
if (goog.isDef(options.overlays)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user