Add ol.interaction.Interaction#setActive and #getActive

This commit is contained in:
Éric Lemoine
2014-09-23 08:52:28 +02:00
parent 04f5768c76
commit de319b9ae8

View File

@@ -34,10 +34,25 @@ ol.interaction.Interaction = function() {
*/
this.map_ = null;
/**
* @private
* @type {boolean}
*/
this.active_ = true;
};
goog.inherits(ol.interaction.Interaction, ol.Observable);
/**
* @return {boolean} `true` if the interaction is active, `false` otherwise.
* @api
*/
ol.interaction.Interaction.prototype.getActive = function() {
return this.active_;
};
/**
* Get the map associated with this interaction.
* @return {ol.Map} Map.
@@ -57,6 +72,16 @@ ol.interaction.Interaction.prototype.handleMapBrowserEvent =
goog.abstractMethod;
/**
* Activate or deactivate the interaction.
* @param {boolean} active Active.
* @api
*/
ol.interaction.Interaction.prototype.setActive = function(active) {
this.active_ = active;
};
/**
* Remove the interaction from its current map and attach it to the new map.
* Subclasses may set up event handlers to get notified about changes to