Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearing the underlying source's tiles while removing a layer. #9305

Merged
merged 3 commits into from
Feb 21, 2020
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