Add layer also for programmatically selected features
This commit is contained in:
@@ -664,6 +664,25 @@ class PluggableMap extends BaseObject {
|
||||
return features;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all layers from all layer groups.
|
||||
* @return {Array<import("./layer/Layer.js").default>} Layers.
|
||||
*/
|
||||
getAllLayers() {
|
||||
const layers = [];
|
||||
function addLayersFrom(layerGroup) {
|
||||
layerGroup.forEach(function (layer) {
|
||||
if (layer instanceof LayerGroup) {
|
||||
addLayersFrom(layer.getLayers());
|
||||
} else {
|
||||
layers.push(layer);
|
||||
}
|
||||
});
|
||||
}
|
||||
addLayersFrom(this.getLayers());
|
||||
return layers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect layers that have a color value at a pixel on the viewport, and
|
||||
* execute a callback with each matching layer. Layers included in the
|
||||
|
||||
Reference in New Issue
Block a user