ComfyUI_frontend
ComfyUI_frontend copied to clipboard
[Feature Request]: Snap all group borders do grid, when `Fit Group to Nodes` is used
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What would your feature do ?
Since snap to grid is now in the core, I'm opening here a feature request, that I also have in the extension repo:
https://github.com/pythongosssss/ComfyUI-Custom-Scripts/issues/261
It's a small improvement to make snap to grid work better with groups.
This would allow to snap all group borders to the grid, when Fit Group to Nodes is used ( see last image ).
Proposed workflow
Now groups can also snap to the grid, when dragged, which is great !
But this works in a different way than the Fit Group to Nodes option.
When I use Fit Group to Nodes, the group's bottom border it's aligned with the grid ( but not the top one ).
And after moving the group, it's the top border that's snapped to grid ( not the bottom one ). So, the node vertical position is changed in relation to the group.
The nodes can be displaced a little up or down in the group ( see the next 2 images ).
So after moving, I still need to redimension the bottom border manually, to snap it to the grid, like this:
Once the group's top and bottom borders are aligned to the grid, the node's relative positions will always remain the same, after moving the group again.
But every time I use Fit Group to Nodes the group's top border will be misaligned again.
A solution would be to snap all group borders to the grid, when Fit Group to Nodes is used, like on the last image.
Additional information
No response
This one drives me insane. I actually thought I might have mucked something up on my end but I'm glad that it's not that.
Hopefully, this one isn't too hard to fix either, since I think the change should effectively be to respect the fit group padding px with the snapping when using any type of resize.
@webfiltered, now that "snap to grid" is fixed, can you take a look at this ?
When "snap to grid" is enabled, we want the group to also snap to the grid, if we use Fit Group To Nodes.
This should be pretty straight forward. Just need the existing snap logic to be assessed after running the fit function - which is all in in the one place, now.
Is still possible to add this feature ?
It definitely is! It needs some frontend options added, some tests, and a few little bits. But it's on the list!
@webfiltered If you would like, I can try stacking a PR on top of yours, if you let me know what options and little bits are missing.
@webfiltered If you would like, I can try stacking a PR on top of yours, if you let me know what options and little bits are missing.
There's no PR for this, sorry; was simply mentioning that whilst it is a simple change, it requires many times the effort to write the supporting code. The actual change to hard-code this always on would be very small.
In case the Comfy team ever consider a redesign of the groups,
This could also be fixed if the group's header height is changed from ~3.3 grid units, to exactly 3 grid units ( like the node's header ) or exactly 4 units.