mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-27 11:37:13 -06:00
UI: the loupe follows a texture's aspect only when it really differs (#280)
A texture's whole-pixel size is slightly off the frame's exact aspect (a 128 px thumbnail by up to ~1 %), so following it always made the loupe rect jump a little as the thumbnail, preview and full render arrived, and moved mask and crop overlays with it. Follow it only when it differs by more than 2 % (an unsupported raw's embedded JPEG with another crop), and never in the crop tool, whose overlays need the frame's own geometry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01912WaK6Rmew3wxZuPyX7E8
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user