Upstream render of slot error (#872)

Upstream slot error rendering from ComfyUI_frontend.


![image](https://github.com/user-attachments/assets/d14b49a1-7943-4249-a20a-8b3d33df8ddb)
This commit is contained in:
Chenlei Hu
2025-03-30 17:40:44 -04:00
committed by GitHub
parent 30a7f19a64
commit df279024c4
2 changed files with 14 additions and 0 deletions

View File

@@ -97,6 +97,7 @@ export abstract class NodeSlot implements INodeSlot {
nameLocked?: boolean
pos?: Point
widget?: IWidget
hasErrors?: boolean
constructor(slot: INodeSlot) {
Object.assign(this, slot)
@@ -237,6 +238,15 @@ export abstract class NodeSlot implements INodeSlot {
}
}
// Draw a red circle if the slot has errors.
if (this.hasErrors) {
ctx.lineWidth = 2
ctx.strokeStyle = "red"
ctx.beginPath()
ctx.arc(pos[0], pos[1], 12, 0, Math.PI * 2)
ctx.stroke()
}
// Restore the original fillStyle and strokeStyle
ctx.fillStyle = originalFillStyle
ctx.strokeStyle = originalStrokeStyle

View File

@@ -291,6 +291,10 @@ export interface INodeSlot {
* This is calculated at runtime; it is **not** serialized.
*/
_floatingLinks?: Set<LLink>
/**
* Whether the slot has errors. It is **not** serialized.
*/
hasErrors?: boolean
}
export interface INodeFlags {