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

@@ -326,6 +326,18 @@ class TileSource extends Source {
*/
useTile(z, x, y, projection) {}
/**
* 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. If undefined,
* the decision is left to the renderer.
* @return {number|undefined} Prefered zDirection for source resolution selection.
*/
getZDirection() {
return undefined;
}
}