Type Widget.computedHeight (#2539)

This commit is contained in:
Chenlei Hu
2025-02-12 16:50:30 -05:00
committed by GitHub
parent 8bb785c5e4
commit c7aaa2a45d
3 changed files with 6 additions and 5 deletions

View File

@@ -31,7 +31,6 @@ export interface DOMWidget<T extends HTMLElement, V extends object | string>
// All unrecognized types will be treated the same way as 'custom' in litegraph internally.
type: 'custom'
name: string
computedHeight?: number
element: T
options: DOMWidgetOptions<T, V>
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