From debc68ac6d36ecb547c7f0d422e045b3811f2d46 Mon Sep 17 00:00:00 2001 From: OneSlips Date: Sun, 25 Oct 2026 15:36:34 +1000 Subject: [PATCH 01/33] LR-MASK-OVERLAY: one overlay rule; a mask with settings never shows by itself Every trigger goes through one check: the overlay shows with O / the eye (on to stay), or while the pointer is on a mask's row or pin and nothing is adjusted, or by itself for a mask without settings yet. A mask with settings is judged by its effect: creating, picking, duplicating or adding to one no longer shows the overlay (replaces #1800's re-show; its test is changed to the rule). A slider at work, a handle or pin drag and a brush stroke hide the overlay and the mask's lines and pins until let go, instead of switching the overlay off. No stand-in overlay while an Object click or a description is computed. From 42dbad7d, 5d074db8, 0c58de7a, 4436ab71 (minimum needed on main: no mask tree, overlay pop-up, dial input or on-photo AI progress). Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/lib.rs | 18 ++--- crates/ui-egui/src/menus.rs | 15 +++- crates/ui-egui/src/panels/detail.rs | 90 +++++++++++++++++++++-- crates/ui-egui/src/panels/masking.rs | 11 ++- crates/ui-egui/src/state.rs | 21 +++++- crates/ui-egui/src/tests_masking.rs | 69 +++++++++++------ crates/ui-egui/src/tests_preview_limit.rs | 4 + docs/parity-checklist.md | 5 +- docs/whats-new.md | 11 +++ 9 files changed, 192 insertions(+), 52 deletions(-) diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 4fc43172ce..e55617a601 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -695,16 +695,8 @@ impl LightcraftApp { // menu), it must not keep a search that no longer applies (issue #1648) self.ui.search.clear(); } - if r.is_ok() && id == "mask.adjust" { - // Judge local adjustments on the photo, without the selection overlay obscuring them. - // Keep it hidden after release; O / the overlay eye can show it again. - self.ui.mask_overlay = false; - } - if r.is_ok() && matches!(id, "mask.add" | "mask.addComponent" | "mask.duplicate" | "mask.select") { - // A new or newly picked mask shows its overlay again, as in Lightroom: hidden by a slider - // drag above, it stayed hidden while the Overlay menu still named a mode (issue #1800). - self.ui.mask_overlay = true; - } + // (a mask's sliders don't switch the overlay off, and creating or picking a mask doesn't + // switch it on: one rule decides when it shows, see `panels::detail::overlay_mask`) if r.is_ok() { // These commands finish synchronously, so their completion would otherwise // be invisible once the activity stack is gone. Never show success on error. @@ -907,8 +899,8 @@ impl LightcraftApp { ctx.request_repaint(); } if let Some(mask) = polled.refine { - // a new selection from a click or a description: show it, as `run` does for new masks - self.ui.mask_overlay = true; + // (a new selection from a click or a description shows by the overlay rule while its + // mask has no settings: `panels::detail::overlay_mask`) self.ui.detail_due = Some((now + 0.3, mask)); } if let Some(e) = polled.messages.into_iter().last() { @@ -1583,6 +1575,8 @@ impl LightcraftApp { self.library_changed(&ctx); // panels set it again this frame while the pointer rests on a preset or profile self.hover_preview = None; + // (and the mask row or pin under the pointer: the overlay shows that mask) + self.ui.mask_hover_prev = self.ui.mask_hover.take(); self.ai_mask_detail(&ctx); self.place_names_outcome(&ctx); if self.ui.fullscreen { diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index f6691a861d..5232f6c9fe 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -1082,8 +1082,18 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { - app.ui.mask_overlay = p.get("show").and_then(Value::as_bool).unwrap_or(!app.ui.mask_overlay); - Ok(json!({"maskOverlay": app.ui.mask_overlay})) + // O shows or hides what is on screen now: an overlay that showed by itself (a mask + // without settings yet) is hidden for that mask + let selected = app.session.active().and_then(|id| app.session.develop_of(id)).and_then(|d| { + app.session + .active_mask + .and_then(|mid| d.masks.iter().find(|m| m.id == mid).map(|m| (mid, crate::panels::detail::overlay_shown(app, m)))) + }); + let shown = selected.is_some_and(|s| s.1) || (selected.is_none() && app.ui.mask_overlay); + let show = p.get("show").and_then(Value::as_bool).unwrap_or(!shown); + app.ui.mask_overlay = show; + app.ui.mask_overlay_hidden = if show { None } else { selected.map(|s| s.0) }; + Ok(json!({"maskOverlay": show})) } "view.maskOverlayAll" => { app.ui.mask_overlay_all = !app.ui.mask_overlay_all; @@ -1363,7 +1373,6 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option bool { + app.ui.dragging_control.as_deref().is_some_and(|c| !shapes_graphics(c)) +} + +/// Slider ids that change what the mask graphics show rather than the photo's look. +fn shapes_graphics(id: &str) -> bool { + matches!(id, "refine" | "smoothness" | "edge" | "feather") +} + +/// The mask the overlay shows, if any. One rule: +/// overlay = O / Always, OR (the pointer on the mask's pin or row AND not adjusting), OR (Auto AND +/// the mask has no settings). "Adjusting" is a slider at work ([`adjusting`], which hides every +/// overlay in [`view_overlay`]) or a mask gesture (a handle or the gradient dragged, a brush +/// stroke): hovering never shows the overlay while one runs, even with the pointer over the pin +/// being dragged. A mask with settings (its own, or a preset's) never shows by itself, so its effect +/// can be judged while it is placed or picked; a mask without settings shows what it selects, also +/// while it is drawn (there is no effect to see yet). This replaces showing the overlay again on +/// every new, picked or duplicated mask (#1800): that covered the photo exactly when the user +/// judges a mask's effect; hovering its row or pin, or O, shows it on request. +pub(crate) fn overlay_mask<'a>(app: &LightcraftApp, d: &'a DevelopSettings) -> Option<&'a lightcraft_develop::Mask> { + if !mask_gesture(app) + && let Some(m) = app.ui.mask_hover.or(app.ui.mask_hover_prev).and_then(|id| d.masks.iter().find(|m| m.id == id)) + { + return Some(m); + } + let m = app.session.active_mask.and_then(|id| d.masks.iter().find(|m| m.id == id))?; + overlay_shown(app, m).then_some(m) +} + +/// Whether the selected mask `m`'s overlay shows (without hovering): O / Always, or Auto and `m` +/// has no settings ([`overlay_mask`] has the whole rule). +pub(crate) fn overlay_shown(app: &LightcraftApp, m: &lightcraft_develop::Mask) -> bool { + if app.ui.mask_overlay { + return true; + } + if app.ui.mask_overlay_hidden == Some(m.id) { + return false; + } + !mask_has_settings(m) +} + +/// Whether mask `m` changes the photo by itself: any adjustment off its default. (Its shape, Refine +/// Edges included, is not a setting: it is what the overlay is for.) +pub(crate) fn mask_has_settings(m: &lightcraft_develop::Mask) -> bool { + m.adjust != lightcraft_develop::LocalAdjustments::default() +} + +/// Whether a mask is being shaped on the photo right now: a handle or the gradient dragged, a brush +/// stroke. +pub(crate) fn mask_gesture(app: &LightcraftApp) -> bool { + matches!(app.gesture, Some(Gesture::MaskHandle { .. } | Gesture::Brush { .. })) +} + +/// Whether the selected mask `m` has an AI selection (an Object click or a description) still +/// being computed. Meanwhile no overlay shows for it: a stand-in would look like the result. +pub(crate) fn ai_computing(app: &LightcraftApp, m: &lightcraft_develop::Mask) -> bool { + app.session.segmenter.busy() + && m.components.iter().any(|c| matches!(&c.shape, MaskShape::Prompt { seg: None, .. } | MaskShape::Object { seg: None, .. })) +} + /// The diagnostic overlay the loupe shows (the selected mask, Point Color's visualized range, /// Visualize Spots). pub(crate) fn view_overlay(app: &LightcraftApp, d: &DevelopSettings) -> lightcraft_pipeline::Overlay { @@ -1570,19 +1634,22 @@ pub(crate) fn view_overlay(app: &LightcraftApp, d: &DevelopSettings) -> lightcra if app.ui.fullscreen { return Overlay::None; } + // a slider at work: the effect shows, not the overlay (it returns afterwards) + let shown = !adjusting(app); // Show every visible mask's region at once (Ctrl+Shift+O / Cmd+Shift+O), ahead of the selected-mask overlay - // so the shortcut is not shadowed by the always-on single-mask overlay. - if app.ui.right == RightPanel::Masking && app.ui.mask_overlay_all && d.masks.iter().any(|m| m.visible && !m.components.is_empty()) { + // so the shortcut is not shadowed by the single-mask overlay. + if shown && app.ui.right == RightPanel::Masking && app.ui.mask_overlay_all && d.masks.iter().any(|m| m.visible && !m.components.is_empty()) { return Overlay::AllMasks { view: MaskView::parse(&app.ui.mask_overlay_mode).unwrap_or_default(), color: app.ui.mask_overlay_color, opacity: app.ui.mask_overlay_opacity.clamp(0.0, 100.0).round() as u8, }; } - if app.ui.right == RightPanel::Masking - && app.ui.mask_overlay - && let Some(m) = app.session.active_mask.and_then(|id| d.masks.iter().find(|m| m.id == id)) + if shown + && app.ui.right == RightPanel::Masking + && let Some(m) = overlay_mask(app, d) && !m.components.is_empty() + && !ai_computing(app, m) { return Overlay::Mask { id: m.id.min(u16::MAX as u32) as u16, @@ -2337,7 +2404,12 @@ fn mask_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Respons let long = (map.rect.width().max(map.rect.height())) as f64; let active = app.session.active_mask; let clip = app.canvas_rect.unwrap_or(map.rect); - let p = &ui.painter_at(clip); + let mut painter = ui.painter_at(clip); + // a slider at work: no lines, handles or pins over the effect + if adjusting(app) { + painter.set_invisible(); + } + let p = &painter; // (mask, component, handle, screen position) of everything that can be grabbed let mut grips: Vec<(u32, usize, u8, Pos2)> = Vec::new(); // pins follow Show Pins and the Tool Overlay mode (Shift+H); Auto hides them while brushing @@ -2419,6 +2491,12 @@ fn mask_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Respons } } } + // the pointer on a pin shows that mask's overlay (as Lightroom Classic) + if let Some(h) = resp.hover_pos() + && let Some((mid, ..)) = grips.iter().find(|(_, _, handle, q)| *handle == 0 && q.distance(h) < 9.0) + { + app.ui.mask_hover = Some(*mid); + } mask_keys(app, ui, map, d, &grips); // Object selections (SAM 3) of the selected mask: each click, green to include, red to exclude // (clicks still on their way to the model included) diff --git a/crates/ui-egui/src/panels/masking.rs b/crates/ui-egui/src/panels/masking.rs index 675e5da6fb..7e1a91505c 100644 --- a/crates/ui-egui/src/panels/masking.rs +++ b/crates/ui-egui/src/panels/masking.rs @@ -195,9 +195,12 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { ui.horizontal(|ui| { ui.label(egui::RichText::new(crate::i18n::tr("Masks")).font(t.semibold(13.0)).color(t.text_label)); ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + // lit while the overlay is on to stay; a click does what O does let on = app.ui.mask_overlay; - if icon_button(ui, "maskOverlay", Icon::Eye, vec2(24.0, 24.0), on, true, "Show overlay (O)").clicked() { - app.ui.mask_overlay = !on; + if icon_button(ui, "maskOverlay", Icon::Eye, vec2(24.0, 24.0), on, true, "Show overlay (O)").clicked() + && let Err(e) = app.run("view.maskOverlay", json!({})) + { + app.toast(ui.ctx(), e); } let all = app.ui.mask_overlay_all; let all_mac = ui.ctx().os() == egui::os::OperatingSystem::Mac; @@ -260,6 +263,10 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { register(ui.ctx(), format!("maskName:{}", m.id), Rect::from_min_size(at, g.size())); ui.painter().galley(at, g, color); let resp = if elided { resp.on_hover_text(&m.name) } else { resp }; + // the pointer on a mask's row shows that mask's overlay (as Lightroom Classic) + if ui.rect_contains_pointer(r) { + app.ui.mask_hover = Some(m.id); + } // show / hide on hover (and always while hidden) // (the pointer test, not `hovered`: over the eye, the row itself no longer counts as hovered) if ui.rect_contains_pointer(r) || !m.visible { diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index decdf63641..15e2b0a720 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -835,9 +835,21 @@ pub struct UiState { #[serde(skip)] pub proof_intent: lightcraft_engine::proof::ProofIntent, pub proof_paper_ink: bool, - /// Masking: show the selected mask as a rendered overlay (O), how (`MaskView` name, ⇧O cycles), - /// in which colour and opacity (0..100, colour views), and whether pins are drawn. + /// Masking: the selected mask's overlay switched on to stay (O, the panel's eye: "Always"), + /// how it is drawn (`MaskView` name, ⇧O cycles), in which colour and opacity (0..100, colour + /// views), and whether pins are drawn. Without it the overlay shows only by the one rule of + /// [`crate::panels::detail::overlay_mask`]: a mask without settings yet, or the mask whose row + /// or pin the pointer is on. Not kept between sessions: the photo opens without it. + #[serde(skip)] pub mask_overlay: bool, + /// The mask whose row or pin the pointer is on, this frame and the last (the overlay shows it). + #[serde(skip)] + pub mask_hover: Option, + #[serde(skip)] + pub mask_hover_prev: Option, + /// O hid the automatic overlay of this mask (until O shows it again). + #[serde(skip)] + pub mask_overlay_hidden: Option, pub mask_overlay_mode: String, pub mask_overlay_color: [u8; 3], pub mask_overlay_opacity: f32, @@ -1506,7 +1518,10 @@ impl Default for UiState { proof_profile: None, proof_intent: lightcraft_engine::proof::ProofIntent::Perceptual, proof_paper_ink: false, - mask_overlay: true, + mask_overlay: false, + mask_hover: None, + mask_hover_prev: None, + mask_overlay_hidden: None, mask_overlay_mode: "color".into(), mask_overlay_color: [230, 30, 40], mask_overlay_opacity: 50.0, diff --git a/crates/ui-egui/src/tests_masking.rs b/crates/ui-egui/src/tests_masking.rs index c8d6d6c2ea..4d95304b6a 100644 --- a/crates/ui-egui/src/tests_masking.rs +++ b/crates/ui-egui/src/tests_masking.rs @@ -119,7 +119,9 @@ fn new_brush_starts_a_separate_mask_in_paint_mode() { click(&mut h, "maskNew:brush"); assert_eq!(h.app.session.active_mask, Some(2)); assert!(!h.app.ui.brush_erase); - assert!(h.app.ui.mask_overlay); + // a new mask has no settings: its overlay shows by itself (O stays as it was) + assert!(!h.app.ui.mask_overlay); + assert_eq!(crate::panels::detail::overlay_mask(&h.app, &develop(&h)).map(|m| m.id), Some(2)); let r = h.request("ui.set", json!({"brushSize": 0.15, "brushFeather": 0.0, "brushFlow": 100.0}), T); assert_eq!(r["ok"], true, "{r}"); brush_at(&mut h, 0.5, 0.5); @@ -138,11 +140,14 @@ fn mask_adjustments_hide_overlay_without_disabling_the_mask() { use lightcraft_pipeline::Overlay; let mut h = detail("panel.masking"); exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]})); - assert!(h.app.ui.mask_overlay); + let shown = |h: &Headless| matches!(crate::panels::detail::view_overlay(&h.app, &develop(h)), Overlay::Mask { .. }); + // a mask without settings shows what it selects, by itself (O is off) + assert!(!h.app.ui.mask_overlay); + assert!(shown(&h), "a new mask shows its overlay"); // Changing the shape needs the overlay; changing the image needs an unobscured preview. exec(&mut h, "mask.refine", json!({"value": 10.0})); - assert!(h.app.ui.mask_overlay); + assert!(shown(&h), "Refine Edges is the mask's shape, not a setting"); // The dock header pushes this adjustment below the initial viewport. Exercise the // actual visible slider rather than sending a synthetic click outside its clipped body. let panel = h.app.widgets.iter().find(|(id, _)| id == "panel:right_panel").unwrap().1; @@ -155,21 +160,28 @@ fn mask_adjustments_hide_overlay_without_disabling_the_mask() { assert!(panel.contains_rect(slider), "exposure is visible before clicking: {slider:?} in {panel:?}"); let r = h.request("ui.clickWidget", json!({"id": "slider:exposure", "fx": 0.7}), T); assert_eq!(r["ok"], true, "{r}"); - assert!(!h.app.ui.mask_overlay, "the exposure slider hides the overlay after release"); let d = develop(&h); assert!(d.masks[0].adjust.exposure > 0.0); assert!(d.masks[0].visible, "hiding the overlay must not disable the mask"); - assert_eq!(crate::panels::detail::view_overlay(&h.app, &d), Overlay::None); + // the pointer is off the row and the pin: a mask with settings shows its effect, not the overlay + h.app.ui.mask_hover = None; + h.app.ui.mask_hover_prev = None; + assert_eq!(crate::panels::detail::view_overlay(&h.app, &d), Overlay::None, "a mask with settings never shows by itself"); let mask = d.masks[0].clone(); let r = h.request("ui.key", json!({"key": "o"}), T); assert_eq!(r["ok"], true, "{r}"); - assert!(h.app.ui.mask_overlay, "O can restore the overlay"); + assert!(h.app.ui.mask_overlay, "O shows the overlay on request"); assert_eq!(develop(&h).masks[0], mask, "toggling the overlay leaves the mask and its effect unchanged"); - assert!(matches!(crate::panels::detail::view_overlay(&h.app, &develop(&h)), Overlay::Mask { .. })); + assert!(shown(&h)); + // a slider at work hides even an overlay switched on with O; it comes back when let go + h.app.ui.dragging_control = Some("exposure".into()); + assert_eq!(crate::panels::detail::view_overlay(&h.app, &develop(&h)), Overlay::None, "nothing shows while a slider is at work"); + h.app.ui.dragging_control = None; + assert!(shown(&h)); // Ctrl+Shift+O / Cmd+Shift+O shows every visible mask's region at once (the new command), ahead of the selected - // mask overlay so it is not shadowed by the always-on single-mask overlay. + // mask overlay so it is not shadowed by the single-mask overlay. exec(&mut h, "view.maskOverlayAll", json!({})); assert!(h.app.ui.mask_overlay_all, "the all-masks overlay command turns it on"); assert!(matches!(crate::panels::detail::view_overlay(&h.app, &develop(&h)), Overlay::AllMasks { .. })); @@ -177,49 +189,58 @@ fn mask_adjustments_hide_overlay_without_disabling_the_mask() { assert!(!h.app.ui.mask_overlay_all, "the all-masks overlay command toggles it off"); assert!(!matches!(crate::panels::detail::view_overlay(&h.app, &develop(&h)), Overlay::AllMasks { .. })); - // Failed edits and global adjustments must not hide the mask overlay. + // O stays on through edits: failed ones, global adjustments and the mask's own values assert!(h.app.run("mask.adjust", json!({"id": 999, "values": {"exposure": 1.0}})).is_err()); assert!(h.app.ui.mask_overlay); exec(&mut h, "develop.set", json!({"control": "light.exposure", "value": 0.5})); assert!(h.app.ui.mask_overlay); - - // Numeric edits/resets and Amount use the same command path as the sliders. for values in [json!({"exposure": 0.0}), json!({"saturation": 20.0}), json!({"amount": 50.0})] { - exec(&mut h, "view.maskOverlay", json!({"show": true})); exec(&mut h, "mask.adjust", json!({"values": values})); - assert!(!h.app.ui.mask_overlay); + assert!(h.app.ui.mask_overlay && shown(&h), "{values}"); } h.settle(SETTLE); } -/// A slider hides the overlay (above); a new mask, an added part, a duplicate or picking a mask in -/// the list shows it again, so the Overlay menu's mode is what the photo shows (issue #1800). +/// One overlay rule replaces showing the overlay again on every new, picked, duplicated or extended +/// mask (issue #1800): a mask without settings shows what it selects by itself; picking a mask that +/// has settings, adding a part to it or duplicating it shows its effect, so it can be judged; the +/// pointer on its row (or pin), or O, shows its overlay on request. #[test] -fn a_new_or_picked_mask_shows_the_overlay_hidden_by_a_slider() { +fn a_mask_shows_its_overlay_by_itself_only_without_settings() { use lightcraft_pipeline::Overlay; let mut h = detail("panel.masking"); exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]})); let first = h.app.session.active_mask.unwrap(); - let hide = |h: &mut Headless| { - exec(h, "mask.adjust", json!({"values": {"exposure": 0.5}})); - assert!(!h.app.ui.mask_overlay); + let off_rows = |h: &mut Headless| { + h.app.ui.mask_hover = None; + h.app.ui.mask_hover_prev = None; }; let shown = |h: &Headless| matches!(crate::panels::detail::view_overlay(&h.app, &develop(h)), Overlay::Mask { .. }); - hide(&mut h); + assert!(shown(&h), "a new mask without settings shows its overlay"); + exec(&mut h, "mask.adjust", json!({"values": {"exposure": 0.5}})); + off_rows(&mut h); + assert!(!shown(&h), "with settings it shows its effect"); exec(&mut h, "mask.add", json!({"kind": "radial", "center": [0.4, 0.5], "rx": 0.2, "ry": 0.2})); + off_rows(&mut h); assert!(shown(&h), "a new mask shows its overlay"); - hide(&mut h); let r = h.request("ui.clickWidget", json!({"id": format!("mask:{first}")}), T); assert_eq!(r["ok"], true, "{r}"); assert_eq!(h.app.session.active_mask, Some(first)); - assert!(shown(&h), "picking a mask in the list shows its overlay"); + off_rows(&mut h); + assert!(!shown(&h), "picking a mask with settings shows its effect, not the overlay"); for (cmd, params) in [("mask.addComponent", json!({"kind": "radial", "op": "add", "center": [0.6, 0.5], "rx": 0.1, "ry": 0.1})), ("mask.duplicate", json!({}))] { - hide(&mut h); exec(&mut h, cmd, params); - assert!(shown(&h), "{cmd} shows the overlay"); + off_rows(&mut h); + assert!(!shown(&h), "{cmd} on a mask with settings shows its effect"); } + // on request: the pointer on the mask's row, or O + h.app.ui.mask_hover = h.app.session.active_mask; + assert!(shown(&h), "the pointer on its row shows the overlay"); + off_rows(&mut h); + h.request("ui.key", json!({"key": "o"}), T); + assert!(shown(&h), "O shows it"); h.settle(SETTLE); } diff --git a/crates/ui-egui/src/tests_preview_limit.rs b/crates/ui-egui/src/tests_preview_limit.rs index e87e523551..b5e17fe329 100644 --- a/crates/ui-egui/src/tests_preview_limit.rs +++ b/crates/ui-egui/src/tests_preview_limit.rs @@ -202,13 +202,16 @@ mod in_the_loupe { } h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.app.ui.pan = (0.3, 0.4); + // (a mask without settings shows its overlay by itself: O hides it for that mask) h.app.ui.mask_overlay = false; + h.app.ui.mask_overlay_hidden = h.app.session.active_mask; h.settle(SETTLE); let (zoom, pan) = (h.app.ui.zoom, h.app.ui.pan); assert_eq!(zoom, crate::state::Zoom::Percent(100.0)); let plain = h.app.region_view.expect("a window render without the overlay"); h.app.ui.mask_overlay = true; + h.app.ui.mask_overlay_hidden = None; h.settle(SETTLE); let id = h.app.session.active().expect("a photo"); let d = h.app.session.develop_of(id).expect("settings"); @@ -222,6 +225,7 @@ mod in_the_loupe { assert_ne!(shown.settings, plain.settings, "the overlay is part of the window's look"); h.app.ui.mask_overlay = false; + h.app.ui.mask_overlay_hidden = h.app.session.active_mask; h.settle(SETTLE); assert_eq!((h.app.ui.zoom, h.app.ui.pan), (zoom, pan), "hiding it keeps them too"); assert_eq!(h.app.region_view.map(|r| r.settings), Some(plain.settings), "back to the plain window"); diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index dcdaec565d..429456a22b 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -1,6 +1,6 @@ # Lightroom parity checklist -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-24 · **Change:** minor (KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (LR-MASK-OVERLAY: one overlay rule — O, the pointer on a row or pin, or a mask without settings; nothing while adjusting; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what we have and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good @@ -308,7 +308,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | LR-MASK-FEATHER-EDGE | Refine mask edges | P2 | ✅ | `cmd:mask.refine`, `crates/pipeline/src/masks.rs` (`evaluate_one`) | Refine Edges slider per mask: guided filter on the photo's luminance snaps soft mask edges to the photo's edges (rendered on the CPU) | | LR-MASK-SLIDERS | Local adjustment sliders | P0 | ✅ | `cmd:mask.adjust`, `crates/pipeline/src/finish.rs` | every slider renders (CPU + GPU), incl. Noise, Moiré, Defringe (negative Defringe has no effect); no local curve | | LR-MASK-EFFECTS | Local adjustment (effect / brush) presets | P1 | ✅ | `cmd:mask.effects`, `cmd:mask.applyEffect`, `cmd:mask.saveEffect`, `cmd:mask.updateEffect`, `cmd:mask.renameEffect`, `cmd:mask.duplicateEffect`, `cmd:mask.deleteEffect`, `cmd:mask.favoriteEffect`, `cmd:mask.setEffectGroup`, `cmd:mask.renameEffectGroup`, `cmd:mask.toolEffect`, `cmd:mask.importEffects`, `cmd:mask.exportEffects`, `cmd:dialog.saveMaskEffect`, `cmd:dialog.manageMaskEffects`, `cmd:file.exportMaskEffects`, `crates/engine/src/cmd/mask_effects.rs`, `crates/engine/src/cmd/mask_effect_files.rs`, `crates/ui-egui/src/panels/mask_effects.rs` | Effect menu above the mask sliders: grouped (folders, ★ Favorites first), searchable, scrolls, ↑ ↓ Return, ✓ on the matching effect (else Custom), resting on an effect previews it on the photo; right-click: apply to all masks / to the same-named mask on the selected photos (one undo step), update, rename, duplicate, star, move to group, delete (asks first); Reset Sliders; New Effect Preset dialog: which sliders (All / None / Changed Only), Amount, brush size/feather/flow; any mask type; Manage Effect Presets window (search, inline rename, update, duplicate, stars, groups, export, delete with confirmation); a new mask starts with the effect last applied to a mask of its kind (per tool, kept with the library); imports Lightroom Classic local `.lrtemplate` presets, Camera Raw local-correction `.xmp` presets, `.lceffect` and `.zip` bundles, through File ▸ Import Profiles & Presets… and drag & drop too; folders and LrC divider presets (`10 ----- DETAIL ----- 10`) become groups; settings with no local slider here (`grain`, Point Color `pointColors`, `toningLuminance`) are reported and kept with the effect for export, not applied (🟡 for those); brush size/feather/flow aren't in LrC presets (it keeps them per brush), so only `.lceffect` carries them; no built-in effects | -| LR-MASK-OVERLAY | Mask overlay | P0 | ✅ | `cmd:view.maskOverlay`, `cmd:view.maskOverlayMode`, `cmd:view.maskOverlayColor`, `crates/pipeline/src/visualize.rs` | rendered alpha of the selected mask (CPU + GPU): colour, colour on B&W, image on black/white, white on black; ⇧O cycles while masking; successful local adjustments (including Amount) hide the overlay until O / the eye shows it again or a mask is created, picked, duplicated or added to (issue #1800); shape/edge edits retain it; zoomed in, the overlay is rendered on the same sharp window as the plain view (zoom and pan unchanged; `crates/ui-egui/src/tests_preview_limit.rs`, `crates/pipeline/src/tests_window.rs`); no auto-show on hover | +| LR-MASK-OVERLAY | Mask overlay | P0 | ✅ | `cmd:view.maskOverlay`, `cmd:view.maskOverlayMode`, `cmd:view.maskOverlayColor`, `crates/pipeline/src/visualize.rs`, `crates/ui-egui/src/panels/detail.rs` (`overlay_mask`, `adjusting`) | one rule decides when the overlay shows: O / the eye by the Masks title (on to stay), or the pointer on a mask's row or pin while nothing is being adjusted, or by itself for a mask without settings yet; a mask with settings never shows by itself (picking, creating, duplicating or adding to it shows its effect, replacing #1800's re-show); nothing shows while a slider or a mask drag or brush stroke is at work, and it comes back when let go; no stand-in overlay while an Object click or a description is still being computed; rendered alpha of the selected mask (CPU + GPU): colour, colour on B&W, image on black/white, white on black; ⇧O cycles while masking; zoomed in, the overlay is rendered on the same sharp window as the plain view (zoom and pan unchanged; `crates/ui-egui/src/tests_preview_limit.rs`, `crates/pipeline/src/tests_window.rs`) | | LR-MASK-OVERLAYALL | Show all mask overlays | P1 | ✅ | `cmd:view.maskOverlayAll`, `crates/ui-egui/src/panels/masking.rs`, `crates/pipeline/src/visualize.rs` | one diagnostic tint over every visible mask at once (CPU + GPU): the masks still stack their adjustments as before — this only paints each mask's region together, so you can see all masked areas at a glance (⌘⇧O / Ctrl+Shift+O) | | LR-MASK-PINS | Pins | P1 | ✅ | `cmd:view.maskPins`, `cmd:view.toolOverlay`, `crates/ui-egui/src/panels/detail.rs`, `crates/ui-egui/src/tests_tool_overlay.rs` | a pin per radial/linear/brush component: click selects its mask, drag moves it; Show Pins on follows the Tool Overlay mode (Auto: while the pointer is over the photo, hidden while brushing; Always; Selected: the selected mask's; Never; ⇧H cycles, #224); no pins for range/AI components | | LR-MASK-UPDATE | Recompute AI masks | P2 | ⬜ | | | @@ -799,6 +799,7 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | Date | Change | Summary | |---|---|---| +| 2026-10-25 | minor | LR-MASK-OVERLAY: one overlay rule (O / the eye, or the pointer on the mask's row or pin while nothing is adjusted, or a mask without settings yet); a mask with settings never shows by itself, so picking, creating, duplicating or adding to one no longer shows the overlay (#1800's re-show replaced, its test changed to the rule); sliders, mask drags and brush strokes hide it and the mask's lines and pins while at work; no stand-in overlay while an AI selection is computed; status unchanged (✅) | | 2026-10-24 | minor | KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 (`keyword.nextSet`, `keyword.previousSet`) go to the next / previous keyword set; status counts unchanged (KEYC-METADATA stays 🟡) | | 2026-10-24 | minor | KEYC-METADATA: ⌘K / Ctrl+K (`panel.addKeywords`, Add Keywords) shows the Keywords panel, opens Keywording and puts the cursor in the Add keyword box; status counts unchanged (KEYC-METADATA stays 🟡) | | 2026-10-24 | patch | LR-LIB-RATING, LR-LIB-DELETE: a slider drag still open when a rating, flag or label takes the photo out of the view, or when the photo is deleted, ends as its own undo step before the selection moves on, as moving to the next photo does; LR-BEHAV-LOCALIZE lists all 18 languages; status unchanged | diff --git a/docs/whats-new.md b/docs/whats-new.md index c6c2592003..d276c2cc48 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -1,5 +1,16 @@ # What's new in LightCraft +## 2026-10-25 + +### The mask overlay shows when it helps +- One rule now decides when a mask's overlay covers the photo: when you switch it on with **O** (or the eye by the + Masks title), while the pointer is on the mask's row or pin, or by itself for a mask that has no settings yet, so + you see what it selects. A mask with settings (its own or a preset's) never shows the overlay by itself, so you can + judge its effect: picking, creating, duplicating or adding to such a mask no longer covers the photo. While a + slider, a mask drag or a brush stroke is at work nothing covers the photo, not even an overlay switched on with O; + it comes back when you let go. While an Object click or a description is still being computed, no stand-in + overlay shows. + ## 2026-10-24 ### Relative-date filters and smart albums follow the clock From 197383884c8a947a659e4c1a67d2833d1fa1a53d Mon Sep 17 00:00:00 2001 From: OneSlips Date: Sun, 25 Oct 2026 21:11:10 +1000 Subject: [PATCH 02/33] LR-MASK-OVERLAY: the hovered and the O-hidden mask belong to their photo A mask's hover (row or pin) and O hiding a mask's automatic overlay now keep the photo they were on: on another photo a mask with the same id is another mask, so a hover left over from the photo the filmstrip just left, or a mask hidden there, says nothing about the photo now shown (CodeRabbit). Test `tests_masking::a_mask_hovered_or_hidden_on_one_photo_says_nothing_about_another`. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/menus.rs | 3 ++- crates/ui-egui/src/panels/detail.rs | 8 +++--- crates/ui-egui/src/panels/masking.rs | 2 +- crates/ui-egui/src/state.rs | 11 ++++---- crates/ui-egui/src/tests_masking.rs | 32 ++++++++++++++++++++++- crates/ui-egui/src/tests_preview_limit.rs | 4 +-- 6 files changed, 47 insertions(+), 13 deletions(-) diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 5232f6c9fe..396f2aad9d 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -1092,7 +1092,8 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { diff --git a/crates/ui-egui/src/panels/detail.rs b/crates/ui-egui/src/panels/detail.rs index 33d84fcb7a..0829134d7c 100644 --- a/crates/ui-egui/src/panels/detail.rs +++ b/crates/ui-egui/src/panels/detail.rs @@ -1588,7 +1588,9 @@ fn shapes_graphics(id: &str) -> bool { /// judges a mask's effect; hovering its row or pin, or O, shows it on request. pub(crate) fn overlay_mask<'a>(app: &LightcraftApp, d: &'a DevelopSettings) -> Option<&'a lightcraft_develop::Mask> { if !mask_gesture(app) - && let Some(m) = app.ui.mask_hover.or(app.ui.mask_hover_prev).and_then(|id| d.masks.iter().find(|m| m.id == id)) + && let Some(photo) = app.session.active() + && let Some(m) = + app.ui.mask_hover.or(app.ui.mask_hover_prev).filter(|(p, _)| *p == photo).and_then(|(_, id)| d.masks.iter().find(|m| m.id == id)) { return Some(m); } @@ -1602,7 +1604,7 @@ pub(crate) fn overlay_shown(app: &LightcraftApp, m: &lightcraft_develop::Mask) - if app.ui.mask_overlay { return true; } - if app.ui.mask_overlay_hidden == Some(m.id) { + if app.session.active().is_some_and(|photo| app.ui.mask_overlay_hidden == Some((photo, m.id))) { return false; } !mask_has_settings(m) @@ -2495,7 +2497,7 @@ fn mask_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Respons if let Some(h) = resp.hover_pos() && let Some((mid, ..)) = grips.iter().find(|(_, _, handle, q)| *handle == 0 && q.distance(h) < 9.0) { - app.ui.mask_hover = Some(*mid); + app.ui.mask_hover = app.session.active().map(|photo| (photo, *mid)); } mask_keys(app, ui, map, d, &grips); // Object selections (SAM 3) of the selected mask: each click, green to include, red to exclude diff --git a/crates/ui-egui/src/panels/masking.rs b/crates/ui-egui/src/panels/masking.rs index 7e1a91505c..31526ccedf 100644 --- a/crates/ui-egui/src/panels/masking.rs +++ b/crates/ui-egui/src/panels/masking.rs @@ -265,7 +265,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { let resp = if elided { resp.on_hover_text(&m.name) } else { resp }; // the pointer on a mask's row shows that mask's overlay (as Lightroom Classic) if ui.rect_contains_pointer(r) { - app.ui.mask_hover = Some(m.id); + app.ui.mask_hover = app.session.active().map(|photo| (photo, m.id)); } // show / hide on hover (and always while hidden) // (the pointer test, not `hovered`: over the eye, the row itself no longer counts as hovered) diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 15e2b0a720..24f9799bb2 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -842,14 +842,15 @@ pub struct UiState { /// or pin the pointer is on. Not kept between sessions: the photo opens without it. #[serde(skip)] pub mask_overlay: bool, - /// The mask whose row or pin the pointer is on, this frame and the last (the overlay shows it). + /// The mask whose row or pin the pointer is on, this frame and the last (the overlay shows it), + /// with the photo it is on: a mask of the same id on another photo is another mask. #[serde(skip)] - pub mask_hover: Option, + pub mask_hover: Option<(lightcraft_engine::catalog::PhotoId, u32)>, #[serde(skip)] - pub mask_hover_prev: Option, - /// O hid the automatic overlay of this mask (until O shows it again). + pub mask_hover_prev: Option<(lightcraft_engine::catalog::PhotoId, u32)>, + /// O hid the automatic overlay of this mask of this photo (until O shows it again). #[serde(skip)] - pub mask_overlay_hidden: Option, + pub mask_overlay_hidden: Option<(lightcraft_engine::catalog::PhotoId, u32)>, pub mask_overlay_mode: String, pub mask_overlay_color: [u8; 3], pub mask_overlay_opacity: f32, diff --git a/crates/ui-egui/src/tests_masking.rs b/crates/ui-egui/src/tests_masking.rs index 4d95304b6a..034b530f48 100644 --- a/crates/ui-egui/src/tests_masking.rs +++ b/crates/ui-egui/src/tests_masking.rs @@ -236,7 +236,7 @@ fn a_mask_shows_its_overlay_by_itself_only_without_settings() { assert!(!shown(&h), "{cmd} on a mask with settings shows its effect"); } // on request: the pointer on the mask's row, or O - h.app.ui.mask_hover = h.app.session.active_mask; + h.app.ui.mask_hover = h.app.session.active().zip(h.app.session.active_mask); assert!(shown(&h), "the pointer on its row shows the overlay"); off_rows(&mut h); h.request("ui.key", json!({"key": "o"}), T); @@ -244,6 +244,36 @@ fn a_mask_shows_its_overlay_by_itself_only_without_settings() { h.settle(SETTLE); } +/// The pointer on a mask's row, and O hiding a mask's automatic overlay, belong to that photo: on +/// another photo a mask with the same id is another mask. +#[test] +fn a_mask_hovered_or_hidden_on_one_photo_says_nothing_about_another() { + use lightcraft_pipeline::Overlay; + let mut h = detail("panel.masking"); + let first = h.app.session.active().unwrap(); + exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]})); + let mask = h.app.session.active_mask.unwrap(); + let shown = |h: &Headless| matches!(crate::panels::detail::view_overlay(&h.app, &develop(h)), Overlay::Mask { .. }); + // O hides the fresh mask's overlay on this photo + h.request("ui.key", json!({"key": "o"}), T); + assert!(!shown(&h)); + assert_eq!(h.app.ui.mask_overlay_hidden, Some((first, mask))); + // another photo with a fresh mask of the same id still shows it + let other = h.app.session.visible_cloned().into_iter().find(|p| *p != first).unwrap(); + exec(&mut h, "library.select", json!({"ids": [other.0]})); + exec(&mut h, "mask.add", json!({"kind": "linear", "start": [0.5, 0.2], "end": [0.5, 0.7]})); + assert_eq!(h.app.session.active(), Some(other)); + assert_eq!(h.app.session.active_mask, Some(mask), "the same id on the other photo"); + h.app.ui.mask_hover = None; + h.app.ui.mask_hover_prev = None; + assert!(shown(&h), "hidden on the first photo only"); + // a hover left over from the first photo doesn't count here + exec(&mut h, "mask.adjust", json!({"values": {"exposure": 0.5}})); + h.app.ui.mask_hover_prev = Some((first, mask)); + assert!(!shown(&h), "the first photo's hover is not this photo's"); + h.settle(SETTLE); +} + #[test] fn radial_body_drag_moves_rotated_components_and_undoes_once() { let mut h = detail("panel.masking"); diff --git a/crates/ui-egui/src/tests_preview_limit.rs b/crates/ui-egui/src/tests_preview_limit.rs index b5e17fe329..26397af151 100644 --- a/crates/ui-egui/src/tests_preview_limit.rs +++ b/crates/ui-egui/src/tests_preview_limit.rs @@ -204,7 +204,7 @@ mod in_the_loupe { h.app.ui.pan = (0.3, 0.4); // (a mask without settings shows its overlay by itself: O hides it for that mask) h.app.ui.mask_overlay = false; - h.app.ui.mask_overlay_hidden = h.app.session.active_mask; + h.app.ui.mask_overlay_hidden = h.app.session.active().zip(h.app.session.active_mask); h.settle(SETTLE); let (zoom, pan) = (h.app.ui.zoom, h.app.ui.pan); assert_eq!(zoom, crate::state::Zoom::Percent(100.0)); @@ -225,7 +225,7 @@ mod in_the_loupe { assert_ne!(shown.settings, plain.settings, "the overlay is part of the window's look"); h.app.ui.mask_overlay = false; - h.app.ui.mask_overlay_hidden = h.app.session.active_mask; + h.app.ui.mask_overlay_hidden = h.app.session.active().zip(h.app.session.active_mask); h.settle(SETTLE); assert_eq!((h.app.ui.zoom, h.app.ui.pan), (zoom, pan), "hiding it keeps them too"); assert_eq!(h.app.region_view.map(|r| r.settings), Some(plain.settings), "back to the plain window"); From 5a8f54a1ba8c6a6905a3bd5da88a8a9adee75f46 Mon Sep 17 00:00:00 2001 From: OneSlips Date: Sun, 25 Oct 2026 23:44:29 +1000 Subject: [PATCH 03/33] LR-MASK-OVERLAY: each mask hidden with O stays hidden until O shows it again mask_overlay_hidden holds every (photo, mask) O hid, not just the last one: hiding mask B no longer brings mask A's automatic overlay back (CodeRabbit). Test `tests_masking::each_mask_hidden_with_o_stays_hidden`. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/menus.rs | 8 ++++++- crates/ui-egui/src/panels/detail.rs | 2 +- crates/ui-egui/src/state.rs | 6 ++--- crates/ui-egui/src/tests_masking.rs | 28 ++++++++++++++++++++++- crates/ui-egui/src/tests_preview_limit.rs | 6 ++--- 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 396f2aad9d..7f22ab7401 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -1093,7 +1093,13 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option