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 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas 2026-10-01 11:18:10 -04:00
parent 900fd6101a
commit c97a7356f5
1 changed files with 9 additions and 1 deletions

View File

@ -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<f32> {
(0..256)
.map(|i| {