diff --git a/src/scripts/domWidget.ts b/src/scripts/domWidget.ts index fc17709cd..8bb3e11bf 100644 --- a/src/scripts/domWidget.ts +++ b/src/scripts/domWidget.ts @@ -31,7 +31,6 @@ export interface DOMWidget // All unrecognized types will be treated the same way as 'custom' in litegraph internally. type: 'custom' name: string - computedHeight?: number element: T options: DOMWidgetOptions value: V @@ -260,9 +259,7 @@ function computeSize(this: LGraphNode, size: Size): void { // Position each of the widgets for (const w of this.widgets) { w.y = y - // @ts-expect-error custom widget type if (w.computedHeight) { - // @ts-expect-error custom widget type y += w.computedHeight } else if (w.computeSize) { y += w.computeSize()[1] + 4 diff --git a/src/services/litegraphService.ts b/src/services/litegraphService.ts index 440d37bbf..38ade99e8 100644 --- a/src/services/litegraphService.ts +++ b/src/services/litegraphService.ts @@ -371,9 +371,7 @@ export const useLitegraphService = () => { shiftY = w.last_y if (w.computeSize) { shiftY += w.computeSize()[1] + 4 - // @ts-expect-error computedHeight only exists for DOMWidget } else if (w.computedHeight) { - // @ts-expect-error computedHeight only exists for DOMWidget shiftY += w.computedHeight } else { shiftY += LiteGraph.NODE_WIDGET_HEIGHT + 4 diff --git a/src/types/litegraph-augmentation.d.ts b/src/types/litegraph-augmentation.d.ts index ce8a718c2..b5b243818 100644 --- a/src/types/litegraph-augmentation.d.ts +++ b/src/types/litegraph-augmentation.d.ts @@ -24,6 +24,12 @@ declare module '@comfyorg/litegraph/dist/types/widgets' { * See extensions/core/dynamicPrompts.ts */ dynamicPrompts?: boolean + + /** + * The computed height of the widget. Used by customized node resize logic. + * See scripts/domWidget.ts for more details. + */ + computedHeight?: number } }