mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-02 03:30:04 +00:00
Fix reroutes lost when dropping output links on reroute (#820)
Blocks attempts to drag links from an output onto a reroute in any of the links.
This commit is contained in:
@@ -96,6 +96,15 @@ export class FloatingRenderLink implements RenderLink {
|
||||
this.fromPos = fromReroute.pos
|
||||
}
|
||||
|
||||
canConnectToReroute(reroute: Reroute): boolean {
|
||||
if (this.toType === "input") {
|
||||
if (reroute.origin_id === this.inputNode?.id) return false
|
||||
} else {
|
||||
if (reroute.origin_id === this.outputNode?.id) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
connectToInput(node: LGraphNode, input: INodeInputSlot, _events?: LinkConnectorEventTarget): void {
|
||||
const floatingLink = this.link
|
||||
floatingLink.target_id = node.id
|
||||
|
||||
@@ -538,6 +538,7 @@ export class LinkConnector {
|
||||
|
||||
for (const renderLink of this.renderLinks) {
|
||||
if (renderLink.toType !== "output") continue
|
||||
if (!renderLink.canConnectToReroute(reroute)) continue
|
||||
if (isValidConnectionToOutput(renderLink, node, output)) return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,15 @@ export class MovingRenderLink implements RenderLink {
|
||||
this.fromSlotIndex = this.toType === "input" ? outputIndex : inputIndex
|
||||
}
|
||||
|
||||
canConnectToReroute(reroute: Reroute): boolean {
|
||||
if (this.toType === "input") {
|
||||
if (reroute.origin_id === this.inputNode.id) return false
|
||||
} else {
|
||||
if (reroute.origin_id === this.outputNode.id) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
connectToInput(inputNode: LGraphNode, input: INodeInputSlot, events: LinkConnectorEventTarget): LLink | null | undefined {
|
||||
if (input === this.inputSlot) return
|
||||
|
||||
|
||||
@@ -31,6 +31,11 @@ export class ToOutputRenderLink implements RenderLink {
|
||||
: this.node.getInputPos(inputIndex)
|
||||
}
|
||||
|
||||
canConnectToReroute(reroute: Reroute): boolean {
|
||||
if (reroute.origin_id === this.node.id) return false
|
||||
return true
|
||||
}
|
||||
|
||||
connectToOutput(node: LGraphNode, output: INodeOutputSlot, events: LinkConnectorEventTarget) {
|
||||
const { node: inputNode, fromSlot, fromReroute } = this
|
||||
if (inputNode) return
|
||||
|
||||
Reference in New Issue
Block a user