Skip to content

Commit

Permalink
Rangelands layers always at the bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarrenechea committed Jun 13, 2024
1 parent bfa833f commit 421a387
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions client/src/containers/map/layer-manager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,22 @@ const LayerManager = () => {
Generate all transparent backgrounds to be able to sort by layers without an error
- https://github.com/visgl/react-map-gl/issues/939#issuecomment-625290200
*/}
{layers.map((l, i) => {
const beforeId = i === 0 ? baseLayer : `${layers[i - 1]}-layer`;
return (
<Layer
id={`${l}-layer`}
key={l}
type="background"
layout={{ visibility: "none" }}
beforeId={beforeId}
/>
);
})}
{layers
.toSorted((a) => {
return a.includes("rangeland") ? 1 : -1;
})
.map((l, i) => {
const beforeId = i === 0 ? baseLayer : `${layers[i - 1]}-layer`;
return (
<Layer
id={`${l}-layer`}
key={l}
type="background"
layout={{ visibility: "none" }}
beforeId={beforeId}
/>
);
})}

{/*
Loop through active layers. The id is gonna be used to fetch the current layer and know how to order the layers.
Expand Down

0 comments on commit 421a387

Please sign in to comment.