PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge PR #6480: Ctrl+Space and Alt+Space zoom the image under an open dialog
aiongga97dcfcb9ec7
diff --cc crates/ui-egui/src/canvas.rsindex 6e9ec9bc6,4afedd01d..edc9ac1f4--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@@ -3551,22 -3352,24 +3551,38 @@@ pub fn canvas_view(app: &mut Photocraft// Layer Style on a Drop or Inner Shadow page: a drag on the image moves the shadow (#5701).let shadow_drag =!picking && app.ui.dialogs.last().is_some_and(|d| d.kind == crate::state::DialogKind::LayerStyle && crate::layer_style::drags_shadow(&d.fields));- let hand = app.ui.tool == Tool::Hand && !picking && !range_picking && !refine_brushing && !pinning && !shadow_drag;+ // ⌘/Ctrl-click with Curves open: a point at the pixel's tone (#7325), whatever the tool. The+ // press's own modifiers decide, and only the press adds: a drag would add one per frame.+ let curve_point_press = (primary && !middle && crate::adjust_dialog::curves_on_top(app))+ .then(|| {+ ctx.input(|i| {+ i.events.iter().rev().find_map(|e| match e {+ egui::Event::PointerButton { button: PointerButton::Primary, pressed: true, modifiers, .. } => Some(*modifiers),+ _ => None,+ })+ })+ })+ .flatten()+ .map(|m| crate::workspace_ui::sticky_mods(app, m))+ .filter(|m| m.command);+ let hand = app.ui.tool == Tool::Hand && !picking && !range_picking && !refine_brushing && !pinning && !shadow_drag && curve_point_press.is_none();- if let Some(d) = crate::dialogs::pan_delta(&ctx, rect, hand) {+ // ⌘Space / ⌥Space zoom under the dialog as they do without one, before Space pans (#6460).+ let held_zoom = !middle && matches!(temporary, Some(crate::hold_keys::Temporary::ZoomIn | crate::hold_keys::Temporary::ZoomOut));+ if held_zoom {+ let alt = ctx.input(|i| i.modifiers.alt);+ if free_hover {+ ctx.set_cursor_icon(crate::tool_cursor::zoom(&ctx, zoom_out(alt)));+ }+ let b = crate::dialogs::free_buttons(&ctx, rect);+ let pointer = ctx.input(|i| i.pointer.latest_pos());+ crate::zoom_tool::drag(app, &ctx, &mut view, &xf, &b, pointer);+ if b.clicked+ && let Some(p) = pointer+ {+ let nz = crate::zoom_levels::step(view.zoom, if zoom_out(alt) { -1 } else { 1 }, view.doc_size);+ zoom_about(&mut view, &xf, p, nz, app.session.prefs().tools.zoom_clicked_point_to_center, ppp);+ }+ } else if let Some(d) = crate::dialogs::pan_delta(&ctx, rect, hand) {let d = xf.unmap_vec(d) / (view.zoom / ppp);view.center[0] -= d.x;view.center[1] -= d.y;