Add an "handleEvent" interaction option

This commit is contained in:
Éric Lemoine
2014-12-08 17:52:34 +01:00
parent df170859cc
commit d07185e8f2
15 changed files with 139 additions and 86 deletions

View File

@@ -32,11 +32,11 @@ ol.interaction.InteractionProperty = {
* vectors and so are visible on the screen.
*
* @constructor
* @param {olx.interaction.InteractionOptions} options Options.
* @extends {ol.Object}
* @implements {oli.interaction.Interaction}
* @api
*/
ol.interaction.Interaction = function() {
ol.interaction.Interaction = function(options) {
goog.base(this);
@@ -48,6 +48,11 @@ ol.interaction.Interaction = function() {
this.setActive(true);
/**
* @type {function(ol.MapBrowserEvent):boolean}
*/
this.handleEvent = options.handleEvent;
};
goog.inherits(ol.interaction.Interaction, ol.Object);
@@ -76,22 +81,6 @@ ol.interaction.Interaction.prototype.getMap = function() {
};
/**
* Method called by the map to notify the interaction that a browser
* event was dispatched on the map. If the interaction wants to handle
* that event it can return `false` to prevent the propagation of the
* event to other interactions in the map's interactions chain.
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} Whether the map browser event should continue
* through the chain of interactions. `false` means stop, `true`
* means continue.
* @function
* @api
*/
ol.interaction.Interaction.prototype.handleMapBrowserEvent =
goog.abstractMethod;
/**
* Activate or deactivate the interaction.
* @param {boolean} active Active.