PhotoCraft: An open-source, photo editor written by scratch in pure Rust
docs(ui-parity): a Hand-tool ⌘-drag follows Scrubby Zoom (#6434)
Khawar Zamman Wani3649a4e6eac3
diff --git a/crates/ui-egui/src/hold_keys/tests.rs b/crates/ui-egui/src/hold_keys/tests.rsindex d2bbc687a..7251859a5 100644--- a/crates/ui-egui/src/hold_keys/tests.rs+++ b/crates/ui-egui/src/hold_keys/tests.rs@@ -880,7 +880,8 @@ fn cmd_and_alt_with_the_hand_tool_zoom_in_and_out() {assert_eq!(h.state().ui.tool, Tool::Hand, "the Hand is still the tool");}-/// A ⌘-drag with the Hand is the Zoom tool's scrubby zoom, not a pan.+/// A ⌘-drag with the Hand is the Zoom tool's drag, not a pan: a scrubby zoom with Scrubby Zoom on+/// (the default).#[test]fn cmd_drag_with_the_hand_tool_is_a_scrubby_zoom() {let mut h = harness(Tool::Hand);@@ -890,6 +891,19 @@ fn cmd_drag_with_the_hand_tool_is_a_scrubby_zoom() {assert_eq!(h.state().ui.tool, Tool::Hand);}+/// With Scrubby Zoom off, a ⌘-drag with the Hand draws the Zoom tool's rectangle instead. The+/// drag is nearly vertical, so a scrubby zoom (horizontal motion only) would barely change the+/// zoom, while zooming to the narrow rectangle fills the view with it.+#[test]+fn cmd_drag_with_the_hand_tool_follows_scrubby_zoom_off() {+ let mut h = harness(Tool::Hand);+ h.state_mut().ui.tool_options.zoom_scrubby = false;+ let z0 = h.state().ui.views[0].zoom;+ drag_with(&mut h, Modifiers::COMMAND, 150.0, 100.0, 160.0, 180.0);+ assert!(h.state().ui.views[0].zoom > z0 * 2.0, "{z0} -> {}", h.state().ui.views[0].zoom);+ assert_eq!(h.state().ui.tool, Tool::Hand);+}+/// ⌘ or ⌥ pressed during a Hand pan doesn't turn the drag into a zoom: the pan goes on.#[test]fn modifiers_pressed_during_a_hand_pan_keep_panning() {diff --git a/docs/ui-parity.md b/docs/ui-parity.mdindex 5c78b1884..702098554 100644--- a/docs/ui-parity.md+++ b/docs/ui-parity.md@@ -168,7 +168,7 @@ Triangle and Curvature Pen (minus legacy Rounded Rectangle and Targeted Adjustme| Behaviour | Status | Evidence ||---|---|---|| Space = Hand, ⌘Space / ⌘⌥Space = zoom in/out, spring-loaded while held | done | `hold_keys.rs` |-| Hand tool: ⌘ held = Zoom In, ⌥ (or ⌘⌥) held = Zoom Out; click steps, drag scrubs | done | `hold_keys.rs` `hand_zoom` (#6434); not during Free Transform or once a pan has started |+| Hand tool: ⌘ held = Zoom In, ⌥ (or ⌘⌥) held = Zoom Out; click steps, drag zooms as the Zoom tool does (scrubs with Scrubby Zoom on, else draws a zoom rectangle) | done | `hold_keys.rs` `hand_zoom` (#6434); not during Free Transform or once a pan has started || Hand tool: ⇧-drag / Scroll All Windows pans every open document; hold H for Bird's Eye View | missing | || Hold any tool letter for a temporary tool | done | `spring_tools.rs`: held ≥ 300 ms or used on the canvas, release gives the previous tool back; ⇧ never springs (#2672) || Scrubby zoom | done | `zoom_tool.rs` |