Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Merge PR #3698: feat: animate zoom

aiongg51606201ac96
diff --cc crates/ui-egui/src/canvas.rs
index 3a6fa065e,71d99e66b..456e104c6
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@@ -4025,13 -4108,17 +4126,21 @@@ pub fn canvas_view(app: &mut Photocraft
ctx.request_repaint();
}
}
- let xf = if crop_camera { ViewXform { center: view.center, rotation: view.rotation, ..xf } } else { xf };
- let (img_rect, beyond, layer_edges) = painted.unwrap_or_else(|| paint_canvas(app, ui, &view, xf));
+ let xf = if crop_camera {
+ if view.center != target_xf.center {
+ display_view.center = view.center;
+ }
+ display_view.rotation = view.rotation;
+ ViewXform { center: display_view.center, rotation: display_view.rotation, ..xf }
+ } else {
+ xf
+ };
+ let (img_rect, beyond, layer_edges) = painted.unwrap_or_else(|| paint_canvas(app, ui, &display_view, xf));
- if primary && !(hand_pan && response.dragged()) {
+ // A Hand drag (the tool, Space or the middle button) keeps every overlay on screen, as in
+ // Photoshop: the Pen path being drawn, paths, guides, grid, transform box (#6592). Only the
+ // tool cursors below give way to the fist.
+ let panning = hand_pan && response.dragged();
+ if primary {
// The transform preview is image content: it goes under the grid and guides, which
// stay visible across a layer being transformed (#5086); the box is drawn later.
crate::transform_tool::draw_content(app, &painter, &xf);