Merge pull request #663 from twpayne/render-error-tiles-as-empty
Render error tiles as empty
This commit is contained in:
@@ -104,7 +104,11 @@ ol.ImageTile.prototype.handleImageError_ = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.ImageTile.prototype.handleImageLoad_ = function() {
|
||||
this.state = ol.TileState.LOADED;
|
||||
if (this.image_.naturalWidth && this.image_.naturalHeight) {
|
||||
this.state = ol.TileState.LOADED;
|
||||
} else {
|
||||
this.state = ol.TileState.EMPTY;
|
||||
}
|
||||
this.unlistenImage_();
|
||||
this.dispatchChangeEvent();
|
||||
};
|
||||
|
||||
@@ -279,11 +279,11 @@ ol.renderer.canvas.TileLayer.prototype.renderFrame =
|
||||
|
||||
tile = tileSource.getTile(z, x, y, projection);
|
||||
tileState = tile.getState();
|
||||
if (tileState == ol.TileState.LOADED || tileState == ol.TileState.EMPTY) {
|
||||
if (tileState == ol.TileState.LOADED ||
|
||||
tileState == ol.TileState.EMPTY ||
|
||||
tileState == ol.TileState.ERROR) {
|
||||
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
|
||||
continue;
|
||||
} else if (tileState == ol.TileState.ERROR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
allTilesLoaded = false;
|
||||
@@ -335,7 +335,9 @@ ol.renderer.canvas.TileLayer.prototype.renderFrame =
|
||||
x = tileSize.width * (tile.tileCoord.x - canvasTileRange.minX);
|
||||
y = tileSize.height * (canvasTileRange.maxY - tile.tileCoord.y);
|
||||
tileState = tile.getState();
|
||||
if (tileState == ol.TileState.EMPTY || !opaque) {
|
||||
if (tileState == ol.TileState.EMPTY ||
|
||||
tileState == ol.TileState.ERROR ||
|
||||
!opaque) {
|
||||
context.clearRect(x, y, tileSize.width, tileSize.height);
|
||||
}
|
||||
if (tileState == ol.TileState.LOADED) {
|
||||
|
||||
Reference in New Issue
Block a user