Fix widget sizing logic in LGraphCanvas and LGraphNode (#609)

This fixes an issue with widget heights not coinciding with actual
computed heights.
<img
src="https://github.com/user-attachments/assets/50b4b86c-8de8-4844-9a17-6f18d32e7f5e"
height="128" alt="old">old
<img
src="https://github.com/user-attachments/assets/c34e432a-6941-469e-99cd-df15c0a527de"
height="256" alt="new">new
This commit is contained in:
Miguel C
2025-02-26 09:56:30 -06:00
committed by GitHub
parent 939e9c0a2f
commit 7e6b64f216
2 changed files with 8 additions and 4 deletions

View File

@@ -1929,9 +1929,12 @@ export class LGraphCanvas implements ConnectionColorContext {
for (const widget of node.widgets) {
if (widget.hidden || (widget.advanced && !node.showAdvanced)) continue
let widgetWidth, widgetHeight
let widgetWidth: number, widgetHeight: number
if (widget.computeSize) {
([widgetWidth, widgetHeight] = widget.computeSize(node.size[0]))
} else if (widget.computeLayoutSize) {
widgetWidth = widget.width
widgetHeight = widget.computedHeight
} else {
widgetWidth = widget.width || node.size[0]
widgetHeight = LiteGraph.NODE_WIDGET_HEIGHT