Let a zoomed view fill the viewport rather than keep the photograph's shape
The view was the same fraction of each axis, so it kept the frame's aspect at every zoom: a portrait zoomed on a landscape screen stayed a portrait strip with the screen's sides empty. Each axis now shows as much of the frame as the viewport holds at that magnification, capped at the whole frame, and the render is fitted to the viewed region rather than to the frame. A redraw re-cuts a zoomed view about its centre when the viewport or the crop changes shape.
This commit is contained in:
@@ -895,10 +895,12 @@ fn wire_zoom_pan_crop(
|
||||
let weak = window.as_weak();
|
||||
let session = session.clone();
|
||||
let redraw = redraw.clone();
|
||||
let viewport = viewport.clone();
|
||||
window.on_zoom_at(move |factor, at_x, at_y| {
|
||||
let Some(w) = weak.upgrade() else { return };
|
||||
let (vw, vh) = *viewport.borrow();
|
||||
if let Some(s) = session.borrow_mut().as_mut() {
|
||||
s.zoom_about(factor, at_x, at_y);
|
||||
s.zoom_about(factor, at_x, at_y, vw, vh);
|
||||
}
|
||||
redraw(&w);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user