Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

feat(ui): allow disabling Studio canvas background dots (#2317)

Nigel Ihza Firdausye59bb2909b22
diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs
index ac5f62b16..902e89bf9 100644
--- a/crates/engine/src/prefs.rs
+++ b/crates/engine/src/prefs.rs
@@ -221,6 +221,9 @@ pub struct Interface {
/// Pasteboard colour in standard screen mode (`canvasCustomColor` when "custom").
pub canvas_color: CanvasColor,
pub canvas_custom_color: String,
+ /// Show the repeating dot pattern on the canvas surround (including the empty workspace).
+ /// Disable for a uniform background, for example on OLED displays (#2264).
+ pub show_canvas_dots: bool,
/// Document border in standard screen mode.
pub canvas_border: CanvasBorder,
pub ui_scale: UiScale,
@@ -257,6 +260,7 @@ impl Default for Interface {
light_theme: LightTheme::StudioLight,
canvas_color: CanvasColor::Default,
canvas_custom_color: "#282828".into(),
+ show_canvas_dots: true,
canvas_border: CanvasBorder::DropShadow,
ui_scale: UiScale::Auto,
language: "auto".into(),
diff --git a/crates/engine/src/prefs/tests.rs b/crates/engine/src/prefs/tests.rs
index bee5a082a..ed78dcaa0 100644
--- a/crates/engine/src/prefs/tests.rs
+++ b/crates/engine/src/prefs/tests.rs
@@ -22,6 +22,33 @@ fn defaults_match_photoshop() {
}
}
+/// #2264: the Studio workspace dot pattern can be hidden without changing themes.
+#[test]
+fn canvas_dot_grid_can_be_disabled_persisted_and_reset() {
+ let mut s = Session::new();
+ assert!(s.prefs().interface.show_canvas_dots, "existing Studio appearance stays unchanged by default");
+ assert_eq!(s.execute("prefs.get", json!({"path": "interface.showCanvasDots"})).unwrap(), json!(true));
+
+ s.execute("prefs.set", json!({"path": "interface.showCanvasDots", "value": false})).unwrap();
+ assert!(!s.prefs().interface.show_canvas_dots);
+ assert_eq!(s.execute("prefs.get", json!({"path": "interface.showCanvasDots"})).unwrap(), json!(false));
+
+ let mut restored = Session::new();
+ restored.load_prefs_json(&s.prefs_to_json()).unwrap();
+ assert!(!restored.prefs().interface.show_canvas_dots, "disabling the pattern must survive restart");
+
+ // Older preference files without the new key retain the original dotted workspace.
+ let mut legacy = Session::new();
+ legacy.load_prefs_json(r#"{"interface": {"theme": "studio"}}"#).unwrap();
+ assert!(legacy.prefs().interface.show_canvas_dots);
+
+ assert!(s.execute("prefs.set", json!({"path": "interface.showCanvasDots", "value": "no"})).is_err());
+ assert!(!s.prefs().interface.show_canvas_dots, "an invalid type must not change the preference");
+
+ s.execute("prefs.reset", json!({"path": "interface.showCanvasDots"})).unwrap();
+ assert!(s.prefs().interface.show_canvas_dots);
+}
+
#[test]
fn appearance_defaults_and_legacy_theme_migrate() {
let p = Preferences::default();
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index a04e299f1..e9227d756 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -1610,7 +1610,7 @@ fn documents(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
}
if n == 0 && !opening {
// Auto show the Home Screen is off: an empty workspace, like Photoshop.
- paint_dots(ui, ui.available_rect_before_wrap());
+ paint_dots(ui, ui.available_rect_before_wrap(), app.session.prefs().interface.show_canvas_dots);
return;
}
if !app.ui.view.hides_tabs() || opening {
@@ -2156,7 +2156,10 @@ fn dots(ctx: &egui::Context, t: &crate::theme::Tokens) -> Option<egui::TextureId
Some(id)
}
-fn paint_dots(ui: &egui::Ui, rect: Rect) {
+fn paint_dots(ui: &egui::Ui, rect: Rect, enabled: bool) {
+ if !enabled {
+ return;
+ }
let t = crate::theme::Tokens::get(ui.ctx());
if let Some(id) = dots(ui.ctx(), &t) {
let uv = Rect::from_min_max(Pos2::ZERO, pos2(rect.width() / 22.0, rect.height() / 22.0));
@@ -2180,7 +2183,7 @@ pub fn mode_label(doc: &Document) -> &'static str {
fn start_screen(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
let t = crate::theme::Tokens::get(ui.ctx());
let area = ui.available_rect_before_wrap();
- paint_dots(ui, area);
+ paint_dots(ui, area, app.session.prefs().interface.show_canvas_dots);
// File › Open Recent, newest first (on the web there are no paths to reopen).
let recent: Vec<String> = if cfg!(target_arch = "wasm32") { Vec::new() } else { app.ui.recent_files.iter().take(HOME_RECENT).cloned().collect() };
let recent_h = if recent.is_empty() { 0.0 } else { 34.0 + recent.len() as f32 * HOME_RECENT_ROW };
@@ -2424,7 +2427,7 @@ pub fn canvas_view(app: &mut PhotocraftApp, ui: &mut egui::Ui, idx: usize, rect:
Some(c) => {
ui.painter_at(rect).rect_filled(rect, 0.0, c);
}
- None => paint_dots(ui, rect),
+ None => paint_dots(ui, rect, app.session.prefs().interface.show_canvas_dots),
}
let border = app.session.prefs().interface.canvas_border;
let drop_shadow = border == photocraft_engine::prefs::CanvasBorder::DropShadow;
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index a506161e6..5d512872d 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -1814,6 +1814,7 @@
Cache tile size Velikost dlaždice mezipaměti
Camera Raw Defaults Výchozí nastavení Camera Raw
Canvas border Okraj plátna
+ Show canvas dots Zobrazit tečky plátna
Canvas color Barva plátna
Canvas custom color Vlastní barva plátna
Color picker Výběr barvy
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index dba14c693..07c6e9e49 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -1785,6 +1785,7 @@
Cache tile size Cache-Kachelgröße
Camera Raw Defaults Camera-Raw-Standardeinstellungen
Canvas border Zeichenflächenrand
+ Show canvas dots Punkte der Zeichenfläche anzeigen
Canvas color Zeichenflächenfarbe
Canvas custom color Benutzerdefinierte Zeichenflächenfarbe
Color picker Farbwähler
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index bc85440b1..d154de7ff 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -1583,6 +1583,7 @@
Cache tile size Μέγεθος πλακιδίου προσωρινής μνήμης
Camera Raw Defaults Προεπιλογές Camera Raw
Canvas border Περίγραμμα καμβά
+ Show canvas dots Εμφάνιση κουκκίδων καμβά
Canvas color Χρώμα καμβά
Canvas custom color Προσαρμοσμένο χρώμα καμβά
Color picker Επιλογέας χρώματος
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index a9281a120..7dbe065bc 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -1797,6 +1797,7 @@
Cache tile size Tamaño de tesela de caché
Camera Raw Defaults Valores predeterminados de Camera Raw
Canvas border Borde del lienzo
+ Show canvas dots Mostrar puntos del lienzo
Canvas color Color del lienzo
Canvas custom color Color personalizado del lienzo
Color picker Selector de color
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index 2d340befd..91b3010ed 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -1769,6 +1769,7 @@
Cache tile size Taille des tuiles du cache
Camera Raw Defaults Valeurs par défaut de Camera Raw
Canvas border Bordure du canevas
+ Show canvas dots Afficher les points du canevas
Canvas color Couleur du canevas
Canvas custom color Couleur personnalisée du canevas
Color picker Sélecteur de couleurs
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 25fd766db..1e20656c9 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -1763,6 +1763,7 @@
Cache tile size Ukuran tile cache
Camera Raw Defaults Default Camera Raw
Canvas border Border kanvas
+ Show canvas dots Tampilkan titik kanvas
Canvas color Warna kanvas
Canvas custom color Warna kustom kanvas
Color picker Pemilih warna
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index fb1bc73b2..77cfe99e4 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -1795,6 +1795,7 @@
Cache tile size Dimensione tile cache
Camera Raw Defaults Default Camera Raw
Canvas border Bordo quadro
+ Show canvas dots Mostra punti del quadro
Canvas color Colore quadro
Canvas custom color Colore personalizzato quadro
Color picker Selettore colore
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 3614d38be..240897c93 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -1800,6 +1800,7 @@
Cache tile size キャッシュタイルのサイズ
Camera Raw Defaults Camera Raw の既定値
Canvas border カンバスの境界
+ Show canvas dots カンバスのドットを表示
Canvas color カンバスの色
Canvas custom color カンバスのカスタム色
Color picker カラーピッカー
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index 0f11c22f5..d162f5b7a 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -1762,6 +1762,7 @@
Cache tile size 캐시 타일 크기
Camera Raw Defaults Camera Raw 기본값
Canvas border 캔버스 테두리
+ Show canvas dots 캔버스 점 표시
Canvas color 캔버스 색상
Canvas custom color 캔버스 사용자 정의 색상
Color picker 색상 피커
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index f9e2ccdc0..145532cd0 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -1775,6 +1775,7 @@
Cache tile size Tegelgrootte cache
Camera Raw Defaults Standaardwaarden Camera Raw
Canvas border Canvasrand
+ Show canvas dots Canvasstippen tonen
Canvas color Canvaskleur
Canvas custom color Aangepaste canvaskleur
Color picker Kleurkiezer
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 08fa9c9fd..b66d95096 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -1793,6 +1793,7 @@
Cache tile size Rozmiar kafla pamięci podręcznej
Camera Raw Defaults Domyślne ustawienia Camera Raw
Canvas border Obramowanie płótna
+ Show canvas dots Pokaż kropki płótna
Canvas color Kolor płótna
Canvas custom color Własny kolor płótna
Color picker Próbnik kolorów
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index ac6a0d71c..3821f6cf1 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -1768,6 +1768,7 @@
Cache tile size Tamanho do bloco do cache
Camera Raw Defaults Padrões do Camera Raw
Canvas border Borda da tela de pintura
+ Show canvas dots Mostrar pontos da tela de pintura
Canvas color Cor da tela de pintura
Canvas custom color Cor personalizada da tela de pintura
Color picker Seletor de cores
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index fde0abc57..0af1516a6 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -2205,6 +2205,7 @@
Cache tile size Размер блока кэша
Camera Raw Defaults Значения Camera Raw по умолчанию
Canvas border Рамка холста
+ Show canvas dots Показывать точки холста
Canvas color Цвет холста
Canvas custom color Свой цвет холста
Classic Классическая
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index 9a76d6836..28beeab34 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -2182,6 +2182,7 @@
Cache tile size Розмір плитки кешу
Camera Raw Defaults Типові параметри Camera Raw
Canvas border Межа полотна
+ Show canvas dots Показувати крапки полотна
Canvas color Колір полотна
Canvas custom color Довільний колір полотна
Classic Класична
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 06a73fa0d..0283ca3c5 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -1806,6 +1806,7 @@
Cache tile size 缓存图块大小
Camera Raw Defaults Camera Raw 默认设置
Canvas border 画布边框
+ Show canvas dots 显示画布圆点
Canvas color 画布颜色
Canvas custom color 画布自定颜色
Color picker 拾色器
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index 4256b8ffc..42948b8d9 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -1800,6 +1800,7 @@
Cache tile size 快取拼貼大小
Camera Raw Defaults Camera Raw 預設值
Canvas border 畫布邊框
+ Show canvas dots 顯示畫布圓點
Canvas color 畫布顏色
Canvas custom color 畫布自訂顏色
Color picker 檢色器
diff --git a/docs/scorecard.md b/docs/scorecard.md
index 6c7f54000..665f82fcb 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 | 22 | 56 scenarios: 3 within budget, 22 over budget or failing, 9 tracked only, 15 not run, 7 not measurable yet (baseline 2026-10-05) |
| [File compatibility](#file-compatibility) | 5 | 11 | 11 | io corpus: oracle ≥ 146/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 236/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 133/256, round trip ≥ 258/256 |
| [Tools](#tools) | 21 | 16 | 5 | |
-| [Workspace and UI](#workspace-and-ui) | 6 | 7 | 10 | settings that do nothing: 43 of 150 (target 0) |
+| [Workspace and UI](#workspace-and-ui) | 6 | 7 | 10 | settings that do nothing: 43 of 151 (target 0) |
| [Type](#type) | 0 | 3 | 6 | |
| [Automation](#automation) | 3 | 2 | 6 | 630 of 630 menu items live (100.0%) |
| [Reliability](#reliability) | 5 | 2 | 0 | never-crash lints on 28 of 28 crates; panic_hunt present |
@@ -175,7 +175,7 @@ Corpus floors (`crates/io/tests/corpus.rs`): the enforced minimums; the corpus t
## Workspace and UI
-**Settings that do nothing: 43 of 150** (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: 43 of 151** (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.beep_when_done`, `general.always_create_smart_objects_when_placing`, `general.animated_zoom`, `general.zoom_resizes_windows`, `workspace.auto_collapse_icon_panels`, `workspace.auto_show_hidden_panels`, `workspace.enable_floating_document_window_docking`, `workspace.enable_narrow_options_bar`, `tools.enable_flick_panning`, `tools.vary_round_brush_hardness_on_hud`, `tools.show_transformation_values`, `file_handling.image_previews`, `file_handling.save_in_background`, `file_handling.ignore_exif_profile_tag`, `file_handling.maximize_psd_compatibility`, `performance.cache_levels`, `performance.legacy_compositing`, `scratch_disks.disks`, `cursors.brush_preview_color`, `units_and_rulers.type_units`, `units_and_rulers.column_width`, `units_and_rulers.gutter`, `units_and_rulers.print_resolution`, `plug_ins.show_extension_panels`, `plug_ins.allow_scripts_to_connect`, `plug_ins.generator_enabled`, `type_.missing_glyph_protection`, `type_.show_font_names_in_english`, `type_.text_engine`, `type_.font_preview`, `type_.recent_fonts`, `enhanced_controls.scrubby_slider_acceleration`, `enhanced_controls.touch_gestures`, `enhanced_controls.zoom_with_trackpad_pinch`, `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`.