Browse Source
Merge pull request #7520 from timunie/fix/ScrollViewerShiftAndPointerWheel
Fix [Shift] + [PointerWheel] should scroll horizontally
pull/7804/head
Max Katz
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
0 deletions
-
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,6 +335,13 @@ namespace Avalonia.Input |
|
|
|
var hit = HitTest(root, p); |
|
|
|
var source = GetSource(hit); |
|
|
|
|
|
|
|
// 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); |
|
|
|
} |
|
|
|
|
|
|
|
if (source is not null) |
|
|
|
{ |
|
|
|
var e = new PointerWheelEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, delta); |
|
|
|
|