[TS] Declare missing types in BaseWidget (#1038)

This commit is contained in:
filtered
2025-05-09 16:37:59 +10:00
committed by GitHub
parent bc8b13b5a4
commit d452240936
3 changed files with 9 additions and 3 deletions

View File

@@ -42,6 +42,13 @@ export abstract class BaseWidget<TWidget extends IBaseWidget = IBaseWidget> impl
static labelValueGap = 5
declare computedHeight?: number
declare serialize?: boolean
computeLayoutSize?(node: LGraphNode): {
minHeight: number
maxHeight?: number
minWidth: number
maxWidth?: number
}
#node: LGraphNode
/** The node that this widget belongs to. */

View File

@@ -12,7 +12,7 @@ export class KnobWidget extends BaseWidget<IKnobWidget> implements IKnobWidget {
* Compute the layout size of the widget.
* @returns The layout size of the widget.
*/
computeLayoutSize(): {
override computeLayoutSize(): {
minHeight: number
maxHeight?: number
minWidth: number

View File

@@ -23,8 +23,7 @@ export class LegacyWidget<TWidget extends IBaseWidget = IBaseWidget> extends Bas
override drawWidget(ctx: CanvasRenderingContext2D, options: DrawWidgetOptions) {
const H = LiteGraph.NODE_WIDGET_HEIGHT
const thisAsICustomWidget = this
thisAsICustomWidget.draw?.(ctx, this.node, options.width, this.y, H, !!options.showText)
this.draw?.(ctx, this.node, options.width, this.y, H, !!options.showText)
}
override onClick() {