Skip to content

Commit

Permalink
perf: 移除多余节点
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jan 16, 2024
1 parent a2e8248 commit 372e70a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/TrackGraph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ const visibleNodes = computed(() => {
}
if (n !== topNode && n.parent) {
const selfIndex = n.parent.children.indexOf(n);
n.parent.children.forEach((c, broIndex) => {
if (Math.abs(broIndex - selfIndex) <= 1) {
subNodes.add(c);
}
});
if (selfIndex != 0) {
n.parent.children.forEach((c, broIndex) => {
if (Math.abs(broIndex - selfIndex) <= 1) {
subNodes.add(c);
}
});
}
}
});
const graphNodes = Array.from(subNodes).map<
Expand Down

0 comments on commit 372e70a

Please sign in to comment.