Skip to content

Commit

Permalink
Only list relevant layers in custom filter layer selection
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Feb 28, 2024
1 parent 2cf8031 commit 88aa083
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugins/MapFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ class MapFilter extends React.Component {
}
const layerNames = this.props.layers.reduce((res, layer) => {
if (layer.role === LayerRole.THEME) {
return [...res, ...LayerUtils.getSublayerNames(layer)];
return [...res, ...LayerUtils.getSublayerNames(layer, true, lyr => !!lyr.geometryType)];
}
return res;
}, []);
Expand Down
6 changes: 3 additions & 3 deletions utils/LayerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,9 @@ const LayerUtils = {
}
}
},
getSublayerNames(layer, toplevel = true) {
return [toplevel && layer.sublayers ? null : layer.name].concat((layer.sublayers || []).reduce((list, sublayer) => {
return list.concat([...this.getSublayerNames(sublayer, false)]);
getSublayerNames(layer, toplevel = true, filter = null) {
return [(toplevel && layer.sublayers) || (filter && !filter(layer)) ? null : layer.name].concat((layer.sublayers || []).reduce((list, sublayer) => {
return list.concat([...this.getSublayerNames(sublayer, false, filter)]);
}, [])).filter(x => x);
},
mergeSubLayers(baselayer, addlayer) {
Expand Down

0 comments on commit 88aa083

Please sign in to comment.