Skip to content

Commit 249481d

Browse files
stephanheiglgithub-actions[bot]
authored andcommitted
Skip recalculation of layers with visibility set to none.
GitOrigin-RevId: aa366a07bf62f5ea7d920cc7afd8ab635db5ec0e
1 parent 5c951a7 commit 249481d

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/render/painter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ class Painter {
809809

810810
for (const id of layerIds) {
811811
const layer = layers[id];
812-
812+
if (layer.visibility === 'none') continue;
813813
if (layer.type === 'circle') {
814814
layersRequireTerrainDepth = true;
815815
} else if (layer.type === 'building') {
@@ -979,6 +979,7 @@ class Painter {
979979
this.layersWithOcclusionOpacity = [];
980980
for (let i = 0; i < orderedLayers.length; i++) {
981981
const layer = orderedLayers[i];
982+
if (layer.visibility === 'none') continue;
982983
const cutoffRange = layer.cutoffRange();
983984
this.longestCutoffRange = Math.max(cutoffRange, this.longestCutoffRange);
984985
if (cutoffRange > 0.0) {

src/style/pauseable_placement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class PauseablePlacement {
105105
const layerId = order[this._currentPlacementIndex];
106106
const layer = layers[layerId];
107107
const placementZoom = this.placement.collisionIndex.transform.zoom;
108-
if (layer.type === 'symbol' &&
108+
if (layer.type === 'symbol' && layer.visibility !== 'none' &&
109109
(!layer.minzoom || layer.minzoom <= placementZoom) &&
110110
(!layer.maxzoom || layer.maxzoom > placementZoom)) {
111111

src/style/style.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,7 @@ class Style extends Evented<MapEvents> {
17881788

17891789
for (const layerId of this._mergedOrder) {
17901790
const layer = this._mergedLayers[layerId];
1791-
layer.recalculate(parameters, this._availableImages);
1791+
if (layer.visibility !== 'none') layer.recalculate(parameters, this._availableImages);
17921792
if (!layer.isHidden(parameters.zoom)) {
17931793
const sourceCache = this.getLayerSourceCache(layer);
17941794
if (sourceCache) {
@@ -4197,6 +4197,7 @@ class Style extends Evented<MapEvents> {
41974197
const layerId = this._mergedOrder[i];
41984198
const styleLayer = this._mergedLayers[layerId];
41994199
if (styleLayer.type !== 'symbol') continue;
4200+
if (styleLayer.visibility === 'none') continue;
42004201
const checkAgainstClipLayer = this.isLayerClipped(styleLayer);
42014202
this.placement.updateLayerOpacities(styleLayer, layerTiles[makeFQID(styleLayer.source, styleLayer.scope)], i, checkAgainstClipLayer ? replacementSource : null);
42024203
}

0 commit comments

Comments
 (0)