From 41ef776d46aac50580035e865de55f87ceb6048b Mon Sep 17 00:00:00 2001 From: Matt Woelfel Date: Mon, 13 May 2024 21:16:19 -0500 Subject: [PATCH] fixes #2359 The current implementation strictly scrolls vertically without the shift modifier and horizontally with the shift modifier. This patch checks the modifier only when the direction is Both. --- widget/src/scrollable.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index 6fc00f877d..fb2da87792 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -564,12 +564,18 @@ where let delta = match delta { mouse::ScrollDelta::Lines { x, y } => { // TODO: Configurable speed/friction (?) - let movement = if !cfg!(target_os = "macos") // macOS automatically inverts the axes when Shift is pressed - && state.keyboard_modifiers.shift() - { - Vector::new(y, x) - } else { - Vector::new(x, y) + let movement = match self.direction { + Direction::Vertical(_) => Vector::new(x, y), + Direction::Horizontal(_) => Vector::new(y, x), + Direction::Both { vertical: _, horizontal: _ } => { + if !cfg!(target_os = "macos") // macOS automatically inverts the axes when Shift is pressed + && state.keyboard_modifiers.shift() + { + Vector::new(y, x) + } else { + Vector::new(x, y) + } + } }; movement * 60.0