From 83f8dfd2b77777976834d9a5cfb6b0b718ef1503 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 24 Oct 2026 10:11:27 -0700 Subject: [PATCH] =?UTF-8?q?Hand=20tool:=20Shift=20held=20in=20Window=20?= =?UTF-8?q?=E2=80=BA=20Modifier=20Keys=20also=20scrolls=20every=20shown=20?= =?UTF-8?q?document?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A Hand drag read only the Shift key on the keyboard, so Shift turned on in the Modifier Keys panel left the other views where they were, although other canvas gestures read it as held. The drag now reads Shift through workspace_ui::sticky_mods. --- crates/ui-egui/src/canvas.rs | 5 +++-- crates/ui-egui/src/scroll_all_windows.rs | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index dccf2b03d0..50b3498b2b 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -4066,8 +4066,9 @@ pub fn canvas_view(app: &mut PhotocraftApp, ui: &mut egui::Ui, idx: usize, rect: // Preferences › Tools › Enable Flick Panning: a Hand drag let go while moving glides on. let flick_id = egui::Id::new(("pc-flick-pan", idx, primary, ctx.viewport_id())); let flick_on = app.session.prefs().tools.enable_flick_panning; - // Hand › Scroll All Windows, or Shift held: the other shown views follow this one. - let scroll_all = hand_pan && crate::scroll_all_windows::active(app, ctx.input(|i| i.modifiers.shift)); + // Hand › Scroll All Windows, or Shift held (on the keyboard or in Window › Modifier Keys): the + // other shown views follow this one. + let scroll_all = hand_pan && crate::scroll_all_windows::active(app, crate::workspace_ui::sticky_mods(app, ctx.input(|i| i.modifiers)).shift); let scroll_source = crate::scroll_all_windows::source(app, idx); // A glide keeps the drag's choice after Space, Shift or the button is let go. let scroll_all_id = flick_id.with("scroll-all"); diff --git a/crates/ui-egui/src/scroll_all_windows.rs b/crates/ui-egui/src/scroll_all_windows.rs index c3230a4a03..29a26ccc70 100644 --- a/crates/ui-egui/src/scroll_all_windows.rs +++ b/crates/ui-egui/src/scroll_all_windows.rs @@ -149,6 +149,11 @@ mod tests { /// Returns the dragged view's center and the stored centers of document 0's main view and of /// the window's view. fn drag_on_canvas(option: bool, shift: bool, in_window: bool) -> ([f32; 2], [f32; 2], [f32; 2]) { + drag_on_canvas_with(option, shift, false, in_window) + } + + /// As `drag_on_canvas`, with Shift held in Window › Modifier Keys when `sticky_shift` is set. + fn drag_on_canvas_with(option: bool, shift: bool, sticky_shift: bool, in_window: bool) -> ([f32; 2], [f32; 2], [f32; 2]) { let ctx = egui::Context::default(); let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default()); app.run("file.new", json!({"width": 2000, "height": 1500})).unwrap(); @@ -158,6 +163,7 @@ mod tests { app.session.set_active(0); app.ui.tool = Tool::Hand; app.ui.tool_options.hand_scroll_all = option; + app.ui.shell.sticky_shift = sticky_shift; app.ui.views[0] = view(1.0, [1000.0, 750.0], 0.0); app.ui.windows.push(DocWindow { id: 5, document: 1, view: view(1.0, [500.0, 375.0], 0.0), open: true, position: None }); let mut v = if in_window { view(1.0, [500.0, 375.0], 0.0) } else { view(1.0, [1000.0, 750.0], 0.0) }; @@ -201,6 +207,13 @@ mod tests { assert!(near(window, moved), "Shift turns it on for the drag: {window:?}"); } + #[test] + fn shift_held_in_the_modifier_keys_panel_makes_a_hand_drag_scroll_the_document_windows_too() { + let (dragged, _, window) = drag_on_canvas_with(false, false, true, false); + assert!(near(dragged, [1060.0, 720.0]), "the dragged view follows the pointer: {dragged:?}"); + assert!(near(window, [530.0, 360.0]), "sticky Shift turns it on for the drag: {window:?}"); + } + #[test] fn a_hand_drag_in_a_document_window_scrolls_the_main_window_once() { let (dragged, main, window) = drag_on_canvas(false, false, true);