From 6703a1f1fa9ffcbafa9cf66835020cc9d1b1f23b Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Tue, 18 Feb 2025 16:51:17 -0500 Subject: [PATCH] [Type] Mark LGraphGroup.color as optional (#545) * [Type] Mark LGraphGroup.color as optional * nit --- src/LGraphGroup.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/LGraphGroup.ts b/src/LGraphGroup.ts index 06ca55d3f..14db550cf 100644 --- a/src/LGraphGroup.ts +++ b/src/LGraphGroup.ts @@ -33,7 +33,7 @@ export class LGraphGroup implements Positionable, IPinnable { static defaultColour = "#335" id: number - color: string + color?: string title: string font?: string font_size: number = LiteGraph.DEFAULT_GROUP_FONT || 24 @@ -153,18 +153,19 @@ export class LGraphGroup implements Positionable, IPinnable { const [x, y] = this._pos const [width, height] = this._size + const color = this.color || defaultColour // Titlebar ctx.globalAlpha = 0.25 * graphCanvas.editor_alpha - ctx.fillStyle = this.color || defaultColour - ctx.strokeStyle = this.color || defaultColour + ctx.fillStyle = color + ctx.strokeStyle = color ctx.beginPath() ctx.rect(x + 0.5, y + 0.5, width, font_size * 1.4) ctx.fill() // Group background, border - ctx.fillStyle = this.color - ctx.strokeStyle = this.color + ctx.fillStyle = color + ctx.strokeStyle = color ctx.beginPath() ctx.rect(x + 0.5, y + 0.5, width, height) ctx.fill()