mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 22:37:32 +00:00
Remove LGraphCanvas._graph_stack (legacy subgraph) (#454)
This commit is contained in:
@@ -450,7 +450,6 @@ export class LGraphCanvas {
|
||||
last_mouse: ReadOnlyPoint = [0, 0]
|
||||
last_mouseclick: number = 0
|
||||
graph!: LGraph
|
||||
_graph_stack: LGraph[] | null = null
|
||||
canvas: HTMLCanvasElement
|
||||
bgcanvas: HTMLCanvasElement
|
||||
ctx?: CanvasRenderingContext2D
|
||||
@@ -1638,21 +1637,9 @@ export class LGraphCanvas {
|
||||
|
||||
graph.attachCanvas(this)
|
||||
|
||||
// remove the graph stack in case a subgraph was open
|
||||
this._graph_stack &&= null
|
||||
|
||||
this.setDirty(true, true)
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns the top level graph (in case there are subgraphs open on the canvas)
|
||||
*/
|
||||
getTopGraph(): LGraph {
|
||||
return this._graph_stack.length
|
||||
? this._graph_stack[0]
|
||||
: this.graph
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns the visually active graph (in case there are more in the stack)
|
||||
*/
|
||||
@@ -4647,25 +4634,6 @@ export class LGraphCanvas {
|
||||
ctx.clearRect(viewport[0], viewport[1], viewport[2], viewport[3])
|
||||
}
|
||||
|
||||
// show subgraph stack header
|
||||
if (this._graph_stack?.length) {
|
||||
ctx.save()
|
||||
const subgraph_node = this.graph._subgraph_node
|
||||
ctx.strokeStyle = subgraph_node.bgcolor
|
||||
ctx.lineWidth = 10
|
||||
ctx.strokeRect(1, 1, canvas.width - 2, canvas.height - 2)
|
||||
ctx.lineWidth = 1
|
||||
ctx.font = "40px Arial"
|
||||
ctx.textAlign = "center"
|
||||
ctx.fillStyle = subgraph_node.bgcolor || "#AAA"
|
||||
let title = ""
|
||||
for (let i = 1; i < this._graph_stack.length; ++i) {
|
||||
title += this._graph_stack[i]._subgraph_node.getTitle() + " >> "
|
||||
}
|
||||
ctx.fillText(title + subgraph_node.getTitle(), canvas.width * 0.5, 40)
|
||||
ctx.restore()
|
||||
}
|
||||
|
||||
const bg_already_painted = this.onRenderBackground
|
||||
? this.onRenderBackground(canvas, ctx)
|
||||
: false
|
||||
|
||||
Reference in New Issue
Block a user