From c97a7356f5411c1f386f0d33c0341fcf32373d70 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Thu, 1 Oct 2026 11:18:10 -0400 Subject: [PATCH] M2.11: histogram shows the selected photo in the grid (thumbnail fallback) and never another photo's loupe render Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/edit.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/edit.rs b/crates/ui-egui/src/panels/edit.rs index 794dc5fb..239316a6 100644 --- a/crates/ui-egui/src/panels/edit.rs +++ b/crates/ui-egui/src/panels/edit.rs @@ -341,7 +341,15 @@ fn histogram(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { let p = ui.painter(); p.rect_filled(r, 0.0, t.button); let plot = Rect::from_min_max(r.min + vec2(0.0, 6.0), pos2(r.right(), r.bottom() - 26.0)); - if let Some(h) = app.renderer.textures.get(&Slot::Main).and_then(|t| t.histogram.clone()) { + // the loupe render of this photo, else its thumbnail (grid view before the loupe has rendered it) + let hist = app + .renderer + .textures + .get(&Slot::Main) + .filter(|t| t.photo == id) + .and_then(|t| t.histogram.clone()) + .or_else(|| app.renderer.textures.get(&Slot::Thumb(id)).and_then(|t| t.histogram.clone())); + if let Some(h) = hist { let smooth = |v: &[u32]| -> Vec { (0..256) .map(|i| {