Merge pull request #10112 from ahocevar/rendertile-no-error
No ERROR state for render tiles
This commit is contained in:
@@ -12,7 +12,6 @@ import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid.
|
||||
import {buffer as bufferExtent, getIntersection, intersects} from '../extent.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {loadFeaturesXhr} from '../featureloader.js';
|
||||
import {isEmpty} from '../obj.js';
|
||||
import {equals} from '../array.js';
|
||||
|
||||
/**
|
||||
@@ -252,10 +251,11 @@ class VectorTile extends UrlTile {
|
||||
} else if (state === TileState.ERROR) {
|
||||
tile.errorSourceTileKeys[sourceTileKey] = true;
|
||||
}
|
||||
if (tile.loadingSourceTiles - Object.keys(tile.errorSourceTileKeys).length === 0) {
|
||||
tile.hifi = true;
|
||||
const errorTileCount = Object.keys(tile.errorSourceTileKeys).length;
|
||||
if (tile.loadingSourceTiles - errorTileCount === 0) {
|
||||
tile.hifi = errorTileCount === 0;
|
||||
tile.sourceZ = sourceZ;
|
||||
tile.setState(isEmpty(tile.errorSourceTileKeys) ? TileState.LOADED : TileState.ERROR);
|
||||
tile.setState(TileState.LOADED);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,9 +27,11 @@ describe('ol.VectorRenderTile', function() {
|
||||
listen(tile, 'change', function(e) {
|
||||
++calls;
|
||||
if (calls === 1) {
|
||||
expect(tile.getState()).to.be(TileState.ERROR);
|
||||
expect(tile.getState()).to.be(TileState.LOADED);
|
||||
expect(tile.hifi).to.be(false);
|
||||
setTimeout(function() {
|
||||
sourceTile.setState(TileState.LOADED);
|
||||
expect(tile.hifi).to.be(true);
|
||||
}, 0);
|
||||
} else if (calls === 2) {
|
||||
done();
|
||||
@@ -37,7 +39,7 @@ describe('ol.VectorRenderTile', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('sets ERROR state when source tiles fail to load', function(done) {
|
||||
it('sets LOADED state and hifi==false when source tiles fail to load', function(done) {
|
||||
const source = new VectorTileSource({
|
||||
format: new GeoJSON(),
|
||||
url: 'spec/ol/data/unavailable.json'
|
||||
@@ -47,7 +49,8 @@ describe('ol.VectorRenderTile', function() {
|
||||
tile.load();
|
||||
|
||||
listen(tile, 'change', function(e) {
|
||||
expect(tile.getState()).to.be(TileState.ERROR);
|
||||
expect(tile.getState()).to.be(TileState.LOADED);
|
||||
expect(tile.hifi).to.be(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user