Skip to content

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

LR-VIEW-ZOOM: choose the drag draft size from what the render costs (#330)

Matthew James Sivakc0a1a6443a8b
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 9a387c77c..bd825d467 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -336,6 +336,8 @@ pub struct LightcraftApp {
pub region_before_view: Option<region::RegionView>,
/// The loupe's render sizes while a pinch or two-finger scroll runs.
pub(crate) size_hold: region::SizeHold,
+ /// The size of a slider drag's whole-frame drafts (full size where they keep up, issue #330).
+ pub(crate) drag_scale: region::DragScale,
/// (photo, look, window frame size) a window was refused for: it reads more than one render holds.
pub(crate) window_refused: Option<(lightcraft_catalog::PhotoId, u64, usize)>,
pub(crate) region_tiles: std::collections::HashMap<(bool, u64), region::RegionView>,
@@ -439,6 +441,7 @@ impl LightcraftApp {
region_view: None,
region_before_view: None,
size_hold: Default::default(),
+ drag_scale: Default::default(),
window_refused: None,
region_tiles: Default::default(),
compare_windows: [None; 2],
diff --git a/crates/ui-egui/src/panels/detail.rs b/crates/ui-egui/src/panels/detail.rs
index 28365fbc3..22173a61d 100644
--- a/crates/ui-egui/src/panels/detail.rs
+++ b/crates/ui-egui/src/panels/detail.rs
@@ -436,15 +436,25 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
app.image_rect = Some(img_rect);
// request renders: the loupe at display resolution (drafts during drags)
let interacting = app.session.interaction.is_some();
- // (`ready` first: `available` would wait for the device while it is still being created)
- let gpu = interacting && lightcraft_engine::gpu::ready() && lightcraft_engine::gpu::available();
- let scale = crate::region::drag_scale(interacting, gpu);
+ let overlay = view_overlay(app, &d);
+ // a drag drafts at full size where the GPU draws the view (soft proofs and the HDR range
+ // render on the CPU; `ready` first: `available` would wait for a device still being created)
+ let gpu = interacting
+ && !app.ui.soft_proof
+ && overlay != lightcraft_pipeline::Overlay::HdrRange
+ && lightcraft_engine::gpu::ready()
+ && lightcraft_engine::gpu::available();
+ let shown = app.renderer.textures.get(&Slot::Main).filter(|t| t.photo == id && t.quick.is_none()).map(|t| (t.key, t.ms));
+ let drag = app.session.interaction.as_ref().map(|i| (i.photo, i.label.as_str()));
+ let draft = app.drag_scale.scale(drag, gpu, shown.map(|(key, _)| key));
+ if let Some((key, ms)) = shown {
+ app.drag_scale.observe(key, ms);
+ }
// render at the final size: a click-zoom animation only changes how the result is drawn
let native_long = native[0].max(native[1]);
let drawn_long = target_rect.width().max(target_rect.height()) * ppp;
// the whole frame at about canvas size; the zoomed part of it is a window render (below)
let look = d.hash64();
- let overlay = view_overlay(app, &d);
// Diagnostic views that need whole-frame context, soft proofing, or reads too far for one
// window still render the whole frame at the size it is drawn. A mask overlay is window-safe.
let sizes = crate::region::ViewSizes {
@@ -452,8 +462,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
canvas_long: canvas.width().max(canvas.height()) * ppp,
native_long,
texture_side,
- draft_scale: scale,
- drafting: interacting,
+ draft,
windows: !app.ui.soft_proof && overlay_supports_window(overlay),
};
let mut plan = crate::region::plan(&app.ui.settings, sizes);
diff --git a/crates/ui-egui/src/region.rs b/crates/ui-egui/src/region.rs
index acfc87063..bd7c57c94 100644
--- a/crates/ui-egui/src/region.rs
+++ b/crates/ui-egui/src/region.rs
@@ -70,11 +70,10 @@ pub struct ViewSizes {
pub native_long: usize,
/// The largest texture the GPU takes.
pub texture_side: usize,
- /// 1.0, or less while a slider is dragged (a draft of the whole-frame render; see
- /// [`drag_scale`]).
- pub draft_scale: f32,
- /// A slider is being dragged: the render is a draft, never above the canvas size.
- pub drafting: bool,
+ /// While a slider is dragged, the scale of the whole-frame draft against the render at rest
+ /// (1.0 or [`CPU_DRAFT_SCALE`], from [`DragScale`]); a draft is never above the canvas size.
+ /// `None`: no drag.
+ pub draft: Option<f32>,
/// Whether a window can be drawn over the whole-frame render (not with a diagnostic overlay
/// that needs whole-frame context, soft proofing, or a read too far for one window). Mask
/// overlays are window-safe.
@@ -93,13 +92,95 @@ pub struct LoupePlan {
pub window_edge: Option<usize>,
}
-/// Size of a slider drag's whole-frame draft on the CPU, against the render at rest.
+/// Size of a slider drag's whole-frame draft when full size would be too slow (the CPU renders
+/// it, or full-size drafts of this drag went over [`DRAFT_BUDGET_MS`]), against the render at rest.
pub const CPU_DRAFT_SCALE: f32 = 0.6;
-/// [`ViewSizes::draft_scale`] for the loupe: a drag on the GPU renders at full size (a canvas-sized
-/// draft takes a few ms there, issue #330); on the CPU it renders a smaller draft to keep up.
-pub fn drag_scale(drafting: bool, gpu: bool) -> f32 {
- if drafting && !gpu { CPU_DRAFT_SCALE } else { 1.0 }
+/// The slider budget (ms): a drag whose full-size drafts take longer gets smaller drafts next time.
+pub const DRAFT_BUDGET_MS: f64 = 16.0;
+
+/// The most (photo, control) pairs [`DragScale`] remembers as too slow for full-size drafts.
+const SLOW_DRAGS_KEPT: usize = 256;
+
+/// The size of a slider drag's whole-frame draft, chosen when the drag starts and kept until it
+/// ends (a change in the middle would make the resolution jump). A drag renders at full size when
+/// the GPU draws the view and no earlier drag of the same control on this photo went over budget
+/// at that size; otherwise at [`CPU_DRAFT_SCALE`] (issue #330). Whether the GPU drew a render is
+/// not enough on its own: some views (a LUT profile, refined masks, a photo past a GPU limit) fall
+/// back to the CPU per render, which only the time a draft took shows.
+#[derive(Clone, Debug, Default)]
+pub struct DragScale {
+ /// The drag running now: (photo, control) and its scale.
+ current: Option<((lightcraft_catalog::PhotoId, String), f32)>,
+ /// How long the current drag's full-size drafts took (ms).
+ samples: Vec<f64>,
+ /// Key of the whole-frame render last timed (each render is timed once).
+ seen: Option<u64>,
+ /// Drags whose full-size drafts went over budget.
+ slow: std::collections::HashSet<(lightcraft_catalog::PhotoId, String)>,
+}
+
+impl DragScale {
+ /// The draft scale for this frame, or `None` without a drag. `drag` is the photo and control
+ /// being dragged; `gpu` whether the GPU draws this view; `shown` the key of the whole-frame
+ /// render on screen (a render from before the drag is not one of its drafts).
+ pub fn scale(&mut self, drag: Option<(lightcraft_catalog::PhotoId, &str)>, gpu: bool, shown: Option<u64>) -> Option<f32> {
+ let Some((photo, control)) = drag else {
+ self.finish();
+ return None;
+ };
+ match &self.current {
+ Some(((p, c), s)) if *p == photo && c == control => return Some(*s),
+ Some(_) => self.finish(),
+ None => {}
+ }
+ let key = (photo, control.to_string());
+ let s = if gpu && !self.slow.contains(&key) { 1.0 } else { CPU_DRAFT_SCALE };
+ self.current = Some((key, s));
+ self.seen = shown;
+ Some(s)
+ }
+
+ /// The whole-frame render on screen: `key` identifies it, `ms` is how long it took. Times the
+ /// current drag's full-size drafts.
+ pub fn observe(&mut self, key: u64, ms: f64) {
+ let full = matches!(self.current, Some((_, s)) if s >= 1.0);
+ if !full || self.seen == Some(key) {
+ return;
+ }
+ self.seen = Some(key);
+ if ms.is_finite() && ms >= 0.0 && self.samples.len() < 1024 {
+ self.samples.push(ms);
+ }
+ }
+
+ /// Remember drags of `control` on `photo` as too slow for full-size drafts (tests).
+ #[cfg(test)]
+ pub fn remember_slow(&mut self, photo: lightcraft_catalog::PhotoId, control: &str) {
+ self.slow.insert((photo, control.to_string()));
+ }
+
+ /// The drag ended: remember it if its full-size drafts were over budget.
+ fn finish(&mut self) {
+ if let Some((key, _)) = self.current.take()
+ && over_budget(&self.samples)
+ {
+ if self.slow.len() >= SLOW_DRAGS_KEPT {
+ self.slow.clear();
+ }
+ self.slow.insert(key);
+ }
+ self.samples.clear();
+ self.seen = None;
+ }
+}
+
+/// Whether a drag's draft times (ms) are over [`DRAFT_BUDGET_MS`]: the median, leaving out the
+/// first draft (it rebuilds the stage caches the others reuse).
+fn over_budget(samples: &[f64]) -> bool {
+ let mut rest: Vec<f64> = samples.iter().skip(1).copied().collect();
+ rest.sort_by(f64::total_cmp);
+ rest.get(rest.len() / 2).is_some_and(|median| *median > DRAFT_BUDGET_MS)
}
/// The loupe's render plan. The cost of a render follows the canvas, not the zoom: the whole-frame
@@ -107,12 +188,12 @@ pub fn drag_scale(drafting: bool, gpu: bool) -> f32 {
pub fn plan(settings: &crate::state::AppSettings, v: ViewSizes) -> LoupePlan {
let canvas_long = if v.canvas_long.is_finite() { v.canvas_long.max(8.0) } else { 8.0 };
let drawn_long = if v.drawn_long.is_finite() { v.drawn_long.max(8.0) } else { canvas_long };
- let scale = if v.draft_scale.is_finite() { v.draft_scale.clamp(0.1, 1.0) } else { 1.0 };
+ let scale = v.draft.map_or(1.0, |s| if s.is_finite() { s.clamp(0.1, 1.0) } else { 1.0 });
if !v.windows {
// the whole frame at the size it is drawn (soft proof or a whole-frame diagnostic has no
// window); while a slider drags, a canvas-sized draft as with windows: a drag at 1:1 must
// not render the photo's every pixel each frame
- let long = if v.drafting { drawn_long.min(canvas_long) } else { drawn_long };
+ let long = if v.draft.is_some() { drawn_long.min(canvas_long) } else { drawn_long };
let main_edge = settings.loupe_edge(long * scale, v.native_long, v.texture_side);
return LoupePlan { main_edge, window_edge: None };
}
@@ -237,7 +318,7 @@ mod tests {
const BIG: usize = 16384;
fn sizes(drawn: f32, canvas: f32, native: usize) -> ViewSizes {
- ViewSizes { drawn_long: drawn, canvas_long: canvas, native_long: native, texture_side: BIG, draft_scale: 1.0, drafting: false, windows: true }
+ ViewSizes { drawn_long: drawn, canvas_long: canvas, native_long: native, texture_side: BIG, draft: None, windows: true }
}
fn auto() -> AppSettings {
@@ -288,7 +369,7 @@ mod tests {
#[test]
fn a_drag_shrinks_the_whole_frame_draft_not_the_window() {
let still = plan(&auto(), sizes(24000.0, 2800.0, 6000));
- let drag = plan(&auto(), ViewSizes { draft_scale: 0.6, drafting: true, ..sizes(24000.0, 2800.0, 6000) });
+ let drag = plan(&auto(), ViewSizes { draft: Some(0.6), ..sizes(24000.0, 2800.0, 6000) });
assert!(drag.main_edge < still.main_edge, "{drag:?} vs {still:?}");
assert_eq!(drag.window_edge, still.window_edge);
}
@@ -298,9 +379,9 @@ mod tests {
// windowed path
#[test]
fn without_a_window_a_drag_drafts_at_the_canvas_size() {
- let no_window = |draft_scale: f32| ViewSizes { windows: false, draft_scale, drafting: draft_scale < 1.0, ..sizes(24000.0, 2800.0, 6000) };
- let still = plan(&auto(), no_window(1.0));
- let drag = plan(&auto(), no_window(0.6));
+ let no_window = |draft: Option<f32>| ViewSizes { windows: false, draft, ..sizes(24000.0, 2800.0, 6000) };
+ let still = plan(&auto(), no_window(None));
+ let drag = plan(&auto(), no_window(Some(0.6)));
assert_eq!(still.window_edge, None);
assert!(still.main_edge > 2800, "at rest the zoomed frame: {still:?}");
assert!(drag.main_edge <= 2800, "a drag drafts at most the canvas: {drag:?}");
@@ -309,27 +390,85 @@ mod tests {
// Given a slider drag, the GPU renders it at full size and the CPU a smaller draft (#330)
#[test]
fn a_drag_shrinks_the_draft_only_on_the_cpu() {
- assert_eq!(drag_scale(true, true), 1.0);
- assert_eq!(drag_scale(true, false), CPU_DRAFT_SCALE);
- assert_eq!(drag_scale(false, true), 1.0);
- assert_eq!(drag_scale(false, false), 1.0);
+ use lightcraft_catalog::PhotoId;
+ let mut gpu = DragScale::default();
+ assert_eq!(gpu.scale(None, true, None), None, "no drag, no draft");
+ assert_eq!(gpu.scale(Some((PhotoId(1), "Exposure")), true, None), Some(1.0));
+ let mut cpu = DragScale::default();
+ assert_eq!(cpu.scale(Some((PhotoId(1), "Exposure")), false, None), Some(CPU_DRAFT_SCALE));
+ }
+
+ // Given a drag that started before the GPU was ready, it keeps its size until it ends: the
+ // resolution never jumps in the middle of a drag
+ #[test]
+ fn a_drag_keeps_its_draft_size_until_it_ends() {
+ use lightcraft_catalog::PhotoId;
+ let mut d = DragScale::default();
+ let drag = Some((PhotoId(1), "Exposure"));
+ assert_eq!(d.scale(drag, false, None), Some(CPU_DRAFT_SCALE));
+ assert_eq!(d.scale(drag, true, None), Some(CPU_DRAFT_SCALE), "the GPU came up mid-drag");
+ assert_eq!(d.scale(None, true, None), None);
+ assert_eq!(d.scale(drag, true, None), Some(1.0), "the next drag gets full size");
+ // and the other way: the GPU lost mid-drag keeps the drag at full size until it ends
+ assert_eq!(d.scale(drag, false, None), Some(1.0));
+ }
+
+ // Given full-size drafts over the slider budget (a LUT profile or refined mask the CPU renders,
+ // a photo past a GPU limit, a slow GPU), the next drag of that control on that photo drafts
+ // small; other controls and photos keep full size
+ #[test]
+ fn a_drag_over_budget_drafts_small_the_next_time() {
+ use lightcraft_catalog::PhotoId;
+ let mut d = DragScale::default();
+ let exposure = Some((PhotoId(1), "Exposure"));
+ assert_eq!(d.scale(exposure, true, Some(7)), Some(1.0));
+ d.observe(7, 400.0); // the render from before the drag: not a draft of it
+ for (key, ms) in [(8, 300.0), (9, 40.0), (10, 45.0), (11, 9.0)] {
+ d.observe(key, ms);
+ d.observe(key, ms); // a render is timed once, however many frames show it
+ }
+ assert_eq!(d.scale(None, true, None), None);
+ assert_eq!(d.scale(exposure, true, None), Some(CPU_DRAFT_SCALE));
+ assert_eq!(d.scale(Some((PhotoId(1), "Contrast")), true, None), Some(1.0));
+ assert_eq!(d.scale(Some((PhotoId(2), "Exposure")), true, None), Some(1.0));
+ }
+
+ // Given full-size drafts within budget (the first one, rebuilding the stage caches, may be
+ // slow), the next drag stays at full size
+ #[test]
+ fn a_drag_within_budget_stays_full_size() {
+ use lightcraft_catalog::PhotoId;
+ let mut d = DragScale::default();
+ let drag = Some((PhotoId(1), "Exposure"));
+ d.scale(drag, true, None);
+ for (key, ms) in [(1, 120.0), (2, 4.0), (3, 6.0), (4, 30.0), (5, 5.0)] {
+ d.observe(key, ms);
+ }
+ d.scale(None, true, None);
+ assert_eq!(d.scale(drag, true, None), Some(1.0));
+ // hostile times are ignored, never a panic
+ for (key, ms) in [(6, f64::NAN), (7, f64::INFINITY), (8, -1.0)] {
+ d.observe(key, ms);
+ }
+ d.scale(None, true, None);
+ assert_eq!(d.scale(drag, true, None), Some(1.0));
}
- // Given a drag at fit on the GPU, the draft is as sharp as the render at rest
+ // Given a drag at fit at full size, the draft is as sharp as the render at rest
#[test]
- fn a_gpu_drag_at_fit_keeps_the_resolution() {
+ fn a_full_size_drag_at_fit_keeps_the_resolution() {
for drawn in [1400.0, 2800.0] {
let still = plan(&auto(), sizes(drawn, drawn, 6000));
- let drag = plan(&auto(), ViewSizes { draft_scale: drag_scale(true, true), drafting: true, ..sizes(drawn, drawn, 6000) });
+ let drag = plan(&auto(), ViewSizes { draft: Some(1.0), ..sizes(drawn, drawn, 6000) });
assert_eq!(drag, still, "{drawn}");
}
}
- // Given no window and a drag on the GPU, the draft is still at most the canvas: a drag at 1:1
+ // Given no window and a full-size drag, the draft is still at most the canvas: a drag at 1:1
// must not render the photo's every pixel each frame
#[test]
- fn a_gpu_drag_without_a_window_drafts_at_the_canvas_size() {
- let drag = plan(&auto(), ViewSizes { windows: false, draft_scale: 1.0, drafting: true, ..sizes(24000.0, 2800.0, 6000) });
+ fn a_full_size_drag_without_a_window_drafts_at_the_canvas_size() {
+ let drag = plan(&auto(), ViewSizes { windows: false, draft: Some(1.0), ..sizes(24000.0, 2800.0, 6000) });
assert!(drag.main_edge <= 2816, "{drag:?}");
}
@@ -365,7 +504,7 @@ mod tests {
fn a_drag_at_fit_on_a_large_display_keeps_the_window() {
for drawn in [3300.0, 3840.0, 4096.0, 5120.0] {
let still = plan(&auto(), sizes(drawn, drawn, 6000));
- let drag = plan(&auto(), ViewSizes { draft_scale: 0.6, drafting: true, ..sizes(drawn, drawn, 6000) });
+ let drag = plan(&auto(), ViewSizes { draft: Some(0.6), ..sizes(drawn, drawn, 6000) });
assert!(still.window_edge.is_some(), "{drawn}: {still:?}");
assert_eq!(drag.window_edge, still.window_edge, "{drawn}");
}
@@ -409,7 +548,7 @@ mod tests {
// Given a drag at fit on a Retina Mac, the window does not switch on (it would flicker with the drag)
#[test]
fn a_drag_at_fit_does_not_switch_the_window_on() {
- let p = plan(&auto(), ViewSizes { draft_scale: 0.6, drafting: true, ..sizes(2800.0, 2800.0, 6000) });
+ let p = plan(&auto(), ViewSizes { draft: Some(0.6), ..sizes(2800.0, 2800.0, 6000) });
assert_eq!(p.window_edge, None);
}
@@ -480,7 +619,7 @@ mod tests {
#[test]
fn hostile_sizes_give_a_usable_plan() {
for v in [f32::NAN, f32::INFINITY, f32::NEG_INFINITY, -3.0, 0.0] {
- let p = plan(&auto(), ViewSizes { drawn_long: v, canvas_long: v, draft_scale: v, ..sizes(1.0, 1.0, 6000) });
+ let p = plan(&auto(), ViewSizes { drawn_long: v, canvas_long: v, draft: Some(v), ..sizes(1.0, 1.0, 6000) });
assert!((8..=2560).contains(&p.main_edge), "{v}: {p:?}");
}
let p = plan(&auto(), sizes(1000.0, 1000.0, 0));
diff --git a/crates/ui-egui/src/tests_preview_limit.rs b/crates/ui-egui/src/tests_preview_limit.rs
index 976d4d0e7..076181599 100644
--- a/crates/ui-egui/src/tests_preview_limit.rs
+++ b/crates/ui-egui/src/tests_preview_limit.rs
@@ -433,6 +433,44 @@ mod in_the_loupe {
assert!(w * hh <= 3_000_000, "{w}×{hh}: the window holds what is on screen, not the frame");
}
+ /// Drag Exposure in the loupe and return the long edge of the whole-frame draft shown, with
+ /// the largest a small (CPU-sized) draft of the photo as drawn can be.
+ fn drag_exposure(h: &mut Headless) -> (usize, usize) {
+ h.app.session.begin_interaction("Exposure").unwrap();
+ h.request("engine.execute", json!({"command": "develop.set", "params": {"control": "light.exposure", "value": 0.5}}), T);
+ h.settle(SETTLE);
+ let image = h.app.image_rect.expect("the photo was drawn");
+ let small = (image.width().max(image.height()) * crate::region::CPU_DRAFT_SCALE) as usize + crate::state::LOUPE_EDGE_STEP;
+ (rendered_long_edge(h), small)
+ }
+
+ // Given a drag whose full-size drafts were too slow before (the CPU, a LUT profile, a slow
+ // GPU), when the same slider is dragged again, then it drafts small (#330)
+ #[test]
+ fn a_slow_drag_drafts_small() {
+ // the GPU device up front (the loupe never waits for it): with one, it is the earlier
+ // drag's time that makes this drag small
+ let _ = lightcraft_engine::gpu::available();
+ let (mut h, _) = detail();
+ let id = h.app.session.active().expect("a photo is open");
+ h.app.drag_scale.remember_slow(id, "Exposure");
+ let (main, small) = drag_exposure(&mut h);
+ assert!(main <= small, "the draft is {main} px, a small one at most {small}");
+ }
+
+ // Given soft proofing (rendered on the CPU even with a GPU), a drag drafts small (#330)
+ #[test]
+ fn a_soft_proofed_drag_drafts_small() {
+ // the GPU device up front (the loupe never waits for it): with one, this is the case where
+ // the GPU is there and the render still goes to the CPU
+ let _ = lightcraft_engine::gpu::available();
+ let (mut h, _) = detail();
+ h.app.ui.soft_proof = true;
+ h.settle(SETTLE);
+ let (main, small) = drag_exposure(&mut h);
+ assert!(main <= small, "the draft is {main} px, a small one at most {small}");
+ }
+
fn tile(h: &Headless, slot: Slot) -> Option<(usize, usize)> {
h.app.renderer.textures.get(&slot).map(|t| (t.size[0], t.size[1]))
}
diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md
index 7a03a5c8c..8fc8117b1 100644
--- a/docs/parity-checklist.md
+++ b/docs/parity-checklist.md
@@ -129,7 +129,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts).
| LR-VIEW-EDIT | Edit view | P0 | ✅ | `cmd:panel.edit` | |
| LR-VIEW-FULLSCREEN | Full-screen preview | P1 | ✅ | `cmd:view.fullScreenPreview`, `cmd:view.enterFullScreen` | photo on black, arrows step, Esc exits; ⇧⌘F window full screen |
| LR-VIEW-FILMSTRIP | Filmstrip | P0 | ✅ | `cmd:view.filmstrip`, `crates/ui-egui/src/panels/detail.rs` | the photo context menu on right-click; the mouse wheel scrolls it sideways; it follows the active photo only when that changes (centred if off screen), so a scrolled strip stays put; every selected photo is highlighted, the active one framed in white, as in the grid |
-| LR-VIEW-ZOOM | Zoom & pan | P0 | 🟡 | `cmd:view.zoomFit`, `cmd:view.zoom100`, `cmd:view.zoomIn`, `cmd:view.zoomOut`, `cmd:view.zoomToggle`, `cmd:view.clickZoom`, `cmd:view.navigate`, `crates/ui-egui/src/panels/detail.rs`, `crates/ui-egui/src/headless.rs` | continuous native pinch / modifier-wheel zoom (Fit–800%, anchored under the pointer), two-finger scroll / touch pan with edge limits; Detail (including tools, Before/After and full-screen preview), Compare and Reference; fractional percentages preserve small gestures; image, picker and targeted-adjustment cursors stay steady between gesture events; keyboard steps 25–800 % (not 6–1600 %); Fill in the bottom bar; click / Z / Space eases to the chosen ratio (1:1 default, 2:1, 3:1, 4:1, 8:1). The loupe's cost follows the canvas, not the zoom (issue #323): the whole frame is rendered at about canvas size (at most the 2560 px preview source level unless a larger Preview size is chosen, and never above the GPU's texture side), and once the view is zoomed well past that (more than 25 %) the window on screen is rendered too, cut from a frame of at most the photo's own pixels, so beyond 100 % the GPU magnifies it (`region::plan`, `RenderRequest::window`, `Session::region_job`, `crates/ui-egui/src/region.rs`); 1:1 and 2:1–8:1 are sharp at any photo size. A slider tick takes 7–12 ms on a 1400 × 900 canvas and 11–25 ms on a 2800 × 1700 one at 100 % and 400 % of a 24 MP photo (M1 Max, GPU, `profile_slider_drag`); about 20–25 ms at 100 % on the big canvas is over a 16 ms frame. A slider drag renders the whole frame at full size when the GPU renders (a canvas-sized frame takes a few ms there) and at 0.6 of it on the CPU, so the fit view stays sharp while dragging (`region::drag_scale`, issue #330). A continuous pinch holds the render sizes (and the windows there are) until it is quiet. A fit view on a canvas up to about 3200 px (a Retina Mac) never decodes the original; larger displays get a window at fit, which does. Modes that draw another picture over the loupe (mask overlays, soft proofing) and photos whose spots or Auto Mask strokes read too far for one window (only photos longer than 8192 px) render the whole frame at the size it is drawn, as before windows; while a preset or profile is hovered, or over a picture that is not the frame (an unsupported raw's embedded JPEG), the whole frame stays canvas-sized. Before/After (side by side, stacked, `\\` and both wipes) gets the same windows on both sides, clipped to their pane or side of the line. Windows render on the GPU like whole frames (equivalence-tested against the CPU), in the browser build too (windows no wider than its GPU's texture side, at most 3072 px), and are not made while hovering a look, soft-proofing or showing an overlay, nor over a picture that is not the frame (an unsupported raw's embedded JPEG with another crop). No texture is larger than the GPU allows. Spots and Auto Mask brushes work while what a window reads fits one render (8192 px along an axis, 4096 in the browser): the window grows to hold the spot and its source patch, or the dabs near it, and if that would take more (a clone from far away at 8:1) the loupe keeps the whole-frame render instead, and spots with an automatic source pick it from a fixed-size render of the whole frame (so a window's choice can differ from a whole-frame render's, which picks at its own resolution). The wide stages (dehaze, clarity, highlights/shadows base) and Refine Edges on masks read a window margin capped at 768 px; measured on hard-edged blocks that costs at most a few levels at 8:1. the histogram and Navigator come from the whole-frame render. Compare and Reference get the same windows, one per pane (`Slot::CompareRegion`, `panels/compare.rs`), over each pane's whole-frame render (at most 2560 px); while either view is open two originals stay decoded (`MediaCache::set_full_capacity`), so one pane's window does not evict the other's source; a pinch, or a slider drag on the active photo in Reference, keeps the windows there are until it ends. Still 🟡: mask overlays and soft proofing have no window (a full-size whole-frame render at 1:1) |
+| LR-VIEW-ZOOM | Zoom & pan | P0 | 🟡 | `cmd:view.zoomFit`, `cmd:view.zoom100`, `cmd:view.zoomIn`, `cmd:view.zoomOut`, `cmd:view.zoomToggle`, `cmd:view.clickZoom`, `cmd:view.navigate`, `crates/ui-egui/src/panels/detail.rs`, `crates/ui-egui/src/headless.rs` | continuous native pinch / modifier-wheel zoom (Fit–800%, anchored under the pointer), two-finger scroll / touch pan with edge limits; Detail (including tools, Before/After and full-screen preview), Compare and Reference; fractional percentages preserve small gestures; image, picker and targeted-adjustment cursors stay steady between gesture events; keyboard steps 25–800 % (not 6–1600 %); Fill in the bottom bar; click / Z / Space eases to the chosen ratio (1:1 default, 2:1, 3:1, 4:1, 8:1). The loupe's cost follows the canvas, not the zoom (issue #323): the whole frame is rendered at about canvas size (at most the 2560 px preview source level unless a larger Preview size is chosen, and never above the GPU's texture side), and once the view is zoomed well past that (more than 25 %) the window on screen is rendered too, cut from a frame of at most the photo's own pixels, so beyond 100 % the GPU magnifies it (`region::plan`, `RenderRequest::window`, `Session::region_job`, `crates/ui-egui/src/region.rs`); 1:1 and 2:1–8:1 are sharp at any photo size. A slider tick takes 7–12 ms on a 1400 × 900 canvas and 11–25 ms on a 2800 × 1700 one at 100 % and 400 % of a 24 MP photo (M1 Max, GPU, `profile_slider_drag`); about 20–25 ms at 100 % on the big canvas is over a 16 ms frame. A slider drag renders the whole frame at full size where the GPU draws the view, so the fit view stays sharp while dragging, and at 0.6 of it where that would be too slow: on the CPU, with soft proofing or the HDR range shown, or for a control whose full-size drafts on this photo went over the 16 ms slider budget in an earlier drag (a LUT profile or refined mask the CPU renders, a photo past a GPU limit, a slow GPU); the size is chosen when a drag starts and kept until it ends (`region::DragScale`, issue #330). A continuous pinch holds the render sizes (and the windows there are) until it is quiet. A fit view on a canvas up to about 3200 px (a Retina Mac) never decodes the original; larger displays get a window at fit, which does. Modes that draw another picture over the loupe (mask overlays, soft proofing) and photos whose spots or Auto Mask strokes read too far for one window (only photos longer than 8192 px) render the whole frame at the size it is drawn, as before windows; while a preset or profile is hovered, or over a picture that is not the frame (an unsupported raw's embedded JPEG), the whole frame stays canvas-sized. Before/After (side by side, stacked, `\\` and both wipes) gets the same windows on both sides, clipped to their pane or side of the line. Windows render on the GPU like whole frames (equivalence-tested against the CPU), in the browser build too (windows no wider than its GPU's texture side, at most 3072 px), and are not made while hovering a look, soft-proofing or showing an overlay, nor over a picture that is not the frame (an unsupported raw's embedded JPEG with another crop). No texture is larger than the GPU allows. Spots and Auto Mask brushes work while what a window reads fits one render (8192 px along an axis, 4096 in the browser): the window grows to hold the spot and its source patch, or the dabs near it, and if that would take more (a clone from far away at 8:1) the loupe keeps the whole-frame render instead, and spots with an automatic source pick it from a fixed-size render of the whole frame (so a window's choice can differ from a whole-frame render's, which picks at its own resolution). The wide stages (dehaze, clarity, highlights/shadows base) and Refine Edges on masks read a window margin capped at 768 px; measured on hard-edged blocks that costs at most a few levels at 8:1. the histogram and Navigator come from the whole-frame render. Compare and Reference get the same windows, one per pane (`Slot::CompareRegion`, `panels/compare.rs`), over each pane's whole-frame render (at most 2560 px); while either view is open two originals stay decoded (`MediaCache::set_full_capacity`), so one pane's window does not evict the other's source; a pinch, or a slider drag on the active photo in Reference, keeps the windows there are until it ends. Still 🟡: mask overlays and soft proofing have no window (a full-size whole-frame render at 1:1) |
| LR-VIEW-NAVIGATOR | Navigator mini map | P1 | ✅ | `cmd:view.navigator`, `crates/ui-egui/src/panels/detail.rs` | shown while zoomed (bottom right); click/drag pans |
| LR-VIEW-BEFOREAFTER | Before / after | P0 | ✅ | `cmd:view.showOriginal`, `cmd:view.beforeAfter`, `cmd:view.beforeAfterSplit`, `cmd:view.beforeAfterTopBottom`, `cmd:view.beforeAfterSplitTopBottom`, `cmd:beforeAfter.setBefore`, `cmd:beforeAfter.copyAfterToBefore`, `cmd:beforeAfter.copyBeforeToAfter`, `cmd:beforeAfter.swap`, `cmd:beforeAfter.resetBefore` | all four layouts; before = the import state (defaults + import preset) or a chosen history step / version / the current settings; copy and swap (View → Before/After Settings, History row menu). The chosen before lasts for the session; in side by side and top / bottom, clicks with the white-balance selector, colour samplers and targeted adjustment work in the Before view too (`crates/ui-egui/src/tests_before_after.rs`). Zoomed in, the side by side and stacked views each stay in their pane, with their labels under it |
| LR-VIEW-COMPARE | Compare two photos | P1 | ✅ | `cmd:view.compare`, `cmd:compare.swap`, `cmd:compare.makeSelect`, `cmd:compare.set`, `crates/ui-egui/src/panels/compare.rs`, `crates/ui-egui/src/tests_compare.rs` | select / candidate, synced zoom + pan, arrows move the candidate; a filmstrip click puts the photo into the active side (a photo on the other side swaps), so the active photo is always one of the two shown; 1:1 to 8:1 sharp on both sides (zoom windows, see LR-VIEW-ZOOM); no zoom-link toggle |
@@ -787,7 +787,7 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove
| Date | Change | Summary |
|---|---|---|
-| 2026-10-11 | minor | LR-VIEW-ZOOM: a slider drag keeps the loupe's full resolution when the GPU renders (0.6 draft on the CPU only, issue #330); status unchanged |
+| 2026-10-11 | minor | LR-VIEW-ZOOM: a slider drag keeps the loupe's full resolution where the GPU draws the view and keeps up (0.6 drafts on the CPU, with soft proofing or the HDR range, or after over-budget drags; issue #330); status unchanged |
| 2026-10-11 | minor | KEY-SLIDER-TYPE: honor immediate Return/Escape and keep typed keys in the value editor; add regression references |
| 2026-10-11 | minor | LR-PROF-CAMERACOLOR: raws with a black-and-white camera JPEG take its tone curve (issue #577) |
| 2026-10-11 | minor | LR-VIEW-ZOOM and LR-VIEW-COMPARE: Compare and Reference are sharp at 1:1 (zoom windows per pane, two originals kept decoded while they are open); statuses unchanged |