Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Merge PR #2317: #2267: the Before label stays in view when zoomed in (stacked on #2274)

aionggfeaf1aa5bb24
diff --cc crates/ui-egui/src/tests_zoom.rs
index 984a037cf,bfad3910c..580b70615
--- a/crates/ui-egui/src/tests_zoom.rs
+++ b/crates/ui-egui/src/tests_zoom.rs
@@@ -109,7 -109,58 +109,58 @@@ fn zoomed_before_after_views_stay_in_th
}
}
+ /// The "Before" label (\ or the Before view) at 100 %: the photo's corner is off screen, and the
+ /// label used to leave with it (issue #2267). It now sits at the canvas' corner, in view.
+ #[test]
+ fn zoomed_in_the_before_label_stays_in_view() {
+ use crate::state::{BeforeAfter, Zoom};
+ let mut h = detail();
+ h.app.ui.before_after = BeforeAfter::Original;
+ let label = |h: &mut Headless| -> egui::Rect {
+ let w = h.request("ui.widgets", json!({"filter": "canvas:beforeLabel"}), T);
+ let r = w["result"][0]["rect"].as_array().unwrap_or_else(|| panic!("the Before label is registered: {w}"));
+ let v: Vec<f32> = r.iter().filter_map(|x| x.as_f64()).map(|x| x as f32).collect();
+ egui::Rect::from_min_size(egui::pos2(v[0], v[1]), egui::vec2(v[2], v[3]))
+ };
+ h.app.ui.zoom = Zoom::Fit;
+ h.settle(SETTLE);
+ let (img, canvas) = (h.app.image_rect.expect("photo on screen"), h.app.canvas_rect.expect("canvas"));
+ let fitted = label(&mut h);
+ assert_eq!(fitted.min, img.min + egui::vec2(8.0, 8.0), "at Fit the label sits on the photo's corner");
+ h.app.ui.zoom = Zoom::Percent(100.0);
+ h.app.ui.pan = (0.3, 0.4);
+ h.settle(SETTLE);
+ let img = h.app.image_rect.expect("photo on screen");
+ assert!(img.min.x < canvas.min.x && img.min.y < canvas.min.y, "100 % reaches past the canvas ({img:?} in {canvas:?})");
+ let zoomed = label(&mut h);
+ assert!(canvas.contains_rect(zoomed), "the label stays in view: {zoomed:?} in {canvas:?}");
+ assert_eq!(zoomed.min, canvas.min + egui::vec2(8.0, 8.0));
+ }
+
+ /// With the info overlay on, zoomed in, the Before label sits below the overlay's lines instead
+ /// of under them (both live in the canvas' top-left corner).
+ #[test]
+ fn zoomed_in_the_before_label_keeps_clear_of_the_info_overlay() {
+ use crate::state::{BeforeAfter, InfoOverlay, Zoom};
+ let mut h = detail();
+ h.app.ui.before_after = BeforeAfter::Original;
+ h.app.ui.info_overlay = InfoOverlay::Exposure;
+ h.app.ui.zoom = Zoom::Percent(100.0);
+ h.app.ui.pan = (0.3, 0.4);
+ h.settle(SETTLE);
+ let rect = |h: &mut Headless, id: &str| -> egui::Rect {
+ let w = h.request("ui.widgets", json!({"filter": id}), T);
+ let r = w["result"][0]["rect"].as_array().unwrap_or_else(|| panic!("{id} is registered: {w}"));
+ let v: Vec<f32> = r.iter().filter_map(|x| x.as_f64()).map(|x| x as f32).collect();
+ egui::Rect::from_min_size(egui::pos2(v[0], v[1]), egui::vec2(v[2], v[3]))
+ };
+ let (badge, overlay) = (rect(&mut h, "canvas:beforeLabel"), rect(&mut h, "canvas:infoOverlay"));
+ let canvas = h.app.canvas_rect.expect("canvas");
+ assert!(badge.top() >= overlay.bottom(), "the label {badge:?} is below the overlay {overlay:?}");
+ assert!(canvas.contains_rect(badge), "and still in view: {badge:?} in {canvas:?}");
+ }
+
-/// A crop of no size (or a hair wide), from an agent or a sidecar, gave the loupe a NaN aspect:
+/// A crop of no size (or a hair wide), from a sidecar, gave the loupe a NaN aspect:
/// the photo was laid out at a NaN size, which egui's debug checks stop on (a panic in a debug
/// build) and nothing could be drawn or clicked. It now lays out at a finite size, fitted and at
/// 100 %.
diff --cc docs/whats-new.md
index 302af92b0,70a4cc1f8..a972b9291
--- a/docs/whats-new.md
+++ b/docs/whats-new.md
@@@ -2,12 -2,10 +2,16 @@@
## 2026-10-19
+ ### The Before label stays in view when zoomed in
+ - Zoomed in, the "Before" label (\ key or the Before view) now sits at the canvas' corner instead of leaving the
+ screen with the photo's corner (issue #2267).
+
+### Synchronize Folder on a folder that is up to date
+- When the scan finds nothing to import, relink, remove or read, the Synchronize Folder dialog says the library is up
+ to date with the folder and has one Close button. It used to show four greyed choices, two of them still ticked,
+ and a Synchronize button that started a job with nothing to do. Files it skipped (already in the library elsewhere,
+ or unreadable) are still listed.
+
### Hidden Local locations come back one at a time
- With several locations removed from Local, "Show N hidden locations" now lists them, so each comes back on its own
(Restore All is there too). The row used to bring every hidden location back at once (issue #2114).