diff --git a/src/ol/extent.js b/src/ol/extent.js index 67d11ad039..c073fb3191 100644 --- a/src/ol/extent.js +++ b/src/ol/extent.js @@ -1,7 +1,6 @@ /** * @module ol/extent */ -import Corner from './extent/Corner.js'; import Relationship from './extent/Relationship.js'; import {assert} from './asserts.js'; @@ -11,6 +10,11 @@ import {assert} from './asserts.js'; * @api */ +/** + * Extent corner. + * @typedef {'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'} Corner + */ + /** * Build an extent that includes all given coordinates. * @@ -484,18 +488,18 @@ export function getCenter(extent) { /** * Get a corner coordinate of an extent. * @param {Extent} extent Extent. - * @param {import("./extent/Corner.js").default} corner Corner. + * @param {Corner} corner Corner. * @return {import("./coordinate.js").Coordinate} Corner coordinate. */ export function getCorner(extent, corner) { let coordinate; - if (corner === Corner.BOTTOM_LEFT) { + if (corner === 'bottom-left') { coordinate = getBottomLeft(extent); - } else if (corner === Corner.BOTTOM_RIGHT) { + } else if (corner === 'bottom-right') { coordinate = getBottomRight(extent); - } else if (corner === Corner.TOP_LEFT) { + } else if (corner === 'top-left') { coordinate = getTopLeft(extent); - } else if (corner === Corner.TOP_RIGHT) { + } else if (corner === 'top-right') { coordinate = getTopRight(extent); } else { assert(false, 13); // Invalid corner diff --git a/src/ol/extent/Corner.js b/src/ol/extent/Corner.js deleted file mode 100644 index 027293e7a5..0000000000 --- a/src/ol/extent/Corner.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @module ol/extent/Corner - */ - -/** - * Extent corner. - * @enum {string} - */ -export default { - BOTTOM_LEFT: 'bottom-left', - BOTTOM_RIGHT: 'bottom-right', - TOP_LEFT: 'top-left', - TOP_RIGHT: 'top-right', -}; diff --git a/src/ol/tilegrid.js b/src/ol/tilegrid.js index c342cf6e8c..cdaab9c9fd 100644 --- a/src/ol/tilegrid.js +++ b/src/ol/tilegrid.js @@ -1,7 +1,6 @@ /** * @module ol/tilegrid */ -import Corner from './extent/Corner.js'; import TileGrid from './tilegrid/TileGrid.js'; import Units from './proj/Units.js'; import {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from './tilegrid/common.js'; @@ -57,11 +56,11 @@ export function wrapX(tileGrid, tileCoord, projection) { * DEFAULT_MAX_ZOOM). * @param {number|import("./size.js").Size} [opt_tileSize] Tile size (default uses * DEFAULT_TILE_SIZE). - * @param {import("./extent/Corner.js").default} [opt_corner] Extent corner (default is `'top-left'`). + * @param {import("./extent.js").Corner} [opt_corner] Extent corner (default is `'top-left'`). * @return {!TileGrid} TileGrid instance. */ export function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) { - const corner = opt_corner !== undefined ? opt_corner : Corner.TOP_LEFT; + const corner = opt_corner !== undefined ? opt_corner : 'top-left'; const resolutions = resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize); @@ -153,7 +152,7 @@ function resolutionsFromExtent( * DEFAULT_MAX_ZOOM). * @param {number|import("./size.js").Size} [opt_tileSize] Tile size (default uses * DEFAULT_TILE_SIZE). - * @param {import("./extent/Corner.js").default} [opt_corner] Extent corner (default is `'top-left'`). + * @param {import("./extent.js").Corner} [opt_corner] Extent corner (default is `'top-left'`). * @return {!TileGrid} TileGrid instance. */ export function createForProjection(