Fix bug with clipping

This commit is contained in:
2026-04-07 12:37:43 +02:00
parent 9a8f6c7dc5
commit a3ca2eb372
5 changed files with 125 additions and 124 deletions

View File

@@ -9,7 +9,13 @@
* @param {Number} depth
*/
function traverse(node, flatList, depth = 1) {
const normNode = {label: node.label};
const normNode = {
id: node.label,
label: node.label,
opacity: node.opacity ?? null,
isMain: node.isMain ?? false,
active: true,
};
if (node.model) {
normNode.model = node.model;
}
@@ -18,9 +24,8 @@ function traverse(node, flatList, depth = 1) {
depth
});
if (node.children) {
depth++;
for(let child of node.children) {
traverse(child, flatList, depth);
traverse(child, flatList, depth + 1);
}
}
}
@@ -32,11 +37,11 @@ function traverse(node, flatList, depth = 1) {
* @returns {Object[]} A flat list of nodes
**/
export function normalizeNodes (nodes) {
let flatNodes = [];
let flatList = [];
for (let node of nodes) {
traverse(node, flatNodes);
traverse(node, flatList);
}
return flatNodes;
return flatList;
}