Return null tiles when out of range

This commit is contained in:
Tom Payne
2012-07-15 22:22:25 +02:00
parent bf31b614e8
commit 8df2404e77
2 changed files with 8 additions and 2 deletions

View File

@@ -102,7 +102,12 @@ ol.TileStore.prototype.getTile = function(tileCoord) {
return this.tileCache_[key];
} else {
var tileUrl = this.getTileCoordUrl(tileCoord);
var tile = new ol.Tile(tileCoord, tileUrl, this.crossOrigin_);
var tile;
if (goog.isDef(tileUrl)) {
tile = new ol.Tile(tileCoord, tileUrl, this.crossOrigin_);
} else {
tile = null;
}
this.tileCache_[key] = tile;
return tile;
}

View File

@@ -210,7 +210,8 @@ ol.webgl.TileLayerRenderer.prototype.redraw = function() {
tileBounds.forEachTileCoord(z, function(tileCoord) {
var tile = tileStore.getTile(tileCoord);
if (tile.isLoaded()) {
if (goog.isNull(tile)) {
} else if (tile.isLoaded()) {
var x = tileSize.width * (tileCoord.x - tileBounds.minX);
var y = tileSize.height * (tileCoord.y - tileBounds.minY);
gl.texSubImage2D(goog.webgl.TEXTURE_2D, 0,