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.
This commit is contained in:
qvest-ssels committed 2026-11-23 23:17:59 +01:00
1 parent c64ec699b3
commit 5bc88ca51d
2 files changed
+24 -2

No files matched your search

+21
View File
@@ -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<Layer> = 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),
+3 -2
View File
@@ -496,8 +496,9 @@ fn footer(app: &mut PhotocraftApp, picked: Option<crate::smart_ui::FilterDrag>,
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 {