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

Use duck-typing for recursing into layer groups #1

Merged
merged 1 commit into from
Jun 13, 2021
Merged
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
4 changes: 2 additions & 2 deletions src/olgm/herald/Layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class LayersHerald extends Herald {
} else if (layer instanceof ImageLayer &&
this.watchOptions_.image !== false) {
this.imageWMSSourceHerald_.watchLayer(layer);
} else if (layer instanceof LayerGroup) {
} else if (layer instanceof LayerGroup || typeof layer.getLayers === 'function') {
layer.getLayers().forEach(lyr => this.watchLayer_(lyr));
}
}
Expand Down Expand Up @@ -304,7 +304,7 @@ class LayersHerald extends Herald {
this.tileSourceHerald_.unwatchLayer(layer);
} else if (layer instanceof ImageLayer) {
this.imageWMSSourceHerald_.unwatchLayer(layer);
} else if (layer instanceof LayerGroup) {
} else if (layer instanceof LayerGroup || typeof layer.getLayers === 'function') {
layer.getLayers().forEach(layer => this.unwatchLayer_(layer));
}
}
Expand Down