Skip to content

Commit 074d161

Browse files
committed
Fix primitive resize on load
Fixes #676
1 parent e59ed85 commit 074d161

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/extensions/core/widgetInputs.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ class PrimitiveNode extends LGraphNode {
203203
type = 'COMBO'
204204
}
205205

206+
// Store current size as addWidget resizes the node
207+
const size = this.size
206208
let widget
207209
if (type in ComfyWidgets) {
208210
widget = (ComfyWidgets[type](this, 'value', inputData, app) || {}).widget
@@ -261,8 +263,14 @@ class PrimitiveNode extends LGraphNode {
261263
return r
262264
}
263265

266+
// Use the biggest dimensions in case the widgets caused the node to grow
267+
this.size = [
268+
Math.max(this.size[0], size[0]),
269+
Math.max(this.size[1], size[1])
270+
]
271+
264272
if (!recreating) {
265-
// Grow our node if required
273+
// Grow our node more if required
266274
const sz = this.computeSize()
267275
if (this.size[0] < sz[0]) {
268276
this.size[0] = sz[0]

0 commit comments

Comments
 (0)