Skip to content

Commit 7f5efca

Browse files
authored
Respect minimum node size on subgraph conversion (#6241)
Two small changes to improve sizing on subgraphs - On conversion, automatically promoted widgets can increase the minimum width of a node. When this occurs, the node is now automatically resized to respect this new minimum. <img width="434" height="274" alt="image" src="https://github.com/user-attachments/assets/8b642f12-24bf-439a-a07d-b392b1f406df" /> - On nodes with title_badges, titles now have greatly reduced empty padding before being abbreviated. <img width="314" height="123" alt="image" src="https://github.com/user-attachments/assets/4d8fd899-a159-4c0d-b309-04844b6203fc" /> ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6241-Respect-minimum-node-size-on-subgraph-conversion-2956d73d3650817c867fe42d60afa28b) by [Unito](https://www.unito.io)
1 parent a108c52 commit 7f5efca

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/core/graph/subgraph/proxyWidgetUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,5 @@ export function promoteRecommendedWidgets(subgraphNode: SubgraphNode) {
161161
const proxyWidgets: ProxyWidgetsProperty =
162162
filteredWidgets.map(widgetItemToProperty)
163163
subgraphNode.properties.proxyWidgets = proxyWidgets
164+
subgraphNode.computeSize(subgraphNode.size)
164165
}

src/lib/litegraph/src/LGraphNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3680,7 +3680,7 @@ export class LGraphNode
36803680
}
36813681
ctx.font = savedFont // Restore font after button measurements
36823682
if (buttonsWidth > 0) {
3683-
buttonsWidth += 10 // Extra margin before buttons
3683+
buttonsWidth -= 20 // Reduce by empty padding
36843684
availableWidth -= buttonsWidth
36853685
}
36863686
}

0 commit comments

Comments
 (0)