mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-27 01:39:47 +00:00
Fix corruption of selected link highlights (#897)
Occurred when deselecting one side of a link when both sides were selected.
This commit is contained in:
24
src/LLink.ts
24
src/LLink.ts
@@ -5,7 +5,7 @@ import type {
|
||||
LinkSegment,
|
||||
ReadonlyLinkNetwork,
|
||||
} from "./interfaces"
|
||||
import type { NodeId } from "./LGraphNode"
|
||||
import type { LGraphNode, NodeId } from "./LGraphNode"
|
||||
import type { Reroute, RerouteId } from "./Reroute"
|
||||
import type { Serialisable, SerialisableLLink } from "./types/serialisation"
|
||||
|
||||
@@ -156,6 +156,28 @@ export class LLink implements LinkSegment, Serialisable<SerialisableLLink> {
|
||||
?.findNextReroute(rerouteId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the origin node of a link.
|
||||
* @param network The network to search
|
||||
* @param linkId The ID of the link to get the origin node of
|
||||
* @returns The origin node of the link, or `undefined` if the link is not found or the origin node is not found
|
||||
*/
|
||||
static getOriginNode(network: Pick<ReadonlyLinkNetwork, "getNodeById" | "links">, linkId: LinkId): LGraphNode | undefined {
|
||||
const id = network.links.get(linkId)?.origin_id
|
||||
return network.getNodeById(id) ?? undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the target node of a link.
|
||||
* @param network The network to search
|
||||
* @param linkId The ID of the link to get the target node of
|
||||
* @returns The target node of the link, or `undefined` if the link is not found or the target node is not found
|
||||
*/
|
||||
static getTargetNode(network: Pick<ReadonlyLinkNetwork, "getNodeById" | "links">, linkId: LinkId): LGraphNode | undefined {
|
||||
const id = network.links.get(linkId)?.target_id
|
||||
return network.getNodeById(id) ?? undefined
|
||||
}
|
||||
|
||||
configure(o: LLink | SerialisedLLinkArray) {
|
||||
if (Array.isArray(o)) {
|
||||
this.id = o[0]
|
||||
|
||||
Reference in New Issue
Block a user