Commit 18d010cc authored by rockyl's avatar rockyl

优化递归效率

parent 5106093d
......@@ -52,7 +52,11 @@ export function traversePostorder(target: Entity, hitChild: (child: Entity, ...p
for (let i = target.children.length - 1; i >= 0; i--) {
const child = target.children[i];
if(traversePostorder(child, hitChild, level - 1, false, fullCallback, ...params)){
if(child.children.length > 0){
if(traversePostorder(child, hitChild, level - 1, false, fullCallback, ...params)){
return true;
}
}else{
return true;
}
if (hitChild(child, ...params)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment