diff --git a/src/components/CatalogLayerLegend.vue b/src/components/CatalogLayerLegend.vue index e83fee835..6adfd98a8 100644 --- a/src/components/CatalogLayerLegend.vue +++ b/src/components/CatalogLayerLegend.vue @@ -142,7 +142,6 @@ async setLayerCategories(all=false) { try { - const projectLayer = this.getProjectLayer(); const categories = projectLayer.getCategories(); @@ -178,9 +177,9 @@ nodes.forEach(({icon, title, symbols = []}) => { if (icon) symbols = [{icon, title}]; categories.forEach(category => { - category.disabled = - ("undefined" !== typeof category.checked ? category.checked : true) && - false == symbols.find(symbol => symbol.icon === category.icon && symbol.title === category.title); + const find = symbols.find(symbol => symbol.icon === category.icon && symbol.title === category.title); + const disabled = "undefined" !== typeof category.checked ? category.checked : true; + category.disabled = disabled && !find; }); }) } else { @@ -230,7 +229,7 @@ CatalogEventHub.$on('layer-change-style', this.handlerChangeLegend); // Get all legend graphics of a layer when start - if(this.layer.visible) { + if (this.layer.visible) { this.setLayerCategories(true).then(() => { if (this.dynamic) { GUI.getService('map').on('change-map-legend-params', async () => {