Avoid append only cache in WebGL tile layers
This commit is contained in:
@@ -674,6 +674,7 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer {
|
||||
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
||||
*/
|
||||
const postRenderFunction = function (map, frameState) {
|
||||
tileSource.updateCacheSize(0.1, frameState.viewState.projection);
|
||||
tileSource.expireCache(frameState.viewState.projection, empty);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import DataTileSource from '../../../../../src/ol/source/DataTile.js';
|
||||
import Map from '../../../../../src/ol/Map.js';
|
||||
import OSM from '../../../../../src/ol/source/OSM.js';
|
||||
import TileWMS from '../../../../../src/ol/source/TileWMS.js';
|
||||
import View from '../../../../../src/ol/View.js';
|
||||
import WebGLHelper from '../../../../../src/ol/webgl/Helper.js';
|
||||
@@ -269,6 +270,19 @@ describe('ol/layer/WebGLTile', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('caching', () => {
|
||||
it('updates the size of the tile cache on the source ', (done) => {
|
||||
const source = new OSM();
|
||||
const spy = sinon.spy(source, 'updateCacheSize');
|
||||
const layer = new WebGLTileLayer({source: source});
|
||||
map.addLayer(layer);
|
||||
map.once('rendercomplete', () => {
|
||||
expect(spy.called).to.be(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('creates fragment and vertex shaders', function () {
|
||||
const compileShaderSpy = sinon.spy(WebGLHelper.prototype, 'compileShader');
|
||||
const renderer = layer.getRenderer();
|
||||
|
||||
Reference in New Issue
Block a user