Enumerate children only.

This commit is contained in:
kovacsv 2021-10-16 11:59:36 +02:00
parent 9dcf49b548
commit 97312fe080
2 changed files with 5 additions and 5 deletions

View File

@ -46,11 +46,11 @@ OV.Node = class
return this.meshIndices;
}
Enumerate (processor)
EnumerateChildren (processor)
{
processor (this);
for (const childNode of this.childNodes) {
childNode.Enumerate (processor);
processor (childNode);
childNode.EnumerateChildren (processor);
}
}
};

View File

@ -51,10 +51,10 @@ describe ('Node', function() {
child1.AddChildNode (child12);
let enumerated = [];
node.Enumerate ((child) => {
node.EnumerateChildren ((child) => {
enumerated.push (child);
});
assert.deepStrictEqual (enumerated, [node, child1, child11, child12, child2]);
assert.deepStrictEqual (enumerated, [child1, child11, child12, child2]);
});
});