pythongosssss / ComfyUI-Custom-Scripts

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

snap group to grid if SHIFT is down or "always snap to grid" is enabled #229

Open choey opened 5 months ago

choey commented 5 months ago

This PR addresses #198.

Problem

Groups do not snap like nodes do, which makes maintaining neatly aligned nodes extremely difficult/cumbersome.

Solution

Make groups behave like nodes, by snapping their position and size to the grid:

https://github.com/pythongosssss/ComfyUI-Custom-Scripts/assets/83140/907d17d8-cec8-432c-9373-69dbb49f4eab

When "always snap to grid" is off, holding SHIFT enables snapping for groups, as is the behavior for nodes. Snapping also works when pressing CTRL while dragging a group to release the "tether" from the group to its nodes.

choey commented 5 months ago

Groups would benefit from some sort of guide lines (like in #228), but that could be a future iteration. Some options to consider:

  1. show guide lines orthogonal to the group (i.e., 2 horizontal and 2 vertical lines like it's done for nodes in #228)
  2. show guide lines for all nodes within the group

Maybe both?

pythongosssss commented 2 months ago

Hey, I apologise for the slowness, I think this functionality has since been added to core ComfyUI