mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-07 06:00:03 +00:00
[TS] Use strict mode in LLink & Reroute (#602)
- Adds fallback colour if reroute colour is somehow nullish
This commit is contained in:
13
src/LLink.ts
13
src/LLink.ts
@@ -1,4 +1,3 @@
|
||||
// @ts-strict-ignore
|
||||
import type {
|
||||
CanvasColour,
|
||||
LinkNetwork,
|
||||
@@ -46,9 +45,9 @@ export class LLink implements LinkSegment, Serialisable<SerialisableLLink> {
|
||||
/** @inheritdoc */
|
||||
_centreAngle?: number
|
||||
|
||||
#color?: CanvasColour
|
||||
#color?: CanvasColour | null
|
||||
/** Custom colour for this link only */
|
||||
public get color(): CanvasColour {
|
||||
public get color(): CanvasColour | null | undefined {
|
||||
return this.#color
|
||||
}
|
||||
|
||||
@@ -108,7 +107,9 @@ export class LLink implements LinkSegment, Serialisable<SerialisableLLink> {
|
||||
network: LinkNetwork,
|
||||
linkSegment: LinkSegment,
|
||||
): Reroute[] {
|
||||
return network.reroutes.get(linkSegment.parentId)
|
||||
if (!linkSegment.parentId) return []
|
||||
return network.reroutes
|
||||
.get(linkSegment.parentId)
|
||||
?.getReroutes() ?? []
|
||||
}
|
||||
|
||||
@@ -125,7 +126,9 @@ export class LLink implements LinkSegment, Serialisable<SerialisableLLink> {
|
||||
linkSegment: LinkSegment,
|
||||
rerouteId: RerouteId,
|
||||
): Reroute | null | undefined {
|
||||
return network.reroutes.get(linkSegment.parentId)
|
||||
if (!linkSegment.parentId) return
|
||||
return network.reroutes
|
||||
.get(linkSegment.parentId)
|
||||
?.findNextReroute(rerouteId)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user