Only iterate over ready, visible layers

This commit is contained in:
Tom Payne
2012-07-27 23:35:00 +02:00
parent 6ceeac2427
commit ade0d17541
2 changed files with 4 additions and 4 deletions

View File

@@ -262,10 +262,10 @@ ol.Map.prototype.fitUserExtent = function(userExtent) {
* @param {T=} opt_obj Object.
* @template T
*/
ol.Map.prototype.forEachVisibleLayer = function(f, opt_obj) {
ol.Map.prototype.forEachReadyVisibleLayer = function(f, opt_obj) {
var layers = this.getLayers();
layers.forEach(function(layer, index) {
if (layer.getVisible()) {
if (layer.isReady() && layer.getVisible()) {
var layerRenderer = this.getLayerRenderer(layer);
f.call(opt_obj, layer, layerRenderer, index);
}
@@ -677,7 +677,7 @@ ol.Map.prototype.renderInternal = function() {
var animate = false;
this.forEachVisibleLayer(function(layer, layerRenderer) {
this.forEachReadyVisibleLayer(function(layer, layerRenderer) {
if (layerRenderer.render()) {
animate = true;
}

View File

@@ -537,7 +537,7 @@ ol.webgl.Map.prototype.renderInternal = function() {
this.locations_.aTexCoord, 2, goog.webgl.FLOAT, false, 16, 8);
gl.uniform1i(this.locations_.uTexture, 0);
this.forEachVisibleLayer(function(layer, layerRenderer) {
this.forEachReadyVisibleLayer(function(layer, layerRenderer) {
gl.uniformMatrix4fv(
this.locations_.uMatrix, false, layerRenderer.getMatrix());
gl.uniform1f(this.locations_.uBrightness, layer.getBrightness());