Move interaction event handlers to class methods

This commit is contained in:
Kevin Schmidt
2018-10-03 06:30:09 -06:00
parent 9586c7cbc7
commit 942a0976be
12 changed files with 916 additions and 995 deletions

View File

@@ -38,6 +38,10 @@ class Interaction extends BaseObject {
constructor(options) {
super();
if (options.handleEvent) {
this.handleEvent = options.handleEvent;
}
/**
* @private
* @type {import("../PluggableMap.js").default}
@@ -45,12 +49,6 @@ class Interaction extends BaseObject {
this.map_ = null;
this.setActive(true);
/**
* @type {function(import("../MapBrowserEvent.js").default):boolean}
*/
this.handleEvent = options.handleEvent;
}
/**
@@ -72,6 +70,16 @@ class Interaction extends BaseObject {
return this.map_;
}
/**
* Handles the {@link module:ol/MapBrowserEvent map browser event}.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @api
*/
handleEvent(mapBrowserEvent) {
return true;
}
/**
* Activate or deactivate the interaction.
* @param {boolean} active Active.