Check the type of the source before using it
This satisfies tsc in addition to making the class more defensive against source types that it does not support.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
import LayerType from '../../LayerType.js';
|
||||
import TileRange from '../../TileRange.js';
|
||||
import TileState from '../../TileState.js';
|
||||
import TileSource from '../../source/Tile.js';
|
||||
import {numberSafeCompareFunction} from '../../array.js';
|
||||
import {createEmpty, intersects} from '../../extent.js';
|
||||
import {roundUpToPowerOfTwo} from '../../math.js';
|
||||
@@ -152,6 +153,10 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer {
|
||||
|
||||
const tileLayer = /** @type {import("../../layer/Tile.js").default} */ (this.getLayer());
|
||||
const tileSource = tileLayer.getSource();
|
||||
if (!(tileSource instanceof TileSource)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const tileGrid = tileSource.getTileGridForProjection(projection);
|
||||
const z = tileGrid.getZForResolution(viewState.resolution);
|
||||
const tileResolution = tileGrid.getResolution(z);
|
||||
|
||||
Reference in New Issue
Block a user