mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-03 20:20:03 +00:00
Fix badge width when invisble (#132)
This commit is contained in:
@@ -40,7 +40,13 @@ export class LGraphBadge {
|
||||
this.cornerRadius = cornerRadius;
|
||||
}
|
||||
|
||||
get visible() {
|
||||
return this.text.length > 0;
|
||||
}
|
||||
|
||||
getWidth(ctx: CanvasRenderingContext2D) {
|
||||
if (!this.visible) return 0;
|
||||
|
||||
ctx.save();
|
||||
ctx.font = `${this.fontSize}px sans-serif`;
|
||||
const textWidth = ctx.measureText(this.text).width;
|
||||
@@ -53,7 +59,7 @@ export class LGraphBadge {
|
||||
x: number,
|
||||
y: number,
|
||||
): void {
|
||||
if (!this.text) return;
|
||||
if (!this.visible) return;
|
||||
|
||||
ctx.save();
|
||||
ctx.font = `${this.fontSize}px sans-serif`;
|
||||
|
||||
Reference in New Issue
Block a user