mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-11 08:00:21 +00:00
Upstream render of slot error (#872)
Upstream slot error rendering from ComfyUI_frontend. 
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user