[Cleanup] Follow-up on #566 - fix style (#568)

This commit is contained in:
filtered
2025-02-24 07:20:44 +11:00
committed by GitHub
parent 46535409c8
commit 4add6c3211
2 changed files with 9 additions and 3 deletions

View File

@@ -2409,7 +2409,9 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
target_node.inputs[targetIndex].link = link_info.id
// Reroutes
for (const x of LLink.getReroutes(graph, link_info)) x?.linkIds.add(nextId)
for (const reroute of LLink.getReroutes(graph, link_info)) {
reroute?.linkIds.add(nextId)
}
graph._version++
// link_info has been created now, so its updated

View File

@@ -10,13 +10,17 @@ import { LGraphNode } from "@/LGraphNode"
*/
export function getAllNestedItems(items: ReadonlySet<Positionable>): Set<Positionable> {
const allItems = new Set<Positionable>()
if (items) for (const x of items) addRecursively(x, allItems)
if (items) {
for (const item of items) addRecursively(item, allItems)
}
return allItems
function addRecursively(item: Positionable, flatSet: Set<Positionable>): void {
if (flatSet.has(item) || item.pinned) return
flatSet.add(item)
if (item.children) for (const x of item.children) addRecursively(x, flatSet)
if (item.children) {
for (const child of item.children) addRecursively(child, flatSet)
}
}
}