From 5bc88ca51dddc75a51ba205f0273bb6315b73272 Mon Sep 17 00:00:00 2001 From: qvest-ssels <214787280+qvest-ssels@users.noreply.github.com> Date: Mon, 23 Nov 2026 23:17:59 +0100 Subject: [PATCH] Layers footer: Alt-click with a lone artboard keeps New Group An artboard can't go into a group, so New Group from Layers failed on OK when an artboard was the only active layer and no group was made. The single-layer route of #14717 now leaves artboards out, so a lone artboard gets the New Group dialog and its empty group as before. --- crates/ui-egui/src/layers_footer_tests.rs | 21 +++++++++++++++++++++ crates/ui-egui/src/panels/layers_events.rs | 5 +++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/layers_footer_tests.rs b/crates/ui-egui/src/layers_footer_tests.rs index 1a2619e033..bbbc2ddf51 100644 --- a/crates/ui-egui/src/layers_footer_tests.rs +++ b/crates/ui-egui/src/layers_footer_tests.rs @@ -235,6 +235,27 @@ fn footer_buttons_run_photocraft_commands() { assert!(groups(h)[0].children().unwrap().is_empty()); }, }, + Case { + case: "Alt New Group, one artboard active: an empty group, the artboard stays a board", + doc: || { + let mut s = Session::new(); + s.execute("file.new", json!({"width": 200, "height": 100})).unwrap(); + s.execute("layer.new.artboard", json!({"name": "Board", "rect": [0, 0, 100, 100]})).unwrap(); + s + }, + before: none, + button: "Create a new group", + mods: Modifiers::ALT, + after: |h| { + let id = h.state().framework.dialogs.stack().top().expect("the New Group dialog opened"); + confirm(h, id); + h.run_steps(4); + let plain: Vec = groups(h).into_iter().filter(|g| g.artboard().is_none()).collect(); + assert_eq!(plain.len(), 1, "OK adds one group: {:?}", top(h)); + assert!(plain[0].children().unwrap().is_empty()); + assert!(doc(h).layers.iter().any(|l| l.artboard().is_some()), "the artboard stays at the top level"); + }, + }, Case { case: "Cmd New Group, two selected: an empty group below the active layer", doc: || two(true), diff --git a/crates/ui-egui/src/panels/layers_events.rs b/crates/ui-egui/src/panels/layers_events.rs index 85a7a4f25f..36344f5f94 100644 --- a/crates/ui-egui/src/panels/layers_events.rs +++ b/crates/ui-egui/src/panels/layers_events.rs @@ -496,8 +496,9 @@ fn footer(app: &mut PhotocraftApp, picked: Option, if ask { // Null params go through the menu path, which opens the dialog. Like Photoshop, // ⌥-click asks for New Group from Layers also with one non-Background layer - // active, and OK puts that layer in the group (#14717). - let one = active.is_some_and(|l| !doc.is_background(l.id)); + // active, and OK puts that layer in the group (#14717). An artboard can't go into + // a group, so a lone artboard keeps New Group. + let one = active.is_some_and(|l| !doc.is_background(l.id) && l.artboard().is_none()); let cmd = if groups || one { crate::new_group_ui::FROM_LAYERS } else { crate::new_group_ui::NEW_GROUP }; actions.push((cmd.into(), Value::Null)); } else if below {