clean custom layer logic

This commit is contained in:
vcoppe
2025-11-11 10:37:06 +01:00
parent 88c9abb78e
commit 683ac4e118
2 changed files with 25 additions and 49 deletions

View File

@@ -55,4 +55,15 @@ export function toggle(node: LayerTreeType, id: string) {
return node;
}
export function remove(node: LayerTreeType, id: string) {
Object.keys(node).forEach((key) => {
if (key === id) {
delete node[key];
} else if (typeof node[key] !== 'boolean') {
remove(node[key], id);
}
});
return node;
}
export const customBasemapUpdate = writable(0);