Fix primitive resize (#683)

* Fix primitive resize on load
Fixes #676

* Add test

* Add playwright test

* Update test expectations [skip ci]

---------

Co-authored-by: huchenlei <chenlei.hu@mail.utoronto.ca>
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
pythongosssss
2024-08-29 23:01:57 +01:00
committed by GitHub
parent e59ed85cc0
commit d0067719b8
5 changed files with 179 additions and 1 deletions

View File

@@ -203,6 +203,8 @@ class PrimitiveNode extends LGraphNode {
type = 'COMBO'
}
// Store current size as addWidget resizes the node
const size = this.size
let widget
if (type in ComfyWidgets) {
widget = (ComfyWidgets[type](this, 'value', inputData, app) || {}).widget
@@ -261,8 +263,14 @@ class PrimitiveNode extends LGraphNode {
return r
}
// Use the biggest dimensions in case the widgets caused the node to grow
this.size = [
Math.max(this.size[0], size[0]),
Math.max(this.size[1], size[1])
]
if (!recreating) {
// Grow our node if required
// Grow our node more if required
const sz = this.computeSize()
if (this.size[0] < sz[0]) {
this.size[0] = sz[0]