Transformed types

Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e):

    jscodeshift --transform ts.js src
This commit is contained in:
Tim Schaub
2018-09-05 08:05:29 -06:00
parent f2aaaa19e1
commit ccfacc5ee6
239 changed files with 3999 additions and 3999 deletions

View File

@@ -20,7 +20,7 @@ import Interaction, {zoomByDelta} from '../interaction/Interaction.js';
class DoubleClickZoom extends Interaction {
/**
* @param {module:ol/interaction/DoubleClickZoom~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
super({
@@ -49,9 +49,9 @@ class DoubleClickZoom extends Interaction {
/**
* Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a
* doubleclick) and eventually zooms the map.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/DoubleClickZoom}
* @this {import("./DoubleClickZoom.js").default}
*/
function handleEvent(mapBrowserEvent) {
let stopEvent = false;

View File

@@ -13,13 +13,13 @@ import {get as getProjection} from '../proj.js';
/**
* @typedef {Object} Options
* @property {Array<function(new: module:ol/format/Feature)>} [formatConstructors] Format constructors.
* @property {module:ol/source/Vector} [source] Optional vector source where features will be added. If a source is provided
* @property {Array<function(new: import("../format/Feature.js").default)>} [formatConstructors] Format constructors.
* @property {import("../source/Vector.js").default} [source] Optional vector source where features will be added. If a source is provided
* all existing features will be removed and new features will be added when
* they are dropped on the target. If you want to add features to a vector
* source without removing the existing features (append only), instead of
* providing the source option listen for the "addfeatures" event.
* @property {module:ol/proj~ProjectionLike} [projection] Target projection. By default, the map's view's projection is used.
* @property {import("../proj.js").ProjectionLike} [projection] Target projection. By default, the map's view's projection is used.
* @property {Element} [target] The element that is used as the drop target, default is the viewport element.
*/
@@ -30,7 +30,7 @@ import {get as getProjection} from '../proj.js';
const DragAndDropEventType = {
/**
* Triggered when features are added
* @event module:ol/interaction/DragAndDrop~DragAndDropEvent#addfeatures
* @event DragAndDropEvent#addfeatures
* @api
*/
ADD_FEATURES: 'addfeatures'
@@ -45,10 +45,10 @@ const DragAndDropEventType = {
class DragAndDropEvent extends Event {
/**
* @param {module:ol/interaction/DragAndDrop~DragAndDropEventType} type Type.
* @param {DragAndDropEventType} type Type.
* @param {File} file File.
* @param {Array<module:ol/Feature>=} opt_features Features.
* @param {module:ol/proj/Projection=} opt_projection Projection.
* @param {Array<import("../Feature.js").default>=} opt_features Features.
* @param {import("../proj/Projection.js").default=} opt_projection Projection.
*/
constructor(type, file, opt_features, opt_projection) {
@@ -56,7 +56,7 @@ class DragAndDropEvent extends Event {
/**
* The features parsed from dropped data.
* @type {Array<module:ol/Feature>|undefined}
* @type {Array<import("../Feature.js").default>|undefined}
* @api
*/
this.features = opt_features;
@@ -70,7 +70,7 @@ class DragAndDropEvent extends Event {
/**
* The feature projection.
* @type {module:ol/proj/Projection|undefined}
* @type {import("../proj/Projection.js").default|undefined}
* @api
*/
this.projection = opt_projection;
@@ -85,11 +85,11 @@ class DragAndDropEvent extends Event {
* Handles input of vector data by drag and drop.
* @api
*
* @fires module:ol/interaction/DragAndDrop~DragAndDropEvent
* @fires DragAndDropEvent
*/
class DragAndDrop extends Interaction {
/**
* @param {module:ol/interaction/DragAndDrop~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -101,27 +101,27 @@ class DragAndDrop extends Interaction {
/**
* @private
* @type {Array<function(new: module:ol/format/Feature)>}
* @type {Array<function(new: import("../format/Feature.js").default)>}
*/
this.formatConstructors_ = options.formatConstructors ?
options.formatConstructors : [];
/**
* @private
* @type {module:ol/proj/Projection}
* @type {import("../proj/Projection.js").default}
*/
this.projection_ = options.projection ?
getProjection(options.projection) : null;
/**
* @private
* @type {Array<module:ol/events~EventsKey>}
* @type {Array<import("../events.js").EventsKey>}
*/
this.dropListenKeys_ = null;
/**
* @private
* @type {module:ol/source/Vector}
* @type {import("../source/Vector.js").default}
*/
this.source_ = options.source || null;
@@ -156,7 +156,7 @@ class DragAndDrop extends Interaction {
*/
const formatConstructor = formatConstructors[i];
/**
* @type {module:ol/format/Feature}
* @type {import("../format/Feature.js").default}
*/
const format = new formatConstructor();
features = this.tryReadFeatures_(format, result, {
@@ -216,11 +216,11 @@ class DragAndDrop extends Interaction {
}
/**
* @param {module:ol/format/Feature} format Format.
* @param {import("../format/Feature.js").default} format Format.
* @param {string} text Text.
* @param {module:ol/format/Feature~ReadOptions} options Read options.
* @param {import("../format/Feature.js").ReadOptions} options Read options.
* @private
* @return {Array<module:ol/Feature>} Features.
* @return {Array<import("../Feature.js").default>} Features.
*/
tryReadFeatures_(format, text, options) {
try {
@@ -244,7 +244,7 @@ class DragAndDrop extends Interaction {
/**
* @param {DragEvent} event Event.
* @this {module:ol/interaction/DragAndDrop}
* @this {import("./DragAndDrop.js").default}
*/
function handleDrop(event) {
const files = event.dataTransfer.files;

View File

@@ -13,22 +13,22 @@ import RenderBox from '../render/Box.js';
* A function that takes a {@link module:ol/MapBrowserEvent} and two
* {@link module:ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met,
* true should be returned.
* @typedef {function(this: ?, module:ol/MapBrowserEvent, module:ol/pixel~Pixel, module:ol/pixel~Pixel):boolean} EndCondition
* @typedef {function(this: ?, import("../MapBrowserEvent.js").default, import("../pixel.js").Pixel, import("../pixel.js").Pixel):boolean} EndCondition
*/
/**
* @typedef {Object} Options
* @property {string} [className='ol-dragbox'] CSS class name for styling the box.
* @property {module:ol/events/condition~Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
* @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
* to indicate whether that event should be handled.
* Default is {@link ol/events/condition~always}.
* @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the default
* `boxEndCondition` function.
* @property {module:ol/interaction/DragBox~EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two
* @property {EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two
* {@link module:ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired.
* Default is `true` if the area of the box is bigger than the `minArea` option.
* @property {function(this:module:ol/interaction/DragBox, module:ol/MapBrowserEvent)} onBoxEnd Code to execute just
* @property {function(this:import("./DragBox.js").default, import("../MapBrowserEvent.js").default)} onBoxEnd Code to execute just
* before `boxend` is fired.
*/
@@ -39,21 +39,21 @@ import RenderBox from '../render/Box.js';
const DragBoxEventType = {
/**
* Triggered upon drag box start.
* @event module:ol/interaction/DragBox~DragBoxEvent#boxstart
* @event DragBoxEvent#boxstart
* @api
*/
BOXSTART: 'boxstart',
/**
* Triggered on drag when box is active.
* @event module:ol/interaction/DragBox~DragBoxEvent#boxdrag
* @event DragBoxEvent#boxdrag
* @api
*/
BOXDRAG: 'boxdrag',
/**
* Triggered upon drag box end.
* @event module:ol/interaction/DragBox~DragBoxEvent#boxend
* @event DragBoxEvent#boxend
* @api
*/
BOXEND: 'boxend'
@@ -69,8 +69,8 @@ class DragBoxEvent extends Event {
/**
* @param {string} type The event type.
* @param {module:ol/coordinate~Coordinate} coordinate The event coordinate.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Originating event.
* @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Originating event.
*/
constructor(type, coordinate, mapBrowserEvent) {
super(type);
@@ -78,14 +78,14 @@ class DragBoxEvent extends Event {
/**
* The coordinate of the drag event.
* @const
* @type {module:ol/coordinate~Coordinate}
* @type {import("../coordinate.js").Coordinate}
* @api
*/
this.coordinate = coordinate;
/**
* @const
* @type {module:ol/MapBrowserEvent}
* @type {import("../MapBrowserEvent.js").default}
* @api
*/
this.mapBrowserEvent = mapBrowserEvent;
@@ -106,12 +106,12 @@ class DragBoxEvent extends Event {
*
* This interaction is only supported for mouse devices.
*
* @fires module:ol/interaction/DragBox~DragBoxEvent
* @fires DragBoxEvent
* @api
*/
class DragBox extends PointerInteraction {
/**
* @param {module:ol/interaction/DragBox~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -124,7 +124,7 @@ class DragBox extends PointerInteraction {
const options = opt_options ? opt_options : {};
/**
* @type {module:ol/render/Box}
* @type {import("../render/Box.js").default}
* @private
*/
this.box_ = new RenderBox(options.className || 'ol-dragbox');
@@ -137,26 +137,26 @@ class DragBox extends PointerInteraction {
/**
* Function to execute just before `onboxend` is fired
* @type {function(this:module:ol/interaction/DragBox, module:ol/MapBrowserEvent)}
* @type {function(this:import("./DragBox.js").default, import("../MapBrowserEvent.js").default)}
* @private
*/
this.onBoxEnd_ = options.onBoxEnd ? options.onBoxEnd : VOID;
/**
* @type {module:ol/pixel~Pixel}
* @type {import("../pixel.js").Pixel}
* @private
*/
this.startPixel_ = null;
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.condition_ = options.condition ? options.condition : always;
/**
* @private
* @type {module:ol/interaction/DragBox~EndCondition}
* @type {EndCondition}
*/
this.boxEndCondition_ = options.boxEndCondition ?
options.boxEndCondition : defaultBoxEndCondition;
@@ -164,7 +164,7 @@ class DragBox extends PointerInteraction {
/**
* Returns geometry of last drawn box.
* @return {module:ol/geom/Polygon} Geometry.
* @return {import("../geom/Polygon.js").default} Geometry.
* @api
*/
getGeometry() {
@@ -176,12 +176,12 @@ class DragBox extends PointerInteraction {
/**
* The default condition for determining whether the boxend event
* should fire.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent The originating MapBrowserEvent
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent The originating MapBrowserEvent
* leading to the box end.
* @param {module:ol/pixel~Pixel} startPixel The starting pixel of the box.
* @param {module:ol/pixel~Pixel} endPixel The end pixel of the box.
* @param {import("../pixel.js").Pixel} startPixel The starting pixel of the box.
* @param {import("../pixel.js").Pixel} endPixel The end pixel of the box.
* @return {boolean} Whether or not the boxend condition should be fired.
* @this {module:ol/interaction/DragBox}
* @this {import("./DragBox.js").default}
*/
function defaultBoxEndCondition(mapBrowserEvent, startPixel, endPixel) {
const width = endPixel[0] - startPixel[0];
@@ -191,8 +191,8 @@ function defaultBoxEndCondition(mapBrowserEvent, startPixel, endPixel) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragBox}
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @this {import("./DragBox.js").default}
*/
function handleDragEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -207,9 +207,9 @@ function handleDragEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/DragBox}
* @this {import("./DragBox.js").default}
*/
function handleUpEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -228,9 +228,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/DragBox}
* @this {import("./DragBox.js").default}
*/
function handleDownEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {

View File

@@ -11,10 +11,10 @@ import PointerInteraction, {centroid as centroidFromPointers} from '../interacti
/**
* @typedef {Object} Options
* @property {module:ol/events/condition~Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
* @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
* to indicate whether that event should be handled.
* Default is {@link module:ol/events/condition~noModifierKeys}.
* @property {module:ol/Kinetic} [kinetic] Kinetic inertia to apply to the pan.
* @property {import("../Kinetic.js").default} [kinetic] Kinetic inertia to apply to the pan.
*/
@@ -25,7 +25,7 @@ import PointerInteraction, {centroid as centroidFromPointers} from '../interacti
*/
class DragPan extends PointerInteraction {
/**
* @param {module:ol/interaction/DragPan~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -40,12 +40,12 @@ class DragPan extends PointerInteraction {
/**
* @private
* @type {module:ol/Kinetic|undefined}
* @type {import("../Kinetic.js").default|undefined}
*/
this.kinetic_ = options.kinetic;
/**
* @type {module:ol/pixel~Pixel}
* @type {import("../pixel.js").Pixel}
*/
this.lastCentroid = null;
@@ -61,7 +61,7 @@ class DragPan extends PointerInteraction {
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.condition_ = options.condition ? options.condition : noModifierKeys;
@@ -77,8 +77,8 @@ class DragPan extends PointerInteraction {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragPan}
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @this {import("./DragPan.js").default}
*/
function handleDragEvent(mapBrowserEvent) {
if (!this.panning_) {
@@ -114,9 +114,9 @@ function handleDragEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/DragPan}
* @this {import("./DragPan.js").default}
*/
function handleUpEvent(mapBrowserEvent) {
const map = mapBrowserEvent.map;
@@ -125,7 +125,7 @@ function handleUpEvent(mapBrowserEvent) {
if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) {
const distance = this.kinetic_.getDistance();
const angle = this.kinetic_.getAngle();
const center = /** @type {!module:ol/coordinate~Coordinate} */ (view.getCenter());
const center = /** @type {!import("../coordinate.js").Coordinate} */ (view.getCenter());
const centerpx = map.getPixelFromCoordinate(center);
const dest = map.getCoordinateFromPixel([
centerpx[0] - distance * Math.cos(angle),
@@ -155,9 +155,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/DragPan}
* @this {import("./DragPan.js").default}
*/
function handleDownEvent(mapBrowserEvent) {
if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {

View File

@@ -11,7 +11,7 @@ import PointerInteraction from '../interaction/Pointer.js';
/**
* @typedef {Object} Options
* @property {module:ol/events/condition~Condition} [condition] A function that takes an
* @property {import("../events/condition.js").Condition} [condition] A function that takes an
* {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
* to indicate whether that event should be handled.
* Default is {@link module:ol/events/condition~altShiftKeysOnly}.
@@ -31,7 +31,7 @@ import PointerInteraction from '../interaction/Pointer.js';
class DragRotate extends PointerInteraction {
/**
* @param {module:ol/interaction/DragRotate~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -46,7 +46,7 @@ class DragRotate extends PointerInteraction {
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.condition_ = options.condition ? options.condition : altShiftKeysOnly;
@@ -68,8 +68,8 @@ class DragRotate extends PointerInteraction {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragRotate}
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @this {import("./DragRotate.js").default}
*/
function handleDragEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -95,9 +95,9 @@ function handleDragEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/DragRotate}
* @this {import("./DragRotate.js").default}
*/
function handleUpEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -114,9 +114,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/DragRotate}
* @this {import("./DragRotate.js").default}
*/
function handleDownEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {

View File

@@ -10,7 +10,7 @@ import PointerInteraction from '../interaction/Pointer.js';
/**
* @typedef {Object} Options
* @property {module:ol/events/condition~Condition} [condition] A function that
* @property {import("../events/condition.js").Condition} [condition] A function that
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled.
* Default is {@link module:ol/events/condition~shiftKeyOnly}.
@@ -32,7 +32,7 @@ import PointerInteraction from '../interaction/Pointer.js';
class DragRotateAndZoom extends PointerInteraction {
/**
* @param {module:ol/interaction/DragRotateAndZoom~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -46,7 +46,7 @@ class DragRotateAndZoom extends PointerInteraction {
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.condition_ = options.condition ? options.condition : shiftKeyOnly;
@@ -80,8 +80,8 @@ class DragRotateAndZoom extends PointerInteraction {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragRotateAndZoom}
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @this {import("./DragRotateAndZoom.js").default}
*/
function handleDragEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -113,9 +113,9 @@ function handleDragEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/DragRotateAndZoom}
* @this {import("./DragRotateAndZoom.js").default}
*/
function handleUpEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -134,9 +134,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/DragRotateAndZoom}
* @this {import("./DragRotateAndZoom.js").default}
*/
function handleDownEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {

View File

@@ -11,7 +11,7 @@ import DragBox from '../interaction/DragBox.js';
* @typedef {Object} Options
* @property {string} [className='ol-dragzoom'] CSS class name for styling the
* box.
* @property {module:ol/events/condition~Condition} [condition] A function that
* @property {import("../events/condition.js").Condition} [condition] A function that
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled.
* Default is {@link module:ol/events/condition~shiftKeyOnly}.
@@ -32,7 +32,7 @@ import DragBox from '../interaction/DragBox.js';
*/
class DragZoom extends DragBox {
/**
* @param {module:ol/interaction/DragZoom~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
@@ -61,12 +61,12 @@ class DragZoom extends DragBox {
/**
* @this {module:ol/interaction/DragZoom}
* @this {import("./DragZoom.js").default}
*/
function onBoxEnd() {
const map = this.getMap();
const view = /** @type {!module:ol/View} */ (map.getView());
const size = /** @type {!module:ol/size~Size} */ (map.getSize());
const view = /** @type {!import("../View.js").default} */ (map.getView());
const size = /** @type {!import("../size.js").Size} */ (map.getSize());
let extent = this.getGeometry().getExtent();
if (this.out_) {

View File

@@ -30,16 +30,16 @@ import {createEditingStyle} from '../style/Style.js';
/**
* @typedef {Object} Options
* @property {module:ol/geom/GeometryType} type Geometry type of
* @property {import("../geom/GeometryType.js").default} type Geometry type of
* the geometries being drawn with this instance.
* @property {number} [clickTolerance=6] The maximum distance in pixels between
* "down" and "up" for a "up" event to be considered a "click" event and
* actually add a point/vertex to the geometry being drawn. The default of `6`
* was chosen for the draw interaction to behave correctly on mouse as well as
* on touch devices.
* @property {module:ol/Collection<module:ol/Feature>} [features]
* @property {import("../Collection.js").default<import("../Feature.js").default>} [features]
* Destination collection for the drawn features.
* @property {module:ol/source/Vector} [source] Destination source for
* @property {import("../source/Vector.js").default} [source] Destination source for
* the drawn features.
* @property {number} [dragVertexDelay=500] Delay in milliseconds after pointerdown
* before the current vertex can be dragged to its exact position.
@@ -53,16 +53,16 @@ import {createEditingStyle} from '../style/Style.js';
* @property {number} [minPoints] The number of points that must be drawn
* before a polygon ring or line string can be finished. Default is `3` for
* polygon rings and `2` for line strings.
* @property {module:ol/events/condition~Condition} [finishCondition] A function
* @property {import("../events/condition.js").Condition} [finishCondition] A function
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether the drawing can be finished.
* @property {module:ol/style/Style|Array<module:ol/style/Style>|module:ol/style/Style~StyleFunction} [style]
* @property {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction} [style]
* Style for sketch features.
* @property {module:ol/interaction/Draw~GeometryFunction} [geometryFunction]
* @property {GeometryFunction} [geometryFunction]
* Function that is called when a geometry's coordinates are updated.
* @property {string} [geometryName] Geometry name to use for features created
* by the draw interaction.
* @property {module:ol/events/condition~Condition} [condition] A function that
* @property {import("../events/condition.js").Condition} [condition] A function that
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled.
* By default {@link module:ol/events/condition~noModifierKeys}, i.e. a click,
@@ -70,7 +70,7 @@ import {createEditingStyle} from '../style/Style.js';
* @property {boolean} [freehand=false] Operate in freehand mode for lines,
* polygons, and circles. This makes the interaction always operate in freehand
* mode and takes precedence over any `freehandCondition` option.
* @property {module:ol/events/condition~Condition} [freehandCondition]
* @property {import("../events/condition.js").Condition} [freehandCondition]
* Condition that activates freehand drawing for lines and polygons. This
* function takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and
* returns a boolean to indicate whether that event should be handled. The
@@ -86,8 +86,8 @@ import {createEditingStyle} from '../style/Style.js';
* arguments, and returns a geometry. The optional existing geometry is the
* geometry that is returned when the function is called without a second
* argument.
* @typedef {function(!Array<module:ol/coordinate~Coordinate>, module:ol/geom/SimpleGeometry=):
* module:ol/geom/SimpleGeometry} GeometryFunction
* @typedef {function(!Array<import("../coordinate.js").Coordinate>, import("../geom/SimpleGeometry.js").default=):
* import("../geom/SimpleGeometry.js").default} GeometryFunction
*/
@@ -110,13 +110,13 @@ const Mode = {
const DrawEventType = {
/**
* Triggered upon feature draw start
* @event module:ol/interaction/Draw~DrawEvent#drawstart
* @event DrawEvent#drawstart
* @api
*/
DRAWSTART: 'drawstart',
/**
* Triggered upon feature draw end
* @event module:ol/interaction/Draw~DrawEvent#drawend
* @event DrawEvent#drawend
* @api
*/
DRAWEND: 'drawend'
@@ -130,8 +130,8 @@ const DrawEventType = {
*/
class DrawEvent extends Event {
/**
* @param {module:ol/interaction/Draw~DrawEventType} type Type.
* @param {module:ol/Feature} feature The feature drawn.
* @param {DrawEventType} type Type.
* @param {import("../Feature.js").default} feature The feature drawn.
*/
constructor(type, feature) {
@@ -139,7 +139,7 @@ class DrawEvent extends Event {
/**
* The feature being drawn.
* @type {module:ol/Feature}
* @type {import("../Feature.js").default}
* @api
*/
this.feature = feature;
@@ -153,12 +153,12 @@ class DrawEvent extends Event {
* @classdesc
* Interaction for drawing feature geometries.
*
* @fires module:ol/interaction/Draw~DrawEvent
* @fires DrawEvent
* @api
*/
class Draw extends PointerInteraction {
/**
* @param {module:ol/interaction/Draw~Options} options Options.
* @param {Options} options Options.
*/
constructor(options) {
@@ -176,7 +176,7 @@ class Draw extends PointerInteraction {
this.shouldHandle_ = false;
/**
* @type {module:ol/pixel~Pixel}
* @type {import("../pixel.js").Pixel}
* @private
*/
this.downPx_ = null;
@@ -201,14 +201,14 @@ class Draw extends PointerInteraction {
/**
* Target source for drawn features.
* @type {module:ol/source/Vector}
* @type {import("../source/Vector.js").default}
* @private
*/
this.source_ = options.source ? options.source : null;
/**
* Target collection for drawn features.
* @type {module:ol/Collection<module:ol/Feature>}
* @type {import("../Collection.js").default<import("../Feature.js").default>}
* @private
*/
this.features_ = options.features ? options.features : null;
@@ -222,14 +222,14 @@ class Draw extends PointerInteraction {
/**
* Geometry type.
* @type {module:ol/geom/GeometryType}
* @type {import("../geom/GeometryType.js").default}
* @private
*/
this.type_ = /** @type {module:ol/geom/GeometryType} */ (options.type);
this.type_ = /** @type {import("../geom/GeometryType.js").default} */ (options.type);
/**
* Drawing mode (derived from geometry type.
* @type {module:ol/interaction/Draw~Mode}
* @type {Mode}
* @private
*/
this.mode_ = getMode(this.type_);
@@ -264,7 +264,7 @@ class Draw extends PointerInteraction {
/**
* A function to decide if a potential finish coordinate is permissible
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.finishCondition_ = options.finishCondition ? options.finishCondition : TRUE;
@@ -272,13 +272,13 @@ class Draw extends PointerInteraction {
if (!geometryFunction) {
if (this.type_ === GeometryType.CIRCLE) {
/**
* @param {!Array<module:ol/coordinate~Coordinate>} coordinates
* @param {!Array<import("../coordinate.js").Coordinate>} coordinates
* The coordinates.
* @param {module:ol/geom/SimpleGeometry=} opt_geometry Optional geometry.
* @return {module:ol/geom/SimpleGeometry} A geometry.
* @param {import("../geom/SimpleGeometry.js").default=} opt_geometry Optional geometry.
* @return {import("../geom/SimpleGeometry.js").default} A geometry.
*/
geometryFunction = function(coordinates, opt_geometry) {
const circle = opt_geometry ? /** @type {module:ol/geom/Circle} */ (opt_geometry) :
const circle = opt_geometry ? /** @type {import("../geom/Circle.js").default} */ (opt_geometry) :
new Circle([NaN, NaN]);
const squaredLength = squaredCoordinateDistance(
coordinates[0], coordinates[1]);
@@ -296,10 +296,10 @@ class Draw extends PointerInteraction {
Constructor = Polygon;
}
/**
* @param {!Array<module:ol/coordinate~Coordinate>} coordinates
* @param {!Array<import("../coordinate.js").Coordinate>} coordinates
* The coordinates.
* @param {module:ol/geom/SimpleGeometry=} opt_geometry Optional geometry.
* @return {module:ol/geom/SimpleGeometry} A geometry.
* @param {import("../geom/SimpleGeometry.js").default=} opt_geometry Optional geometry.
* @return {import("../geom/SimpleGeometry.js").default} A geometry.
*/
geometryFunction = function(coordinates, opt_geometry) {
let geometry = opt_geometry;
@@ -323,7 +323,7 @@ class Draw extends PointerInteraction {
}
/**
* @type {module:ol/interaction/Draw~GeometryFunction}
* @type {GeometryFunction}
* @private
*/
this.geometryFunction_ = geometryFunction;
@@ -337,42 +337,42 @@ class Draw extends PointerInteraction {
/**
* Finish coordinate for the feature (first point for polygons, last point for
* linestrings).
* @type {module:ol/coordinate~Coordinate}
* @type {import("../coordinate.js").Coordinate}
* @private
*/
this.finishCoordinate_ = null;
/**
* Sketch feature.
* @type {module:ol/Feature}
* @type {import("../Feature.js").default}
* @private
*/
this.sketchFeature_ = null;
/**
* Sketch point.
* @type {module:ol/Feature}
* @type {import("../Feature.js").default}
* @private
*/
this.sketchPoint_ = null;
/**
* Sketch coordinates. Used when drawing a line or polygon.
* @type {module:ol/coordinate~Coordinate|Array<module:ol/coordinate~Coordinate>|Array<Array<module:ol/coordinate~Coordinate>>}
* @type {import("../coordinate.js").Coordinate|Array<import("../coordinate.js").Coordinate>|Array<Array<import("../coordinate.js").Coordinate>>}
* @private
*/
this.sketchCoords_ = null;
/**
* Sketch line. Used when drawing polygon.
* @type {module:ol/Feature}
* @type {import("../Feature.js").default}
* @private
*/
this.sketchLine_ = null;
/**
* Sketch line coordinates. Used when drawing a polygon or circle.
* @type {Array<module:ol/coordinate~Coordinate>}
* @type {Array<import("../coordinate.js").Coordinate>}
* @private
*/
this.sketchLineCoords_ = null;
@@ -389,7 +389,7 @@ class Draw extends PointerInteraction {
/**
* Draw overlay where our sketch features are drawn.
* @type {module:ol/layer/Vector}
* @type {import("../layer/Vector.js").default}
* @private
*/
this.overlay_ = new VectorLayer({
@@ -411,13 +411,13 @@ class Draw extends PointerInteraction {
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.condition_ = options.condition ? options.condition : noModifierKeys;
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.freehandCondition_;
if (options.freehand) {
@@ -443,7 +443,7 @@ class Draw extends PointerInteraction {
/**
* Get the overlay layer that this interaction renders sketch features to.
* @return {module:ol/layer/Vector} Overlay layer.
* @return {import("../layer/Vector.js").default} Overlay layer.
* @api
*/
getOverlay() {
@@ -452,7 +452,7 @@ class Draw extends PointerInteraction {
/**
* Handle move events.
* @param {module:ol/MapBrowserEvent} event A move event.
* @param {import("../MapBrowserEvent.js").default} event A move event.
* @return {boolean} Pass the event to other interactions.
* @private
*/
@@ -483,7 +483,7 @@ class Draw extends PointerInteraction {
/**
* Determine if an event is within the snapping tolerance of the start coord.
* @param {module:ol/MapBrowserEvent} event Event.
* @param {import("../MapBrowserEvent.js").default} event Event.
* @return {boolean} The event is within the snapping tolerance of the start.
* @private
*/
@@ -521,7 +521,7 @@ class Draw extends PointerInteraction {
}
/**
* @param {module:ol/MapBrowserEvent} event Event.
* @param {import("../MapBrowserEvent.js").default} event Event.
* @private
*/
createOrUpdateSketchPoint_(event) {
@@ -530,14 +530,14 @@ class Draw extends PointerInteraction {
this.sketchPoint_ = new Feature(new Point(coordinates));
this.updateSketchFeatures_();
} else {
const sketchPointGeom = /** @type {module:ol/geom/Point} */ (this.sketchPoint_.getGeometry());
const sketchPointGeom = /** @type {import("../geom/Point.js").default} */ (this.sketchPoint_.getGeometry());
sketchPointGeom.setCoordinates(coordinates);
}
}
/**
* Start the drawing.
* @param {module:ol/MapBrowserEvent} event Event.
* @param {import("../MapBrowserEvent.js").default} event Event.
* @private
*/
startDrawing_(event) {
@@ -567,12 +567,12 @@ class Draw extends PointerInteraction {
/**
* Modify the drawing.
* @param {module:ol/MapBrowserEvent} event Event.
* @param {import("../MapBrowserEvent.js").default} event Event.
* @private
*/
modifyDrawing_(event) {
let coordinate = event.coordinate;
const geometry = /** @type {module:ol/geom/SimpleGeometry} */ (this.sketchFeature_.getGeometry());
const geometry = /** @type {import("../geom/SimpleGeometry.js").default} */ (this.sketchFeature_.getGeometry());
let coordinates, last;
if (this.mode_ === Mode.POINT) {
last = this.sketchCoords_;
@@ -589,9 +589,9 @@ class Draw extends PointerInteraction {
}
last[0] = coordinate[0];
last[1] = coordinate[1];
this.geometryFunction_(/** @type {!Array<module:ol/coordinate~Coordinate>} */ (this.sketchCoords_), geometry);
this.geometryFunction_(/** @type {!Array<import("../coordinate.js").Coordinate>} */ (this.sketchCoords_), geometry);
if (this.sketchPoint_) {
const sketchPointGeom = /** @type {module:ol/geom/Point} */ (this.sketchPoint_.getGeometry());
const sketchPointGeom = /** @type {import("../geom/Point.js").default} */ (this.sketchPoint_.getGeometry());
sketchPointGeom.setCoordinates(coordinate);
}
let sketchLineGeom;
@@ -601,7 +601,7 @@ class Draw extends PointerInteraction {
this.sketchLine_ = new Feature();
}
const ring = geometry.getLinearRing(0);
sketchLineGeom = /** @type {module:ol/geom/LineString} */ (this.sketchLine_.getGeometry());
sketchLineGeom = /** @type {import("../geom/LineString.js").default} */ (this.sketchLine_.getGeometry());
if (!sketchLineGeom) {
sketchLineGeom = new LineString(ring.getFlatCoordinates(), ring.getLayout());
this.sketchLine_.setGeometry(sketchLineGeom);
@@ -611,7 +611,7 @@ class Draw extends PointerInteraction {
sketchLineGeom.changed();
}
} else if (this.sketchLineCoords_) {
sketchLineGeom = /** @type {module:ol/geom/LineString} */ (this.sketchLine_.getGeometry());
sketchLineGeom = /** @type {import("../geom/LineString.js").default} */ (this.sketchLine_.getGeometry());
sketchLineGeom.setCoordinates(this.sketchLineCoords_);
}
this.updateSketchFeatures_();
@@ -619,12 +619,12 @@ class Draw extends PointerInteraction {
/**
* Add a new coordinate to the drawing.
* @param {module:ol/MapBrowserEvent} event Event.
* @param {import("../MapBrowserEvent.js").default} event Event.
* @private
*/
addToDrawing_(event) {
const coordinate = event.coordinate;
const geometry = /** @type {module:ol/geom/SimpleGeometry} */ (this.sketchFeature_.getGeometry());
const geometry = /** @type {import("../geom/SimpleGeometry.js").default} */ (this.sketchFeature_.getGeometry());
let done;
let coordinates;
if (this.mode_ === Mode.LINE_STRING) {
@@ -668,7 +668,7 @@ class Draw extends PointerInteraction {
if (!this.sketchFeature_) {
return;
}
const geometry = /** @type {module:ol/geom/SimpleGeometry} */ (this.sketchFeature_.getGeometry());
const geometry = /** @type {import("../geom/SimpleGeometry.js").default} */ (this.sketchFeature_.getGeometry());
let coordinates, sketchLineGeom;
if (this.mode_ === Mode.LINE_STRING) {
coordinates = this.sketchCoords_;
@@ -680,7 +680,7 @@ class Draw extends PointerInteraction {
} else if (this.mode_ === Mode.POLYGON) {
coordinates = this.sketchCoords_[0];
coordinates.splice(-2, 1);
sketchLineGeom = /** @type {module:ol/geom/LineString} */ (this.sketchLine_.getGeometry());
sketchLineGeom = /** @type {import("../geom/LineString.js").default} */ (this.sketchLine_.getGeometry());
sketchLineGeom.setCoordinates(coordinates);
this.geometryFunction_(this.sketchCoords_, geometry);
}
@@ -704,7 +704,7 @@ class Draw extends PointerInteraction {
return;
}
let coordinates = this.sketchCoords_;
const geometry = /** @type {module:ol/geom/SimpleGeometry} */ (sketchFeature.getGeometry());
const geometry = /** @type {import("../geom/SimpleGeometry.js").default} */ (sketchFeature.getGeometry());
if (this.mode_ === Mode.LINE_STRING) {
// remove the redundant last point
coordinates.pop();
@@ -739,7 +739,7 @@ class Draw extends PointerInteraction {
/**
* Stop drawing without adding the sketch feature to the target layer.
* @return {module:ol/Feature} The sketch feature (or null if none).
* @return {import("../Feature.js").default} The sketch feature (or null if none).
* @private
*/
abortDrawing_() {
@@ -758,12 +758,12 @@ class Draw extends PointerInteraction {
* Extend an existing geometry by adding additional points. This only works
* on features with `LineString` geometries, where the interaction will
* extend lines by adding points to the end of the coordinates array.
* @param {!module:ol/Feature} feature Feature to be extended.
* @param {!import("../Feature.js").default} feature Feature to be extended.
* @api
*/
extend(feature) {
const geometry = feature.getGeometry();
const lineString = /** @type {module:ol/geom/LineString} */ (geometry);
const lineString = /** @type {import("../geom/LineString.js").default} */ (geometry);
this.sketchFeature_ = feature;
this.sketchCoords_ = lineString.getCoordinates();
const last = this.sketchCoords_[this.sketchCoords_.length - 1];
@@ -808,7 +808,7 @@ class Draw extends PointerInteraction {
/**
* @return {module:ol/style/Style~StyleFunction} Styles.
* @return {import("../style/Style.js").StyleFunction} Styles.
*/
function getDefaultStyleFunction() {
const styles = createEditingStyle();
@@ -821,9 +821,9 @@ function getDefaultStyleFunction() {
/**
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may actually
* draw or finish the drawing.
* @param {module:ol/MapBrowserEvent} event Map browser event.
* @param {import("../MapBrowserEvent.js").default} event Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/Draw}
* @this {import("./Draw.js").default}
* @api
*/
export function handleEvent(event) {
@@ -873,9 +873,9 @@ export function handleEvent(event) {
/**
* @param {module:ol/MapBrowserPointerEvent} event Event.
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/Draw}
* @this {import("./Draw.js").default}
*/
function handleDownEvent(event) {
this.shouldHandle_ = !this.freehand_;
@@ -901,9 +901,9 @@ function handleDownEvent(event) {
/**
* @param {module:ol/MapBrowserPointerEvent} event Event.
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/Draw}
* @this {import("./Draw.js").default}
*/
function handleUpEvent(event) {
let pass = true;
@@ -947,13 +947,13 @@ function handleUpEvent(event) {
/**
* Create a `geometryFunction` for `type: 'Circle'` that will create a regular
* polygon with a user specified number of sides and start angle instead of an
* `module:ol/geom/Circle~Circle` geometry.
* `import("../geom/Circle.js").Circle` geometry.
* @param {number=} opt_sides Number of sides of the regular polygon. Default is
* 32.
* @param {number=} opt_angle Angle of the first point in radians. 0 means East.
* Default is the angle defined by the heading from the center of the
* regular polygon to the current pointer position.
* @return {module:ol/interaction/Draw~GeometryFunction} Function that draws a
* @return {GeometryFunction} Function that draws a
* polygon.
* @api
*/
@@ -963,7 +963,7 @@ export function createRegularPolygon(opt_sides, opt_angle) {
const end = coordinates[1];
const radius = Math.sqrt(
squaredCoordinateDistance(center, end));
const geometry = opt_geometry ? /** @type {module:ol/geom/Polygon} */ (opt_geometry) :
const geometry = opt_geometry ? /** @type {import("../geom/Polygon.js").default} */ (opt_geometry) :
fromCircle(new Circle(center), opt_sides);
let angle = opt_angle;
if (!opt_angle) {
@@ -981,7 +981,7 @@ export function createRegularPolygon(opt_sides, opt_angle) {
* Create a `geometryFunction` that will create a box-shaped polygon (aligned
* with the coordinate system axes). Use this with the draw interaction and
* `type: 'Circle'` to return a box instead of a circle geometry.
* @return {module:ol/interaction/Draw~GeometryFunction} Function that draws a box-shaped polygon.
* @return {GeometryFunction} Function that draws a box-shaped polygon.
* @api
*/
export function createBox() {
@@ -1010,8 +1010,8 @@ export function createBox() {
/**
* Get the drawing mode. The mode for mult-part geometries is the same as for
* their single-part cousins.
* @param {module:ol/geom/GeometryType} type Geometry type.
* @return {module:ol/interaction/Draw~Mode} Drawing mode.
* @param {import("../geom/GeometryType.js").default} type Geometry type.
* @return {Mode} Drawing mode.
*/
function getMode(type) {
let mode;
@@ -1028,7 +1028,7 @@ function getMode(type) {
mode = Mode.CIRCLE;
}
return (
/** @type {!module:ol/interaction/Draw~Mode} */ (mode)
/** @type {!Mode} */ (mode)
);
}

View File

@@ -18,14 +18,14 @@ import {createEditingStyle} from '../style/Style.js';
/**
* @typedef {Object} Options
* @property {module:ol/extent~Extent} [extent] Initial extent. Defaults to no
* @property {import("../extent.js").Extent} [extent] Initial extent. Defaults to no
* initial extent.
* @property {module:ol/style/Style|Array<module:ol/style/Style>|module:ol/style/Style~StyleFunction} [boxStyle]
* @property {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction} [boxStyle]
* Style for the drawn extent box. Defaults to
* {@link module:ol/style/Style~createEditing()['Polygon']}
* @property {number} [pixelTolerance=10] Pixel tolerance for considering the
* pointer close enough to a segment or vertex for editing.
* @property {module:ol/style/Style|Array<module:ol/style/Style>|module:ol/style/Style~StyleFunction} [pointerStyle]
* @property {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction} [pointerStyle]
* Style for the cursor used to draw the extent. Defaults to
* {@link module:ol/style/Style~createEditing()['Point']}
* @property {boolean} [wrapX=false] Wrap the drawn extent across multiple maps
@@ -39,7 +39,7 @@ import {createEditingStyle} from '../style/Style.js';
const ExtentEventType = {
/**
* Triggered after the extent is changed
* @event module:ol/interaction/Extent~ExtentEventType#extentchanged
* @event ExtentEventType#extentchanged
* @api
*/
EXTENTCHANGED: 'extentchanged'
@@ -54,14 +54,14 @@ const ExtentEventType = {
class ExtentInteractionEvent extends Event {
/**
* @param {module:ol/extent~Extent} extent the new extent
* @param {import("../extent.js").Extent} extent the new extent
*/
constructor(extent) {
super(ExtentEventType.EXTENTCHANGED);
/**
* The current extent.
* @type {module:ol/extent~Extent}
* @type {import("../extent.js").Extent}
* @api
*/
this.extent = extent;
@@ -76,12 +76,12 @@ class ExtentInteractionEvent extends Event {
* Once drawn, the vector box can be modified by dragging its vertices or edges.
* This interaction is only supported for mouse devices.
*
* @fires module:ol/interaction/Extent~Event
* @fires Event
* @api
*/
class ExtentInteraction extends PointerInteraction {
/**
* @param {module:ol/interaction/Extent~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -96,14 +96,14 @@ class ExtentInteraction extends PointerInteraction {
/**
* Extent of the drawn box
* @type {module:ol/extent~Extent}
* @type {import("../extent.js").Extent}
* @private
*/
this.extent_ = null;
/**
* Handler for pointer move events
* @type {function (module:ol/coordinate~Coordinate): module:ol/extent~Extent|null}
* @type {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent|null}
* @private
*/
this.pointerHandler_ = null;
@@ -125,14 +125,14 @@ class ExtentInteraction extends PointerInteraction {
/**
* Feature for displaying the visible extent
* @type {module:ol/Feature}
* @type {import("../Feature.js").default}
* @private
*/
this.extentFeature_ = null;
/**
* Feature for displaying the visible pointer
* @type {module:ol/Feature}
* @type {import("../Feature.js").default}
* @private
*/
this.vertexFeature_ = null;
@@ -143,7 +143,7 @@ class ExtentInteraction extends PointerInteraction {
/**
* Layer for the extentFeature
* @type {module:ol/layer/Vector}
* @type {import("../layer/Vector.js").default}
* @private
*/
this.extentOverlay_ = new VectorLayer({
@@ -158,7 +158,7 @@ class ExtentInteraction extends PointerInteraction {
/**
* Layer for the vertexFeature
* @type {module:ol/layer/Vector}
* @type {import("../layer/Vector.js").default}
* @private
*/
this.vertexOverlay_ = new VectorLayer({
@@ -177,9 +177,9 @@ class ExtentInteraction extends PointerInteraction {
}
/**
* @param {module:ol/pixel~Pixel} pixel cursor location
* @param {module:ol/PluggableMap} map map
* @returns {module:ol/coordinate~Coordinate|null} snapped vertex on extent
* @param {import("../pixel.js").Pixel} pixel cursor location
* @param {import("../PluggableMap.js").default} map map
* @returns {import("../coordinate.js").Coordinate|null} snapped vertex on extent
* @private
*/
snapToVertex_(pixel, map) {
@@ -219,7 +219,7 @@ class ExtentInteraction extends PointerInteraction {
}
/**
* @param {module:ol/MapBrowserEvent} mapBrowserEvent pointer move event
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent pointer move event
* @private
*/
handlePointerMove_(mapBrowserEvent) {
@@ -234,8 +234,8 @@ class ExtentInteraction extends PointerInteraction {
}
/**
* @param {module:ol/extent~Extent} extent extent
* @returns {module:ol/Feature} extent as featrue
* @param {import("../extent.js").Extent} extent extent
* @returns {import("../Feature.js").default} extent as featrue
* @private
*/
createOrUpdateExtentFeature_(extent) {
@@ -260,8 +260,8 @@ class ExtentInteraction extends PointerInteraction {
}
/**
* @param {module:ol/coordinate~Coordinate} vertex location of feature
* @returns {module:ol/Feature} vertex as feature
* @param {import("../coordinate.js").Coordinate} vertex location of feature
* @returns {import("../Feature.js").default} vertex as feature
* @private
*/
createOrUpdatePointerFeature_(vertex) {
@@ -271,7 +271,7 @@ class ExtentInteraction extends PointerInteraction {
this.vertexFeature_ = vertexFeature;
this.vertexOverlay_.getSource().addFeature(vertexFeature);
} else {
const geometry = /** @type {module:ol/geom/Point} */ (vertexFeature.getGeometry());
const geometry = /** @type {import("../geom/Point.js").default} */ (vertexFeature.getGeometry());
geometry.setCoordinates(vertex);
}
return vertexFeature;
@@ -289,7 +289,7 @@ class ExtentInteraction extends PointerInteraction {
/**
* Returns the current drawn extent in the view projection
*
* @return {module:ol/extent~Extent} Drawn extent in the view projection.
* @return {import("../extent.js").Extent} Drawn extent in the view projection.
* @api
*/
getExtent() {
@@ -299,7 +299,7 @@ class ExtentInteraction extends PointerInteraction {
/**
* Manually sets the drawn extent, using the view projection.
*
* @param {module:ol/extent~Extent} extent Extent
* @param {import("../extent.js").Extent} extent Extent
* @api
*/
setExtent(extent) {
@@ -311,9 +311,9 @@ class ExtentInteraction extends PointerInteraction {
}
/**
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Propagate event?
* @this {module:ol/interaction/Extent~ExtentInteraction}
* @this {ExtentInteraction}
*/
function handleEvent(mapBrowserEvent) {
if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) {
@@ -330,9 +330,9 @@ function handleEvent(mapBrowserEvent) {
}
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Event handled?
* @this {module:ol/interaction/Extent~ExtentInteraction}
* @this {ExtentInteraction}
*/
function handleDownEvent(mapBrowserEvent) {
const pixel = mapBrowserEvent.pixel;
@@ -389,9 +389,9 @@ function handleDownEvent(mapBrowserEvent) {
}
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Event handled?
* @this {module:ol/interaction/Extent~ExtentInteraction}
* @this {ExtentInteraction}
*/
function handleDragEvent(mapBrowserEvent) {
if (this.pointerHandler_) {
@@ -403,9 +403,9 @@ function handleDragEvent(mapBrowserEvent) {
}
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/Extent~ExtentInteraction}
* @this {ExtentInteraction}
*/
function handleUpEvent(mapBrowserEvent) {
this.pointerHandler_ = null;
@@ -420,7 +420,7 @@ function handleUpEvent(mapBrowserEvent) {
/**
* Returns the default style for the drawn bbox
*
* @return {module:ol/style/Style~StyleFunction} Default Extent style
* @return {import("../style/Style.js").StyleFunction} Default Extent style
*/
function getDefaultExtentStyleFunction() {
const style = createEditingStyle();
@@ -432,7 +432,7 @@ function getDefaultExtentStyleFunction() {
/**
* Returns the default style for the pointer
*
* @return {module:ol/style/Style~StyleFunction} Default pointer style
* @return {import("../style/Style.js").StyleFunction} Default pointer style
*/
function getDefaultPointerStyleFunction() {
const style = createEditingStyle();
@@ -442,8 +442,8 @@ function getDefaultPointerStyleFunction() {
}
/**
* @param {module:ol/coordinate~Coordinate} fixedPoint corner that will be unchanged in the new extent
* @returns {function (module:ol/coordinate~Coordinate): module:ol/extent~Extent} event handler
* @param {import("../coordinate.js").Coordinate} fixedPoint corner that will be unchanged in the new extent
* @returns {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent} event handler
*/
function getPointHandler(fixedPoint) {
return function(point) {
@@ -452,9 +452,9 @@ function getPointHandler(fixedPoint) {
}
/**
* @param {module:ol/coordinate~Coordinate} fixedP1 first corner that will be unchanged in the new extent
* @param {module:ol/coordinate~Coordinate} fixedP2 second corner that will be unchanged in the new extent
* @returns {function (module:ol/coordinate~Coordinate): module:ol/extent~Extent|null} event handler
* @param {import("../coordinate.js").Coordinate} fixedP1 first corner that will be unchanged in the new extent
* @param {import("../coordinate.js").Coordinate} fixedP2 second corner that will be unchanged in the new extent
* @returns {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent|null} event handler
*/
function getEdgeHandler(fixedP1, fixedP2) {
if (fixedP1[0] == fixedP2[0]) {
@@ -471,8 +471,8 @@ function getEdgeHandler(fixedP1, fixedP2) {
}
/**
* @param {module:ol/extent~Extent} extent extent
* @returns {Array<Array<module:ol/coordinate~Coordinate>>} extent line segments
* @param {import("../extent.js").Extent} extent extent
* @returns {Array<Array<import("../coordinate.js").Coordinate>>} extent line segments
*/
function getSegments(extent) {
return [

View File

@@ -10,7 +10,7 @@ import {clamp} from '../math.js';
/**
* Object literal with config options for interactions.
* @typedef {Object} InteractionOptions
* @property {function(module:ol/MapBrowserEvent):boolean} handleEvent
* @property {function(import("../MapBrowserEvent.js").default):boolean} handleEvent
* Method called by the map to notify the interaction that a browser event was
* dispatched to the map. If the function returns a falsy value, propagation of
* the event to other interactions in the map's interactions chain will be
@@ -33,21 +33,21 @@ import {clamp} from '../math.js';
*/
class Interaction extends BaseObject {
/**
* @param {module:ol/interaction/Interaction~InteractionOptions} options Options.
* @param {InteractionOptions} options Options.
*/
constructor(options) {
super();
/**
* @private
* @type {module:ol/PluggableMap}
* @type {import("../PluggableMap.js").default}
*/
this.map_ = null;
this.setActive(true);
/**
* @type {function(module:ol/MapBrowserEvent):boolean}
* @type {function(import("../MapBrowserEvent.js").default):boolean}
*/
this.handleEvent = options.handleEvent;
@@ -65,7 +65,7 @@ class Interaction extends BaseObject {
/**
* Get the map associated with this interaction.
* @return {module:ol/PluggableMap} Map.
* @return {import("../PluggableMap.js").default} Map.
* @api
*/
getMap() {
@@ -86,7 +86,7 @@ class Interaction extends BaseObject {
* Remove the interaction from its current map and attach it to the new map.
* Subclasses may set up event handlers to get notified about changes to
* the map here.
* @param {module:ol/PluggableMap} map Map.
* @param {import("../PluggableMap.js").default} map Map.
*/
setMap(map) {
this.map_ = map;
@@ -95,8 +95,8 @@ class Interaction extends BaseObject {
/**
* @param {module:ol/View} view View.
* @param {module:ol/coordinate~Coordinate} delta Delta.
* @param {import("../View.js").default} view View.
* @param {import("../coordinate.js").Coordinate} delta Delta.
* @param {number=} opt_duration Duration.
*/
export function pan(view, delta, opt_duration) {
@@ -118,9 +118,9 @@ export function pan(view, delta, opt_duration) {
/**
* @param {module:ol/View} view View.
* @param {import("../View.js").default} view View.
* @param {number|undefined} rotation Rotation.
* @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate.
* @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
export function rotate(view, rotation, opt_anchor, opt_duration) {
@@ -130,9 +130,9 @@ export function rotate(view, rotation, opt_anchor, opt_duration) {
/**
* @param {module:ol/View} view View.
* @param {import("../View.js").default} view View.
* @param {number|undefined} rotation Rotation.
* @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate.
* @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
export function rotateWithoutConstraints(view, rotation, opt_anchor, opt_duration) {
@@ -154,9 +154,9 @@ export function rotateWithoutConstraints(view, rotation, opt_anchor, opt_duratio
/**
* @param {module:ol/View} view View.
* @param {import("../View.js").default} view View.
* @param {number|undefined} resolution Resolution to go to.
* @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate.
* @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
* @param {number=} opt_direction Zooming direction; > 0 indicates
* zooming out, in which case the constraints system will select
@@ -174,9 +174,9 @@ export function zoom(view, resolution, opt_anchor, opt_duration, opt_direction)
/**
* @param {module:ol/View} view View.
* @param {import("../View.js").default} view View.
* @param {number} delta Delta from previous zoom level.
* @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate.
* @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
export function zoomByDelta(view, delta, opt_anchor, opt_duration) {
@@ -212,9 +212,9 @@ export function zoomByDelta(view, delta, opt_anchor, opt_duration) {
/**
* @param {module:ol/View} view View.
* @param {import("../View.js").default} view View.
* @param {number|undefined} resolution Resolution to go to.
* @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate.
* @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
export function zoomWithoutConstraints(view, resolution, opt_anchor, opt_duration) {

View File

@@ -10,7 +10,7 @@ import Interaction, {pan} from '../interaction/Interaction.js';
/**
* @typedef {Object} Options
* @property {module:ol/events/condition~Condition} [condition] A function that
* @property {import("../events/condition.js").Condition} [condition] A function that
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled. Default is
* {@link module:ol/events/condition~noModifierKeys} and
@@ -36,7 +36,7 @@ import Interaction, {pan} from '../interaction/Interaction.js';
*/
class KeyboardPan extends Interaction {
/**
* @param {module:ol/interaction/KeyboardPan~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -48,7 +48,7 @@ class KeyboardPan extends Interaction {
/**
* @private
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Browser event.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Browser event.
* @return {boolean} Combined condition result.
*/
this.defaultCondition_ = function(mapBrowserEvent) {
@@ -58,7 +58,7 @@ class KeyboardPan extends Interaction {
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.condition_ = options.condition !== undefined ?
options.condition : this.defaultCondition_;
@@ -85,9 +85,9 @@ class KeyboardPan extends Interaction {
* Handles the {@link module:ol/MapBrowserEvent map browser event} if it was a
* `KeyEvent`, and decides the direction to pan to (if an arrow key was
* pressed).
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/KeyboardPan}
* @this {import("./KeyboardPan.js").default}
*/
function handleEvent(mapBrowserEvent) {
let stopEvent = false;

View File

@@ -9,7 +9,7 @@ import Interaction, {zoomByDelta} from '../interaction/Interaction.js';
/**
* @typedef {Object} Options
* @property {number} [duration=100] Animation duration in milliseconds.
* @property {module:ol/events/condition~Condition} [condition] A function that
* @property {import("../events/condition.js").Condition} [condition] A function that
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled. Default is
* {@link module:ol/events/condition~targetNotEditable}.
@@ -32,7 +32,7 @@ import Interaction, {zoomByDelta} from '../interaction/Interaction.js';
*/
class KeyboardZoom extends Interaction {
/**
* @param {module:ol/interaction/KeyboardZoom~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -44,7 +44,7 @@ class KeyboardZoom extends Interaction {
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.condition_ = options.condition ? options.condition : targetNotEditable;
@@ -69,9 +69,9 @@ class KeyboardZoom extends Interaction {
* Handles the {@link module:ol/MapBrowserEvent map browser event} if it was a
* `KeyEvent`, and decides whether to zoom in or out (depending on whether the
* key pressed was '+' or '-').
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/KeyboardZoom}
* @this {import("./KeyboardZoom.js").default}
*/
function handleEvent(mapBrowserEvent) {
let stopEvent = false;

View File

@@ -61,39 +61,39 @@ const ModifyEventType = {
/**
* @typedef {Object} SegmentData
* @property {Array<number>} [depth]
* @property {module:ol/Feature} feature
* @property {module:ol/geom/SimpleGeometry} geometry
* @property {import("../Feature.js").default} feature
* @property {import("../geom/SimpleGeometry.js").default} geometry
* @property {number} index
* @property {Array<module:ol/extent~Extent>} segment
* @property {Array<module:ol/interaction/Modify~SegmentData>} [featureSegments]
* @property {Array<import("../extent.js").Extent>} segment
* @property {Array<SegmentData>} [featureSegments]
*/
/**
* @typedef {Object} Options
* @property {module:ol/events/condition~Condition} [condition] A function that
* @property {import("../events/condition.js").Condition} [condition] A function that
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event will be considered to add or move a
* vertex to the sketch. Default is
* {@link module:ol/events/condition~primaryAction}.
* @property {module:ol/events/condition~Condition} [deleteCondition] A function
* @property {import("../events/condition.js").Condition} [deleteCondition] A function
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled. By default,
* {@link module:ol/events/condition~singleClick} with
* {@link module:ol/events/condition~altKeyOnly} results in a vertex deletion.
* @property {module:ol/events/condition~Condition} [insertVertexCondition] A
* @property {import("../events/condition.js").Condition} [insertVertexCondition] A
* function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and
* returns a boolean to indicate whether a new vertex can be added to the sketch
* features. Default is {@link module:ol/events/condition~always}.
* @property {number} [pixelTolerance=10] Pixel tolerance for considering the
* pointer close enough to a segment or vertex for editing.
* @property {module:ol/style/Style|Array<module:ol/style/Style>|module:ol/style/Style~StyleFunction} [style]
* @property {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction} [style]
* Style used for the features being modified. By default the default edit
* style is used (see {@link module:ol/style}).
* @property {module:ol/source/Vector} [source] The vector source with
* @property {import("../source/Vector.js").default} [source] The vector source with
* features to modify. If a vector source is not provided, a feature collection
* must be provided with the features option.
* @property {module:ol/Collection<module:ol/Feature>} [features]
* @property {import("../Collection.js").default<import("../Feature.js").default>} [features]
* The features the interaction works on. If a feature collection is not
* provided, a vector source must be provided with the source option.
* @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch
@@ -109,9 +109,9 @@ const ModifyEventType = {
export class ModifyEvent extends Event {
/**
* @param {ModifyEventType} type Type.
* @param {module:ol/Collection<module:ol/Feature>} features
* @param {import("../Collection.js").default<import("../Feature.js").default>} features
* The features modified.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserPointerEvent
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserPointerEvent
* Associated {@link module:ol/MapBrowserPointerEvent}.
*/
constructor(type, features, mapBrowserPointerEvent) {
@@ -119,14 +119,14 @@ export class ModifyEvent extends Event {
/**
* The features being modified.
* @type {module:ol/Collection<module:ol/Feature>}
* @type {import("../Collection.js").default<import("../Feature.js").default>}
* @api
*/
this.features = features;
/**
* Associated {@link module:ol/MapBrowserEvent}.
* @type {module:ol/MapBrowserEvent}
* @type {import("../MapBrowserEvent.js").default}
* @api
*/
this.mapBrowserEvent = mapBrowserPointerEvent;
@@ -148,12 +148,12 @@ export class ModifyEvent extends Event {
* By default, the interaction will allow deletion of vertices when the `alt`
* key is pressed. To configure the interaction with a different condition
* for deletion, use the `deleteCondition` option.
* @fires module:ol/interaction/Modify~ModifyEvent
* @fires ModifyEvent
* @api
*/
class Modify extends PointerInteraction {
/**
* @param {module:ol/interaction/Modify~Options} options Options.
* @param {Options} options Options.
*/
constructor(options) {
@@ -166,14 +166,14 @@ class Modify extends PointerInteraction {
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.condition_ = options.condition ? options.condition : primaryAction;
/**
* @private
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Browser event.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Browser event.
* @return {boolean} Combined condition result.
*/
this.defaultDeleteCondition_ = function(mapBrowserEvent) {
@@ -181,14 +181,14 @@ class Modify extends PointerInteraction {
};
/**
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
* @private
*/
this.deleteCondition_ = options.deleteCondition ?
options.deleteCondition : this.defaultDeleteCondition_;
/**
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
* @private
*/
this.insertVertexCondition_ = options.insertVertexCondition ?
@@ -196,7 +196,7 @@ class Modify extends PointerInteraction {
/**
* Editing vertex.
* @type {module:ol/Feature}
* @type {import("../Feature.js").default}
* @private
*/
this.vertexFeature_ = null;
@@ -209,7 +209,7 @@ class Modify extends PointerInteraction {
this.vertexSegments_ = null;
/**
* @type {module:ol/pixel~Pixel}
* @type {import("../pixel.js").Pixel}
* @private
*/
this.lastPixel_ = [0, 0];
@@ -230,7 +230,7 @@ class Modify extends PointerInteraction {
/**
* Segment RTree for each layer
* @type {module:ol/structs/RBush<module:ol/interaction/Modify~SegmentData>}
* @type {import("../structs/RBush.js").default<SegmentData>}
* @private
*/
this.rBush_ = new RBush();
@@ -264,7 +264,7 @@ class Modify extends PointerInteraction {
/**
* Draw overlay where sketch features are drawn.
* @type {module:ol/layer/Vector}
* @type {import("../layer/Vector.js").default}
* @private
*/
this.overlay_ = new VectorLayer({
@@ -281,7 +281,7 @@ class Modify extends PointerInteraction {
/**
* @const
* @private
* @type {!Object<string, function(module:ol/Feature, module:ol/geom/Geometry)>}
* @type {!Object<string, function(import("../Feature.js").default, import("../geom/Geometry.js").default)>}
*/
this.SEGMENT_WRITERS_ = {
'Point': this.writePointGeometry_,
@@ -297,7 +297,7 @@ class Modify extends PointerInteraction {
/**
* @type {module:ol/source/Vector}
* @type {import("../source/Vector.js").default}
* @private
*/
this.source_ = null;
@@ -318,7 +318,7 @@ class Modify extends PointerInteraction {
}
/**
* @type {module:ol/Collection<module:ol/Feature>}
* @type {import("../Collection.js").default<import("../Feature.js").default>}
* @private
*/
this.features_ = features;
@@ -330,7 +330,7 @@ class Modify extends PointerInteraction {
this.handleFeatureRemove_, this);
/**
* @type {module:ol/MapBrowserPointerEvent}
* @type {import("../MapBrowserPointerEvent.js").default}
* @private
*/
this.lastPointerEvent_ = null;
@@ -338,7 +338,7 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature.
* @param {import("../Feature.js").default} feature Feature.
* @private
*/
addFeature_(feature) {
@@ -355,7 +355,7 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/MapBrowserPointerEvent} evt Map browser event
* @param {import("../MapBrowserPointerEvent.js").default} evt Map browser event
* @private
*/
willModifyFeatures_(evt) {
@@ -367,7 +367,7 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature.
* @param {import("../Feature.js").default} feature Feature.
* @private
*/
removeFeature_(feature) {
@@ -383,15 +383,15 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature.
* @param {import("../Feature.js").default} feature Feature.
* @private
*/
removeFeatureSegmentData_(feature) {
const rBush = this.rBush_;
const /** @type {Array<module:ol/interaction/Modify~SegmentData>} */ nodesToRemove = [];
const /** @type {Array<SegmentData>} */ nodesToRemove = [];
rBush.forEach(
/**
* @param {module:ol/interaction/Modify~SegmentData} node RTree node.
* @param {SegmentData} node RTree node.
*/
function(node) {
if (feature === node.feature) {
@@ -424,7 +424,7 @@ class Modify extends PointerInteraction {
/**
* Get the overlay layer that this interaction renders sketch features to.
* @return {module:ol/layer/Vector} Overlay layer.
* @return {import("../layer/Vector.js").default} Overlay layer.
* @api
*/
getOverlay() {
@@ -432,7 +432,7 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/source/Vector~VectorSourceEvent} event Event.
* @param {import("../source/Vector.js").VectorSourceEvent} event Event.
* @private
*/
handleSourceAdd_(event) {
@@ -442,7 +442,7 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/source/Vector~VectorSourceEvent} event Event.
* @param {import("../source/Vector.js").VectorSourceEvent} event Event.
* @private
*/
handleSourceRemove_(event) {
@@ -452,42 +452,42 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/Collection~CollectionEvent} evt Event.
* @param {import("../Collection.js").CollectionEvent} evt Event.
* @private
*/
handleFeatureAdd_(evt) {
this.addFeature_(/** @type {module:ol/Feature} */ (evt.element));
this.addFeature_(/** @type {import("../Feature.js").default} */ (evt.element));
}
/**
* @param {module:ol/events/Event} evt Event.
* @param {import("../events/Event.js").default} evt Event.
* @private
*/
handleFeatureChange_(evt) {
if (!this.changingFeature_) {
const feature = /** @type {module:ol/Feature} */ (evt.target);
const feature = /** @type {import("../Feature.js").default} */ (evt.target);
this.removeFeature_(feature);
this.addFeature_(feature);
}
}
/**
* @param {module:ol/Collection~CollectionEvent} evt Event.
* @param {import("../Collection.js").CollectionEvent} evt Event.
* @private
*/
handleFeatureRemove_(evt) {
const feature = /** @type {module:ol/Feature} */ (evt.element);
const feature = /** @type {import("../Feature.js").default} */ (evt.element);
this.removeFeature_(feature);
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/Point} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/Point.js").default} geometry Geometry.
* @private
*/
writePointGeometry_(feature, geometry) {
const coordinates = geometry.getCoordinates();
const segmentData = /** @type {module:ol/interaction/Modify~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
geometry: geometry,
segment: [coordinates, coordinates]
@@ -496,15 +496,15 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiPoint} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/MultiPoint.js").default} geometry Geometry.
* @private
*/
writeMultiPointGeometry_(feature, geometry) {
const points = geometry.getCoordinates();
for (let i = 0, ii = points.length; i < ii; ++i) {
const coordinates = points[i];
const segmentData = /** @type {module:ol/interaction/Modify~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
geometry: geometry,
depth: [i],
@@ -516,15 +516,15 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/LineString} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/LineString.js").default} geometry Geometry.
* @private
*/
writeLineStringGeometry_(feature, geometry) {
const coordinates = geometry.getCoordinates();
for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {
const segment = coordinates.slice(i, i + 2);
const segmentData = /** @type {module:ol/interaction/Modify~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
geometry: geometry,
index: i,
@@ -535,8 +535,8 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiLineString} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/MultiLineString.js").default} geometry Geometry.
* @private
*/
writeMultiLineStringGeometry_(feature, geometry) {
@@ -545,7 +545,7 @@ class Modify extends PointerInteraction {
const coordinates = lines[j];
for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {
const segment = coordinates.slice(i, i + 2);
const segmentData = /** @type {module:ol/interaction/Modify~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
geometry: geometry,
depth: [j],
@@ -558,8 +558,8 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/Polygon} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/Polygon.js").default} geometry Geometry.
* @private
*/
writePolygonGeometry_(feature, geometry) {
@@ -568,7 +568,7 @@ class Modify extends PointerInteraction {
const coordinates = rings[j];
for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {
const segment = coordinates.slice(i, i + 2);
const segmentData = /** @type {module:ol/interaction/Modify~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
geometry: geometry,
depth: [j],
@@ -581,8 +581,8 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiPolygon} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
* @private
*/
writeMultiPolygonGeometry_(feature, geometry) {
@@ -593,7 +593,7 @@ class Modify extends PointerInteraction {
const coordinates = rings[j];
for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {
const segment = coordinates.slice(i, i + 2);
const segmentData = /** @type {module:ol/interaction/Modify~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
geometry: geometry,
depth: [j, k],
@@ -613,19 +613,19 @@ class Modify extends PointerInteraction {
* {@link CIRCLE_CIRCUMFERENCE_INDEX} is
* the circumference, and is not a line segment.
*
* @param {module:ol/Feature} feature Feature.
* @param {module:ol/geom/Circle} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature.
* @param {import("../geom/Circle.js").default} geometry Geometry.
* @private
*/
writeCircleGeometry_(feature, geometry) {
const coordinates = geometry.getCenter();
const centerSegmentData = /** @type {module:ol/interaction/Modify~SegmentData} */ ({
const centerSegmentData = /** @type {SegmentData} */ ({
feature: feature,
geometry: geometry,
index: CIRCLE_CENTER_INDEX,
segment: [coordinates, coordinates]
});
const circumferenceSegmentData = /** @type {module:ol/interaction/Modify~SegmentData} */ ({
const circumferenceSegmentData = /** @type {SegmentData} */ ({
feature: feature,
geometry: geometry,
index: CIRCLE_CIRCUMFERENCE_INDEX,
@@ -638,8 +638,8 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/GeometryCollection} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
* @private
*/
writeGeometryCollectionGeometry_(feature, geometry) {
@@ -650,8 +650,8 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/coordinate~Coordinate} coordinates Coordinates.
* @return {module:ol/Feature} Vertex feature.
* @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
* @return {import("../Feature.js").default} Vertex feature.
* @private
*/
createOrUpdateVertexFeature_(coordinates) {
@@ -661,14 +661,14 @@ class Modify extends PointerInteraction {
this.vertexFeature_ = vertexFeature;
this.overlay_.getSource().addFeature(vertexFeature);
} else {
const geometry = /** @type {module:ol/geom/Point} */ (vertexFeature.getGeometry());
const geometry = /** @type {import("../geom/Point.js").default} */ (vertexFeature.getGeometry());
geometry.setCoordinates(coordinates);
}
return vertexFeature;
}
/**
* @param {module:ol/MapBrowserEvent} evt Event.
* @param {import("../MapBrowserEvent.js").default} evt Event.
* @private
*/
handlePointerMove_(evt) {
@@ -677,8 +677,8 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/pixel~Pixel} pixel Pixel
* @param {module:ol/PluggableMap} map Map.
* @param {import("../pixel.js").Pixel} pixel Pixel
* @param {import("../PluggableMap.js").default} map Map.
* @private
*/
handlePointerAtPixel_(pixel, map) {
@@ -744,8 +744,8 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/interaction/Modify~SegmentData} segmentData Segment data.
* @param {module:ol/coordinate~Coordinate} vertex Vertex.
* @param {SegmentData} segmentData Segment data.
* @param {import("../coordinate.js").Coordinate} vertex Vertex.
* @private
*/
insertVertex_(segmentData, vertex) {
@@ -785,7 +785,7 @@ class Modify extends PointerInteraction {
const rTree = this.rBush_;
rTree.remove(segmentData);
this.updateSegmentIndices_(geometry, index, depth, 1);
const newSegmentData = /** @type {module:ol/interaction/Modify~SegmentData} */ ({
const newSegmentData = /** @type {SegmentData} */ ({
segment: [segment[0], vertex],
feature: feature,
geometry: geometry,
@@ -796,7 +796,7 @@ class Modify extends PointerInteraction {
newSegmentData);
this.dragSegments_.push([newSegmentData, 1]);
const newSegmentData2 = /** @type {module:ol/interaction/Modify~SegmentData} */ ({
const newSegmentData2 = /** @type {SegmentData} */ ({
segment: [vertex, segment[1]],
feature: feature,
geometry: geometry,
@@ -921,7 +921,7 @@ class Modify extends PointerInteraction {
segments.push(right.segment[1]);
}
if (left !== undefined && right !== undefined) {
const newSegmentData = /** @type {module:ol/interaction/Modify~SegmentData} */ ({
const newSegmentData = /** @type {SegmentData} */ ({
depth: segmentData.depth,
feature: segmentData.feature,
geometry: segmentData.geometry,
@@ -944,7 +944,7 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/geom/SimpleGeometry} geometry Geometry.
* @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
* @param {Array} coordinates Coordinates.
* @private
*/
@@ -955,7 +955,7 @@ class Modify extends PointerInteraction {
}
/**
* @param {module:ol/geom/SimpleGeometry} geometry Geometry.
* @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
* @param {number} index Index.
* @param {Array<number>|undefined} depth Depth.
* @param {number} delta Delta (1 or -1).
@@ -975,8 +975,8 @@ class Modify extends PointerInteraction {
/**
* @param {module:ol/interaction/Modify~SegmentData} a The first segment data.
* @param {module:ol/interaction/Modify~SegmentData} b The second segment data.
* @param {SegmentData} a The first segment data.
* @param {SegmentData} b The second segment data.
* @return {number} The difference in indexes.
*/
function compareIndexes(a, b) {
@@ -985,9 +985,9 @@ function compareIndexes(a, b) {
/**
* @param {module:ol/MapBrowserPointerEvent} evt Event.
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/Modify}
* @this {import("./Modify.js").default}
*/
function handleDownEvent(evt) {
if (!this.condition_(evt)) {
@@ -1000,7 +1000,7 @@ function handleDownEvent(evt) {
const vertexFeature = this.vertexFeature_;
if (vertexFeature) {
const insertVertices = [];
const geometry = /** @type {module:ol/geom/Point} */ (vertexFeature.getGeometry());
const geometry = /** @type {import("../geom/Point.js").default} */ (vertexFeature.getGeometry());
const vertex = geometry.getCoordinates();
const vertexExtent = boundingExtent([vertex]);
const segmentDataMatches = this.rBush_.getInExtent(vertexExtent);
@@ -1061,8 +1061,8 @@ function handleDownEvent(evt) {
/**
* @param {module:ol/MapBrowserPointerEvent} evt Event.
* @this {module:ol/interaction/Modify}
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
* @this {import("./Modify.js").default}
*/
function handleDragEvent(evt) {
this.ignoreNextSingleClick_ = false;
@@ -1137,9 +1137,9 @@ function handleDragEvent(evt) {
/**
* @param {module:ol/MapBrowserPointerEvent} evt Event.
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/Modify}
* @this {import("./Modify.js").default}
*/
function handleUpEvent(evt) {
for (let i = this.dragSegments_.length - 1; i >= 0; --i) {
@@ -1169,9 +1169,9 @@ function handleUpEvent(evt) {
/**
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may modify the
* geometry.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/Modify}
* @this {import("./Modify.js").default}
*/
function handleEvent(mapBrowserEvent) {
if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) {
@@ -1204,9 +1204,9 @@ function handleEvent(mapBrowserEvent) {
/**
* Returns the distance from a point to a line segment.
*
* @param {module:ol/coordinate~Coordinate} pointCoordinates The coordinates of the point from
* @param {import("../coordinate.js").Coordinate} pointCoordinates The coordinates of the point from
* which to calculate the distance.
* @param {module:ol/interaction/Modify~SegmentData} segmentData The object describing the line
* @param {SegmentData} segmentData The object describing the line
* segment we are calculating the distance to.
* @return {number} The square of the distance between a point and a line segment.
*/
@@ -1214,7 +1214,7 @@ function pointDistanceToSegmentDataSquared(pointCoordinates, segmentData) {
const geometry = segmentData.geometry;
if (geometry.getType() === GeometryType.CIRCLE) {
const circleGeometry = /** @type {module:ol/geom/Circle} */ (geometry);
const circleGeometry = /** @type {import("../geom/Circle.js").default} */ (geometry);
if (segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) {
const distanceToCenterSquared =
@@ -1230,11 +1230,11 @@ function pointDistanceToSegmentDataSquared(pointCoordinates, segmentData) {
/**
* Returns the point closest to a given line segment.
*
* @param {module:ol/coordinate~Coordinate} pointCoordinates The point to which a closest point
* @param {import("../coordinate.js").Coordinate} pointCoordinates The point to which a closest point
* should be found.
* @param {module:ol/interaction/Modify~SegmentData} segmentData The object describing the line
* @param {SegmentData} segmentData The object describing the line
* segment which should contain the closest point.
* @return {module:ol/coordinate~Coordinate} The point closest to the specified line segment.
* @return {import("../coordinate.js").Coordinate} The point closest to the specified line segment.
*/
function closestOnSegmentData(pointCoordinates, segmentData) {
const geometry = segmentData.geometry;
@@ -1248,7 +1248,7 @@ function closestOnSegmentData(pointCoordinates, segmentData) {
/**
* @return {module:ol/style/Style~StyleFunction} Styles.
* @return {import("../style/Style.js").StyleFunction} Styles.
*/
function getDefaultStyleFunction() {
const style = createEditingStyle();

View File

@@ -28,7 +28,7 @@ export const Mode = {
/**
* @typedef {Object} Options
* @property {module:ol/events/condition~Condition} [condition] A function that
* @property {import("../events/condition.js").Condition} [condition] A function that
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled. Default is
* {@link module:ol/events/condition~always}.
@@ -50,7 +50,7 @@ export const Mode = {
*/
class MouseWheelZoom extends Interaction {
/**
* @param {module:ol/interaction/MouseWheelZoom~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -92,13 +92,13 @@ class MouseWheelZoom extends Interaction {
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.condition_ = options.condition ? options.condition : always;
/**
* @private
* @type {?module:ol/coordinate~Coordinate}
* @type {?import("../coordinate.js").Coordinate}
*/
this.lastAnchor_ = null;
@@ -116,7 +116,7 @@ class MouseWheelZoom extends Interaction {
/**
* @private
* @type {module:ol/interaction/MouseWheelZoom~Mode|undefined}
* @type {Mode|undefined}
*/
this.mode_ = undefined;
@@ -159,7 +159,7 @@ class MouseWheelZoom extends Interaction {
/**
* @private
* @param {module:ol/PluggableMap} map Map.
* @param {import("../PluggableMap.js").default} map Map.
*/
handleWheelZoom_(map) {
const view = map.getView();
@@ -194,9 +194,9 @@ class MouseWheelZoom extends Interaction {
/**
* Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a
* mousewheel-event) and eventually zooms the map.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
* @return {boolean} Allow event propagation.
* @this {module:ol/interaction/MouseWheelZoom}
* @this {import("./MouseWheelZoom.js").default}
*/
function handleEvent(mapBrowserEvent) {
if (!this.condition_(mapBrowserEvent)) {

View File

@@ -24,7 +24,7 @@ import {disable} from '../rotationconstraint.js';
*/
class PinchRotate extends PointerInteraction {
/**
* @param {module:ol/interaction/PinchRotate~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -39,7 +39,7 @@ class PinchRotate extends PointerInteraction {
/**
* @private
* @type {module:ol/coordinate~Coordinate}
* @type {import("../coordinate.js").Coordinate}
*/
this.anchor_ = null;
@@ -79,8 +79,8 @@ class PinchRotate extends PointerInteraction {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/PinchRotate}
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @this {import("./PinchRotate.js").default}
*/
function handleDragEvent(mapBrowserEvent) {
let rotationDelta = 0.0;
@@ -129,9 +129,9 @@ function handleDragEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/PinchRotate}
* @this {import("./PinchRotate.js").default}
*/
function handleUpEvent(mapBrowserEvent) {
if (this.targetPointers.length < 2) {
@@ -150,9 +150,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/PinchRotate}
* @this {import("./PinchRotate.js").default}
*/
function handleDownEvent(mapBrowserEvent) {
if (this.targetPointers.length >= 2) {

View File

@@ -23,7 +23,7 @@ import PointerInteraction, {centroid as centroidFromPointers} from '../interacti
*/
class PinchZoom extends PointerInteraction {
/**
* @param {module:ol/interaction/PinchZoom~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -44,7 +44,7 @@ class PinchZoom extends PointerInteraction {
/**
* @private
* @type {module:ol/coordinate~Coordinate}
* @type {import("../coordinate.js").Coordinate}
*/
this.anchor_ = null;
@@ -72,8 +72,8 @@ class PinchZoom extends PointerInteraction {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/PinchZoom}
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @this {import("./PinchZoom.js").default}
*/
function handleDragEvent(mapBrowserEvent) {
let scaleDelta = 1.0;
@@ -124,9 +124,9 @@ function handleDragEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/PinchZoom}
* @this {import("./PinchZoom.js").default}
*/
function handleUpEvent(mapBrowserEvent) {
if (this.targetPointers.length < 2) {
@@ -151,9 +151,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/PinchZoom}
* @this {import("./PinchZoom.js").default}
*/
function handleDownEvent(mapBrowserEvent) {
if (this.targetPointers.length >= 2) {

View File

@@ -9,53 +9,53 @@ import {getValues} from '../obj.js';
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/Pointer}
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @this {import("./Pointer.js").default}
*/
const handleDragEvent = VOID;
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Capture dragging.
* @this {module:ol/interaction/Pointer}
* @this {import("./Pointer.js").default}
*/
const handleUpEvent = FALSE;
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Capture dragging.
* @this {module:ol/interaction/Pointer}
* @this {import("./Pointer.js").default}
*/
const handleDownEvent = FALSE;
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/Pointer}
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @this {import("./Pointer.js").default}
*/
const handleMoveEvent = VOID;
/**
* @typedef {Object} Options
* @property {function(module:ol/MapBrowserPointerEvent):boolean} [handleDownEvent]
* @property {function(import("../MapBrowserPointerEvent.js").default):boolean} [handleDownEvent]
* Function handling "down" events. If the function returns `true` then a drag
* sequence is started.
* @property {function(module:ol/MapBrowserPointerEvent)} [handleDragEvent]
* @property {function(import("../MapBrowserPointerEvent.js").default)} [handleDragEvent]
* Function handling "drag" events. This function is called on "move" events
* during a drag sequence.
* @property {function(module:ol/MapBrowserEvent):boolean} [handleEvent]
* @property {function(import("../MapBrowserEvent.js").default):boolean} [handleEvent]
* Method called by the map to notify the interaction that a browser event was
* dispatched to the map. The function may return `false` to prevent the
* propagation of the event to other interactions in the map's interactions
* chain.
* @property {function(module:ol/MapBrowserPointerEvent)} [handleMoveEvent]
* @property {function(import("../MapBrowserPointerEvent.js").default)} [handleMoveEvent]
* Function handling "move" events. This function is called on "move" events,
* also during a drag sequence (so during a drag sequence both the
* `handleDragEvent` function and this function are called).
* @property {function(module:ol/MapBrowserPointerEvent):boolean} [handleUpEvent]
* @property {function(import("../MapBrowserPointerEvent.js").default):boolean} [handleUpEvent]
* Function handling "up" events. If the function returns `false` then the
* current drag sequence is stopped.
* @property {function(boolean):boolean} stopDown
@@ -77,7 +77,7 @@ const handleMoveEvent = VOID;
*/
class PointerInteraction extends Interaction {
/**
* @param {module:ol/interaction/Pointer~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -88,28 +88,28 @@ class PointerInteraction extends Interaction {
});
/**
* @type {function(module:ol/MapBrowserPointerEvent):boolean}
* @type {function(import("../MapBrowserPointerEvent.js").default):boolean}
* @private
*/
this.handleDownEvent_ = options.handleDownEvent ?
options.handleDownEvent : handleDownEvent;
/**
* @type {function(module:ol/MapBrowserPointerEvent)}
* @type {function(import("../MapBrowserPointerEvent.js").default)}
* @private
*/
this.handleDragEvent_ = options.handleDragEvent ?
options.handleDragEvent : handleDragEvent;
/**
* @type {function(module:ol/MapBrowserPointerEvent)}
* @type {function(import("../MapBrowserPointerEvent.js").default)}
* @private
*/
this.handleMoveEvent_ = options.handleMoveEvent ?
options.handleMoveEvent : handleMoveEvent;
/**
* @type {function(module:ol/MapBrowserPointerEvent):boolean}
* @type {function(import("../MapBrowserPointerEvent.js").default):boolean}
* @private
*/
this.handleUpEvent_ = options.handleUpEvent ?
@@ -130,13 +130,13 @@ class PointerInteraction extends Interaction {
this.stopDown = options.stopDown ? options.stopDown : stopDown;
/**
* @type {!Object<string, module:ol/pointer/PointerEvent>}
* @type {!Object<string, import("../pointer/PointerEvent.js").default>}
* @private
*/
this.trackedPointers_ = {};
/**
* @type {Array<module:ol/pointer/PointerEvent>}
* @type {Array<import("../pointer/PointerEvent.js").default>}
* @protected
*/
this.targetPointers = [];
@@ -144,7 +144,7 @@ class PointerInteraction extends Interaction {
}
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @private
*/
updateTrackedPointers_(mapBrowserEvent) {
@@ -169,8 +169,8 @@ class PointerInteraction extends Interaction {
/**
* @param {Array<module:ol/pointer/PointerEvent>} pointerEvents List of events.
* @return {module:ol/pixel~Pixel} Centroid pixel.
* @param {Array<import("../pointer/PointerEvent.js").default>} pointerEvents List of events.
* @return {import("../pixel.js").Pixel} Centroid pixel.
*/
export function centroid(pointerEvents) {
const length = pointerEvents.length;
@@ -185,7 +185,7 @@ export function centroid(pointerEvents) {
/**
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
* @return {boolean} Whether the event is a pointerdown, pointerdrag
* or pointerup event.
*/
@@ -201,9 +201,9 @@ function isPointerDraggingEvent(mapBrowserEvent) {
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may call into
* other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are
* detected.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/Pointer}
* @this {import("./Pointer.js").default}
* @api
*/
export function handleEvent(mapBrowserEvent) {

View File

@@ -34,19 +34,19 @@ const SelectEventType = {
* {@link module:ol/render/Feature} and an
* {@link module:ol/layer/Layer} and returns `true` if the feature may be
* selected or `false` otherwise.
* @typedef {function((module:ol/Feature|module:ol/render/Feature), module:ol/layer/Layer):
* @typedef {function((import("../Feature.js").default|import("../render/Feature.js").default), import("../layer/Layer.js").default):
* boolean} FilterFunction
*/
/**
* @typedef {Object} Options
* @property {module:ol/events/condition~Condition} [addCondition] A function
* @property {import("../events/condition.js").Condition} [addCondition] A function
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled.
* By default, this is {@link module:ol/events/condition~never}. Use this if you
* want to use different events for add and remove instead of `toggle`.
* @property {module:ol/events/condition~Condition} [condition] A function that
* @property {import("../events/condition.js").Condition} [condition] A function that
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled. This is the event
* for the selected features as a whole. By default, this is
@@ -55,21 +55,21 @@ const SelectEventType = {
* feature removes all from the selection.
* See `toggle`, `add`, `remove` options for adding/removing extra features to/
* from the selection.
* @property {Array<module:ol/layer/Layer>|function(module:ol/layer/Layer): boolean} [layers]
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default): boolean} [layers]
* A list of layers from which features should be selected. Alternatively, a
* filter function can be provided. The function will be called for each layer
* in the map and should return `true` for layers that you want to be
* selectable. If the option is absent, all visible layers will be considered
* selectable.
* @property {module:ol/style/Style|Array<module:ol/style/Style>|module:ol/style/Style~StyleFunction} [style]
* @property {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction} [style]
* Style for the selected features. By default the default edit style is used
* (see {@link module:ol/style}).
* @property {module:ol/events/condition~Condition} [removeCondition] A function
* @property {import("../events/condition.js").Condition} [removeCondition] A function
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled.
* By default, this is {@link module:ol/events/condition~never}. Use this if you
* want to use different events for add and remove instead of `toggle`.
* @property {module:ol/events/condition~Condition} [toggleCondition] A function
* @property {import("../events/condition.js").Condition} [toggleCondition] A function
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled. This is in addition
* to the `condition` event. By default,
@@ -80,12 +80,12 @@ const SelectEventType = {
* @property {boolean} [multi=false] A boolean that determines if the default
* behaviour should select only single features or all (overlapping) features at
* the clicked map position. The default of `false` means single select.
* @property {module:ol/Collection<module:ol/Feature>} [features]
* @property {import("../Collection.js").default<import("../Feature.js").default>} [features]
* Collection where the interaction will place selected features. Optional. If
* not set the interaction will create a collection. In any case the collection
* used by the interaction is returned by
* {@link module:ol/interaction/Select~Select#getFeatures}.
* @property {module:ol/interaction/Select~FilterFunction} [filter] A function
* @property {FilterFunction} [filter] A function
* that takes an {@link module:ol/Feature} and an
* {@link module:ol/layer/Layer} and returns `true` if the feature may be
* selected or `false` otherwise.
@@ -105,9 +105,9 @@ const SelectEventType = {
class SelectEvent extends Event {
/**
* @param {SelectEventType} type The event type.
* @param {Array<module:ol/Feature>} selected Selected features.
* @param {Array<module:ol/Feature>} deselected Deselected features.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Associated
* @param {Array<import("../Feature.js").default>} selected Selected features.
* @param {Array<import("../Feature.js").default>} deselected Deselected features.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Associated
* {@link module:ol/MapBrowserEvent}.
*/
constructor(type, selected, deselected, mapBrowserEvent) {
@@ -115,21 +115,21 @@ class SelectEvent extends Event {
/**
* Selected features array.
* @type {Array<module:ol/Feature>}
* @type {Array<import("../Feature.js").default>}
* @api
*/
this.selected = selected;
/**
* Deselected features array.
* @type {Array<module:ol/Feature>}
* @type {Array<import("../Feature.js").default>}
* @api
*/
this.deselected = deselected;
/**
* Associated {@link module:ol/MapBrowserEvent}.
* @type {module:ol/MapBrowserEvent}
* @type {import("../MapBrowserEvent.js").default}
* @api
*/
this.mapBrowserEvent = mapBrowserEvent;
@@ -156,7 +156,7 @@ class SelectEvent extends Event {
*/
class Select extends Interaction {
/**
* @param {module:ol/interaction/Select~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -168,25 +168,25 @@ class Select extends Interaction {
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.condition_ = options.condition ? options.condition : singleClick;
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.addCondition_ = options.addCondition ? options.addCondition : never;
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.removeCondition_ = options.removeCondition ? options.removeCondition : never;
/**
* @private
* @type {module:ol/events/condition~Condition}
* @type {import("../events/condition.js").Condition}
*/
this.toggleCondition_ = options.toggleCondition ? options.toggleCondition : shiftKeyOnly;
@@ -198,7 +198,7 @@ class Select extends Interaction {
/**
* @private
* @type {module:ol/interaction/Select~FilterFunction}
* @type {FilterFunction}
*/
this.filter_ = options.filter ? options.filter : TRUE;
@@ -222,11 +222,11 @@ class Select extends Interaction {
/**
* @private
* @type {module:ol/layer/Vector}
* @type {import("../layer/Vector.js").default}
*/
this.featureOverlay_ = featureOverlay;
/** @type {function(module:ol/layer/Layer): boolean} */
/** @type {function(import("../layer/Layer.js").default): boolean} */
let layerFilter;
if (options.layers) {
if (typeof options.layers === 'function') {
@@ -243,7 +243,7 @@ class Select extends Interaction {
/**
* @private
* @type {function(module:ol/layer/Layer): boolean}
* @type {function(import("../layer/Layer.js").default): boolean}
*/
this.layerFilter_ = layerFilter;
@@ -251,7 +251,7 @@ class Select extends Interaction {
* An association between selected feature (key)
* and layer (value)
* @private
* @type {Object<number, module:ol/layer/Layer>}
* @type {Object<number, import("../layer/Layer.js").default>}
*/
this.featureLayerAssociation_ = {};
@@ -263,8 +263,8 @@ class Select extends Interaction {
}
/**
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature.
* @param {module:ol/layer/Layer} layer Layer.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../layer/Layer.js").default} layer Layer.
* @private
*/
addFeatureLayerAssociation_(feature, layer) {
@@ -274,7 +274,7 @@ class Select extends Interaction {
/**
* Get the selected features.
* @return {module:ol/Collection<module:ol/Feature>} Features collection.
* @return {import("../Collection.js").default<import("../Feature.js").default>} Features collection.
* @api
*/
getFeatures() {
@@ -295,20 +295,20 @@ class Select extends Interaction {
* the (last) selected feature. Note that this will not work with any
* programmatic method like pushing features to
* {@link module:ol/interaction/Select~Select#getFeatures collection}.
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature
* @return {module:ol/layer/Vector} Layer.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature
* @return {import("../layer/Vector.js").default} Layer.
* @api
*/
getLayer(feature) {
const key = getUid(feature);
return (
/** @type {module:ol/layer/Vector} */ (this.featureLayerAssociation_[key])
/** @type {import("../layer/Vector.js").default} */ (this.featureLayerAssociation_[key])
);
}
/**
* Get the overlay layer that this interaction renders selected features to.
* @return {module:ol/layer/Vector} Overlay layer.
* @return {import("../layer/Vector.js").default} Overlay layer.
* @api
*/
getOverlay() {
@@ -329,7 +329,7 @@ class Select extends Interaction {
/**
* Remove the interaction from its current map, if any, and attach it to a new
* map, if any. Pass `null` to just remove the interaction from the current map.
* @param {module:ol/PluggableMap} map Map.
* @param {import("../PluggableMap.js").default} map Map.
* @override
* @api
*/
@@ -348,29 +348,29 @@ class Select extends Interaction {
}
/**
* @param {module:ol/Collection~CollectionEvent} evt Event.
* @param {import("../Collection.js").CollectionEvent} evt Event.
* @private
*/
addFeature_(evt) {
const map = this.getMap();
if (map) {
map.skipFeature(/** @type {module:ol/Feature} */ (evt.element));
map.skipFeature(/** @type {import("../Feature.js").default} */ (evt.element));
}
}
/**
* @param {module:ol/Collection~CollectionEvent} evt Event.
* @param {import("../Collection.js").CollectionEvent} evt Event.
* @private
*/
removeFeature_(evt) {
const map = this.getMap();
if (map) {
map.unskipFeature(/** @type {module:ol/Feature} */ (evt.element));
map.unskipFeature(/** @type {import("../Feature.js").default} */ (evt.element));
}
}
/**
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @private
*/
removeFeatureLayerAssociation_(feature) {
@@ -383,9 +383,9 @@ class Select extends Interaction {
/**
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may change the
* selected state of features.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/Select}
* @this {import("./Select.js").default}
*/
function handleEvent(mapBrowserEvent) {
if (!this.condition_(mapBrowserEvent)) {
@@ -407,8 +407,8 @@ function handleEvent(mapBrowserEvent) {
map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
(
/**
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature.
* @param {module:ol/layer/Layer} layer Layer.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../layer/Layer.js").default} layer Layer.
* @return {boolean|undefined} Continue to iterate over the features.
*/
function(feature, layer) {
@@ -440,8 +440,8 @@ function handleEvent(mapBrowserEvent) {
map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
(
/**
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature.
* @param {module:ol/layer/Layer} layer Layer.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../layer/Layer.js").default} layer Layer.
* @return {boolean|undefined} Continue to iterate over the features.
*/
function(feature, layer) {
@@ -474,7 +474,7 @@ function handleEvent(mapBrowserEvent) {
/**
* @return {module:ol/style/Style~StyleFunction} Styles.
* @return {import("../style/Style.js").StyleFunction} Styles.
*/
function getDefaultStyleFunction() {
const styles = createEditingStyle();

View File

@@ -21,26 +21,26 @@ import RBush from '../structs/RBush.js';
/**
* @typedef {Object} Result
* @property {boolean} snapped
* @property {module:ol/coordinate~Coordinate|null} vertex
* @property {module:ol/pixel~Pixel|null} vertexPixel
* @property {import("../coordinate.js").Coordinate|null} vertex
* @property {import("../pixel.js").Pixel|null} vertexPixel
*/
/**
* @typedef {Object} SegmentData
* @property {module:ol/Feature} feature
* @property {Array<module:ol/coordinate~Coordinate>} segment
* @property {import("../Feature.js").default} feature
* @property {Array<import("../coordinate.js").Coordinate>} segment
*/
/**
* @typedef {Object} Options
* @property {module:ol/Collection<module:ol/Feature>} [features] Snap to these features. Either this option or source should be provided.
* @property {import("../Collection.js").default<import("../Feature.js").default>} [features] Snap to these features. Either this option or source should be provided.
* @property {boolean} [edge=true] Snap to edges.
* @property {boolean} [vertex=true] Snap to vertices.
* @property {number} [pixelTolerance=10] Pixel tolerance for considering the pointer close enough to a segment or
* vertex for snapping.
* @property {module:ol/source/Vector} [source] Snap to features from this source. Either this option or features should be provided
* @property {import("../source/Vector.js").default} [source] Snap to features from this source. Either this option or features should be provided
*/
@@ -67,7 +67,7 @@ import RBush from '../structs/RBush.js';
*/
class Snap extends PointerInteraction {
/**
* @param {module:ol/interaction/Snap~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -81,7 +81,7 @@ class Snap extends PointerInteraction {
const options = opt_options ? opt_options : {};
/**
* @type {module:ol/source/Vector}
* @type {import("../source/Vector.js").default}
* @private
*/
this.source_ = options.source ? options.source : null;
@@ -99,19 +99,19 @@ class Snap extends PointerInteraction {
this.edge_ = options.edge !== undefined ? options.edge : true;
/**
* @type {module:ol/Collection<module:ol/Feature>}
* @type {import("../Collection.js").default<import("../Feature.js").default>}
* @private
*/
this.features_ = options.features ? options.features : null;
/**
* @type {Array<module:ol/events~EventsKey>}
* @type {Array<import("../events.js").EventsKey>}
* @private
*/
this.featuresListenerKeys_ = [];
/**
* @type {Object<number, module:ol/events~EventsKey>}
* @type {Object<number, import("../events.js").EventsKey>}
* @private
*/
this.featureChangeListenerKeys_ = {};
@@ -119,7 +119,7 @@ class Snap extends PointerInteraction {
/**
* Extents are preserved so indexed segment can be quickly removed
* when its feature geometry changes
* @type {Object<number, module:ol/extent~Extent>}
* @type {Object<number, import("../extent.js").Extent>}
* @private
*/
this.indexedFeaturesExtents_ = {};
@@ -128,14 +128,14 @@ class Snap extends PointerInteraction {
* If a feature geometry changes while a pointer drag|move event occurs, the
* feature doesn't get updated right away. It will be at the next 'pointerup'
* event fired.
* @type {!Object<number, module:ol/Feature>}
* @type {!Object<number, import("../Feature.js").default>}
* @private
*/
this.pendingFeatures_ = {};
/**
* Used for distance sorting in sortByDistance_
* @type {module:ol/coordinate~Coordinate}
* @type {import("../coordinate.js").Coordinate}
* @private
*/
this.pixelCoordinate_ = null;
@@ -148,7 +148,7 @@ class Snap extends PointerInteraction {
options.pixelTolerance : 10;
/**
* @type {function(module:ol/interaction/Snap~SegmentData, module:ol/interaction/Snap~SegmentData): number}
* @type {function(SegmentData, SegmentData): number}
* @private
*/
this.sortByDistance_ = sortByDistance.bind(this);
@@ -156,7 +156,7 @@ class Snap extends PointerInteraction {
/**
* Segment RTree for each layer
* @type {module:ol/structs/RBush<module:ol/interaction/Snap~SegmentData>}
* @type {import("../structs/RBush.js").default<SegmentData>}
* @private
*/
this.rBush_ = new RBush();
@@ -165,7 +165,7 @@ class Snap extends PointerInteraction {
/**
* @const
* @private
* @type {Object<string, function(module:ol/Feature, module:ol/geom/Geometry)>}
* @type {Object<string, function(import("../Feature.js").default, import("../geom/Geometry.js").default)>}
*/
this.SEGMENT_WRITERS_ = {
'Point': this.writePointGeometry_,
@@ -182,7 +182,7 @@ class Snap extends PointerInteraction {
/**
* Add a feature to the collection of features that we may snap to.
* @param {module:ol/Feature} feature Feature.
* @param {import("../Feature.js").default} feature Feature.
* @param {boolean=} opt_listen Whether to listen to the feature change or not
* Defaults to `true`.
* @api
@@ -208,7 +208,7 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature.
* @param {import("../Feature.js").default} feature Feature.
* @private
*/
forEachFeatureAdd_(feature) {
@@ -216,7 +216,7 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature.
* @param {import("../Feature.js").default} feature Feature.
* @private
*/
forEachFeatureRemove_(feature) {
@@ -224,7 +224,7 @@ class Snap extends PointerInteraction {
}
/**
* @return {module:ol/Collection<module:ol/Feature>|Array<module:ol/Feature>} Features.
* @return {import("../Collection.js").default<import("../Feature.js").default>|Array<import("../Feature.js").default>} Features.
* @private
*/
getFeatures_() {
@@ -235,12 +235,12 @@ class Snap extends PointerInteraction {
features = this.source_.getFeatures();
}
return (
/** @type {!Array<module:ol/Feature>|!module:ol/Collection<module:ol/Feature>} */ (features)
/** @type {!Array<import("../Feature.js").default>|!import("../Collection.js").default<import("../Feature.js").default>} */ (features)
);
}
/**
* @param {module:ol/source/Vector|module:ol/Collection~CollectionEvent} evt Event.
* @param {import("../source/Vector.js").default|import("../Collection.js").CollectionEvent} evt Event.
* @private
*/
handleFeatureAdd_(evt) {
@@ -250,11 +250,11 @@ class Snap extends PointerInteraction {
} else if (evt instanceof CollectionEvent) {
feature = evt.element;
}
this.addFeature(/** @type {module:ol/Feature} */ (feature));
this.addFeature(/** @type {import("../Feature.js").default} */ (feature));
}
/**
* @param {module:ol/source/Vector|module:ol/Collection~CollectionEvent} evt Event.
* @param {import("../source/Vector.js").default|import("../Collection.js").CollectionEvent} evt Event.
* @private
*/
handleFeatureRemove_(evt) {
@@ -264,15 +264,15 @@ class Snap extends PointerInteraction {
} else if (evt instanceof CollectionEvent) {
feature = evt.element;
}
this.removeFeature(/** @type {module:ol/Feature} */ (feature));
this.removeFeature(/** @type {import("../Feature.js").default} */ (feature));
}
/**
* @param {module:ol/events/Event} evt Event.
* @param {import("../events/Event.js").default} evt Event.
* @private
*/
handleFeatureChange_(evt) {
const feature = /** @type {module:ol/Feature} */ (evt.target);
const feature = /** @type {import("../Feature.js").default} */ (evt.target);
if (this.handlingDownUpSequence) {
const uid = getUid(feature);
if (!(uid in this.pendingFeatures_)) {
@@ -285,7 +285,7 @@ class Snap extends PointerInteraction {
/**
* Remove a feature from the collection of features that we may snap to.
* @param {module:ol/Feature} feature Feature
* @param {import("../Feature.js").default} feature Feature
* @param {boolean=} opt_unlisten Whether to unlisten to the feature change
* or not. Defaults to `true`.
* @api
@@ -349,10 +349,10 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/pixel~Pixel} pixel Pixel
* @param {module:ol/coordinate~Coordinate} pixelCoordinate Coordinate
* @param {module:ol/PluggableMap} map Map.
* @return {module:ol/interaction/Snap~Result} Snap result
* @param {import("../pixel.js").Pixel} pixel Pixel
* @param {import("../coordinate.js").Coordinate} pixelCoordinate Coordinate
* @param {import("../PluggableMap.js").default} map Map.
* @return {Result} Snap result
*/
snapTo(pixel, pixelCoordinate, map) {
@@ -398,7 +398,7 @@ class Snap extends PointerInteraction {
} else if (this.edge_) {
if (isCircle) {
vertex = closestOnCircle(pixelCoordinate,
/** @type {module:ol/geom/Circle} */ (segments[0].feature.getGeometry()));
/** @type {import("../geom/Circle.js").default} */ (segments[0].feature.getGeometry()));
} else {
vertex = closestOnSegment(pixelCoordinate, closestSegment);
}
@@ -424,7 +424,7 @@ class Snap extends PointerInteraction {
}
}
return (
/** @type {module:ol/interaction/Snap~Result} */ ({
/** @type {Result} */ ({
snapped: snapped,
vertex: vertex,
vertexPixel: vertexPixel
@@ -433,7 +433,7 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {import("../Feature.js").default} feature Feature
* @private
*/
updateFeature_(feature) {
@@ -442,8 +442,8 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/Circle} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/Circle.js").default} geometry Geometry.
* @private
*/
writeCircleGeometry_(feature, geometry) {
@@ -451,7 +451,7 @@ class Snap extends PointerInteraction {
const coordinates = polygon.getCoordinates()[0];
for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {
const segment = coordinates.slice(i, i + 2);
const segmentData = /** @type {module:ol/interaction/Snap~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
segment: segment
});
@@ -460,8 +460,8 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/GeometryCollection} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
* @private
*/
writeGeometryCollectionGeometry_(feature, geometry) {
@@ -475,15 +475,15 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/LineString} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/LineString.js").default} geometry Geometry.
* @private
*/
writeLineStringGeometry_(feature, geometry) {
const coordinates = geometry.getCoordinates();
for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {
const segment = coordinates.slice(i, i + 2);
const segmentData = /** @type {module:ol/interaction/Snap~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
segment: segment
});
@@ -492,8 +492,8 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiLineString} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/MultiLineString.js").default} geometry Geometry.
* @private
*/
writeMultiLineStringGeometry_(feature, geometry) {
@@ -502,7 +502,7 @@ class Snap extends PointerInteraction {
const coordinates = lines[j];
for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {
const segment = coordinates.slice(i, i + 2);
const segmentData = /** @type {module:ol/interaction/Snap~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
segment: segment
});
@@ -512,15 +512,15 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiPoint} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/MultiPoint.js").default} geometry Geometry.
* @private
*/
writeMultiPointGeometry_(feature, geometry) {
const points = geometry.getCoordinates();
for (let i = 0, ii = points.length; i < ii; ++i) {
const coordinates = points[i];
const segmentData = /** @type {module:ol/interaction/Snap~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
segment: [coordinates, coordinates]
});
@@ -529,8 +529,8 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiPolygon} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
* @private
*/
writeMultiPolygonGeometry_(feature, geometry) {
@@ -541,7 +541,7 @@ class Snap extends PointerInteraction {
const coordinates = rings[j];
for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {
const segment = coordinates.slice(i, i + 2);
const segmentData = /** @type {module:ol/interaction/Snap~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
segment: segment
});
@@ -552,13 +552,13 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/Point} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/Point.js").default} geometry Geometry.
* @private
*/
writePointGeometry_(feature, geometry) {
const coordinates = geometry.getCoordinates();
const segmentData = /** @type {module:ol/interaction/Snap~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
segment: [coordinates, coordinates]
});
@@ -566,8 +566,8 @@ class Snap extends PointerInteraction {
}
/**
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/Polygon} geometry Geometry.
* @param {import("../Feature.js").default} feature Feature
* @param {import("../geom/Polygon.js").default} geometry Geometry.
* @private
*/
writePolygonGeometry_(feature, geometry) {
@@ -576,7 +576,7 @@ class Snap extends PointerInteraction {
const coordinates = rings[j];
for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {
const segment = coordinates.slice(i, i + 2);
const segmentData = /** @type {module:ol/interaction/Snap~SegmentData} */ ({
const segmentData = /** @type {SegmentData} */ ({
feature: feature,
segment: segment
});
@@ -589,9 +589,9 @@ class Snap extends PointerInteraction {
/**
* Handle all pointer events events.
* @param {module:ol/MapBrowserEvent} evt A move event.
* @param {import("../MapBrowserEvent.js").default} evt A move event.
* @return {boolean} Pass the event to other interactions.
* @this {module:ol/interaction/Snap}
* @this {import("./Snap.js").default}
*/
export function handleEvent(evt) {
const result = this.snapTo(evt.pixel, evt.coordinate, evt.map);
@@ -604,9 +604,9 @@ export function handleEvent(evt) {
/**
* @param {module:ol/MapBrowserPointerEvent} evt Event.
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/Snap}
* @this {import("./Snap.js").default}
*/
function handleUpEvent(evt) {
const featuresToUpdate = getValues(this.pendingFeatures_);
@@ -620,10 +620,10 @@ function handleUpEvent(evt) {
/**
* Sort segments by distance, helper function
* @param {module:ol/interaction/Snap~SegmentData} a The first segment data.
* @param {module:ol/interaction/Snap~SegmentData} b The second segment data.
* @param {SegmentData} a The first segment data.
* @param {SegmentData} b The second segment data.
* @return {number} The difference in distance.
* @this {module:ol/interaction/Snap}
* @this {import("./Snap.js").default}
*/
function sortByDistance(a, b) {
const deltaA = squaredDistanceToSegment(this.pixelCoordinate_, a.segment);

View File

@@ -38,9 +38,9 @@ const TranslateEventType = {
/**
* @typedef {Object} Options
* @property {module:ol/Collection<module:ol/Feature>} [features] Only features contained in this collection will be able to be translated. If
* @property {import("../Collection.js").default<import("../Feature.js").default>} [features] Only features contained in this collection will be able to be translated. If
* not specified, all features on the map will be able to be translated.
* @property {Array<module:ol/layer/Layer>|function(module:ol/layer/Layer): boolean} [layers] A list of layers from which features should be
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default): boolean} [layers] A list of layers from which features should be
* translated. Alternatively, a filter function can be provided. The
* function will be called for each layer in the map and should return
* `true` for layers that you want to be translatable. If the option is
@@ -58,9 +58,9 @@ const TranslateEventType = {
*/
export class TranslateEvent extends Event {
/**
* @param {module:ol/interaction/Translate~TranslateEventType} type Type.
* @param {module:ol/Collection<module:ol/Feature>} features The features translated.
* @param {module:ol/coordinate~Coordinate} coordinate The event coordinate.
* @param {TranslateEventType} type Type.
* @param {import("../Collection.js").default<import("../Feature.js").default>} features The features translated.
* @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
*/
constructor(type, features, coordinate) {
@@ -68,7 +68,7 @@ export class TranslateEvent extends Event {
/**
* The features being translated.
* @type {module:ol/Collection<module:ol/Feature>}
* @type {import("../Collection.js").default<import("../Feature.js").default>}
* @api
*/
this.features = features;
@@ -76,7 +76,7 @@ export class TranslateEvent extends Event {
/**
* The coordinate of the drag event.
* @const
* @type {module:ol/coordinate~Coordinate}
* @type {import("../coordinate.js").Coordinate}
* @api
*/
this.coordinate = coordinate;
@@ -90,12 +90,12 @@ export class TranslateEvent extends Event {
* @classdesc
* Interaction for translating (moving) features.
*
* @fires module:ol/interaction/Translate~TranslateEvent
* @fires TranslateEvent
* @api
*/
class Translate extends PointerInteraction {
/**
* @param {module:ol/interaction/Translate~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
super({
@@ -109,19 +109,19 @@ class Translate extends PointerInteraction {
/**
* The last position we translated to.
* @type {module:ol/coordinate~Coordinate}
* @type {import("../coordinate.js").Coordinate}
* @private
*/
this.lastCoordinate_ = null;
/**
* @type {module:ol/Collection<module:ol/Feature>}
* @type {import("../Collection.js").default<import("../Feature.js").default>}
* @private
*/
this.features_ = options.features !== undefined ? options.features : null;
/** @type {function(module:ol/layer/Layer): boolean} */
/** @type {function(import("../layer/Layer.js").default): boolean} */
let layerFilter;
if (options.layers) {
if (typeof options.layers === 'function') {
@@ -138,7 +138,7 @@ class Translate extends PointerInteraction {
/**
* @private
* @type {function(module:ol/layer/Layer): boolean}
* @type {function(import("../layer/Layer.js").default): boolean}
*/
this.layerFilter_ = layerFilter;
@@ -149,7 +149,7 @@ class Translate extends PointerInteraction {
this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;
/**
* @type {module:ol/Feature}
* @type {import("../Feature.js").default}
* @private
*/
this.lastFeature_ = null;
@@ -163,9 +163,9 @@ class Translate extends PointerInteraction {
/**
* Tests to see if the given coordinates intersects any of our selected
* features.
* @param {module:ol/pixel~Pixel} pixel Pixel coordinate to test for intersection.
* @param {module:ol/PluggableMap} map Map to test the intersection on.
* @return {module:ol/Feature} Returns the feature found at the specified pixel
* @param {import("../pixel.js").Pixel} pixel Pixel coordinate to test for intersection.
* @param {import("../PluggableMap.js").default} map Map to test the intersection on.
* @return {import("../Feature.js").default} Returns the feature found at the specified pixel
* coordinates.
* @private
*/
@@ -218,7 +218,7 @@ class Translate extends PointerInteraction {
}
/**
* @param {module:ol/PluggableMap} oldMap Old map.
* @param {import("../PluggableMap.js").default} oldMap Old map.
* @private
*/
updateState_(oldMap) {
@@ -236,9 +236,9 @@ class Translate extends PointerInteraction {
/**
* @param {module:ol/MapBrowserPointerEvent} event Event.
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/Translate}
* @this {import("./Translate.js").default}
*/
function handleDownEvent(event) {
this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);
@@ -259,9 +259,9 @@ function handleDownEvent(event) {
/**
* @param {module:ol/MapBrowserPointerEvent} event Event.
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/Translate}
* @this {import("./Translate.js").default}
*/
function handleUpEvent(event) {
if (this.lastCoordinate_) {
@@ -281,8 +281,8 @@ function handleUpEvent(event) {
/**
* @param {module:ol/MapBrowserPointerEvent} event Event.
* @this {module:ol/interaction/Translate}
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
* @this {import("./Translate.js").default}
*/
function handleDragEvent(event) {
if (this.lastCoordinate_) {
@@ -308,8 +308,8 @@ function handleDragEvent(event) {
/**
* @param {module:ol/MapBrowserEvent} event Event.
* @this {module:ol/interaction/Translate}
* @param {import("../MapBrowserEvent.js").default} event Event.
* @this {import("./Translate.js").default}
*/
function handleMoveEvent(event) {
const elem = event.map.getViewport();