From c1e101f491b6153bddfd76920563fe160ef00c9f Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 3 Feb 2022 19:15:46 +0100 Subject: [PATCH] Perform check if the scroll should be changed on shift key. This may variy by platform, so we need an additional check. --- src/Avalonia.Input/MouseDevice.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Input/MouseDevice.cs b/src/Avalonia.Input/MouseDevice.cs index 0e1e460427..a17f31498e 100644 --- a/src/Avalonia.Input/MouseDevice.cs +++ b/src/Avalonia.Input/MouseDevice.cs @@ -5,6 +5,7 @@ using System.Reactive.Linq; using Avalonia.Input.Raw; using Avalonia.Interactivity; using Avalonia.Platform; +using Avalonia.Utilities; using Avalonia.VisualTree; namespace Avalonia.Input @@ -334,7 +335,9 @@ namespace Avalonia.Input var hit = HitTest(root, p); var source = GetSource(hit); - if (inputModifiers == KeyModifiers.Shift) + // KeyModifiers.Shift should scroll in horizontal direction. This does not work on every platform. + // If Shift-Key is pressed and X is close to 0 we swap the Vector. + if (inputModifiers == KeyModifiers.Shift && MathUtilities.IsZero(delta.X)) { delta = new Vector(delta.Y, delta.X); }