Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokant committed Mar 25, 2024
1 parent 34d822b commit 35c62f2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/pages/viewer/components/Layers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ import LegendSymbol from "./LegendSymbol";
import { Button } from "react-bulma-components";

function Layer({ node }) {
const { map, layers, lazy, config, visibleLayers, setVisibleLayers } = useContext(MapContext);
const { map, layers, lazy, config, visibleLayers } = useContext(MapContext);
const layer = layers[node.data.id];

const icon = layer && layer.isVisible ? 'fas fa-eye' : 'fas fa-eye-slash';

const updateVisibility = () => {
if (layer) {
if (config && config.exclusive_layers) {
for (const lid of visibleLayers) {
map.setLayoutProperty(lid, 'visibility', 'none');
}
if (config && config.exclusive_layers) {
for (const lid of visibleLayers) {
map.setLayoutProperty(lid, 'visibility', 'none');
}
}

if (layer) {
map.setLayoutProperty(node.data.id, 'visibility', layer.isVisible ? 'none' : 'visible');
} else {
map.addLayer(lazy.layers[node.data.id]);
setVisibleLayers([...visibleLayers, node.data.id]);
}
}

Expand Down

0 comments on commit 35c62f2

Please sign in to comment.