diff --git a/examples/custom-interactions.js b/examples/custom-interactions.js index 56a5c67177..81661214fc 100644 --- a/examples/custom-interactions.js +++ b/examples/custom-interactions.js @@ -29,7 +29,7 @@ app.Drag = function() { }); /** - * @type {module:ol~Pixel} + * @type {module:ol/pixel~Pixel} * @private */ this.coordinate_ = null; diff --git a/src/ol/MapBrowserEvent.js b/src/ol/MapBrowserEvent.js index dc680a6c1e..8aa7bdf59a 100644 --- a/src/ol/MapBrowserEvent.js +++ b/src/ol/MapBrowserEvent.js @@ -31,7 +31,7 @@ class MapBrowserEvent extends MapEvent { /** * The map pixel relative to the viewport corresponding to the original browser event. - * @type {module:ol~Pixel} + * @type {module:ol/pixel~Pixel} * @api */ this.pixel = map.getEventPixel(browserEvent); diff --git a/src/ol/Overlay.js b/src/ol/Overlay.js index 2dfefdd43c..71e95db1a7 100644 --- a/src/ol/Overlay.js +++ b/src/ol/Overlay.js @@ -508,7 +508,7 @@ class Overlay extends BaseObject { } /** - * @param {module:ol~Pixel} pixel The pixel location. + * @param {module:ol/pixel~Pixel} pixel The pixel location. * @param {module:ol/size~Size|undefined} mapSize The map size. * @protected */ diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index 09f7a33e25..e9347d996e 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -543,7 +543,7 @@ class PluggableMap extends BaseObject { * Detect features that intersect a pixel on the viewport, and execute a * callback with each intersecting feature. Layers included in the detection can * be configured through the `layerFilter` option in `opt_options`. - * @param {module:ol~Pixel} pixel Pixel. + * @param {module:ol/pixel~Pixel} pixel Pixel. * @param {function(this: S, (module:ol/Feature|module:ol/render/Feature), * module:ol/layer/Layer): T} callback Feature callback. The callback will be * called with two arguments. The first argument is one @@ -575,7 +575,7 @@ class PluggableMap extends BaseObject { /** * Get all features that intersect a pixel on the viewport. - * @param {module:ol~Pixel} pixel Pixel. + * @param {module:ol/pixel~Pixel} pixel Pixel. * @param {module:ol/PluggableMap~AtPixelOptions=} opt_options Optional options. * @return {Array.} The detected features or * `null` if none were found. @@ -596,7 +596,7 @@ class PluggableMap extends BaseObject { * Detect layers that have a color value at a pixel on the viewport, and * execute a callback with each matching layer. Layers included in the * detection can be configured through `opt_layerFilter`. - * @param {module:ol~Pixel} pixel Pixel. + * @param {module:ol/pixel~Pixel} pixel Pixel. * @param {function(this: S, module:ol/layer/Layer, (Uint8ClampedArray|Uint8Array)): T} callback * Layer callback. This callback will receive two arguments: first is the * {@link module:ol/layer/Layer layer}, second argument is an array representing @@ -624,7 +624,7 @@ class PluggableMap extends BaseObject { /** * Detect if features intersect a pixel on the viewport. Layers included in the * detection can be configured through `opt_layerFilter`. - * @param {module:ol~Pixel} pixel Pixel. + * @param {module:ol/pixel~Pixel} pixel Pixel. * @param {module:ol/PluggableMap~AtPixelOptions=} opt_options Optional options. * @return {boolean} Is there a feature at the given pixel? * @template U @@ -656,7 +656,7 @@ class PluggableMap extends BaseObject { /** * Returns the map pixel position for a browser event relative to the viewport. * @param {Event} event Event. - * @return {module:ol~Pixel} Pixel. + * @return {module:ol/pixel~Pixel} Pixel. * @api */ getEventPixel(event) { @@ -700,7 +700,7 @@ class PluggableMap extends BaseObject { /** * Get the coordinate for a given pixel. This returns a coordinate in the * map view projection. - * @param {module:ol~Pixel} pixel Pixel position in the map viewport. + * @param {module:ol/pixel~Pixel} pixel Pixel position in the map viewport. * @return {module:ol/coordinate~Coordinate} The coordinate for the pixel position. * @api */ @@ -784,7 +784,7 @@ class PluggableMap extends BaseObject { * Get the pixel for a coordinate. This takes a coordinate in the map view * projection and returns the corresponding pixel. * @param {module:ol/coordinate~Coordinate} coordinate A map coordinate. - * @return {module:ol~Pixel} A pixel position in the map viewport. + * @return {module:ol/pixel~Pixel} A pixel position in the map viewport. * @api */ getPixelFromCoordinate(coordinate) { diff --git a/src/ol/View.js b/src/ol/View.js index d635ac73a6..e4ff15c92b 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -1077,7 +1077,7 @@ class View extends BaseObject { * Center on coordinate and view position. * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {module:ol/size~Size} size Box pixel size. - * @param {module:ol~Pixel} position Position on the view to center on. + * @param {module:ol/pixel~Pixel} position Position on the view to center on. * @api */ centerOn(coordinate, size, position) { diff --git a/src/ol/control/MousePosition.js b/src/ol/control/MousePosition.js index f3f68f3996..2e5f74f7fe 100644 --- a/src/ol/control/MousePosition.js +++ b/src/ol/control/MousePosition.js @@ -107,7 +107,7 @@ class MousePosition extends Control { /** * @private - * @type {module:ol~Pixel} + * @type {module:ol/pixel~Pixel} */ this.lastMouseMovePixel_ = null; @@ -208,7 +208,7 @@ class MousePosition extends Control { } /** - * @param {?module:ol~Pixel} pixel Pixel. + * @param {?module:ol/pixel~Pixel} pixel Pixel. * @private */ updateHTML_(pixel) { diff --git a/src/ol/index.js b/src/ol/index.js index 23ac05959f..91c7efeffe 100644 --- a/src/ol/index.js +++ b/src/ol/index.js @@ -33,9 +33,3 @@ export {default as WebGLMap} from './WebGLMap.js'; export {getUid, inherits, VERSION} from './util.js'; -/** - * An array with two elements, representing a pixel. The first element is the - * x-coordinate, the second the y-coordinate of the pixel. - * @typedef {Array.} Pixel - * @api - */ diff --git a/src/ol/interaction/DragBox.js b/src/ol/interaction/DragBox.js index 60bf0b4063..738f5b4bab 100644 --- a/src/ol/interaction/DragBox.js +++ b/src/ol/interaction/DragBox.js @@ -11,9 +11,9 @@ import RenderBox from '../render/Box.js'; /** * A function that takes a {@link module:ol/MapBrowserEvent} and two - * {@link module:ol~Pixel}s and returns a `{boolean}`. If the condition is met, + * {@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, module:ol~Pixel):boolean} EndCondition + * @typedef {function(this: ?, module:ol/MapBrowserEvent, module:ol/pixel~Pixel, module:ol/pixel~Pixel):boolean} EndCondition */ @@ -26,7 +26,7 @@ import RenderBox from '../render/Box.js'; * @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 - * {@link module:ol~Pixel}s to indicate whether a `boxend` event should be fired. + * {@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 * before `boxend` is fired. @@ -143,7 +143,7 @@ class DragBox extends PointerInteraction { this.onBoxEnd_ = options.onBoxEnd ? options.onBoxEnd : UNDEFINED; /** - * @type {module:ol~Pixel} + * @type {module:ol/pixel~Pixel} * @private */ this.startPixel_ = null; @@ -178,8 +178,8 @@ class DragBox extends PointerInteraction { * should fire. * @param {module:ol/MapBrowserEvent} mapBrowserEvent The originating MapBrowserEvent * leading to the box end. - * @param {module:ol~Pixel} startPixel The starting pixel of the box. - * @param {module:ol~Pixel} endPixel The end pixel of the box. + * @param {module:ol/pixel~Pixel} startPixel The starting pixel of the box. + * @param {module:ol/pixel~Pixel} endPixel The end pixel of the box. * @return {boolean} Whether or not the boxend condition should be fired. * @this {module:ol/interaction/DragBox} */ diff --git a/src/ol/interaction/DragPan.js b/src/ol/interaction/DragPan.js index 386c15544d..c9d385f92a 100644 --- a/src/ol/interaction/DragPan.js +++ b/src/ol/interaction/DragPan.js @@ -45,7 +45,7 @@ class DragPan extends PointerInteraction { this.kinetic_ = options.kinetic; /** - * @type {module:ol~Pixel} + * @type {module:ol/pixel~Pixel} */ this.lastCentroid = null; diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index f6a8c592f3..52796f5e96 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -176,7 +176,7 @@ class Draw extends PointerInteraction { this.shouldHandle_ = false; /** - * @type {module:ol~Pixel} + * @type {module:ol/pixel~Pixel} * @private */ this.downPx_ = null; diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 340ee6da42..fb75be3a90 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -177,7 +177,7 @@ class ExtentInteraction extends PointerInteraction { } /** - * @param {module:ol~Pixel} pixel cursor location + * @param {module:ol/pixel~Pixel} pixel cursor location * @param {module:ol/PluggableMap} map map * @returns {module:ol/coordinate~Coordinate|null} snapped vertex on extent * @private diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 63bb54b79c..6691a596e1 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -209,7 +209,7 @@ class Modify extends PointerInteraction { this.vertexSegments_ = null; /** - * @type {module:ol~Pixel} + * @type {module:ol/pixel~Pixel} * @private */ this.lastPixel_ = [0, 0]; @@ -668,7 +668,7 @@ class Modify extends PointerInteraction { } /** - * @param {module:ol~Pixel} pixel Pixel + * @param {module:ol/pixel~Pixel} pixel Pixel * @param {module:ol/PluggableMap} map Map. * @private */ diff --git a/src/ol/interaction/Pointer.js b/src/ol/interaction/Pointer.js index a1cc939eb8..e78f34546c 100644 --- a/src/ol/interaction/Pointer.js +++ b/src/ol/interaction/Pointer.js @@ -170,7 +170,7 @@ class PointerInteraction extends Interaction { /** * @param {Array.} pointerEvents List of events. - * @return {module:ol~Pixel} Centroid pixel. + * @return {module:ol/pixel~Pixel} Centroid pixel. */ export function centroid(pointerEvents) { const length = pointerEvents.length; diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js index 4d41460b5f..e6faaf1ffb 100644 --- a/src/ol/interaction/Snap.js +++ b/src/ol/interaction/Snap.js @@ -22,7 +22,7 @@ import RBush from '../structs/RBush.js'; * @typedef {Object} Result * @property {boolean} snapped * @property {module:ol/coordinate~Coordinate|null} vertex - * @property {module:ol~Pixel|null} vertexPixel + * @property {module:ol/pixel~Pixel|null} vertexPixel */ @@ -348,7 +348,7 @@ class Snap extends PointerInteraction { } /** - * @param {module:ol~Pixel} pixel Pixel + * @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 diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index 3d082ccf9e..419b29cb23 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -163,7 +163,7 @@ class Translate extends PointerInteraction { /** * Tests to see if the given coordinates intersects any of our selected * features. - * @param {module:ol~Pixel} pixel Pixel coordinate to test for intersection. + * @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 * coordinates. diff --git a/src/ol/pixel.js b/src/ol/pixel.js new file mode 100644 index 0000000000..08ebae63fd --- /dev/null +++ b/src/ol/pixel.js @@ -0,0 +1,6 @@ +/** + * An array with two elements, representing a pixel. The first element is the + * x-coordinate, the second the y-coordinate of the pixel. + * @typedef {Array.} Pixel + * @api + */ diff --git a/src/ol/pointer/MouseSource.js b/src/ol/pointer/MouseSource.js index 90b2f27ef7..023252358c 100644 --- a/src/ol/pointer/MouseSource.js +++ b/src/ol/pointer/MouseSource.js @@ -154,7 +154,7 @@ class MouseSource extends EventSource { /** * @const - * @type {Array.} + * @type {Array.} */ this.lastTouches = []; } diff --git a/src/ol/render/Box.js b/src/ol/render/Box.js index c0e9a149bd..fafbb58708 100644 --- a/src/ol/render/Box.js +++ b/src/ol/render/Box.js @@ -34,13 +34,13 @@ class RenderBox extends Disposable { /** * @private - * @type {module:ol~Pixel} + * @type {module:ol/pixel~Pixel} */ this.startPixel_ = null; /** * @private - * @type {module:ol~Pixel} + * @type {module:ol/pixel~Pixel} */ this.endPixel_ = null; @@ -83,8 +83,8 @@ class RenderBox extends Disposable { } /** - * @param {module:ol~Pixel} startPixel Start pixel. - * @param {module:ol~Pixel} endPixel End pixel. + * @param {module:ol/pixel~Pixel} startPixel Start pixel. + * @param {module:ol/pixel~Pixel} endPixel End pixel. */ setPixels(startPixel, endPixel) { this.startPixel_ = startPixel; diff --git a/src/ol/renderer/Map.js b/src/ol/renderer/Map.js index e189d39074..40a56d721d 100644 --- a/src/ol/renderer/Map.js +++ b/src/ol/renderer/Map.js @@ -167,7 +167,7 @@ class MapRenderer extends Disposable { /** * @abstract - * @param {module:ol~Pixel} pixel Pixel. + * @param {module:ol/pixel~Pixel} pixel Pixel. * @param {module:ol/PluggableMap~FrameState} frameState FrameState. * @param {number} hitTolerance Hit tolerance in pixels. * @param {function(this: S, module:ol/layer/Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer diff --git a/src/ol/renderer/webgl/Layer.js b/src/ol/renderer/webgl/Layer.js index 06fb3eedf3..70060f1ac6 100644 --- a/src/ol/renderer/webgl/Layer.js +++ b/src/ol/renderer/webgl/Layer.js @@ -240,7 +240,7 @@ class WebGLLayerRenderer extends LayerRenderer { /** * @abstract - * @param {module:ol~Pixel} pixel Pixel. + * @param {module:ol/pixel~Pixel} pixel Pixel. * @param {module:ol/PluggableMap~FrameState} frameState FrameState. * @param {function(this: S, module:ol/layer/Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer * callback. diff --git a/src/ol/transform.js b/src/ol/transform.js index 3ce1d35857..98d279699f 100644 --- a/src/ol/transform.js +++ b/src/ol/transform.js @@ -125,8 +125,8 @@ export function setFromArray(transform1, transform2) { * resulting, transformed coordinate. The coordinate will be modified in-place. * * @param {module:ol/transform~Transform} transform The transformation. - * @param {module:ol/coordinate~Coordinate|module:ol~Pixel} coordinate The coordinate to transform. - * @return {module:ol/coordinate~Coordinate|module:ol~Pixel} return coordinate so that operations can be + * @param {module:ol/coordinate~Coordinate|module:ol/pixel~Pixel} coordinate The coordinate to transform. + * @return {module:ol/coordinate~Coordinate|module:ol/pixel~Pixel} return coordinate so that operations can be * chained together. */ export function apply(transform, coordinate) {