From 68577e42e1e5bbcbff9fa6fc340bd4339a2f2a20 Mon Sep 17 00:00:00 2001 From: IbrahimOezhan Date: Wed, 21 Oct 2026 15:18:48 +0200 Subject: [PATCH 1/3] Image Assets: optionally keep a transparent artboard's full size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit File › Generate › Image Assets trims every asset to its visible pixels, artboards included. An opaque board background hides this, but a transparent artboard whose contents don't fill it came out cropped to the contents, losing their placement and padding on the board. Export Preferences › Image Assets: Keep Full Artboard Size (export.imageAssetsFullArtboards, off by default so existing asset sizes don't change) exports such an artboard at the board's size, transparent edges included, as File › Export › Artboards to Files does. Layers on the board are still trimmed. file.export.exportPreferences takes the new key; the label is translated in every complete catalog; docs/scorecard.md regenerated (171 preferences). Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/prefs.rs | 4 ++ crates/engine/src/web_cmds.rs | 19 ++++++--- crates/engine/src/web_cmds/tests.rs | 62 +++++++++++++++++++++++++---- crates/ui-egui/src/i18n/cs.tsv | 3 ++ crates/ui-egui/src/i18n/de.tsv | 3 ++ crates/ui-egui/src/i18n/el.tsv | 3 ++ crates/ui-egui/src/i18n/es.tsv | 3 ++ crates/ui-egui/src/i18n/fr.tsv | 3 ++ crates/ui-egui/src/i18n/hu.tsv | 3 ++ crates/ui-egui/src/i18n/id.tsv | 3 ++ crates/ui-egui/src/i18n/it.tsv | 3 ++ crates/ui-egui/src/i18n/ja.tsv | 3 ++ crates/ui-egui/src/i18n/ko.tsv | 3 ++ crates/ui-egui/src/i18n/nl.tsv | 3 ++ crates/ui-egui/src/i18n/pl.tsv | 3 ++ crates/ui-egui/src/i18n/pt-br.tsv | 3 ++ crates/ui-egui/src/i18n/ru.tsv | 3 ++ crates/ui-egui/src/i18n/sr.tsv | 3 ++ crates/ui-egui/src/i18n/tr.tsv | 3 ++ crates/ui-egui/src/i18n/uk.tsv | 3 ++ crates/ui-egui/src/i18n/vi.tsv | 3 ++ crates/ui-egui/src/i18n/zh-hans.tsv | 3 ++ crates/ui-egui/src/i18n/zh-hant.tsv | 3 ++ crates/ui-egui/src/prefs_ui.rs | 5 +++ docs/scorecard.md | 4 +- 25 files changed, 140 insertions(+), 14 deletions(-) diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs index ed8b7f148f..d9437a9c2b 100644 --- a/crates/engine/src/prefs.rs +++ b/crates/engine/src/prefs.rs @@ -496,6 +496,9 @@ pub struct Export { pub webp_quality: u32, pub metadata: ExportMetadata, pub convert_to_srgb: bool, + /// File › Generate › Image Assets exports an artboard named like an asset at the board's + /// size, transparent edges included, instead of trimming it to its visible pixels. + pub image_assets_full_artboards: bool, } impl Default for Export { @@ -508,6 +511,7 @@ impl Default for Export { webp_quality: 85, metadata: ExportMetadata::Copyright, convert_to_srgb: true, + image_assets_full_artboards: false, } } } diff --git a/crates/engine/src/web_cmds.rs b/crates/engine/src/web_cmds.rs index 755ba07320..d2734d5d24 100644 --- a/crates/engine/src/web_cmds.rs +++ b/crates/engine/src/web_cmds.rs @@ -1046,6 +1046,7 @@ fn export_preferences(s: &mut Session, p: &Value) -> Result { ("webpQuality", "export.webpQuality"), ("metadata", "export.metadata"), ("convertToSrgb", "export.convertToSrgb"), + ("imageAssetsFullArtboards", "export.imageAssetsFullArtboards"), ] { if let Some(v) = p.get(k) { values.insert(key.into(), v.clone()); @@ -1402,7 +1403,11 @@ fn asset_output_path(dir: &str, relative: &str) -> Result<(String, String)> { /// same file, the one higher in the Layers panel keeps it and the other is reported in `errors`. /// Names are compared ignoring case, as `Logo.png` and `logo.png` are one file on Windows and /// macOS. -pub fn generate_assets(doc: &Document, dir: &str) -> (Vec, Vec) { +/// +/// A layer is trimmed to its visible pixels. With `full_artboards` (Export Preferences › Image +/// Assets: Keep Full Artboard Size) an artboard keeps its board, transparent edges included, as +/// File › Export › Artboards to Files writes it. +pub fn generate_assets(doc: &Document, dir: &str, full_artboards: bool) -> (Vec, Vec) { let dpi = f64::from(doc.resolution_dpi.max(1.0)); let mut defaults: Option> = None; let mut by_layer: Vec> = Vec::new(); @@ -1434,7 +1439,11 @@ pub fn generate_assets(doc: &Document, dir: &str) -> (Vec, Vec) { if written.contains(&key) { return Err(other(format!("{rel}: another layer already writes this file; rename one of the layers"))); } - let mut one = crate::layer_menu_cmds::layer_document(doc, *id)?; + let board = if full_artboards { crate::artboard_cmds::artboard_document(doc, *id)? } else { None }; + let mut one = match board { + Some(board) => board, + None => crate::layer_menu_cmds::layer_document(doc, *id)?, + }; one.metadata = Default::default(); let (w0, h0) = (f64::from(one.size.width), f64::from(one.size.height)); // The layer's own size spec wins; default variants scale on top of it. @@ -1506,7 +1515,7 @@ fn image_assets(s: &mut Session, p: &Value) -> Result { } match dir { Some(dir) if !cfg!(target_arch = "wasm32") => { - let (files, errors) = generate_assets(&d.doc, &dir); + let (files, errors) = generate_assets(&d.doc, &dir, s.prefs().export.image_assets_full_artboards); Ok(json!({"enabled": true, "dir": dir, "files": files, "errors": errors})) } _ => Ok(json!({"enabled": true, "dir": null, "files": [], "note": "assets are written when the document is saved"})), @@ -1520,7 +1529,7 @@ pub fn on_saved(s: &Session, index: usize) -> Option { return None; } let dir = assets_dir(d.path.as_deref()?); - let (files, errors) = generate_assets(&d.doc, &dir); + let (files, errors) = generate_assets(&d.doc, &dir, s.prefs().export.image_assets_full_artboards); Some(json!({"dir": dir, "files": files, "errors": errors})) } @@ -1548,7 +1557,7 @@ pub fn specs() -> Vec { "Export Preferences…", &["File", "Export"], None, - r##"{"quickExportFormat":"png|jpg|gif|webp"?,"quickExportLocation":"ask|sameFolder"?,"jpegQuality":1..100?,"webpLossless":bool?,"webpQuality":1..100?,"metadata":"none|copyright|all"?,"convertToSrgb":bool?} → {values}"##, + r##"{"quickExportFormat":"png|jpg|gif|webp"?,"quickExportLocation":"ask|sameFolder"?,"jpegQuality":1..100?,"webpLossless":bool?,"webpQuality":1..100?,"metadata":"none|copyright|all"?,"convertToSrgb":bool?,"imageAssetsFullArtboards":bool? (Image Assets export artboards at the board's size instead of trimming transparent edges)} → {values}"##, |_| Ok(()), export_preferences ), diff --git a/crates/engine/src/web_cmds/tests.rs b/crates/engine/src/web_cmds/tests.rs index 5791e5f27c..22a66723a2 100644 --- a/crates/engine/src/web_cmds/tests.rs +++ b/crates/engine/src/web_cmds/tests.rs @@ -599,12 +599,60 @@ fn image_assets_are_generated_now_and_on_save() { d.layers.push(Layer::new("default 200% @2x", LayerContent::Group(photocraft_doc::Group { children: vec![], expanded: false, artboard: None }))); let lid = d.layers[1].id; d.layer_mut(lid).unwrap().name = "icon.png".into(); - let (files, errors) = generate_assets(&d, &dir); + let (files, errors) = generate_assets(&d, &dir, false); assert!(errors.is_empty(), "{errors:?}"); assert_eq!(files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::>(), vec![std::path::Path::new(&dir).join("icon@2x.png")]); assert_eq!(decode(&files[0]).dimensions(), (128, 80)); } +/// Export Preferences › Image Assets: Keep Full Artboard Size. A transparent artboard whose +/// contents don't fill it is trimmed to its pixels by default; with the preference on it keeps +/// the board's size, transparent edges included. Layers inside the board are still trimmed. +#[test] +fn image_assets_keep_full_artboards_when_asked() { + let dir = tmp("asset-artboards"); + let mut s = Session::new(); + s.execute("file.new", json!({"width": 64, "height": 48, "name": "boards.psd", "background": "transparent"})).unwrap(); + s.edit("board", |doc, _| { + let fmt = doc.pixel_format(); + let mut logo = Layer::raster("logo.png", fmt); + logo.surface_mut().unwrap().fill_rect(Rect::new(12, 10, 20, 16), &photocraft_raster::from_rgba(&fmt, [1.0, 0.0, 0.0, 1.0])); + let board = + photocraft_doc::Artboard { rect: Rect::new(4, 6, 44, 36), background: photocraft_doc::ArtboardBackground::Transparent, preset: String::new() }; + let group = photocraft_doc::Group { children: vec![logo], expanded: true, artboard: Some(board) }; + doc.layers = vec![Layer::new("board.png", LayerContent::Group(group))]; + Ok(()) + }) + .unwrap(); + assert!(!s.prefs().export.image_assets_full_artboards, "trimming stays the default"); + + let r = s.execute("file.generate.imageAssets", json!({"on": true, "dir": dir})).unwrap(); + assert!(r["errors"].as_array().unwrap().is_empty(), "{r}"); + assert_eq!(decode(&format!("{dir}/board.png")).dimensions(), (8, 6), "off: trimmed to the board's pixels"); + assert_eq!(decode(&format!("{dir}/logo.png")).dimensions(), (8, 6)); + + let r = s.execute("file.export.exportPreferences", json!({"imageAssetsFullArtboards": true})).unwrap(); + assert_eq!(r["values"]["imageAssetsFullArtboards"], true); + let r = s.execute("file.generate.imageAssets", json!({"on": true, "dir": dir})).unwrap(); + assert!(r["errors"].as_array().unwrap().is_empty(), "{r}"); + let board = decode(&format!("{dir}/board.png")); + assert_eq!(board.dimensions(), (40, 30), "on: the whole board"); + let px = board.to_rgba8(); + let at = |x: usize, y: usize| &px[(y * 40 + x) * 4..(y * 40 + x) * 4 + 4]; + assert_eq!(at(0, 0)[3], 0, "the board's empty corner stays transparent"); + assert_eq!(at(39, 29)[3], 0); + // The logo keeps its place on the board: document (12, 10) is board (8, 4). + assert!(at(8, 4)[0] > 250 && at(8, 4)[3] == 255, "{:?}", at(8, 4)); + assert_eq!(at(7, 4)[3], 0); + assert_eq!(decode(&format!("{dir}/logo.png")).dimensions(), (8, 6), "a layer on the board is still trimmed"); + + // Preferences saved before this setting existed load with it off. + let mut old = s.prefs().to_json(); + old["export"].as_object_mut().unwrap().remove("imageAssetsFullArtboards"); + let restored: crate::prefs::Preferences = serde_json::from_value(old).unwrap(); + assert!(!restored.export.image_assets_full_artboards); +} + /// #6614: two layers, or two default variants, naming one file never overwrite each other: the /// layer higher in the Layers panel keeps the file, whatever the case of its name, and the /// others are reported. @@ -626,7 +674,7 @@ fn image_assets_never_write_one_file_twice() { let (top, logo) = (id(&d, "Top"), id(&d, "Logo")); d.layer_mut(top).unwrap().name = "Logo.PNG".into(); d.layer_mut(logo).unwrap().name = "logo.png, logo.png".into(); - let (files, errors) = generate_assets(&d, &dir); + let (files, errors) = generate_assets(&d, &dir, false); assert_eq!(files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::>(), vec![std::path::Path::new(&dir).join("Logo.png")]); assert_eq!(decode(&files[0]).dimensions(), (4, 4), "the top layer keeps the file"); assert_eq!(errors.len(), 2, "{errors:?}"); @@ -639,7 +687,7 @@ fn image_assets_never_write_one_file_twice() { d.layer_mut(logo).unwrap().name = "Logo".into(); d.layers .push(Layer::new("default 50% + 200% + 200% @2x", LayerContent::Group(photocraft_doc::Group { children: vec![], expanded: false, artboard: None }))); - let (files, errors) = generate_assets(&d, &dir); + let (files, errors) = generate_assets(&d, &dir, false); let names: Vec<_> = files.iter().map(|p| std::path::Path::new(p).file_name().unwrap().to_string_lossy().into_owned()).collect(); assert_eq!(names, ["icon.png", "icon@2x.png"]); assert_eq!(decode(&files[0]).dimensions(), (2, 2), "the 50% variant keeps icon.png"); @@ -656,7 +704,7 @@ fn image_assets_reject_traversal_from_names_and_defaults() { let id = d.layers[1].id; d.layer_mut(id).unwrap().name = format!("nested/ok.png, ../escaped.png, ..\\backslash.png, {outside}/absolute.png, C:\\drive\\escape.png, CON.png, aux/escape.png, foo./trailing.png"); - let (files, errors) = generate_assets(&d, &dir); + let (files, errors) = generate_assets(&d, &dir, false); assert_eq!(files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::>(), vec![std::path::Path::new(&dir).join("nested").join("ok.png")]); assert_eq!(errors.len(), 7, "{errors:?}"); assert!(errors.iter().all(|e| e["error"].as_str().unwrap().contains("unsafe component")), "{errors:?}"); @@ -668,7 +716,7 @@ fn image_assets_reject_traversal_from_names_and_defaults() { "default ../ + /outside/ + ..\\bad/ + C:\\drive/ + 50% nested/", LayerContent::Group(photocraft_doc::Group { children: vec![], expanded: false, artboard: None }), )); - let (files, errors) = generate_assets(&d, &dir); + let (files, errors) = generate_assets(&d, &dir, false); assert_eq!( files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::>(), vec![std::path::Path::new(&dir).join("nested").join("safe.png")] @@ -692,7 +740,7 @@ fn image_assets_reject_existing_symlinks_in_folders_and_files() { let mut d = (*session(8).active().unwrap().doc).clone(); let id = d.layers[1].id; d.layer_mut(id).unwrap().name = "linked/new/sub.png, leaf.png, leaf.webp, good/safe.png".into(); - let (files, errors) = generate_assets(&d, &dir); + let (files, errors) = generate_assets(&d, &dir, false); assert_eq!(files, vec![format!("{dir}/good/safe.png")]); assert_eq!(errors.len(), 3, "{errors:?}"); assert!(errors.iter().all(|e| e["error"].as_str().unwrap().contains("symlink")), "{errors:?}"); @@ -703,7 +751,7 @@ fn image_assets_reject_existing_symlinks_in_folders_and_files() { let linked_root = format!("{dir}/rootlink"); std::os::unix::fs::symlink(&outside, &linked_root).unwrap(); d.layer_mut(id).unwrap().name = "root.png".into(); - let (files, errors) = generate_assets(&d, &format!("{linked_root}/")); + let (files, errors) = generate_assets(&d, &format!("{linked_root}/"), false); assert!(errors.is_empty(), "{errors:?}"); assert_eq!(files, vec![format!("{linked_root}/root.png")]); assert!(std::path::Path::new(&format!("{outside}/root.png")).is_file()); diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 15879f60d2..cfaadeb1be 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -3864,3 +3864,6 @@ navigator Zoom Zvětšení # Graphics Adapter preference (#1885) GPU adapter Adaptér GPU + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Obrazové podklady: zachovat celou velikost kreslicí plochy diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index eb3ca77944..cde6b1147c 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3259,3 +3259,6 @@ curves Smooth Glätten # Graphics Adapter preference (#1885) GPU adapter GPU-Adapter + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Bild-Assets: Volle Zeichenbereichsgröße beibehalten diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index bac53b53d6..16b237b3f3 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -3956,3 +3956,6 @@ curves Smooth Εξομάλυνση # Graphics Adapter preference (#1885) GPU adapter Προσαρμογέας GPU + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Πόροι εικόνας: διατήρηση πλήρους μεγέθους πίνακα σχεδίασης diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 8629fc3fda..bd9733ccf5 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -4218,3 +4218,6 @@ navigator Zoom Zoom # Graphics Adapter preference (#1885) GPU adapter Adaptador de GPU + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Recursos de imagen: mantener el tamaño completo de la mesa de trabajo diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index fad669a4b2..c877fdf7f6 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3265,3 +3265,6 @@ curves Smooth Lisser # Graphics Adapter preference (#1885) GPU adapter Adaptateur GPU + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Ressources d'image : conserver la taille complète du plan de travail diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index c066f42711..f5751e7f8d 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -4175,3 +4175,6 @@ cameraRaw Yellow Sárga # Graphics Adapter preference (#1885) GPU adapter GPU-adapter + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Képelemek: a rajztábla teljes méretének megtartása diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 9e0012bd64..3c94d62990 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3252,3 +3252,6 @@ curves Smooth Haluskan # Graphics Adapter preference (#1885) GPU adapter Adaptor GPU + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Aset Gambar: Pertahankan Ukuran Penuh Artboard diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index fe8d4cf8dd..076de24647 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -4373,3 +4373,6 @@ shape Appearance Aspetto # Graphics Adapter preference (#1885) GPU adapter Adattatore GPU + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Risorse immagine: mantieni la dimensione intera della tavola da disegno diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 9b121c4c90..5d1e57a25a 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3934,3 +3934,6 @@ curves Smooth スムーズ # Graphics Adapter preference (#1885) GPU adapter GPU アダプター + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size 画像アセット: アートボード全体のサイズを保持 diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index dc4bf58c95..7dffb72407 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3440,3 +3440,6 @@ curves Smooth 매끄럽게 # Graphics Adapter preference (#1885) GPU adapter GPU 어댑터 + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size 이미지 에셋: 전체 아트보드 크기 유지 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 7104d69eda..f49f873d9e 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4016,3 +4016,6 @@ curves Smooth Vloeiend maken # Graphics Adapter preference (#1885) GPU adapter GPU-adapter + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Afbeeldingsmiddelen: volledige tekengebiedgrootte behouden diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 8abed62baa..95a9ab3e12 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -3856,3 +3856,6 @@ curves Smooth Wygładź # Graphics Adapter preference (#1885) GPU adapter Karta GPU + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Zasoby obrazów: zachowaj pełny rozmiar obszaru roboczego diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index b21564e683..d2d75c8a21 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -4046,3 +4046,6 @@ layerLabel No Color Sem cor # Graphics Adapter preference (#1885) GPU adapter Adaptador de GPU + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Recursos de imagem: manter o tamanho completo da prancheta diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index ff6fc08de8..8ff569aafb 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3231,3 +3231,6 @@ curves Smooth Сгладить # Graphics Adapter preference (#1885) GPU adapter Адаптер GPU + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Ресурсы изображений: сохранять полный размер монтажной области diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv index 9a1ceff635..957b7bdbbe 100644 --- a/crates/ui-egui/src/i18n/sr.tsv +++ b/crates/ui-egui/src/i18n/sr.tsv @@ -4329,3 +4329,6 @@ shape Appearance Izgled # Graphics Adapter preference (#1885) GPU adapter GPU adapter + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Slikovni resursi: zadrži punu veličinu radne table diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index def688abcd..ad4881300d 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3986,3 +3986,6 @@ cameraData Lens Lens # Graphics Adapter preference (#1885) GPU adapter GPU bağdaştırıcısı + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Resim Varlıkları: Tam çalışma yüzeyi boyutunu koru diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index e28ea0008c..878f2543e3 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3965,3 +3965,6 @@ curves Smooth Згладити # Graphics Adapter preference (#1885) GPU adapter Адаптер GPU + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Ресурси зображення: зберігати повний розмір монтажної області diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 503cc1006f..63855349d0 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3744,3 +3744,6 @@ curves Smooth Làm mượt # Graphics Adapter preference (#1885) GPU adapter Bộ điều hợp GPU + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size Tài nguyên ảnh: Giữ nguyên kích thước bảng vẽ diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index a030a8885f..484ac48da0 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -2882,3 +2882,6 @@ curves Smooth 平滑 # Graphics Adapter preference (#1885) GPU adapter GPU 适配器 + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size 图像资源:保留完整画板大小 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 25a05a1826..a7738bdbea 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -2867,3 +2867,6 @@ curves Smooth 平滑 # Graphics Adapter preference (#1885) GPU adapter GPU 介面卡 + +# Export Preferences › Image Assets: Keep Full Artboard Size + Image Assets: Keep Full Artboard Size 影像資產:保留完整工作區域大小 diff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rs index 5cd2e547d8..8388210bc9 100644 --- a/crates/ui-egui/src/prefs_ui.rs +++ b/crates/ui-egui/src/prefs_ui.rs @@ -1141,6 +1141,10 @@ fn humanize(key: &str) -> String { if key == "webpQuality" { return "Quality".into(); } + // File › Generate › Image Assets keeps a transparent artboard's full board instead of trimming it. + if key == "imageAssetsFullArtboards" { + return "Image Assets: Keep Full Artboard Size".into(); + } // The auto-hide notice settings read best with their own labels (Interface › Notification, #2022). if key == "notificationAutoHide" { return "Auto Hide Notifications".into(); @@ -2640,6 +2644,7 @@ mod tests { assert!(export_field_visible(&obj, "webpQuality")); assert_eq!(humanize("webpLossless"), "Lossless"); assert_eq!(humanize("webpQuality"), "Quality"); + assert_eq!(humanize("imageAssetsFullArtboards"), "Image Assets: Keep Full Artboard Size"); } #[test] diff --git a/docs/scorecard.md b/docs/scorecard.md index 42ae824b4d..dd46004711 100644 --- a/docs/scorecard.md +++ b/docs/scorecard.md @@ -9,7 +9,7 @@ Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.js | [Performance](#performance) | 3 | 22 | 25 | 59 scenarios: 3 within budget, 22 over budget or failing, 9 tracked only, 20 not run, 5 not measurable yet (baseline 2026-10-05) | | [File compatibility](#file-compatibility) | 7 | 14 | 6 | io corpus: oracle ≥ 148/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 249/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 188/256, round trip ≥ 258/256 | | [Tools](#tools) | 33 | 11 | 0 | | -| [Workspace and UI](#workspace-and-ui) | 13 | 6 | 4 | settings that do nothing: 26 of 170 (target 0) | +| [Workspace and UI](#workspace-and-ui) | 13 | 6 | 4 | settings that do nothing: 26 of 171 (target 0) | | [Type](#type) | 4 | 3 | 2 | | | [Automation](#automation) | 5 | 2 | 4 | 631 of 631 menu items live (100.0%) | | [Reliability](#reliability) | 5 | 2 | 0 | never-crash lints on 30 of 30 crates; panic_hunt present | @@ -180,7 +180,7 @@ Corpus floors (`crates/io/tests/corpus.rs`): the enforced minimums; the corpus t ## Workspace and UI -**Settings that do nothing: 26 of 170** (target 0, #204). Counted by the prefs audit (`xtask/src/scorecard.rs`): a `Preferences` field counts as read when code outside the prefs model (`prefs.rs` except its `impl Session` blocks; tests excluded; the schema-driven dialog never names a field) accesses `section.field`, or `.section` and `.field` in the same file, or calls a section method that reads `self.field`. It is a heuristic lower bound: a generic name can look read when it isn't. +**Settings that do nothing: 26 of 171** (target 0, #204). Counted by the prefs audit (`xtask/src/scorecard.rs`): a `Preferences` field counts as read when code outside the prefs model (`prefs.rs` except its `impl Session` blocks; tests excluded; the schema-driven dialog never names a field) accesses `section.field`, or `.section` and `.field` in the same file, or calls a section method that reads `self.field`. It is a heuristic lower bound: a generic name can look read when it isn't. Unread: `general.color_picker`, `general.animated_zoom`, `general.zoom_resizes_windows`, `workspace.auto_show_hidden_panels`, `workspace.enable_floating_document_window_docking`, `file_handling.save_in_background`, `performance.cache_levels`, `performance.gpu_adapter`, `performance.legacy_compositing`, `scratch_disks.disks`, `units_and_rulers.column_width`, `units_and_rulers.gutter`, `plug_ins.show_extension_panels`, `plug_ins.allow_scripts_to_connect`, `plug_ins.generator_enabled`, `type_.text_engine`, `type_.recent_fonts`, `enhanced_controls.scrubby_slider_acceleration`, `raw_defaults.color_space`, `raw_defaults.bit_depth`, `raw_defaults.resolution`, `raw_defaults.sharpen_for`, `raw_defaults.open_as_smart_object`, `raw_defaults.apply_auto_tone`, `integrations.allow_agent_control`, `integrations.control_port`. From c0492f2303c31cfb9e108e5dc8b2cee4fd88053c Mon Sep 17 00:00:00 2001 From: IbrahimOezhan Date: Wed, 21 Oct 2026 15:53:54 +0200 Subject: [PATCH 2/3] Document the Export Preferences, Image Assets and preference-label helpers export_preferences, image_assets and humanize had no doc comments; the review's docstring check counts them as functions this change touches. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/web_cmds.rs | 4 ++++ crates/ui-egui/src/prefs_ui.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/crates/engine/src/web_cmds.rs b/crates/engine/src/web_cmds.rs index d2734d5d24..ff0a29df9d 100644 --- a/crates/engine/src/web_cmds.rs +++ b/crates/engine/src/web_cmds.rs @@ -1035,6 +1035,8 @@ fn save_for_web_impl(s: &mut Session, p: &Value, write: &mut dyn FnMut(&str, &[u // ---------- Export Preferences / Quick Export ---------- +/// File › Export › Export Preferences…: sets the given `export.*` preferences through `prefs.set` +/// (validated like any other preference) and returns the whole section. fn export_preferences(s: &mut Session, p: &Value) -> Result { let cmd = "file.export.exportPreferences"; let mut values = serde_json::Map::new(); @@ -1496,6 +1498,8 @@ pub fn assets_dir(doc_path: &str) -> String { join(&dir, &format!("{}-assets", stem(doc_path))) } +/// File › Generate › Image Assets: toggles generation for the active document (or sets it with +/// `on`) and, when it is on and the output folder is known, writes the assets now. fn image_assets(s: &mut Session, p: &Value) -> Result { let d = s.active().ok_or(EngineError::NoDocument)?; let id: DocId = d.doc.id; diff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rs index 8388210bc9..3c3f6307a4 100644 --- a/crates/ui-egui/src/prefs_ui.rs +++ b/crates/ui-egui/src/prefs_ui.rs @@ -1126,6 +1126,8 @@ fn gpu_memory_lines(app: &PhotocraftApp) -> Vec { v } +/// The label a preference key shows in the dialog: a few keys have their own wording, the rest +/// split camelCase into words (`convertToSrgb` → "Convert to srgb"). fn humanize(key: &str) -> String { match key { "appearanceMode" => return "Appearance Mode".into(), From 4e801502003519e8a3ac220356a9106bbfe3a74f Mon Sep 17 00:00:00 2001 From: David Mann Date: Thu, 22 Oct 2026 21:14:56 +0200 Subject: [PATCH 3/3] Integration: export artboard assets at the full board, no preference (#8254) Photoshop's Generator always exports an artboard named like an asset at the board's bounds (generator-assets renderer: canvasBounds = layer.artboard), with no setting. The PR put that behind a new Export preference that defaulted to the trimmed, non-Photoshop output. Image Assets now always tries artboard_document first and falls back to layer_document; the preference, its dialog label and its 20 translations are gone (scorecard prefs back to main's 21 of 176). Test: image_assets_keep_full_artboards writes a transparent 40x30 artboard with an 8x6 logo through file.generate.imageAssets and expects board.png at 40x30 (the trimmed path gives 8x6) and logo.png still trimmed to 8x6. Co-authored-by: IbrahimOezhan <89545837+IbrahimOezhan@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 (1M context) --- crates/engine/src/prefs.rs | 4 --- crates/engine/src/web_cmds.rs | 18 ++++++-------- crates/engine/src/web_cmds/tests.rs | 38 +++++++++-------------------- crates/ui-egui/src/i18n/cs.tsv | 3 --- crates/ui-egui/src/i18n/de.tsv | 3 --- crates/ui-egui/src/i18n/el.tsv | 3 --- crates/ui-egui/src/i18n/es.tsv | 3 --- crates/ui-egui/src/i18n/fr.tsv | 3 --- crates/ui-egui/src/i18n/hu.tsv | 3 --- crates/ui-egui/src/i18n/id.tsv | 3 --- crates/ui-egui/src/i18n/it.tsv | 3 --- crates/ui-egui/src/i18n/ja.tsv | 3 --- crates/ui-egui/src/i18n/ko.tsv | 3 --- crates/ui-egui/src/i18n/nl.tsv | 3 --- crates/ui-egui/src/i18n/pl.tsv | 3 --- crates/ui-egui/src/i18n/pt-br.tsv | 3 --- crates/ui-egui/src/i18n/ru.tsv | 3 --- crates/ui-egui/src/i18n/sr.tsv | 3 --- crates/ui-egui/src/i18n/tr.tsv | 3 --- crates/ui-egui/src/i18n/uk.tsv | 3 --- crates/ui-egui/src/i18n/vi.tsv | 3 --- crates/ui-egui/src/i18n/zh-hans.tsv | 3 --- crates/ui-egui/src/i18n/zh-hant.tsv | 3 --- crates/ui-egui/src/prefs_ui.rs | 5 ---- 24 files changed, 20 insertions(+), 105 deletions(-) diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs index 4843e1c9d8..a34bda68e9 100644 --- a/crates/engine/src/prefs.rs +++ b/crates/engine/src/prefs.rs @@ -519,9 +519,6 @@ pub struct Export { pub webp_quality: u32, pub metadata: ExportMetadata, pub convert_to_srgb: bool, - /// File › Generate › Image Assets exports an artboard named like an asset at the board's - /// size, transparent edges included, instead of trimming it to its visible pixels. - pub image_assets_full_artboards: bool, } impl Default for Export { @@ -534,7 +531,6 @@ impl Default for Export { webp_quality: 85, metadata: ExportMetadata::Copyright, convert_to_srgb: true, - image_assets_full_artboards: false, } } } diff --git a/crates/engine/src/web_cmds.rs b/crates/engine/src/web_cmds.rs index 7d97a270a6..bba243c225 100644 --- a/crates/engine/src/web_cmds.rs +++ b/crates/engine/src/web_cmds.rs @@ -1037,7 +1037,6 @@ fn export_preferences(s: &mut Session, p: &Value) -> Result { ("webpQuality", "export.webpQuality"), ("metadata", "export.metadata"), ("convertToSrgb", "export.convertToSrgb"), - ("imageAssetsFullArtboards", "export.imageAssetsFullArtboards"), ] { if let Some(v) = p.get(k) { values.insert(key.into(), v.clone()); @@ -1405,10 +1404,10 @@ fn asset_output_path(dir: &str, relative: &str) -> Result<(String, String)> { /// Names are compared ignoring case, as `Logo.png` and `logo.png` are one file on Windows and /// macOS. /// -/// A layer is trimmed to its visible pixels. With `full_artboards` (Export Preferences › Image -/// Assets: Keep Full Artboard Size) an artboard keeps its board, transparent edges included, as -/// File › Export › Artboards to Files writes it. -pub fn generate_assets(doc: &Document, dir: &str, full_artboards: bool) -> (Vec, Vec) { +/// A layer is trimmed to its visible pixels; an artboard keeps its whole board, transparent edges +/// included, as File › Export › Artboards to Files writes it (Photoshop's Generator exports an +/// artboard asset at the board's bounds). +pub fn generate_assets(doc: &Document, dir: &str) -> (Vec, Vec) { let dpi = f64::from(doc.resolution_dpi.max(1.0)); let mut defaults: Option> = None; let mut by_layer: Vec> = Vec::new(); @@ -1440,8 +1439,7 @@ pub fn generate_assets(doc: &Document, dir: &str, full_artboards: bool) -> (Vec< if written.contains(&key) { return Err(other(format!("{rel}: another layer already writes this file; rename one of the layers"))); } - let board = if full_artboards { crate::artboard_cmds::artboard_document(doc, *id)? } else { None }; - let mut one = match board { + let mut one = match crate::artboard_cmds::artboard_document(doc, *id)? { Some(board) => board, None => crate::layer_menu_cmds::layer_document(doc, *id)?, }; @@ -1518,7 +1516,7 @@ fn image_assets(s: &mut Session, p: &Value) -> Result { } match dir { Some(dir) if !cfg!(target_arch = "wasm32") => { - let (files, errors) = generate_assets(&d.doc, &dir, s.prefs().export.image_assets_full_artboards); + let (files, errors) = generate_assets(&d.doc, &dir); Ok(json!({"enabled": true, "dir": dir, "files": files, "errors": errors})) } _ => Ok(json!({"enabled": true, "dir": null, "files": [], "note": "assets are written when the document is saved"})), @@ -1532,7 +1530,7 @@ pub fn on_saved(s: &Session, index: usize) -> Option { return None; } let dir = assets_dir(d.path.as_deref()?); - let (files, errors) = generate_assets(&d.doc, &dir, s.prefs().export.image_assets_full_artboards); + let (files, errors) = generate_assets(&d.doc, &dir); Some(json!({"dir": dir, "files": files, "errors": errors})) } @@ -1560,7 +1558,7 @@ pub fn specs() -> Vec { "Export Preferences…", &["File", "Export"], None, - r##"{"quickExportFormat":"png|jpg|gif|webp|exr"?,"quickExportLocation":"ask|sameFolder"?,"jpegQuality":1..100?,"webpLossless":bool?,"webpQuality":1..100?,"metadata":"none|copyright|all"?,"convertToSrgb":bool?,"imageAssetsFullArtboards":bool? (Image Assets export artboards at the board's size instead of trimming transparent edges)} → {values}"##, + r##"{"quickExportFormat":"png|jpg|gif|webp|exr"?,"quickExportLocation":"ask|sameFolder"?,"jpegQuality":1..100?,"webpLossless":bool?,"webpQuality":1..100?,"metadata":"none|copyright|all"?,"convertToSrgb":bool?} → {values}"##, |_| Ok(()), export_preferences ), diff --git a/crates/engine/src/web_cmds/tests.rs b/crates/engine/src/web_cmds/tests.rs index 1d893f2d52..4de2d43b9a 100644 --- a/crates/engine/src/web_cmds/tests.rs +++ b/crates/engine/src/web_cmds/tests.rs @@ -639,17 +639,17 @@ fn image_assets_are_generated_now_and_on_save() { d.layers.push(Layer::new("default 200% @2x", LayerContent::Group(photocraft_doc::Group { children: vec![], expanded: false, artboard: None }))); let lid = d.layers[1].id; d.layer_mut(lid).unwrap().name = "icon.png".into(); - let (files, errors) = generate_assets(&d, &dir, false); + let (files, errors) = generate_assets(&d, &dir); assert!(errors.is_empty(), "{errors:?}"); assert_eq!(files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::>(), vec![std::path::Path::new(&dir).join("icon@2x.png")]); assert_eq!(decode(&files[0]).dimensions(), (128, 80)); } -/// Export Preferences › Image Assets: Keep Full Artboard Size. A transparent artboard whose -/// contents don't fill it is trimmed to its pixels by default; with the preference on it keeps -/// the board's size, transparent edges included. Layers inside the board are still trimmed. +/// Photoshop's Generator exports an artboard named like an asset at the board's size, transparent +/// edges included (generator-assets renderer: the canvas bounds are the artboard's), with no +/// preference. Layers inside the board are still trimmed to their pixels. #[test] -fn image_assets_keep_full_artboards_when_asked() { +fn image_assets_keep_full_artboards() { let dir = tmp("asset-artboards"); let mut s = Session::new(); s.execute("file.new", json!({"width": 64, "height": 48, "name": "boards.psd", "background": "transparent"})).unwrap(); @@ -664,19 +664,11 @@ fn image_assets_keep_full_artboards_when_asked() { Ok(()) }) .unwrap(); - assert!(!s.prefs().export.image_assets_full_artboards, "trimming stays the default"); - let r = s.execute("file.generate.imageAssets", json!({"on": true, "dir": dir})).unwrap(); - assert!(r["errors"].as_array().unwrap().is_empty(), "{r}"); - assert_eq!(decode(&format!("{dir}/board.png")).dimensions(), (8, 6), "off: trimmed to the board's pixels"); - assert_eq!(decode(&format!("{dir}/logo.png")).dimensions(), (8, 6)); - - let r = s.execute("file.export.exportPreferences", json!({"imageAssetsFullArtboards": true})).unwrap(); - assert_eq!(r["values"]["imageAssetsFullArtboards"], true); let r = s.execute("file.generate.imageAssets", json!({"on": true, "dir": dir})).unwrap(); assert!(r["errors"].as_array().unwrap().is_empty(), "{r}"); let board = decode(&format!("{dir}/board.png")); - assert_eq!(board.dimensions(), (40, 30), "on: the whole board"); + assert_eq!(board.dimensions(), (40, 30), "the whole board, not its trimmed pixels"); let px = board.to_rgba8(); let at = |x: usize, y: usize| &px[(y * 40 + x) * 4..(y * 40 + x) * 4 + 4]; assert_eq!(at(0, 0)[3], 0, "the board's empty corner stays transparent"); @@ -685,12 +677,6 @@ fn image_assets_keep_full_artboards_when_asked() { assert!(at(8, 4)[0] > 250 && at(8, 4)[3] == 255, "{:?}", at(8, 4)); assert_eq!(at(7, 4)[3], 0); assert_eq!(decode(&format!("{dir}/logo.png")).dimensions(), (8, 6), "a layer on the board is still trimmed"); - - // Preferences saved before this setting existed load with it off. - let mut old = s.prefs().to_json(); - old["export"].as_object_mut().unwrap().remove("imageAssetsFullArtboards"); - let restored: crate::prefs::Preferences = serde_json::from_value(old).unwrap(); - assert!(!restored.export.image_assets_full_artboards); } /// #6614: two layers, or two default variants, naming one file never overwrite each other: the @@ -714,7 +700,7 @@ fn image_assets_never_write_one_file_twice() { let (top, logo) = (id(&d, "Top"), id(&d, "Logo")); d.layer_mut(top).unwrap().name = "Logo.PNG".into(); d.layer_mut(logo).unwrap().name = "logo.png, logo.png".into(); - let (files, errors) = generate_assets(&d, &dir, false); + let (files, errors) = generate_assets(&d, &dir); assert_eq!(files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::>(), vec![std::path::Path::new(&dir).join("Logo.png")]); assert_eq!(decode(&files[0]).dimensions(), (4, 4), "the top layer keeps the file"); assert_eq!(errors.len(), 2, "{errors:?}"); @@ -727,7 +713,7 @@ fn image_assets_never_write_one_file_twice() { d.layer_mut(logo).unwrap().name = "Logo".into(); d.layers .push(Layer::new("default 50% + 200% + 200% @2x", LayerContent::Group(photocraft_doc::Group { children: vec![], expanded: false, artboard: None }))); - let (files, errors) = generate_assets(&d, &dir, false); + let (files, errors) = generate_assets(&d, &dir); let names: Vec<_> = files.iter().map(|p| std::path::Path::new(p).file_name().unwrap().to_string_lossy().into_owned()).collect(); assert_eq!(names, ["icon.png", "icon@2x.png"]); assert_eq!(decode(&files[0]).dimensions(), (2, 2), "the 50% variant keeps icon.png"); @@ -744,7 +730,7 @@ fn image_assets_reject_traversal_from_names_and_defaults() { let id = d.layers[1].id; d.layer_mut(id).unwrap().name = format!("nested/ok.png, ../escaped.png, ..\\backslash.png, {outside}/absolute.png, C:\\drive\\escape.png, CON.png, aux/escape.png, foo./trailing.png"); - let (files, errors) = generate_assets(&d, &dir, false); + let (files, errors) = generate_assets(&d, &dir); assert_eq!(files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::>(), vec![std::path::Path::new(&dir).join("nested").join("ok.png")]); assert_eq!(errors.len(), 7, "{errors:?}"); assert!(errors.iter().all(|e| e["error"].as_str().unwrap().contains("unsafe component")), "{errors:?}"); @@ -756,7 +742,7 @@ fn image_assets_reject_traversal_from_names_and_defaults() { "default ../ + /outside/ + ..\\bad/ + C:\\drive/ + 50% nested/", LayerContent::Group(photocraft_doc::Group { children: vec![], expanded: false, artboard: None }), )); - let (files, errors) = generate_assets(&d, &dir, false); + let (files, errors) = generate_assets(&d, &dir); assert_eq!( files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::>(), vec![std::path::Path::new(&dir).join("nested").join("safe.png")] @@ -780,7 +766,7 @@ fn image_assets_reject_existing_symlinks_in_folders_and_files() { let mut d = (*session(8).active().unwrap().doc).clone(); let id = d.layers[1].id; d.layer_mut(id).unwrap().name = "linked/new/sub.png, leaf.png, leaf.webp, good/safe.png".into(); - let (files, errors) = generate_assets(&d, &dir, false); + let (files, errors) = generate_assets(&d, &dir); assert_eq!(files, vec![format!("{dir}/good/safe.png")]); assert_eq!(errors.len(), 3, "{errors:?}"); assert!(errors.iter().all(|e| e["error"].as_str().unwrap().contains("symlink")), "{errors:?}"); @@ -791,7 +777,7 @@ fn image_assets_reject_existing_symlinks_in_folders_and_files() { let linked_root = format!("{dir}/rootlink"); std::os::unix::fs::symlink(&outside, &linked_root).unwrap(); d.layer_mut(id).unwrap().name = "root.png".into(); - let (files, errors) = generate_assets(&d, &format!("{linked_root}/"), false); + let (files, errors) = generate_assets(&d, &format!("{linked_root}/")); assert!(errors.is_empty(), "{errors:?}"); assert_eq!(files, vec![format!("{linked_root}/root.png")]); assert!(std::path::Path::new(&format!("{outside}/root.png")).is_file()); diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 6076fce1bc..3cbbfe672b 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4107,9 +4107,6 @@ cameraRaw Dehaze Odstranění oparu # Graphics Adapter preference (#1885) GPU adapter Adaptér GPU - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Obrazové podklady: zachovat celou velikost kreslicí plochy # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Nejprve potvrďte nebo zrušte otevřený dialog kroku akce Pro Medium Gray Pro (středně šedý) diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index e419c29ac4..cecf610a2b 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3373,9 +3373,6 @@ curves Smooth Glätten # Graphics Adapter preference (#1885) GPU adapter GPU-Adapter - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Bild-Assets: Volle Zeichenbereichsgröße beibehalten # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Bestätige oder brich zuerst den offenen Dialog des Aktionsschritts ab Pro Medium Gray Pro (Mittelgrau) diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 72196e9537..40069a334f 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -4062,9 +4062,6 @@ curves Smooth Εξομάλυνση # Graphics Adapter preference (#1885) GPU adapter Προσαρμογέας GPU - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Πόροι εικόνας: διατήρηση πλήρους μεγέθους πίνακα σχεδίασης # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Επιβεβαιώστε ή ακυρώστε πρώτα το ανοιχτό παράθυρο βήματος της ενέργειας Pro Medium Gray Pro μεσαίου γκρι diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index ef4d78119f..e0cf3a62e9 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -4324,9 +4324,6 @@ navigator Zoom Zoom # Graphics Adapter preference (#1885) GPU adapter Adaptador de GPU - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Recursos de imagen: mantener el tamaño completo de la mesa de trabajo # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Confirme o cancele primero el cuadro de diálogo abierto del paso de la acción Pro Medium Gray Pro (gris medio) diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 887bcb60c2..b6df1c135b 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3373,9 +3373,6 @@ curves Smooth Lisser # Graphics Adapter preference (#1885) GPU adapter Adaptateur GPU - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Ressources d'image : conserver la taille complète du plan de travail # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Validez ou annulez d’abord la boîte de dialogue ouverte de l’étape de l’action Pro Medium Gray Pro gris moyen diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 7ff02c8668..cf66b32534 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -4278,9 +4278,6 @@ cameraRaw Yellow Sárga # Graphics Adapter preference (#1885) GPU adapter GPU-adapter - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Képelemek: a rajztábla teljes méretének megtartása # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Előbb hagyd jóvá vagy vond vissza a művelet lépésének nyitott párbeszédablakát Pro Medium Gray Pro középszürke diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index fe5f8d6294..6198dd099b 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3376,9 +3376,6 @@ curves Smooth Haluskan # Graphics Adapter preference (#1885) GPU adapter Adaptor GPU - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Aset Gambar: Pertahankan Ukuran Penuh Artboard # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Konfirmasi atau batalkan dulu dialog langkah tindakan yang terbuka Pro Medium Gray Pro Abu-abu Sedang diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 310f00251f..a7b7c85381 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -4479,9 +4479,6 @@ shape Appearance Aspetto # Graphics Adapter preference (#1885) GPU adapter Adattatore GPU - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Risorse immagine: mantieni la dimensione intera della tavola da disegno # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Conferma o annulla prima la finestra di dialogo aperta del passo dell’azione Pro Medium Gray Pro grigio medio diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 04b0cf659a..214a56fd93 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -4040,9 +4040,6 @@ curves Smooth スムーズ # Graphics Adapter preference (#1885) GPU adapter GPU アダプター - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size 画像アセット: アートボード全体のサイズを保持 # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first 先に開いているアクションのステップのダイアログを確定またはキャンセルしてください Pro Medium Gray プロ(中間グレー) diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 534eed4d34..00bf8dff22 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3571,9 +3571,6 @@ curves Smooth 매끄럽게 # Graphics Adapter preference (#1885) GPU adapter GPU 어댑터 - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size 이미지 에셋: 전체 아트보드 크기 유지 # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first 먼저 열려 있는 액션 단계 대화 상자를 확인하거나 취소하세요 Pro Medium Gray 프로 중간 회색 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 71e5b5b28a..472dab3980 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4122,9 +4122,6 @@ curves Smooth Vloeiend maken # Graphics Adapter preference (#1885) GPU adapter GPU-adapter - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Afbeeldingsmiddelen: volledige tekengebiedgrootte behouden # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Bevestig of annuleer eerst het geopende dialoogvenster van de handelingsstap Pro Medium Gray Pro middelgrijs diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index a30dfa6a30..5744be49df 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -3978,9 +3978,6 @@ curves Smooth Wygładź # Graphics Adapter preference (#1885) GPU adapter Karta GPU - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Zasoby obrazów: zachowaj pełny rozmiar obszaru roboczego # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Najpierw zatwierdź lub anuluj otwarte okno kroku operacji Pro Medium Gray Pro (średni szary) diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index f63f22ca76..67964ad894 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -4152,9 +4152,6 @@ layerLabel No Color Sem cor # Graphics Adapter preference (#1885) GPU adapter Adaptador de GPU - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Recursos de imagem: manter o tamanho completo da prancheta # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Confirme ou cancele primeiro a caixa de diálogo aberta da etapa da ação diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 3d81fa23b7..791dcf8fb8 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3843,9 +3843,6 @@ curves Smooth Сгладить # Graphics Adapter preference (#1885) GPU adapter Адаптер GPU - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Ресурсы изображений: сохранять полный размер монтажной области # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Сначала подтвердите или отмените открытый диалог шага операции Pro Medium Gray Средне-серая Pro diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv index 656289647a..9695ced464 100644 --- a/crates/ui-egui/src/i18n/sr.tsv +++ b/crates/ui-egui/src/i18n/sr.tsv @@ -4434,9 +4434,6 @@ shape Appearance Izgled # Graphics Adapter preference (#1885) GPU adapter GPU adapter - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Slikovni resursi: zadrži punu veličinu radne table # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Prvo potvrdite ili otkažite otvoreni dijalog koraka radnje Pro Medium Gray Pro srednje siva diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index efd25813cb..342a0ebff4 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -4092,9 +4092,6 @@ cameraData Lens Lens # Graphics Adapter preference (#1885) GPU adapter GPU bağdaştırıcısı - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Resim Varlıkları: Tam çalışma yüzeyi boyutunu koru # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Önce açık eylem adımı iletişim kutusunu onaylayın veya iptal edin Pro Medium Gray Pro Orta Gri diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index f82522a800..a96f028048 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -4071,9 +4071,6 @@ curves Smooth Згладити # Graphics Adapter preference (#1885) GPU adapter Адаптер GPU - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Ресурси зображення: зберігати повний розмір монтажної області # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Спочатку підтвердьте або скасуйте відкритий діалог кроку операції Pro Medium Gray Середньосіра «Профі» diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 5bbb4391f8..9c7155fe0d 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3854,9 +3854,6 @@ curves Smooth Làm mượt # Graphics Adapter preference (#1885) GPU adapter Bộ điều hợp GPU - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size Tài nguyên ảnh: Giữ nguyên kích thước bảng vẽ # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first Hãy xác nhận hoặc hủy hộp thoại bước hành động đang mở trước Pro Medium Gray Pro xám vừa diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 791c4ccf9d..c1630ad97c 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3021,9 +3021,6 @@ curves Smooth 平滑 # Graphics Adapter preference (#1885) GPU adapter GPU 适配器 - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size 图像资源:保留完整画板大小 # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first 请先确认或取消打开的动作步骤对话框 Pro Medium Gray 专业中灰 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index a1bf6696db..0771327a40 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -2985,9 +2985,6 @@ curves Smooth 平滑 # Graphics Adapter preference (#1885) GPU adapter GPU 介面卡 - -# Export Preferences › Image Assets: Keep Full Artboard Size - Image Assets: Keep Full Artboard Size 影像資產:保留完整工作區域大小 # Actions: a step dialog holds a suspended recording (#7365) Confirm or cancel the open action step dialog first 請先確認或取消開啟中的動作步驟對話框 Pro Medium Gray 專業中灰 diff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rs index ed02833474..5899fc51bd 100644 --- a/crates/ui-egui/src/prefs_ui.rs +++ b/crates/ui-egui/src/prefs_ui.rs @@ -1214,10 +1214,6 @@ fn humanize(key: &str) -> String { if key == "webpQuality" { return "Quality".into(); } - // File › Generate › Image Assets keeps a transparent artboard's full board instead of trimming it. - if key == "imageAssetsFullArtboards" { - return "Image Assets: Keep Full Artboard Size".into(); - } // The auto-hide notice settings read best with their own labels (Interface › Notification, #2022). if key == "notificationAutoHide" { return "Auto Hide Notifications".into(); @@ -2736,7 +2732,6 @@ mod tests { assert!(export_field_visible(&obj, "webpQuality")); assert_eq!(humanize("webpLossless"), "Lossless"); assert_eq!(humanize("webpQuality"), "Quality"); - assert_eq!(humanize("imageAssetsFullArtboards"), "Image Assets: Keep Full Artboard Size"); obj.insert("quickExportFormat".into(), json!("exr")); for key in ["jpegQuality", "webpLossless", "webpQuality", "convertToSrgb", "metadata"] { assert!(!export_field_visible(&obj, key), "EXR must not offer ignored web settings: {key}");