Skip to content

Commit

Permalink
[BugFix] Call LGraphCanvas.deleteSelected on context menu remove (#560)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Feb 20, 2025
1 parent 4dc9713 commit dc9a762
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions src/LGraphCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1493,28 +1493,7 @@ export class LGraphCanvas implements ConnectionColorContext {
menu: ContextMenu,

Check warning on line 1493 in src/LGraphCanvas.ts

View workflow job for this annotation

GitHub Actions / test

'menu' is defined but never used
node: LGraphNode,

Check warning on line 1494 in src/LGraphCanvas.ts

View workflow job for this annotation

GitHub Actions / test

'node' is defined but never used
): 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(
Expand Down

0 comments on commit dc9a762

Please sign in to comment.