mirror of
https://github.com/penpot/penpot.git
synced 2026-05-01 14:18:07 +00:00
Closes #7736. The Layers sidebar offered no way to expand every nested level of a single subtree at once. Unfolding a layer that wraps a deep tree required clicking each disclosure indicator one level at a time - O(siblings * depth) clicks. The asymmetry was particularly visible next to the existing Shift+click gesture, which collapses every layer in the panel in a single action via `dwc/collapse-all`, with no expand counterpart for either a single subtree or the whole tree. Add a new `dwc/expand-subtree` event in `app.main.data.workspace.collapse` that uses `cfh/get-children-ids-with-self` to gather the shape's id together with every descendant id, then merges `{descendant-id true}` entries into `[:workspace-local :expanded]` so the entire subtree opens in one update. Existing expansion state on unrelated branches is left untouched (`merge`, not `assoc`), matching the per-key shape used by `toggle-collapse` and `expand-collapse`. Wire the gesture into `layer_item.cljs` `toggle-collapse` callback as a third branch: - Shift+click while expanded - collapse every layer (existing). - Alt+click while collapsed - expand the entire subtree (new). - Otherwise - toggle this single level (existing). Alt is chosen instead of Shift to avoid the ambiguity the issue author flagged: "for a layer of middle depth it is unclear whether [Shift+click] should fold all (up to the topmost parent) or expand all (only the current subtree)". Alt is a common platform convention for "do this recursively" (Finder, file managers, several IDEs), so the asymmetric mapping matches user expectations. The callback's `mf/deps` vector is extended with `id` and `objects` so the closure refreshes when the shape tree changes. CHANGES.md entry added under the 2.17.0 New features section.