Browse Source
PointerWheelEventArgs: Adds RawDelta
Delta is flipped if the user holds down Shift while scrolling. RawDelta
preserves the original scroll vector.
pull/8628/head
Benjamin Lehmann
4 years ago
No known key found for this signature in database
GPG Key ID: 524784255A9289B7
2 changed files with
5 additions and
2 deletions
-
src/Avalonia.Base/Input/MouseDevice.cs
-
src/Avalonia.Base/Input/PointerWheelEventArgs.cs
|
|
|
@ -196,6 +196,7 @@ namespace Avalonia.Input |
|
|
|
PointerPointProperties props, |
|
|
|
Vector delta, KeyModifiers inputModifiers, IInputElement? hitTest) |
|
|
|
{ |
|
|
|
var rawDelta = delta; |
|
|
|
device = device ?? throw new ArgumentNullException(nameof(device)); |
|
|
|
root = root ?? throw new ArgumentNullException(nameof(root)); |
|
|
|
|
|
|
|
@ -210,7 +211,7 @@ namespace Avalonia.Input |
|
|
|
|
|
|
|
if (source is not null) |
|
|
|
{ |
|
|
|
var e = new PointerWheelEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, delta); |
|
|
|
var e = new PointerWheelEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, delta, rawDelta); |
|
|
|
|
|
|
|
source?.RaiseEvent(e); |
|
|
|
return e.Handled; |
|
|
|
|
|
|
|
@ -6,14 +6,16 @@ namespace Avalonia.Input |
|
|
|
public class PointerWheelEventArgs : PointerEventArgs |
|
|
|
{ |
|
|
|
public Vector Delta { get; set; } |
|
|
|
public Vector RawDelta { get; set; } |
|
|
|
|
|
|
|
public PointerWheelEventArgs(IInteractive source, IPointer pointer, IVisual rootVisual, |
|
|
|
Point rootVisualPosition, ulong timestamp, |
|
|
|
PointerPointProperties properties, KeyModifiers modifiers, Vector delta) |
|
|
|
PointerPointProperties properties, KeyModifiers modifiers, Vector delta, Vector rawDelta) |
|
|
|
: base(InputElement.PointerWheelChangedEvent, source, pointer, rootVisual, rootVisualPosition, |
|
|
|
timestamp, properties, modifiers) |
|
|
|
{ |
|
|
|
Delta = delta; |
|
|
|
RawDelta = rawDelta; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|