From b3dbc41368d7e8e8e48286d1b3019c34970260cc Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Mon, 3 Feb 2025 20:27:11 -0800 Subject: [PATCH] Remove LGraphNode.subgraph (Legacy subgraph) (#453) * Remove LGraphNode.subgraph (Legacy subgraph) * Update snapshot --- src/LGraphCanvas.ts | 32 -------------------------- src/LGraphNode.ts | 2 -- test/__snapshots__/LGraph.test.ts.snap | 12 ---------- 3 files changed, 46 deletions(-) diff --git a/src/LGraphCanvas.ts b/src/LGraphCanvas.ts index 2b3906cb8..d40950c87 100644 --- a/src/LGraphCanvas.ts +++ b/src/LGraphCanvas.ts @@ -5340,38 +5340,6 @@ export class LGraphCanvas { } } - // subgraph box - if ( - !collapsed && - node.subgraph && - !node.skip_subgraph_button - ) { - const w = LiteGraph.NODE_TITLE_HEIGHT - const x = node.size[0] - w - const over = LiteGraph.isInsideRectangle( - this.graph_mouse[0] - node.pos[0], - this.graph_mouse[1] - node.pos[1], - x + 2, - -w + 2, - w - 4, - w - 4, - ) - ctx.fillStyle = over ? "#888" : "#555" - if (shape == RenderShape.BOX || low_quality) { - ctx.fillRect(x + 2, -w + 2, w - 4, w - 4) - } else { - ctx.beginPath() - ctx.roundRect(x + 2, -w + 2, w - 4, w - 4, [4]) - ctx.fill() - } - ctx.fillStyle = "#333" - ctx.beginPath() - ctx.moveTo(x + w * 0.2, -w * 0.6) - ctx.lineTo(x + w * 0.8, -w * 0.6) - ctx.lineTo(x + w * 0.5, -w * 0.3) - ctx.fill() - } - // custom title render node.onDrawTitle?.(ctx) } diff --git a/src/LGraphNode.ts b/src/LGraphNode.ts index a99d48a7e..0805711be 100644 --- a/src/LGraphNode.ts +++ b/src/LGraphNode.ts @@ -230,8 +230,6 @@ export class LGraphNode implements Positionable, IPinnable { console?: string[] _level: number _shape?: RenderShape - subgraph?: LGraph - skip_subgraph_button?: boolean mouseOver?: IMouseOverData redraw_on_mouse?: boolean // Appears unused diff --git a/test/__snapshots__/LGraph.test.ts.snap b/test/__snapshots__/LGraph.test.ts.snap index 40d5dcafc..3016146a6 100644 --- a/test/__snapshots__/LGraph.test.ts.snap +++ b/test/__snapshots__/LGraph.test.ts.snap @@ -96,8 +96,6 @@ LGraph { "selected": undefined, "serialize_widgets": undefined, "showAdvanced": undefined, - "skip_subgraph_button": undefined, - "subgraph": undefined, "title": undefined, "type": null, "widgets": undefined, @@ -166,8 +164,6 @@ LGraph { "selected": undefined, "serialize_widgets": undefined, "showAdvanced": undefined, - "skip_subgraph_button": undefined, - "subgraph": undefined, "title": undefined, "type": null, "widgets": undefined, @@ -237,8 +233,6 @@ LGraph { "selected": undefined, "serialize_widgets": undefined, "showAdvanced": undefined, - "skip_subgraph_button": undefined, - "subgraph": undefined, "title": undefined, "type": null, "widgets": undefined, @@ -424,8 +418,6 @@ LGraph { "selected": undefined, "serialize_widgets": undefined, "showAdvanced": undefined, - "skip_subgraph_button": undefined, - "subgraph": undefined, "title": undefined, "type": null, "widgets": undefined, @@ -494,8 +486,6 @@ LGraph { "selected": undefined, "serialize_widgets": undefined, "showAdvanced": undefined, - "skip_subgraph_button": undefined, - "subgraph": undefined, "title": undefined, "type": null, "widgets": undefined, @@ -565,8 +555,6 @@ LGraph { "selected": undefined, "serialize_widgets": undefined, "showAdvanced": undefined, - "skip_subgraph_button": undefined, - "subgraph": undefined, "title": undefined, "type": null, "widgets": undefined,