Skip to content

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

Interface: an Enable Animations preference (#3273) (#3276)

Valentin Klein6de37ce7f063
diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs
index d30cbd0d7..39313e9eb 100644
--- a/crates/engine/src/prefs.rs
+++ b/crates/engine/src/prefs.rs
@@ -239,6 +239,9 @@ pub struct Interface {
/// Draw menu item colours set with Edit › Menus.
pub show_menu_colors: bool,
pub show_tooltips: bool,
+ /// Menus, popups and collapsing sections fade and slide, and scroll areas glide to a new
+ /// position. Off, everything changes at once (a reduced-motion mode; #1218, #3273).
+ pub enable_animations: bool,
/// Move tool drags show only the layer's outline and an arrow, leaving its pixels in place
/// until release. Off (the default), the pixels follow the pointer live inside the outline.
pub show_bounding_box_when_dragging_layer: bool,
@@ -272,6 +275,7 @@ impl Default for Interface {
dynamic_color_sliders: true,
show_menu_colors: true,
show_tooltips: true,
+ enable_animations: true,
show_bounding_box_when_dragging_layer: false,
system_title_bar: false,
notification_auto_hide: true,
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index 1fe086a2c..a4fb9ebbe 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -1979,6 +1979,7 @@
Show only crosshair while painting Při malování zobrazit jen nitkový kříž
Show slice numbers Zobrazit čísla řezů
Show tooltips Zobrazit popisky nástrojů
+ Enable animations Povolit animace
Show highlight on rollover Zobrazit zvýraznění při přejetí
Show bounding box when dragging layer Při přetahování vrstvy zobrazit ohraničovací rámeček
System title bar Systémové záhlaví okna
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index df62b59c1..d9448f882 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -1950,6 +1950,7 @@
Show only crosshair while painting Beim Malen nur Fadenkreuz zeigen
Show slice numbers Slice-Nummern anzeigen
Show tooltips Tooltips anzeigen
+ Enable animations Animationen aktivieren
Show highlight on rollover Hervorhebung bei Rollover anzeigen
Show bounding box when dragging layer Begrenzungsrahmen beim Ziehen einer Ebene anzeigen
System title bar System-Titelleiste
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index 0b029e240..ca540f319 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -1468,6 +1468,7 @@
Show only crosshair while painting Εμφάνιση μόνο σταυρονήματος κατά τη ζωγραφική
Show slice numbers Εμφάνιση αριθμών τομών
Show tooltips Εμφάνιση επεξηγήσεων
+ Enable animations Ενεργοποίηση κινούμενων εφέ
Show highlight on rollover Εμφάνιση επισήμανσης κατά την κατάδειξη
Show bounding box when dragging layer Εμφάνιση πλαισίου οριοθέτησης κατά τη μετακίνηση επιπέδου
Show transformation values Εμφάνιση τιμών μετασχηματισμού
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index b76cb612e..7f1a7af37 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -1963,6 +1963,7 @@
Show only crosshair while painting Mostrar solo la retícula al pintar
Show slice numbers Mostrar los números de sector
Show tooltips Mostrar las descripciones emergentes
+ Enable animations Activar las animaciones
Show highlight on rollover Mostrar resaltado al pasar el cursor
Show bounding box when dragging layer Mostrar el cuadro delimitador al arrastrar la capa
System title bar Barra de título del sistema
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index a40efe6d4..4b286943e 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -1934,6 +1934,7 @@
Show only crosshair while painting N'afficher que le réticule pendant la peinture
Show slice numbers Afficher les numéros de tranche
Show tooltips Afficher les info-bulles
+ Enable animations Activer les animations
Show highlight on rollover Afficher la mise en surbrillance au survol
Show transformation values Afficher les valeurs de transformation
Slice color Couleur des tranches
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index af8afbe49..d51b5a413 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -1928,6 +1928,7 @@
Show only crosshair while painting Tampilkan crosshair saja saat melukis
Show slice numbers Tampilkan nomor slice
Show tooltips Tampilkan tooltip
+ Enable animations Aktifkan animasi
Show highlight on rollover Tampilkan sorotan saat kursor melintas
Show transformation values Tampilkan nilai transformasi
Slice color Warna slice
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index f1522efe0..dd569eb73 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -1961,6 +1961,7 @@
Show only crosshair while painting Mostra solo mirino durante pittura
Show slice numbers Mostra numeri sezioni
Show tooltips Mostra tooltip
+ Enable animations Attiva animazioni
Show highlight on rollover Mostra evidenziazione al passaggio del mouse
Show bounding box when dragging layer Mostra riquadro selezione al trascinamento livello
System title bar Barra del titolo di sistema
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index f2774bc65..524891cf3 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -1962,6 +1962,7 @@
Show only crosshair while painting 描画中は十字線のみ表示
Show slice numbers スライス番号を表示
Show tooltips ツールチップを表示
+ Enable animations アニメーションを有効にする
Show highlight on rollover ロールオーバー時にハイライトを表示
Show bounding box when dragging layer レイヤーのドラッグ中にバウンディングボックスを表示
System title bar システムのタイトルバー
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index 21718cfd9..93ae26f9f 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -1925,6 +1925,7 @@
Show only crosshair while painting 칠하는 동안 십자선만 표시
Show slice numbers 분할 영역 번호 표시
Show tooltips 도구 설명 표시
+ Enable animations 애니메이션 사용
Show highlight on rollover 롤오버 시 강조 표시
Show transformation values 변형 값 표시
Slice color 분할 영역 색상
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index 2be4219f4..97134c953 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -1935,6 +1935,7 @@
Show only crosshair while painting Alleen dradenkruis tonen tijdens schilderen
Show slice numbers Segmentnummers tonen
Show tooltips Knopinfo tonen
+ Enable animations Animaties inschakelen
Show highlight on rollover Markering bij aanwijzen tonen
Show bounding box when dragging layer Selectiekader tonen bij slepen van laag
System title bar Titelbalk van systeem
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 55918649f..29f93cdde 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -1955,6 +1955,7 @@
Show only crosshair while painting Podczas malowania pokaż tylko celownik
Show slice numbers Pokaż numery plasterków
Show tooltips Pokaż podpowiedzi
+ Enable animations Włącz animacje
Show highlight on rollover Pokaż podświetlenie po najechaniu
Show bounding box when dragging layer Pokaż ramkę ograniczającą podczas przeciągania warstwy
Show transformation values Pokaż wartości przekształcenia
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index f091f1448..1b113329e 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -1930,6 +1930,7 @@
Show only crosshair while painting Mostrar apenas a mira ao pintar
Show slice numbers Mostrar números das fatias
Show tooltips Mostrar dicas de ferramentas
+ Enable animations Ativar animações
Show highlight on rollover Mostrar realce ao passar o mouse
Show transformation values Mostrar valores de transformação
Slice color Cor das fatias
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 8eae98aa6..b0c4c5e7c 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -2378,6 +2378,7 @@
Show only crosshair while painting Только перекрестье при рисовании
Show slice numbers Показывать номера фрагментов
Show tooltips Показывать подсказки
+ Enable animations Включить анимацию
Show highlight on rollover Показывать подсветку при наведении
Show bounding box when dragging layer Показывать рамку при перетаскивании слоя
System title bar Системная строка заголовка
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index f0985f308..d1250ad62 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -2353,6 +2353,7 @@
Show only crosshair while painting Показувати лише перехрестя під час малювання
Show slice numbers Показувати номери фрагментів
Show tooltips Показувати підказки
+ Enable animations Увімкнути анімацію
Show highlight on rollover Показувати підсвічування під час наведення
Show bounding box when dragging layer Показувати рамку під час перетягування шару
System title bar Системний рядок заголовка
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index eba8f859f..e89319eb6 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -1972,6 +1972,7 @@
Show only crosshair while painting 绘画时仅显示十字线
Show slice numbers 显示切片编号
Show tooltips 显示工具提示
+ Enable animations 启用动画
Show highlight on rollover 鼠标悬停时显示高亮
Show bounding box when dragging layer 拖动图层时显示边界框
System title bar 系统标题栏
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index 0c742695e..05c8b24ba 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -1965,6 +1965,7 @@
Show only crosshair while painting 繪圖時僅顯示十字線
Show slice numbers 顯示切片編號
Show tooltips 顯示工具提示
+ Enable animations 啟用動畫
Show highlight on rollover 滑鼠懸停時顯示醒目提示
Show bounding box when dragging layer 拖曳圖層時顯示邊界框
System title bar 系統標題列
diff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rs
index 4cf7e0cef..5fc1065a4 100644
--- a/crates/ui-egui/src/prefs_ui.rs
+++ b/crates/ui-egui/src/prefs_ui.rs
@@ -383,6 +383,21 @@ fn sync_tooltips(app: &PhotocraftApp, ctx: &egui::Context) {
}
}
+/// Interface › Enable Animations: off, egui's fades and slides take no time and scroll areas jump
+/// straight to their target (#3273). Re-checked every frame because a theme change rebuilds the
+/// style; both the dark and light styles are set, so a system appearance switch keeps it.
+fn sync_animations(app: &PhotocraftApp, ctx: &egui::Context) {
+ let on = app.session.prefs().interface.enable_animations;
+ let time = if on { egui::Style::default().animation_time } else { 0.0 };
+ if ctx.global_style().animation_time != time {
+ let scroll = if on { egui::style::ScrollAnimation::default() } else { egui::style::ScrollAnimation::none() };
+ ctx.all_styles_mut(|s| {
+ s.animation_time = time;
+ s.scroll_animation = scroll;
+ });
+ }
+}
+
/// Resolve the saved appearance mode without changing it or either theme slot.
pub(crate) fn sync_appearance(app: &mut PhotocraftApp, ctx: &egui::Context) {
// A restored or embedding-supplied pin must not suppress native appearance events.
@@ -406,6 +421,7 @@ pub fn tick(app: &mut PhotocraftApp, ctx: &egui::Context) {
crate::theme::set_ui_font_size(ctx, app.session.prefs().interface.ui_font_size);
presets_store(app);
sync_tooltips(app, ctx);
+ sync_animations(app, ctx);
app.sync_recent();
if let Some(wait) = persist(app, ctx.input(|i| i.time)) {
ctx.request_repaint_after(std::time::Duration::try_from_secs_f64(wait).unwrap_or_default());
@@ -2649,6 +2665,31 @@ mod tests {
}
}
+ #[test]
+ fn enable_animations_off_stops_fades_and_scroll_glides_and_is_remembered() {
+ let on = egui::Style::default().animation_time;
+ let both = |ctx: &egui::Context| [egui::Theme::Dark, egui::Theme::Light].map(|t| ctx.style_of(t).animation_time);
+ // Saved off: the first frame after a restart applies it to both appearance styles.
+ let (mut app, _) = app_with_saved(Some(json!({"interface": {"enableAnimations": false}}).to_string()));
+ let ctx = egui::Context::default();
+ tick(&mut app, &ctx);
+ assert_eq!(both(&ctx), [0.0, 0.0]);
+ assert_eq!(ctx.global_style().scroll_animation.duration.max, 0.0);
+ // A theme change rebuilds the style; the next frame turns animations off again.
+ app.apply_theme(&ctx, crate::theme::ThemeKind::StudioLight);
+ tick(&mut app, &ctx);
+ assert_eq!(both(&ctx), [0.0, 0.0]);
+ app.run("prefs.set", json!({"values": {"interface.enableAnimations": true}})).unwrap();
+ tick(&mut app, &ctx);
+ assert_eq!(both(&ctx), [on, on]);
+ assert!(on > 0.0 && ctx.global_style().scroll_animation.duration.max > 0.0);
+ // A hand-edited value of the wrong type doesn't crash: the defaults (animations on) stay.
+ let (mut bad, _) = app_with_saved(Some(json!({"interface": {"enableAnimations": "nope"}}).to_string()));
+ let ctx2 = egui::Context::default();
+ tick(&mut bad, &ctx2);
+ assert_eq!(both(&ctx2), [on, on]);
+ }
+
#[test]
fn unimplemented_preferences_are_hidden_from_the_dialog() {
let values = prefs::Preferences::default().to_json();
diff --git a/docs/scorecard.md b/docs/scorecard.md
index c6d67f8f9..8d1839f7e 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, 17 not run, 5 not measurable yet (baseline 2026-10-05) |
| [File compatibility](#file-compatibility) | 6 | 13 | 8 | 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) | 27 | 14 | 2 | |
-| [Workspace and UI](#workspace-and-ui) | 11 | 6 | 6 | settings that do nothing: 30 of 154 (target 0) |
+| [Workspace and UI](#workspace-and-ui) | 11 | 7 | 5 | settings that do nothing: 30 of 155 (target 0) |
| [Type](#type) | 4 | 2 | 3 | |
| [Automation](#automation) | 3 | 2 | 6 | 631 of 631 menu items live (100.0%) |
| [Reliability](#reliability) | 5 | 2 | 0 | never-crash lints on 28 of 28 crates; panic_hunt present |
@@ -176,7 +176,7 @@ Corpus floors (`crates/io/tests/corpus.rs`): the enforced minimums; the corpus t
## Workspace and UI
-**Settings that do nothing: 30 of 154** (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: 30 of 155** (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_collapse_icon_panels`, `workspace.auto_show_hidden_panels`, `workspace.enable_floating_document_window_docking`, `workspace.enable_narrow_options_bar`, `file_handling.save_in_background`, `file_handling.maximize_psd_compatibility`, `performance.cache_levels`, `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_.missing_glyph_protection`, `type_.text_engine`, `type_.recent_fonts`, `enhanced_controls.scrubby_slider_acceleration`, `enhanced_controls.touch_gestures`, `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`.
@@ -191,7 +191,7 @@ Unread: `general.color_picker`, `general.animated_zoom`, `general.zoom_resizes_w
| UI-217-7 | Command palette shows recently run commands on an empty query | done | [#217](https://github.com/storytold/photocraft/issues/217) | palette.rs: note_recent from menus::invoke keeps the last 8 commands (dedup, newest first); an empty query lists them via recent_hits; the_palette_records_and_replays_recent_commands_on_an_empty_query covers record -> empty query -> replay |
| UI-217-8 | Tool-specific canvas right-click menu; right-click spelling suggestions in text fields | partial | [#217](https://github.com/storytold/photocraft/issues/217) | paint_mouse.rs brush picker and canvas_tool_menu.rs selection actions; text_field_menu.rs gives every text field its right-click Undo/Cut/Copy/Paste/Delete/Select All menu (#2921); other tools missing; spelling suggestions (edit.checkSpelling suggest) not in the text-field menu yet |
| UI-217-9 | UI scale presets 100/115/125/150/200 % through zoom_factor, remembered | done | [#217](https://github.com/storytold/photocraft/issues/217) | prefs::UiScale offers Auto plus 75 to 300 percent (13 presets, more than the five this row lists); prefs_ui.rs display_scale resolves it (Auto follows the system scale, fractional and unscaled 4K included, #1072/#1278) and sync_display_scale applies it with ctx.set_zoom_factor. It is a preference, so it is remembered. The zoom_factor assert in input_tests.rs is about canvas zoom not scaling the interface, not about this setting |
-| UI-217-10 | Appearance: animation toggle, canvas pattern toggle per theme, start-screen recents | missing | [#217](https://github.com/storytold/photocraft/issues/217) | No such prefs; start screen (canvas.rs:825) has no recents |
+| UI-217-10 | Appearance: animation toggle, canvas pattern toggle per theme, start-screen recents | partial | [#217](https://github.com/storytold/photocraft/issues/217) | interface.enableAnimations (prefs_ui.rs sync_animations, #3273) zeroes egui animation_time and scroll animation in both styles; the Home screen lists recent files (canvas.rs home_recent, #2691); no canvas pattern toggle yet (#2264) and no option to hide the Home screen recents |
| UI-217-11 | Soft dark and soft light themes with picker previews; outlined knobs in light themes | missing | [#217](https://github.com/storytold/photocraft/issues/217) | theme.rs ThemeKind has twelve themes (the four Pro brightness levels, Studio and Studio Light, Classic, Adwaita and Adwaita Dark, Solarized Dark, Breeze Light and Breeze Dark); no Soft dark or Soft light, and no outlined knobs in the light themes |
| UI-217-12 | Save custom New Document presets; a real Recent category | partial | [#217](https://github.com/storytold/photocraft/issues/217) | document_preset_cmds.rs and new_doc_ui.rs: named presets save/select/delete through preferences; Recent remains a static list plus Clipboard |
| UI-217-13 | Numeric fields accept arithmetic and units; scrubby labels; double-click resets a slider | done | [#217](https://github.com/storytold/photocraft/issues/217) | widgets::value_field: arithmetic plus units (1in, 5mm, 72pt, 50%) converted at the document resolution (#3099); widgets::scrub_label makes options-bar, slider-row and Character labels scrubby (Shift x10, Alt fine); slider rows with a known default reset on double-click |
diff --git a/scorecard/ui.toml b/scorecard/ui.toml
index 4a507004a..7565c98ff 100644
--- a/scorecard/ui.toml
+++ b/scorecard/ui.toml
@@ -71,9 +71,9 @@ note = "prefs::UiScale offers Auto plus 75 to 300 percent (13 presets, more than
[[item]]
id = "UI-217-10"
target = "Appearance: animation toggle, canvas pattern toggle per theme, start-screen recents"
-status = "missing"
+status = "partial"
issue = 217
-note = "No such prefs; start screen (canvas.rs:825) has no recents"
+note = "interface.enableAnimations (prefs_ui.rs sync_animations, #3273) zeroes egui animation_time and scroll animation in both styles; the Home screen lists recent files (canvas.rs home_recent, #2691); no canvas pattern toggle yet (#2264) and no option to hide the Home screen recents"
[[item]]
id = "UI-217-11"