From de319b9ae864542dd1355a854373314b5ed000f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 23 Sep 2014 08:52:28 +0200 Subject: [PATCH] Add ol.interaction.Interaction#setActive and #getActive --- src/ol/interaction/interaction.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/ol/interaction/interaction.js b/src/ol/interaction/interaction.js index 11acb63db1..9b91640c2f 100644 --- a/src/ol/interaction/interaction.js +++ b/src/ol/interaction/interaction.js @@ -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