mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-03 04:00:31 +00:00
Redesign invalid node indicator (#358)
* nit * Remove unused code Gradient can (and should) be impl. directly by caching a CanvasGradient. * nit * nit - Refactor * Remove redundant code * Add line width & colour options to shape stroke * Rename drawSelectionBounding to strokeShape * nit - Doc * Fix rounded corners not scaling with padding * Optimise node badge draw * Redesign invalid node visual indication Customisable boundary indicator now used, replacing red background. * Update snapshot --------- Co-authored-by: huchenlei <huchenlei@proton.me>
This commit is contained in:
@@ -47,10 +47,10 @@ export class LGraphBadge {
|
||||
getWidth(ctx: CanvasRenderingContext2D) {
|
||||
if (!this.visible) return 0
|
||||
|
||||
ctx.save()
|
||||
const { font } = ctx
|
||||
ctx.font = `${this.fontSize}px sans-serif`
|
||||
const textWidth = ctx.measureText(this.text).width
|
||||
ctx.restore()
|
||||
ctx.font = font
|
||||
return textWidth + this.padding * 2
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export class LGraphBadge {
|
||||
): void {
|
||||
if (!this.visible) return
|
||||
|
||||
ctx.save()
|
||||
const { fillStyle } = ctx
|
||||
ctx.font = `${this.fontSize}px sans-serif`
|
||||
const badgeWidth = this.getWidth(ctx)
|
||||
const badgeX = 0
|
||||
@@ -85,6 +85,6 @@ export class LGraphBadge {
|
||||
y + this.height - this.padding,
|
||||
)
|
||||
|
||||
ctx.restore()
|
||||
ctx.fillStyle = fillStyle
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user