LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
UI: the loupe follows a texture's aspect only when it really differs (#280)
Claude21de86b3df5a
diff --git a/crates/ui-egui/src/panels/detail.rs b/crates/ui-egui/src/panels/detail.rsindex f68168375..8ee7bfbf1 100644--- a/crates/ui-egui/src/panels/detail.rs+++ b/crates/ui-egui/src/panels/detail.rs@@ -207,7 +207,10 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {.or_else(|| app.renderer.textures.get(&Slot::Preview).filter(|t| t.photo == id)).or_else(|| app.renderer.thumb(id)).map(|tex| tex.size[0].max(1) as f32 / tex.size[1].max(1) as f32);- let display_aspect = visible_texture_aspect.unwrap_or(aspect);+ // Follow the texture only where it really differs (an unsupported raw's embedded JPEG with+ // another crop): a texture's whole-pixel size is a little off the exact aspect, and the crop+ // tool's overlays need the frame's own geometry.+ let display_aspect = visible_texture_aspect.filter(|a| !crop_tool && (a / aspect - 1.0).abs() > 0.02).unwrap_or(aspect);let target_rect = fit_rect(main_area, display_aspect, app.ui.zoom, native, ppp, app.ui.pan);let img_rect = animated_rect(ui.ctx(), &mut app.ui.zoom_anim, target_rect);app.image_rect = Some(img_rect);