From dc9a76200bbf8c364d74c00e5c3e10f4eb7b58b1 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 20 Feb 2025 15:22:53 -0500 Subject: [PATCH] [BugFix] Call LGraphCanvas.deleteSelected on context menu remove (#560) --- src/LGraphCanvas.ts | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/LGraphCanvas.ts b/src/LGraphCanvas.ts index 5ee1146d4..6cae6f3e2 100644 --- a/src/LGraphCanvas.ts +++ b/src/LGraphCanvas.ts @@ -1493,28 +1493,7 @@ export class LGraphCanvas implements ConnectionColorContext { menu: ContextMenu, node: LGraphNode, ): void { - if (!node) throw "no node passed" - - const graph = node.graph - graph.beforeChange() - - const fApplyMultiNode = function (node: LGraphNode) { - if (node.removable === false) return - - graph.remove(node) - } - - const canvas = LGraphCanvas.active_canvas - if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { - fApplyMultiNode(node) - } else { - for (const i in canvas.selected_nodes) { - fApplyMultiNode(canvas.selected_nodes[i]) - } - } - - graph.afterChange() - canvas.setDirty(true, true) + LGraphCanvas.active_canvas.deleteSelected() } static onMenuNodeClone(