Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/source/tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ class Tile {
const vtLayers = this.latestFeatureIndex.loadVTLayers();

for (const id in this.buckets) {
if (!painter.style.hasLayer(id)) continue;

const bucket = this.buckets[id];
// Buckets are grouped by common source-layer
const sourceLayerId = bucket.layers[0]['sourceLayer'] || '_geojsonTileLayer';
Expand Down
11 changes: 11 additions & 0 deletions src/style/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,17 @@ class Style extends Evented {
return this._layers[id];
}

/**
* checks if a specific layer is present within the style.
*
* @param {string} id - id of the desired layer
* @returns {boolean} a boolean specifying if the given layer is present
*/
hasLayer(id: string): boolean {
const layerIds = Object.keys(this._layers);
return layerIds.includes(id, 0);
}

setLayerZoomRange(layerId: string, minzoom: ?number, maxzoom: ?number) {
this._checkLoaded();

Expand Down