feat: select group children on click (#9149)

## Summary

Add a setting to select all children (nodes, reroutes, nested groups)
when clicking a group on the canvas.

## Changes

- **What**: New `LiteGraph.Group.SelectChildrenOnClick` boolean setting
(default: `false`). When enabled, selecting a group cascades `select()`
to all its `_children`, and deselecting cascades `deselect()`. Recursion
handles nested groups naturally. No double-move risk — the drag handler
already uses `skipChildren=true`. The setting is wired via `onChange` to
`canvas.groupSelectChildren`, keeping litegraph free of platform
imports.

## Review Focus

- The select/deselect cascading in `LGraphCanvas.select()` /
`deselect()` — verify no infinite recursion risk with deeply nested
groups.
- The `groupSelectChildren` property is set via the setting's `onChange`
callback on `LGraphCanvas.active_canvas` — confirm this covers canvas
re-creation scenarios.

## Screenshots (if applicable)

N/A — behavioral change behind a setting toggle.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9149-feat-select-group-children-on-click-3116d73d365081a1a7b8c82dea95b242)
by [Unito](https://www.unito.io)

---------

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Christian Byrne
2026-03-13 06:13:18 -07:00
committed by GitHub
parent f4bf169b2f
commit e119383072
6 changed files with 574 additions and 3 deletions

View File

@@ -162,4 +162,12 @@ export const useLitegraphSettings = () => {
'Comfy.EnableWorkflowViewRestore'
)
})
watchEffect(() => {
const selectChildren = settingStore.get(
'LiteGraph.Group.SelectChildrenOnClick'
)
if (canvasStore.canvas)
canvasStore.canvas.groupSelectChildren = selectChildren
})
}

View File

@@ -1258,5 +1258,15 @@ export const CORE_SETTINGS: SettingParams[] = [
defaultValue: true,
experimental: true,
versionAdded: '1.40.0'
},
{
id: 'LiteGraph.Group.SelectChildrenOnClick',
category: ['LiteGraph', 'Group', 'SelectChildrenOnClick'],
name: 'Select group children on click',
tooltip:
'When enabled, clicking a group selects all nodes and items inside it',
type: 'boolean',
defaultValue: false,
versionAdded: '1.42.0'
}
]