Skip to content

Commit

Permalink
[Type] Mark LGraphGroup.color as optional (#545)
Browse files Browse the repository at this point in the history
* [Type] Mark LGraphGroup.color as optional

* nit
  • Loading branch information
huchenlei authored Feb 18, 2025
1 parent aafd720 commit 6703a1f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/LGraphGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 6703a1f

Please sign in to comment.