Add a zDirection option for Zoomify

Via zDirection, the renderer's selection of a tile source's resolution can be
controlled if the view's resolution does not match any tile source resolution.

Currently the zDirection option is only available for Zoomify. The comment
https://github.com/openlayers/openlayers/issues/9343#issuecomment-474341033
describes why caution is advised when using zDirection for other sources.

ol/source/Tile~TileSource#getZDirection has been added to avoid having the
getZDirection method solely in the Zoomify source - just to document the
possibility.
This commit is contained in:
Lutz Helm
2019-03-21 09:52:33 +01:00
parent c4279ff665
commit f5abb45de0
3 changed files with 31 additions and 1 deletions

View File

@@ -111,6 +111,10 @@ export class CustomTile extends ImageTile {
* @property {number} [transition] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
* @property {number} [tileSize=256] Tile size. Same tile size is used for all zoom levels.
* @property {number} [zDirection] Indicate which resolution should be used
* by a renderer if the views resolution does not match any resolution of the tile source.
* If 0, the nearest resolution will be used. If 1, the nearest lower resolution
* will be used. If -1, the nearest higher resolution will be used.
*/
@@ -253,6 +257,19 @@ class Zoomify extends TileImage {
transition: options.transition
});
/**
* @protected
* @type {number|undefined}
*/
this.zDirection = options.zDirection;
}
/**
* @inheritDoc
*/
getZDirection() {
return this.zDirection;
}
}