pythongosssss / ComfyUI-Custom-Scripts

Enhancements & experiments for ComfyUI, mostly focusing on UI features
MIT License
1.37k stars 104 forks source link

Snap all group borders to grid, when [ Fit Group to Nodes ] is used and [ Always snap to grid ] is enabled. #261

Open JorgeR81 opened 1 month ago

JorgeR81 commented 1 month ago

With this new commit, groups are snapped to grid after moving:

https://github.com/comfyanonymous/ComfyUI/pull/3393

But this works in a different way than the [ Fit Group to Nodes ] option.

When I use [ Fit Group to Nodes ], only the group's bottom border it's aligned with the grid ( not the top one ):

before_m

And after moving the group, it's the top border that's snapped to grid ( not the bottom one ), so the node positions are changed in relation to the group :

after2

after

So after moving, I still need to redimension the bottom border manually, to snap it to the grid:

fit

Once the group's top border it's aligned, the relative positions will always stay 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 borders to the grid, when [ Fit Group to Nodes ] is used, like on the last image.