mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-31 05:19:53 +00:00
Type Widget.computedHeight (#2539)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
6
src/types/litegraph-augmentation.d.ts
vendored
6
src/types/litegraph-augmentation.d.ts
vendored
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user