From 48bf415e52af76f93bd8b02cfc45a711f5b6a331 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Sun, 20 Apr 2025 18:20:12 +1000 Subject: [PATCH] [API] Allow connecting to nodes without known slot (#942) Allows better downstream customisation of `LinkConnector`. --- src/canvas/LinkConnector.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/canvas/LinkConnector.ts b/src/canvas/LinkConnector.ts index cf3dafbe3..a885f4acf 100644 --- a/src/canvas/LinkConnector.ts +++ b/src/canvas/LinkConnector.ts @@ -351,7 +351,7 @@ export class LinkConnector { if (output) { this.#dropOnOutput(node, output) } else { - this.#dropOnNodeBackground(node, event) + this.connectToNode(node, event) } // To input } else if (connectingTo === "input") { @@ -370,7 +370,7 @@ export class LinkConnector { this.overWidget = undefined } else { // Node background / title - this.#dropOnNodeBackground(node, event) + this.connectToNode(node, event) } } } @@ -456,11 +456,11 @@ export class LinkConnector { } /** - * Connects the links being dropped onto a node. + * Connects the links being dropped onto a node to the first matching slot. * @param node The node that the links are being dropped on * @param event Contains the drop location, in canvas space */ - #dropOnNodeBackground(node: LGraphNode, event: CanvasPointerEvent): void { + connectToNode(node: LGraphNode, event: CanvasPointerEvent): void { const { state: { connectingTo } } = this const mayContinue = this.events.dispatch("dropped-on-node", { node, event })