We no longer need to increase the cache size
This commit is contained in:
@@ -362,7 +362,6 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
|
||||
|
||||
this.manageTilePyramid(frameState, tileSource, tileGrid, pixelRatio,
|
||||
projection, extent, z, tileLayer.getPreload());
|
||||
this.updateCacheSize_(frameState, tileSource);
|
||||
this.scheduleExpireCache(frameState, tileSource);
|
||||
|
||||
this.postRender(context, frameState);
|
||||
@@ -474,27 +473,6 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
|
||||
usedTiles[tileSourceKey][tile.getKey()] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the cache is big enough, and increase its size if necessary.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {import("../../source/Tile.js").default} tileSource Tile source.
|
||||
* @private
|
||||
*/
|
||||
updateCacheSize_(frameState, tileSource) {
|
||||
const tileSourceKey = getUid(tileSource);
|
||||
let size = 0;
|
||||
if (tileSourceKey in frameState.usedTiles) {
|
||||
size += Object.keys(frameState.usedTiles[tileSourceKey]).length;
|
||||
}
|
||||
if (tileSourceKey in frameState.wantedTiles) {
|
||||
size += Object.keys(frameState.wantedTiles[tileSourceKey]).length;
|
||||
}
|
||||
const tileCache = tileSource.tileCache;
|
||||
if (tileCache.highWaterMark < size) {
|
||||
tileCache.highWaterMark = size;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage tile pyramid.
|
||||
* This function performs a number of functions related to the tiles at the
|
||||
|
||||
@@ -78,15 +78,6 @@ describe('ol.renderer.canvas.TileLayer', function() {
|
||||
disposeMap(map);
|
||||
});
|
||||
|
||||
it('increases the cache size if necessary', function(done) {
|
||||
const tileCache = layer.getSource().tileCache;
|
||||
expect(tileCache.highWaterMark).to.be(1);
|
||||
map.once('rendercomplete', function() {
|
||||
expect(tileCache.highWaterMark).to.be(2);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('respects the source\'s zDirection setting', function(done) {
|
||||
layer.getSource().zDirection = 1;
|
||||
map.getView().setZoom(5.8); // would lead to z6 tile request with the default zDirection
|
||||
|
||||
Reference in New Issue
Block a user