Move interaction event handlers to class methods
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user