Manual class transform
This commit is contained in:
@@ -22,27 +22,31 @@ import Interaction, {zoomByDelta} from '../interaction/Interaction.js';
|
||||
* @param {module:ol/interaction/DoubleClickZoom~Options=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
const DoubleClickZoom = function(opt_options) {
|
||||
class DoubleClickZoom {
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.delta_ = options.delta ? options.delta : 1;
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
Interaction.call(this, {
|
||||
handleEvent: handleEvent
|
||||
});
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.delta_ = options.delta ? options.delta : 1;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
Interaction.call(this, {
|
||||
handleEvent: handleEvent
|
||||
});
|
||||
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(DoubleClickZoom, Interaction);
|
||||
|
||||
|
||||
@@ -50,32 +50,37 @@ const DragAndDropEventType = {
|
||||
* @param {Array.<module:ol/Feature>=} opt_features Features.
|
||||
* @param {module:ol/proj/Projection=} opt_projection Projection.
|
||||
*/
|
||||
const DragAndDropEvent = function(type, file, opt_features, opt_projection) {
|
||||
class DragAndDropEvent {
|
||||
|
||||
Event.call(this, type);
|
||||
constructor(type, file, opt_features, opt_projection) {
|
||||
|
||||
/**
|
||||
* The features parsed from dropped data.
|
||||
* @type {Array.<module:ol/Feature>|undefined}
|
||||
* @api
|
||||
*/
|
||||
this.features = opt_features;
|
||||
Event.call(this, type);
|
||||
|
||||
/**
|
||||
* The dropped file.
|
||||
* @type {File}
|
||||
* @api
|
||||
*/
|
||||
this.file = file;
|
||||
/**
|
||||
* The features parsed from dropped data.
|
||||
* @type {Array.<module:ol/Feature>|undefined}
|
||||
* @api
|
||||
*/
|
||||
this.features = opt_features;
|
||||
|
||||
/**
|
||||
* The feature projection.
|
||||
* @type {module:ol/proj/Projection|undefined}
|
||||
* @api
|
||||
*/
|
||||
this.projection = opt_projection;
|
||||
/**
|
||||
* The dropped file.
|
||||
* @type {File}
|
||||
* @api
|
||||
*/
|
||||
this.file = file;
|
||||
|
||||
/**
|
||||
* The feature projection.
|
||||
* @type {module:ol/proj/Projection|undefined}
|
||||
* @api
|
||||
*/
|
||||
this.projection = opt_projection;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
inherits(DragAndDropEvent, Event);
|
||||
|
||||
|
||||
|
||||
@@ -70,25 +70,29 @@ const DragBoxEventType = {
|
||||
* @extends {module:ol/events/Event}
|
||||
* @constructor
|
||||
*/
|
||||
const DragBoxEvent = function(type, coordinate, mapBrowserEvent) {
|
||||
Event.call(this, type);
|
||||
class DragBoxEvent {
|
||||
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {module:ol/coordinate~Coordinate}
|
||||
* @api
|
||||
*/
|
||||
this.coordinate = coordinate;
|
||||
constructor(type, coordinate, mapBrowserEvent) {
|
||||
Event.call(this, type);
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {module:ol/MapBrowserEvent}
|
||||
* @api
|
||||
*/
|
||||
this.mapBrowserEvent = mapBrowserEvent;
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {module:ol/coordinate~Coordinate}
|
||||
* @api
|
||||
*/
|
||||
this.coordinate = coordinate;
|
||||
|
||||
};
|
||||
/**
|
||||
* @const
|
||||
* @type {module:ol/MapBrowserEvent}
|
||||
* @api
|
||||
*/
|
||||
this.mapBrowserEvent = mapBrowserEvent;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(DragBoxEvent, Event);
|
||||
|
||||
@@ -111,56 +115,56 @@ inherits(DragBoxEvent, Event);
|
||||
* @api
|
||||
*/
|
||||
class DragBox {
|
||||
constructor(opt_options) {
|
||||
constructor(opt_options) {
|
||||
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {module:ol/render/Box}
|
||||
* @private
|
||||
*/
|
||||
this.box_ = new RenderBox(options.className || 'ol-dragbox');
|
||||
this.box_ = new RenderBox(options.className || 'ol-dragbox');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.minArea_ = options.minArea !== undefined ? options.minArea : 64;
|
||||
this.minArea_ = options.minArea !== undefined ? options.minArea : 64;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {module:ol~Pixel}
|
||||
* @private
|
||||
*/
|
||||
this.startPixel_ = null;
|
||||
this.startPixel_ = null;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition : always;
|
||||
this.condition_ = options.condition ? options.condition : always;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/interaction/DragBox~EndCondition}
|
||||
*/
|
||||
this.boxEndCondition_ = options.boxEndCondition ?
|
||||
options.boxEndCondition : defaultBoxEndCondition;
|
||||
}
|
||||
this.boxEndCondition_ = options.boxEndCondition ?
|
||||
options.boxEndCondition : defaultBoxEndCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns geometry of last drawn box.
|
||||
* @return {module:ol/geom/Polygon} Geometry.
|
||||
* @api
|
||||
*/
|
||||
getGeometry() {
|
||||
return this.box_.getGeometry();
|
||||
}
|
||||
getGeometry() {
|
||||
return this.box_.getGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
inherits(DragBox, PointerInteraction);
|
||||
|
||||
@@ -28,45 +28,48 @@ import PointerInteraction, {centroid as centroidFromPointers} from '../interacti
|
||||
* @param {module:ol/interaction/DragPan~Options=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
const DragPan = function(opt_options) {
|
||||
class DragPan {
|
||||
constructor(opt_options) {
|
||||
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/Kinetic|undefined}
|
||||
*/
|
||||
this.kinetic_ = options.kinetic;
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/Kinetic|undefined}
|
||||
*/
|
||||
this.kinetic_ = options.kinetic;
|
||||
|
||||
/**
|
||||
* @type {module:ol~Pixel}
|
||||
*/
|
||||
this.lastCentroid = null;
|
||||
/**
|
||||
* @type {module:ol~Pixel}
|
||||
*/
|
||||
this.lastCentroid = null;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.lastPointersCount_;
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.lastPointersCount_;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition : noModifierKeys;
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition : noModifierKeys;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.noKinetic_ = false;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.noKinetic_ = false;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(DragPan, PointerInteraction);
|
||||
|
||||
|
||||
@@ -33,34 +33,39 @@ import PointerInteraction from '../interaction/Pointer.js';
|
||||
* @param {module:ol/interaction/DragRotate~Options=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
const DragRotate = function(opt_options) {
|
||||
class DragRotate {
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(opt_options) {
|
||||
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition : altShiftKeysOnly;
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.lastAngle_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition : altShiftKeysOnly;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.lastAngle_ = undefined;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(DragRotate, PointerInteraction);
|
||||
|
||||
|
||||
@@ -34,47 +34,51 @@ import PointerInteraction from '../interaction/Pointer.js';
|
||||
* @param {module:ol/interaction/DragRotateAndZoom~Options=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
const DragRotateAndZoom = function(opt_options) {
|
||||
class DragRotateAndZoom {
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(opt_options) {
|
||||
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition : shiftKeyOnly;
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.lastAngle_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition : shiftKeyOnly;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.lastMagnitude_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.lastAngle_ = undefined;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.lastScaleDelta_ = 0;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.lastMagnitude_ = undefined;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 400;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.lastScaleDelta_ = 0;
|
||||
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 400;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(DragRotateAndZoom, PointerInteraction);
|
||||
|
||||
|
||||
@@ -134,18 +134,22 @@ const DrawEventType = {
|
||||
* @param {module:ol/interaction/Draw~DrawEventType} type Type.
|
||||
* @param {module:ol/Feature} feature The feature drawn.
|
||||
*/
|
||||
const DrawEvent = function(type, feature) {
|
||||
class DrawEvent {
|
||||
|
||||
Event.call(this, type);
|
||||
constructor(type, feature) {
|
||||
|
||||
/**
|
||||
* The feature being drawn.
|
||||
* @type {module:ol/Feature}
|
||||
* @api
|
||||
*/
|
||||
this.feature = feature;
|
||||
Event.call(this, type);
|
||||
|
||||
};
|
||||
/**
|
||||
* The feature being drawn.
|
||||
* @type {module:ol/Feature}
|
||||
* @api
|
||||
*/
|
||||
this.feature = feature;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(DrawEvent, Event);
|
||||
|
||||
|
||||
@@ -56,17 +56,21 @@ const ExtentEventType = {
|
||||
* @param {module:ol/extent~Extent} extent the new extent
|
||||
* @extends {module:ol/events/Event}
|
||||
*/
|
||||
const ExtentInteractionEvent = function(extent) {
|
||||
Event.call(this, ExtentEventType.EXTENTCHANGED);
|
||||
class ExtentInteractionEvent {
|
||||
|
||||
/**
|
||||
* The current extent.
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @api
|
||||
*/
|
||||
this.extent = extent;
|
||||
constructor(extent) {
|
||||
Event.call(this, ExtentEventType.EXTENTCHANGED);
|
||||
|
||||
/**
|
||||
* The current extent.
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @api
|
||||
*/
|
||||
this.extent = extent;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
inherits(ExtentInteractionEvent, Event);
|
||||
|
||||
|
||||
|
||||
@@ -39,45 +39,49 @@ import Interaction, {pan} from '../interaction/Interaction.js';
|
||||
* @param {module:ol/interaction/KeyboardPan~Options=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
const KeyboardPan = function(opt_options) {
|
||||
class KeyboardPan {
|
||||
|
||||
Interaction.call(this, {
|
||||
handleEvent: handleEvent
|
||||
});
|
||||
constructor(opt_options) {
|
||||
|
||||
const options = opt_options || {};
|
||||
Interaction.call(this, {
|
||||
handleEvent: handleEvent
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Browser event.
|
||||
* @return {boolean} Combined condition result.
|
||||
*/
|
||||
this.defaultCondition_ = function(mapBrowserEvent) {
|
||||
return noModifierKeys(mapBrowserEvent) &&
|
||||
targetNotEditable(mapBrowserEvent);
|
||||
};
|
||||
const options = opt_options || {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
*/
|
||||
this.condition_ = options.condition !== undefined ?
|
||||
options.condition : this.defaultCondition_;
|
||||
/**
|
||||
* @private
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Browser event.
|
||||
* @return {boolean} Combined condition result.
|
||||
*/
|
||||
this.defaultCondition_ = function(mapBrowserEvent) {
|
||||
return noModifierKeys(mapBrowserEvent) &&
|
||||
targetNotEditable(mapBrowserEvent);
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 100;
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
*/
|
||||
this.condition_ = options.condition !== undefined ?
|
||||
options.condition : this.defaultCondition_;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.pixelDelta_ = options.pixelDelta !== undefined ?
|
||||
options.pixelDelta : 128;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 100;
|
||||
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.pixelDelta_ = options.pixelDelta !== undefined ?
|
||||
options.pixelDelta : 128;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(KeyboardPan, Interaction);
|
||||
|
||||
|
||||
@@ -35,33 +35,37 @@ import Interaction, {zoomByDelta} from '../interaction/Interaction.js';
|
||||
* @extends {module:ol/interaction/Interaction}
|
||||
* @api
|
||||
*/
|
||||
const KeyboardZoom = function(opt_options) {
|
||||
class KeyboardZoom {
|
||||
|
||||
Interaction.call(this, {
|
||||
handleEvent: handleEvent
|
||||
});
|
||||
constructor(opt_options) {
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
Interaction.call(this, {
|
||||
handleEvent: handleEvent
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition : targetNotEditable;
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.delta_ = options.delta ? options.delta : 1;
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition : targetNotEditable;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 100;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.delta_ = options.delta ? options.delta : 1;
|
||||
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 100;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(KeyboardZoom, Interaction);
|
||||
|
||||
|
||||
@@ -99,24 +99,29 @@ const ModifyEventType = {
|
||||
* @param {module:ol/MapBrowserPointerEvent} mapBrowserPointerEvent
|
||||
* Associated {@link module:ol/MapBrowserPointerEvent}.
|
||||
*/
|
||||
export const ModifyEvent = function(type, features, mapBrowserPointerEvent) {
|
||||
export class ModifyEvent {
|
||||
|
||||
Event.call(this, type);
|
||||
constructor(type, features, mapBrowserPointerEvent) {
|
||||
|
||||
/**
|
||||
* The features being modified.
|
||||
* @type {module:ol/Collection.<module:ol/Feature>}
|
||||
* @api
|
||||
*/
|
||||
this.features = features;
|
||||
Event.call(this, type);
|
||||
|
||||
/**
|
||||
* Associated {@link module:ol/MapBrowserEvent}.
|
||||
* @type {module:ol/MapBrowserEvent}
|
||||
* @api
|
||||
*/
|
||||
this.mapBrowserEvent = mapBrowserPointerEvent;
|
||||
};
|
||||
/**
|
||||
* The features being modified.
|
||||
* @type {module:ol/Collection.<module:ol/Feature>}
|
||||
* @api
|
||||
*/
|
||||
this.features = features;
|
||||
|
||||
/**
|
||||
* Associated {@link module:ol/MapBrowserEvent}.
|
||||
* @type {module:ol/MapBrowserEvent}
|
||||
* @api
|
||||
*/
|
||||
this.mapBrowserEvent = mapBrowserPointerEvent;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(ModifyEvent, Event);
|
||||
|
||||
|
||||
@@ -27,53 +27,57 @@ import {disable} from '../rotationconstraint.js';
|
||||
* @param {module:ol/interaction/PinchRotate~Options=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
const PinchRotate = function(opt_options) {
|
||||
class PinchRotate {
|
||||
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
constructor(opt_options) {
|
||||
|
||||
const options = opt_options || {};
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/coordinate~Coordinate}
|
||||
*/
|
||||
this.anchor_ = null;
|
||||
const options = opt_options || {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.lastAngle_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/coordinate~Coordinate}
|
||||
*/
|
||||
this.anchor_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.rotating_ = false;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.lastAngle_ = undefined;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.rotationDelta_ = 0.0;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.rotating_ = false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.threshold_ = options.threshold !== undefined ? options.threshold : 0.3;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.rotationDelta_ = 0.0;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.threshold_ = options.threshold !== undefined ? options.threshold : 0.3;
|
||||
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(PinchRotate, PointerInteraction);
|
||||
|
||||
|
||||
@@ -26,47 +26,51 @@ import PointerInteraction, {centroid as centroidFromPointers} from '../interacti
|
||||
* @param {module:ol/interaction/PinchZoom~Options=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
const PinchZoom = function(opt_options) {
|
||||
class PinchZoom {
|
||||
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
constructor(opt_options) {
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
PointerInteraction.call(this, {
|
||||
handleDownEvent: handleDownEvent,
|
||||
handleDragEvent: handleDragEvent,
|
||||
handleUpEvent: handleUpEvent
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.constrainResolution_ = options.constrainResolution || false;
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/coordinate~Coordinate}
|
||||
*/
|
||||
this.anchor_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.constrainResolution_ = options.constrainResolution || false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 400;
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/coordinate~Coordinate}
|
||||
*/
|
||||
this.anchor_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.lastDistance_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 400;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.lastScaleDelta_ = 1;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.lastDistance_ = undefined;
|
||||
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.lastScaleDelta_ = 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(PinchZoom, PointerInteraction);
|
||||
|
||||
|
||||
@@ -110,30 +110,35 @@ const SelectEventType = {
|
||||
* @extends {module:ol/events/Event}
|
||||
* @constructor
|
||||
*/
|
||||
const SelectEvent = function(type, selected, deselected, mapBrowserEvent) {
|
||||
Event.call(this, type);
|
||||
class SelectEvent {
|
||||
|
||||
/**
|
||||
* Selected features array.
|
||||
* @type {Array.<module:ol/Feature>}
|
||||
* @api
|
||||
*/
|
||||
this.selected = selected;
|
||||
constructor(type, selected, deselected, mapBrowserEvent) {
|
||||
Event.call(this, type);
|
||||
|
||||
/**
|
||||
* Deselected features array.
|
||||
* @type {Array.<module:ol/Feature>}
|
||||
* @api
|
||||
*/
|
||||
this.deselected = deselected;
|
||||
/**
|
||||
* Selected features array.
|
||||
* @type {Array.<module:ol/Feature>}
|
||||
* @api
|
||||
*/
|
||||
this.selected = selected;
|
||||
|
||||
/**
|
||||
* Associated {@link module:ol/MapBrowserEvent}.
|
||||
* @type {module:ol/MapBrowserEvent}
|
||||
* @api
|
||||
*/
|
||||
this.mapBrowserEvent = mapBrowserEvent;
|
||||
};
|
||||
/**
|
||||
* Deselected features array.
|
||||
* @type {Array.<module:ol/Feature>}
|
||||
* @api
|
||||
*/
|
||||
this.deselected = deselected;
|
||||
|
||||
/**
|
||||
* Associated {@link module:ol/MapBrowserEvent}.
|
||||
* @type {module:ol/MapBrowserEvent}
|
||||
* @api
|
||||
*/
|
||||
this.mapBrowserEvent = mapBrowserEvent;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(SelectEvent, Event);
|
||||
|
||||
|
||||
@@ -63,25 +63,30 @@ const TranslateEventType = {
|
||||
* @param {module:ol/Collection.<module:ol/Feature>} features The features translated.
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate The event coordinate.
|
||||
*/
|
||||
export const TranslateEvent = function(type, features, coordinate) {
|
||||
export class TranslateEvent {
|
||||
|
||||
Event.call(this, type);
|
||||
constructor(type, features, coordinate) {
|
||||
|
||||
/**
|
||||
* The features being translated.
|
||||
* @type {module:ol/Collection.<module:ol/Feature>}
|
||||
* @api
|
||||
*/
|
||||
this.features = features;
|
||||
Event.call(this, type);
|
||||
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {module:ol/coordinate~Coordinate}
|
||||
* @api
|
||||
*/
|
||||
this.coordinate = coordinate;
|
||||
};
|
||||
/**
|
||||
* The features being translated.
|
||||
* @type {module:ol/Collection.<module:ol/Feature>}
|
||||
* @api
|
||||
*/
|
||||
this.features = features;
|
||||
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {module:ol/coordinate~Coordinate}
|
||||
* @api
|
||||
*/
|
||||
this.coordinate = coordinate;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inherits(TranslateEvent, Event);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user