Replace Zoomify TierSizeCalculation enum with typedef
This commit is contained in:
@@ -14,12 +14,8 @@ import {getCenter} from '../extent.js';
|
|||||||
import {toSize} from '../size.js';
|
import {toSize} from '../size.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @typedef {'default' | 'truncated'} TierSizeCalculation
|
||||||
*/
|
*/
|
||||||
const TierSizeCalculation = {
|
|
||||||
DEFAULT: 'default',
|
|
||||||
TRUNCATED: 'truncated',
|
|
||||||
};
|
|
||||||
|
|
||||||
export class CustomTile extends ImageTile {
|
export class CustomTile extends ImageTile {
|
||||||
/**
|
/**
|
||||||
@@ -105,7 +101,7 @@ export class CustomTile extends ImageTile {
|
|||||||
* `http://my.zoomify.info?FIF=IMAGE.TIF&JTL={z},{tileIndex}`.
|
* `http://my.zoomify.info?FIF=IMAGE.TIF&JTL={z},{tileIndex}`.
|
||||||
* A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be
|
* A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be
|
||||||
* used instead of defining each one separately in the `urls` option.
|
* used instead of defining each one separately in the `urls` option.
|
||||||
* @property {string} [tierSizeCalculation] Tier size calculation method: `default` or `truncated`.
|
* @property {TierSizeCalculation} [tierSizeCalculation] Tier size calculation method: `default` or `truncated`.
|
||||||
* @property {import("../size.js").Size} size Size.
|
* @property {import("../size.js").Size} size Size.
|
||||||
* @property {import("../extent.js").Extent} [extent] Extent for the TileGrid that is created.
|
* @property {import("../extent.js").Extent} [extent] Extent for the TileGrid that is created.
|
||||||
* Default sets the TileGrid in the
|
* Default sets the TileGrid in the
|
||||||
@@ -143,7 +139,7 @@ class Zoomify extends TileImage {
|
|||||||
const tierSizeCalculation =
|
const tierSizeCalculation =
|
||||||
options.tierSizeCalculation !== undefined
|
options.tierSizeCalculation !== undefined
|
||||||
? options.tierSizeCalculation
|
? options.tierSizeCalculation
|
||||||
: TierSizeCalculation.DEFAULT;
|
: 'default';
|
||||||
|
|
||||||
const tilePixelRatio = options.tilePixelRatio || 1;
|
const tilePixelRatio = options.tilePixelRatio || 1;
|
||||||
const imageWidth = size[0];
|
const imageWidth = size[0];
|
||||||
@@ -153,7 +149,7 @@ class Zoomify extends TileImage {
|
|||||||
let tileSizeForTierSizeCalculation = tileSize * tilePixelRatio;
|
let tileSizeForTierSizeCalculation = tileSize * tilePixelRatio;
|
||||||
|
|
||||||
switch (tierSizeCalculation) {
|
switch (tierSizeCalculation) {
|
||||||
case TierSizeCalculation.DEFAULT:
|
case 'default':
|
||||||
while (
|
while (
|
||||||
imageWidth > tileSizeForTierSizeCalculation ||
|
imageWidth > tileSizeForTierSizeCalculation ||
|
||||||
imageHeight > tileSizeForTierSizeCalculation
|
imageHeight > tileSizeForTierSizeCalculation
|
||||||
@@ -165,7 +161,7 @@ class Zoomify extends TileImage {
|
|||||||
tileSizeForTierSizeCalculation += tileSizeForTierSizeCalculation;
|
tileSizeForTierSizeCalculation += tileSizeForTierSizeCalculation;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TierSizeCalculation.TRUNCATED:
|
case 'truncated':
|
||||||
let width = imageWidth;
|
let width = imageWidth;
|
||||||
let height = imageHeight;
|
let height = imageHeight;
|
||||||
while (
|
while (
|
||||||
|
|||||||
Reference in New Issue
Block a user