Only iterate over ready, visible layers
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user