Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to fix the Background Legend “Show All / Hide All” behavior in LayerControl so it doesn’t toggle layers it shouldn’t.
Changes:
- Updates
setAllBackgroundLayersVisibilityto useisExcludedByPatternwhen deciding which layers to toggle.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| styleLayers.forEach(layer => { | ||
| if (!this.isUserAddedLayer(layer.id)) { | ||
| if (!this.isExcludedByPattern(layer.id)) { |
There was a problem hiding this comment.
setAllBackgroundLayersVisibility now applies visibility changes to all style layers except those matching excludeLayerPatterns. This diverges from populateBackgroundLayerList, which only treats layers as “background” when !isUserAddedLayer (and optionally excludes drawn layers / only-rendered filter). As written, clicking “Show All / Hide All” can unintentionally toggle user-added layers (and potentially custom/drawn layers) that are not part of the background legend, and may call setLayoutProperty on layer types that aren’t meant to be controlled here. Align the filtering logic with the background legend criteria (at minimum: gate on !isUserAddedLayer(layer.id) in addition to the pattern/drawn/rendered filters).
| if (!this.isExcludedByPattern(layer.id)) { | |
| if (!this.isExcludedByPattern(layer.id) && !this.isUserAddedLayer(layer.id)) { |
|
@copilot ; how ybout make |
"(Show|Hide) All" buttons did to much :)