Add lowQuality param to IWidget.draw (#843)

Currently widget needs to get access to `LGraphCanvas` instance to know
whether the canvas is rendering in low quality (Zoomed out). Usually
canvas object is obtained from `ComfyApp` instance.

This PR passes the lowQuality value to `IWidget.draw` to decouple the
dependency on `LGraphCanvas`.
This commit is contained in:
Chenlei Hu
2025-03-23 20:50:14 -04:00
committed by GitHub
parent c8bd5e43dd
commit 7fc8f8c897
2 changed files with 11 additions and 1 deletions

View File

@@ -3376,7 +3376,7 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
if (WidgetClass) {
toClass(WidgetClass, w).drawWidget(ctx, { y, width: widget_width, show_text, margin })
} else {
w.draw?.(ctx, this, widget_width, y, H)
w.draw?.(ctx, this, widget_width, y, H, lowQuality)
}
ctx.globalAlpha = editorAlpha
}