Use extends, super and proper constructor jsdoc for ol/interaction

This commit is contained in:
ahocevar
2018-07-17 21:09:06 +02:00
parent fd962caa1c
commit e79add2e77
20 changed files with 273 additions and 402 deletions

View File

@@ -1,7 +1,7 @@
/**
* @module ol/interaction/Snap
*/
import {getUid, inherits} from '../util.js';
import {getUid} from '../util.js';
import {CollectionEvent} from '../Collection.js';
import CollectionEventType from '../CollectionEventType.js';
import {distance as coordinateDistance, squaredDistance as squaredCoordinateDistance, closestOnCircle, closestOnSegment, squaredDistanceToSegment} from '../coordinate.js';
@@ -62,19 +62,19 @@ import RBush from '../structs/RBush.js';
* var snap = new Snap({
* source: source
* });
*
* @constructor
* @extends {module:ol/interaction/Pointer}
* @param {module:ol/interaction/Snap~Options=} opt_options Options.
* @api
*/
class Snap {
class Snap extends PointerInteraction {
/**
* @param {module:ol/interaction/Snap~Options=} opt_options Options.
* @api
*/
constructor(opt_options) {
PointerInteraction.call(this, {
super({
handleEvent: handleEvent,
handleDownEvent: TRUE,
handleUpEvent: handleUpEvent
handleUpEvent: handleUpEvent,
stopDown: FALSE
});
const options = opt_options ? opt_options : {};
@@ -325,7 +325,7 @@ class Snap {
keys.length = 0;
features.forEach(this.forEachFeatureRemove_.bind(this));
}
PointerInteraction.prototype.setMap.call(this, map);
super.setMap(map);
if (map) {
if (this.features_) {
@@ -585,14 +585,6 @@ class Snap {
}
}
inherits(Snap, PointerInteraction);
/**
* @inheritDoc
*/
Snap.prototype.shouldStopEvent = FALSE;
/**
* Handle all pointer events events.