PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Add fixed UI scale steps from 75% to 300% (#611)
Sirsyorrze77325bd4a2b
diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rsindex 70e3316b0..3cea2eab6 100644--- a/crates/engine/src/prefs.rs+++ b/crates/engine/src/prefs.rs@@ -58,7 +58,7 @@ choice!(ColorPicker { Adobe = "adobe", System = "system" } default Adobe);choice!(Theme { Pro = "pro", ProMedium = "proMedium", Studio = "studio", StudioLight = "studioLight", Classic = "classic" } default ProMedium);choice!(CanvasColor { Default = "default", Black = "black", DarkGray = "darkGray", MediumGray = "mediumGray", LightGray = "lightGray", Custom = "custom" } default Default);choice!(CanvasBorder { DropShadow = "dropShadow", Line = "line", None = "none" } default DropShadow);-choice!(UiScale { Auto = "auto", P100 = "100", P200 = "200" } default Auto);+choice!(UiScale { Auto = "auto", P75 = "75", P100 = "100", P125 = "125", P150 = "150", P175 = "175", P200 = "200", P250 = "250", P300 = "300" } default Auto);choice!(/// Graphics backend of the desktop app's window and GPU canvas (applies at next launch)./// `auto` lets PhotoCraft pick (DX12 for Intel adapters on Windows); `cpu` composites on thediff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsvindex 206e1c54a..5145f04ab 100644--- a/crates/ui-egui/src/i18n/cs.tsv+++ b/crates/ui-egui/src/i18n/cs.tsv@@ -578,6 +578,12 @@Fit Artboard on Screen Přizpůsobit kreslicí plochu obrazovce100% 100 %200% 200 %+ 75% 75 %+ 125% 125 %+ 150% 150 %+ 175% 175 %+ 250% 250 %+ 300% 300 %Print Size Velikost tiskuPixel Aspect Ratio Poměr stran pixeluPixel Aspect Ratio Correction Korekce poměru stran pixeludiff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsvindex a734ebb32..f455a944f 100644--- a/crates/ui-egui/src/i18n/es.tsv+++ b/crates/ui-egui/src/i18n/es.tsv@@ -570,6 +570,12 @@Fit Artboard on Screen Encajar lienzo en pantalla100% 100%200% 200%+ 75% 75%+ 125% 125%+ 150% 150%+ 175% 175%+ 250% 250%+ 300% 300%Print Size Tamaño de impresiónPixel Aspect Ratio Relación de aspecto de píxelPixel Aspect Ratio Correction Corrección de la relación de aspecto de píxeldiff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsvindex 453fa2ad2..c20acf16e 100644--- a/crates/ui-egui/src/i18n/fr.tsv+++ b/crates/ui-egui/src/i18n/fr.tsv@@ -562,6 +562,12 @@Fit Artboard on Screen Adapter le plan de travail à l'écran100% 100 %200% 200 %+ 75% 75 %+ 125% 125 %+ 150% 150 %+ 175% 175 %+ 250% 250 %+ 300% 300 %Print Size Taille d'impressionPixel Aspect Ratio Format des pixelsPixel Aspect Ratio Correction Correction du format des pixelsdiff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsvindex 40aff30af..7a6d87d3b 100644--- a/crates/ui-egui/src/i18n/id.tsv+++ b/crates/ui-egui/src/i18n/id.tsv@@ -555,6 +555,12 @@Fit Artboard on Screen Pas Artboard di Layar100% 100%200% 200%+ 75% 75%+ 125% 125%+ 150% 150%+ 175% 175%+ 250% 250%+ 300% 300%Print Size Ukuran CetakPixel Aspect Ratio Rasio Aspek PikselPixel Aspect Ratio Correction Koreksi Rasio Aspek Pikseldiff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsvindex 6cd6fbe16..e40386f58 100644--- a/crates/ui-egui/src/i18n/ja.tsv+++ b/crates/ui-egui/src/i18n/ja.tsv@@ -574,6 +574,12 @@Fit Artboard on Screen アートボードを画面サイズに合わせる100% 100%200% 200%+ 75% 75%+ 125% 125%+ 150% 150%+ 175% 175%+ 250% 250%+ 300% 300%Print Size 印刷サイズPixel Aspect Ratio ピクセル縦横比Pixel Aspect Ratio Correction ピクセル縦横比を補正diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsvindex c2b4fa5f3..3ae2058a0 100644--- a/crates/ui-egui/src/i18n/ko.tsv+++ b/crates/ui-egui/src/i18n/ko.tsv@@ -2023,3 +2023,11 @@ cameraRaw Color 색상# Type layer thumbnails (#598)Edit Type 문자 편집++# UI scale steps (#611)+ 75% 75%+ 125% 125%+ 150% 150%+ 175% 175%+ 250% 250%+ 300% 300%diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsvindex 29159ae71..90918f088 100644--- a/crates/ui-egui/src/i18n/ru.tsv+++ b/crates/ui-egui/src/i18n/ru.tsv@@ -364,6 +364,12 @@Fit on Screen По размеру экрана100% 100%200% 200%+ 75% 75%+ 125% 125%+ 150% 150%+ 175% 175%+ 250% 250%+ 300% 300%Print Size Размер при печатиScreen Mode Режим экранаStandard Screen Mode Стандартный режим экранаdiff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsvindex 62816f08c..a1756992b 100644--- a/crates/ui-egui/src/i18n/zh-hans.tsv+++ b/crates/ui-egui/src/i18n/zh-hans.tsv@@ -574,6 +574,12 @@Fit Artboard on Screen 使画板适合屏幕100% 100%200% 200%+ 75% 75%+ 125% 125%+ 150% 150%+ 175% 175%+ 250% 250%+ 300% 300%Print Size 打印尺寸Pixel Aspect Ratio 像素长宽比Pixel Aspect Ratio Correction 像素长宽比校正diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsvindex 5168fe32c..73e2faa3e 100644--- a/crates/ui-egui/src/i18n/zh-hant.tsv+++ b/crates/ui-egui/src/i18n/zh-hant.tsv@@ -578,6 +578,12 @@Fit Artboard on Screen 使工作區域符合螢幕100% 100%200% 200%+ 75% 75%+ 125% 125%+ 150% 150%+ 175% 175%+ 250% 250%+ 300% 300%Print Size 列印尺寸Pixel Aspect Ratio 像素外觀比例Pixel Aspect Ratio Correction 像素外觀比例校正diff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rsindex 9ac034492..ed85535ac 100644--- a/crates/ui-egui/src/prefs_ui.rs+++ b/crates/ui-egui/src/prefs_ui.rs@@ -160,13 +160,12 @@ fn presets_store(app: &mut PhotocraftApp) {fn display_scale(pref: prefs::UiScale, native: Option<f32>, monitor_px: Option<egui::Vec2>) -> f32 {let native = native.filter(|v| v.is_finite() && *v > 0.0).unwrap_or(1.0);match pref {- prefs::UiScale::P100 => 1.0,- prefs::UiScale::P200 => 2.0,prefs::UiScale::Auto => {// A 4K display needs at least 200%; preserve larger system scales.let is_4k = monitor_px.is_some_and(|s| s.x.is_finite() && s.y.is_finite() && s.x.min(s.y) >= 2160.0 && s.x.max(s.y) >= 3840.0);if is_4k { native.max(2.0) } else { native }}+ fixed => fixed.name().parse::<f32>().map_or(1.0, |pct| pct / 100.0),}}@@ -774,8 +773,7 @@ fn choice_label(v: &str) -> String {match v {"cm" => "Centimeters".into(),"mm" => "Millimeters".into(),- "100" => "100%".into(),- "200" => "200%".into(),+ "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" => format!("{v}%"),"8" => "8 Bits/Channel".into(),"16" => "16 Bits/Channel".into(),"postScript" => "PostScript (72 points/inch)".into(),@@ -1582,7 +1580,7 @@ mod tests {step(vec2(1920.0, 1080.0), 1.0, 1.0);step(vec2(3840.0, 2160.0), 1.5, 2.0);}- for (pref, expected) in [("200", 2.0), ("100", 1.0), ("auto", 1.5)] {+ for (pref, expected) in [("200", 2.0), ("125", 1.25), ("150", 1.5), ("100", 1.0), ("auto", 1.5)] {app.run("prefs.set", json!({"values": {"interface.uiScale": pref}})).unwrap();let mut input = egui::RawInput::default();input.viewports.get_mut(&egui::ViewportId::ROOT).unwrap().native_pixels_per_point = Some(1.5);diff --git a/docs/ui-design.md b/docs/ui-design.mdindex ce75d86b6..0ce68485c 100644--- a/docs/ui-design.md+++ b/docs/ui-design.md@@ -68,7 +68,7 @@ Edit → Preferences → Interface → UI Scale applies immediately. Auto followsystem's display scale (including fractional scales). For a 4K or larger monitor,Auto uses at least 200% so text and controls remain readable. Detection uses the current monitor,including portrait displays, and updates when the window moves between monitors. If monitor-size is unavailable, Auto follows system DPI. The 100% and 200% choices set an absolute UI+size is unavailable, Auto follows system DPI. The fixed choices (75% to 300%) set an absolute UIscale, allowing large 4K displays to use smaller controls when desired. Canvas zoom shortcutscontinue to control the document independently of UI scaling.