mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
Add LGraph.empty (#371)
This commit is contained in:
@@ -115,6 +115,16 @@ export class LGraph implements LinkNetwork, Serialisable<SerialisableGraph> {
|
|||||||
inputs: Dictionary<IGraphInput>
|
inputs: Dictionary<IGraphInput>
|
||||||
outputs: Dictionary<IGraphInput>
|
outputs: Dictionary<IGraphInput>
|
||||||
|
|
||||||
|
/** @returns Whether the graph has no items */
|
||||||
|
get empty(): boolean {
|
||||||
|
return this.positionableItems.length === 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @returns All items on the canvas that can be selected */
|
||||||
|
get positionableItems(): Positionable[] {
|
||||||
|
return [...this._nodes, ...this._groups, ...this.reroutes.values()]
|
||||||
|
}
|
||||||
|
|
||||||
#reroutes = new Map<RerouteId, Reroute>()
|
#reroutes = new Map<RerouteId, Reroute>()
|
||||||
/** All reroutes in this graph. */
|
/** All reroutes in this graph. */
|
||||||
public get reroutes(): Map<RerouteId, Reroute> {
|
public get reroutes(): Map<RerouteId, Reroute> {
|
||||||
|
|||||||
@@ -3954,15 +3954,12 @@ export class LGraphCanvas {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
get empty(): boolean {
|
||||||
* @returns All items on the canvas that can be selected
|
return this.graph.empty
|
||||||
*/
|
}
|
||||||
|
|
||||||
get positionableItems(): Positionable[] {
|
get positionableItems(): Positionable[] {
|
||||||
return [
|
return this.graph.positionableItems
|
||||||
...this.graph._nodes,
|
|
||||||
...this.graph._groups,
|
|
||||||
...this.graph.reroutes.values(),
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user