From 85630ee441e308f8914cc834c9b9cdcb28ab403e Mon Sep 17 00:00:00 2001 From: RickiNano <81099017+RickiNano@users.noreply.github.com> Date: Sat, 14 Nov 2026 20:59:01 +0100 Subject: [PATCH] New Document: another tab's preset unticks only Artboards a preset ticked (#14042) A Photo, Print, Art & Illustration or Film & Video preset turned Artboards off even when the user had ticked it by hand. That case wasn't measured, so it keeps today's behaviour: the dialog now remembers when a Web or Mobile preset ticked the box and turns off only that. --- crates/ui-egui/src/dialogs/new_doc_ui.rs | 21 +++++-- .../src/new_doc_web_artboards_tests.rs | 63 +++++++++++++++++-- 2 files changed, 73 insertions(+), 11 deletions(-) diff --git a/crates/ui-egui/src/dialogs/new_doc_ui.rs b/crates/ui-egui/src/dialogs/new_doc_ui.rs index 7c4aad1e68..49c6acd485 100644 --- a/crates/ui-egui/src/dialogs/new_doc_ui.rs +++ b/crates/ui-egui/src/dialogs/new_doc_ui.rs @@ -221,10 +221,15 @@ pub fn at_pref_resolutions(p: &Preset, units: &UnitsAndRulers) -> Preset { /// The category tabs whose presets start the document as an artboard, as in Photoshop (#14042). const ARTBOARD_CATEGORIES: &[&str] = &["Web", "Mobile"]; +/// Set when a Web or Mobile preset ticked Artboards, so a preset of another tab unticks only that +/// and never a box ticked by hand (#14042). +const PRESET_ARTBOARD: &str = "__presetArtboard"; + /// Apply a built-in preset (at the preference resolutions, see [`at_pref_resolutions`]) to the /// dialog fields. A preset of the category tab picked in `__category` also sets Artboards: on for -/// Web and Mobile, off for the other tabs (#14042). Recent's built-in cards and the Clipboard -/// preset leave it as it is. +/// Web and Mobile; the other tabs turn it back off when a Web or Mobile preset turned it on, and +/// leave a box ticked by hand as it is (#14042). Recent's built-in cards and the Clipboard preset +/// leave it as it is. pub fn apply_preset(f: &mut Map, p: &Preset, units: &UnitsAndRulers) { let (name, w, h, ppi) = at_pref_resolutions(p, units); let unit = preset_unit(p, f); @@ -238,13 +243,17 @@ pub fn apply_preset(f: &mut Map, p: &Preset, units: &UnitsAndRule f.insert("__unit".into(), json!(unit)); match tab { Some((tab, _)) if ARTBOARD_CATEGORIES.contains(tab) => { - f.insert("artboard".into(), json!(true)); + if f.get("artboard").and_then(Value::as_bool) != Some(true) { + f.insert("artboard".into(), json!(true)); + f.insert(PRESET_ARTBOARD.into(), json!(true)); + } } // Off is the checkbox's and `file.new`'s default. - Some(_) => { + Some(_) if f.contains_key(PRESET_ARTBOARD) => { + f.remove(PRESET_ARTBOARD); f.remove("artboard"); } - None => {} + _ => {} } } @@ -722,6 +731,8 @@ pub fn body(app: &mut crate::PhotocraftApp, ui: &mut egui::Ui, f: &mut Map