mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 14:27:40 +00:00
[TS] Declare missing types in BaseWidget (#1038)
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user