Add functionality to quickly disconnect moved input links (#7459)

Disconnections are frequently performed by dragging a link from an input
slot and dropping it on the canvas, but needing to wait for the
searchbox to pop up, and then needing to manually close out of this can
make it feel slow. Sometimes, this will even result in users disabling
the link release action for more responsive graph building.

Instead, this PR introduces new functionality where a link which is
moved only a short distance from a node input and dropped will be
immediately disconnected instead of performing the default link release
action.

![fast-disco_00001](https://github.com/user-attachments/assets/5b0795da-12c0-4347-8ea1-6fc1bcafaae2)

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7459-Add-functionality-to-quickly-disconnect-moved-input-links-2c86d73d365081919052f3856db8e672)
by [Unito](https://www.unito.io)
This commit is contained in:
AustinMroz
2026-02-23 11:54:54 -08:00
committed by GitHub
parent 2634acdd8c
commit d7546e68ef
5 changed files with 68 additions and 7 deletions

View File

@@ -1,3 +1,5 @@
import type { SlotLayout } from '@/renderer/core/layout/types'
import type { Point } from '@/lib/litegraph/src/interfaces'
import type { LGraph } from '@/lib/litegraph/src/LGraph'
import type { NodeId } from '@/lib/litegraph/src/LGraphNode'
import type { RerouteId } from '@/lib/litegraph/src/Reroute'
@@ -72,7 +74,11 @@ export class LinkConnectorAdapter {
beginFromInput(
nodeId: NodeId,
inputIndex: number,
opts?: { moveExisting?: boolean; fromRerouteId?: RerouteId }
opts?: {
fromRerouteId?: RerouteId
layout?: SlotLayout
moveExisting?: boolean
}
): void {
const node = this.network.getNodeById(nodeId)
const input = node?.inputs?.[inputIndex]
@@ -81,7 +87,10 @@ export class LinkConnectorAdapter {
const fromReroute = this.network.getReroute(opts?.fromRerouteId)
if (opts?.moveExisting) {
this.linkConnector.moveInputLink(this.network, input)
const startPoint: Point | undefined = opts.layout
? [opts.layout.position.x, opts.layout.position.y]
: undefined
this.linkConnector.moveInputLink(this.network, input, { startPoint })
} else {
this.linkConnector.dragNewFromInput(
this.network,

View File

@@ -671,7 +671,8 @@ export function useSlotLinkInteraction({
})
} else {
activeAdapter.beginFromInput(localNodeId, index, {
moveExisting: shouldMoveExistingInput
moveExisting: shouldMoveExistingInput,
layout
})
}