REVERT: Back to working viewer - Keep what works (Mouse Zoom/Pan), Remove over-engineering

This commit is contained in:
wfx 2026-02-04 16:29:09 +01:00
parent 49bff3dd89
commit a9284bc22b
9 changed files with 637 additions and 642 deletions

View file

@ -126,6 +126,31 @@ pub fn update(app: &mut NoctuaApp, msg: &AppMessage) -> UpdateResult {
app.model.reset_pan();
}
AppMessage::ViewerStateChanged {
scale,
offset_x,
offset_y,
canvas_size,
image_size,
} => {
// Detect scale changes (zoom vs just pan)
let old_scale = app.model.scale;
// Update model from viewer state
app.model.scale = *scale;
app.model.pan_x = *offset_x;
app.model.pan_y = *offset_y;
app.model.canvas_size = *canvas_size;
app.model.image_size = *image_size;
// If scale changed, user zoomed -> switch to Custom mode
// (Fit mode is only maintained when explicitly set via ZoomFit button)
if old_scale != *scale {
app.model.view_mode = ViewMode::Custom;
}
}
// ---- Pan control ---------------------------------------------------------
AppMessage::PanLeft => {
app.model.pan_x -= app.config.pan_step;
}
@ -223,11 +248,9 @@ pub fn update(app: &mut NoctuaApp, msg: &AppMessage) -> UpdateResult {
}
}
}
AppMessage::CropDragMove { x, y } => {
AppMessage::CropDragMove { x, y, max_x, max_y } => {
if app.model.tool_mode == ToolMode::Crop {
if let Some((img_w, img_h)) = app.model.current_dimensions {
app.model.crop_selection.update_drag(*x, *y, img_w as f32, img_h as f32);
}
app.model.crop_selection.update_drag(*x, *y, *max_x, *max_y);
}
}
AppMessage::CropDragEnd => {