Skip to content

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

Merge main into feat/zoom-animation-566

Gustavo Zigere0b0b53946f6
diff --cc crates/ui-egui/src/canvas.rs
index 1cbf146be,db0efe31f..0dd249791
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@@ -2855,9 -2904,10 +2985,10 @@@ pub fn canvas_view(app: &mut Photocraft
if app.gpu.is_some()
&& gpu_ok
&& let Some((k, key, preview_size)) =
- ensure_adjust_proxy(app, idx, view.zoom).or_else(|| ensure_filter_preview(app, idx, &ctx)).or_else(|| ensure_proxy_preview(app, idx))
+ ensure_adjust_proxy(app, idx, render_zoom).or_else(|| ensure_filter_preview(app, idx, &ctx)).or_else(|| ensure_proxy_preview(app, idx))
{
on_gpu = true;
+ app.navigator_gpu.remove(&doc.id);
let original_size = [doc.size.width.div_ceil(k), doc.size.height.div_ceil(k)];
let params = crate::gpu_canvas::ViewParams {
doc: key,
@@@ -2881,7 -2931,7 +3012,7 @@@
offset: [0.0, 0.0],
};
paint_gpu_view(&painter, rect, params, &pattern);
- } else if gpu_ok && ensure_gpu(app, idx, render_visible) {
- } else if gpu_ok && ensure_gpu(app, &ctx, idx, visible_doc_rect(&xf)) {
++ } else if gpu_ok && ensure_gpu(app, &ctx, idx, render_visible) {
on_gpu = true;
app.perf.gpu = true;
// Shadow, checkerboard, document and pixel grid in one custom shader (gpu_canvas.rs).
diff --cc crates/ui-egui/src/panels.rs
index a4aae1508,cff94a840..75a2911b3
--- a/crates/ui-egui/src/panels.rs
+++ b/crates/ui-egui/src/panels.rs
@@@ -6051,52 -6052,6 +6074,56 @@@ mod properties_target_regressions
}
}
+#[cfg(test)]
+mod navigator_animated_zoom_tests {
+ use super::*;
+
+ #[test]
+ fn animated_zoom_off_navigator_buttons_jump_without_a_transition() {
+ let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
+ app.run("file.new", json!({"width": 200, "height": 100})).unwrap();
+ app.run("prefs.set", json!({"values": {"general.animatedZoom": false}})).unwrap();
+ app.sync_views();
+ app.ui.views[0].fit_pending = false;
+ let mut h = egui_kittest::Harness::builder().with_size(vec2(430.0, 460.0)).build_ui_state(
+ |ui, app: &mut PhotocraftApp| {
+ if ui.ctx().fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
+ navigator(app, ui);
+ }
+ },
+ app,
+ );
+ PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::Studio);
+ h.run_steps(4);
+ let width = |label: &str| h.ctx.fonts_mut(|f| f.layout_no_wrap(label.into(), crate::theme::medium(12.5), Color32::WHITE).size().x + 20.0);
+ let spacing = h.ctx.style_of(h.ctx.theme()).spacing.item_spacing.x;
+ let widths = [width("200%"), width("100%"), width("Fit")];
+ let controls = last_navigator_controls(&h.ctx).unwrap();
+ let mut right = controls.right();
+ for (index, zoom) in [2.0, 1.0].into_iter().enumerate() {
+ let pointer = pos2(right - widths[index] / 2.0, controls.top() + 16.0);
+ h.hover_at(pointer);
+ for pressed in [true, false] {
+ h.event(egui::Event::PointerButton { pos: pointer, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE });
+ h.step();
+ }
+ right -= widths[index] + spacing;
+ let view = &h.state().ui.views[0];
+ assert_eq!(view.zoom, zoom);
+ assert_eq!(view.display_camera, Some((view.zoom, view.center)));
+ assert!(!view.zoom_animating && view.zoom_anchor.is_none() && view.zoom_transition.is_none());
+ }
+ let pointer = pos2(right - widths[2] / 2.0, controls.top() + 16.0);
+ h.hover_at(pointer);
+ for pressed in [true, false] {
+ h.event(egui::Event::PointerButton { pos: pointer, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE });
+ h.step();
+ }
+ assert!(h.state().ui.views[0].fit_pending);
+ assert!(!h.state().ui.views[0].zoom_animating);
+ }
+}
++
+ #[cfg(test)]
+ #[path = "history_panel_select_tests.rs"]
+ mod history_panel_select_tests;
diff --cc docs/scorecard.md
index f2ea9be1e,92f9315eb..6c43e8e98
--- a/docs/scorecard.md
+++ b/docs/scorecard.md
@@@ -9,7 -9,7 +9,7 @@@ Generated by `cargo xtask scorecard` fr
| [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) | 7 | 13 | 7 | io corpus: oracle ≥ 146/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 236/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 145/256, round trip ≥ 258/256 |
| [Tools](#tools) | 28 | 14 | 1 | |
- | [Workspace and UI](#workspace-and-ui) | 13 | 6 | 4 | settings that do nothing: 25 of 156 (target 0) |
-| [Workspace and UI](#workspace-and-ui) | 13 | 6 | 4 | settings that do nothing: 26 of 157 (target 0) |
++| [Workspace and UI](#workspace-and-ui) | 13 | 6 | 4 | settings that do nothing: 25 of 157 (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 28 of 28 crates; panic_hunt present |
@@@ -176,9 -176,9 +176,9 @@@ Corpus floors (`crates/io/tests/corpus.
## Workspace and UI
- **Settings that do nothing: 25 of 156** (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 157** (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: 25 of 157** (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.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`, `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`.
+Unread: `general.color_picker`, `general.zoom_resizes_windows`, `workspace.auto_show_hidden_panels`, `workspace.enable_floating_document_window_docking`, `file_handling.save_in_background`, `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_.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`.
| Id | Target | Status | Issue | Note |
|---|---|---|---|---|