Skip to content

Improve default node sizes#3596

Merged
huchenlei merged 10 commits intomainfrom
node-thicckness
Apr 24, 2025
Merged

Improve default node sizes#3596
huchenlei merged 10 commits intomainfrom
node-thicckness

Conversation

@webfiltered
Copy link
Contributor

@webfiltered webfiltered commented Apr 24, 2025

Current

Nodes are created at 1.5x the minimum node width. This min value recently went up to prevent slot overlap, but this has resulted in huge default node sizes.

image

Proposed

For nodes without widgets, use the default Litegraph size, which now measures text. Add 60px to nodes with widgets, to ensure wide widgets show their value (rather than an ellipsis).

image

Adds a setting to disable the resize entirely.

image

┆Issue is synchronized with this Notion page by Unito

@webfiltered webfiltered requested a review from a team as a code owner April 24, 2025 01:01
@webfiltered
Copy link
Contributor Author

I think pad values (e.g. pixels) actually make more sense than the existing multiplier (pecentage).

At the very least, have the multiplier capped by a static value (e.g. 100 px in canvas space).

Copy link
Contributor

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not add an extra setting for this change. Pick a good default padding value (e.g. Fixed 30px) should be fine. And it is fine update all test expectations.

@webfiltered
Copy link
Contributor Author

I'd prefer to avoid multiple incremental changes to the node default size; it's too disruptive. The goal here was to work around whatever got changed recently (<=1.16 -- can't recall when, but nodes now have larger min-width, so default size is huge).

If the concern is an orphaned setting / setting overload, this might be better waiting until a fix for label sizes is implemented.

@huchenlei
Copy link
Contributor

huchenlei commented Apr 24, 2025

I'd prefer to avoid multiple incremental changes to the node default size; it's too disruptive. The goal here was to work around whatever got changed recently (<=1.16 -- can't recall when, but nodes now have larger min-width, so default size is huge).

If the concern is an orphaned setting / setting overload, this might be better waiting until a fix for label sizes is implemented.

The 1.16 change is caused by widget label also getting counted towards the width calculation because of widget input socket addition. Do you want to fix this on litegraph side instead if you just want the behavior to match pre1.16? i.e. filter out widget input sockets when calculating size.

@webfiltered
Copy link
Contributor Author

Yeah - already have a partial bit of work done on litegraph side for label size calc. But may be a "tomorrow" problem at this point.

@webfiltered
Copy link
Contributor Author

Widget label definitely should count towards size, but should be something like:

Math.max(
  largest input + largest output,
  largest widget,
  min node width
)

@webfiltered webfiltered requested a review from huchenlei April 24, 2025 15:04
@webfiltered
Copy link
Contributor Author

webfiltered commented Apr 24, 2025

@huchenlei Hard-coded to 60px for nodes, and only expands nodes that have widgets.

With Comfy-Org/litegraph.js#962, nodes should behave pretty much as expected.

@webfiltered webfiltered changed the title Add setting: default node width multiplier Improve default node sizes Apr 24, 2025
@webfiltered webfiltered added New Browser Test Expectations New browser test screenshot should be set by github action and removed New Browser Test Expectations New browser test screenshot should be set by github action labels Apr 24, 2025
@webfiltered webfiltered added New Browser Test Expectations New browser test screenshot should be set by github action and removed New Browser Test Expectations New browser test screenshot should be set by github action labels Apr 24, 2025
@huchenlei huchenlei merged commit a944372 into main Apr 24, 2025
2 checks passed
@huchenlei huchenlei deleted the node-thicckness branch April 24, 2025 16:42
christian-byrne pushed a commit that referenced this pull request May 20, 2025
Co-authored-by: github-actions <github-actions@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Browser Test Expectations New browser test screenshot should be set by github action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants