Browse Source

fix: Fix the TouchDevice lost the touch Pressure (#15297)

pull/15318/head
lindexi 2 years ago
committed by GitHub
parent
commit
3cecae943a
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      src/Avalonia.Base/Input/PointerPoint.cs
  2. 6
      src/Avalonia.Base/Input/TouchDevice.cs

5
src/Avalonia.Base/Input/PointerPoint.cs

@ -164,6 +164,11 @@ namespace Avalonia.Input
YTilt = yTilt;
}
internal PointerPointProperties(RawInputModifiers modifiers, PointerUpdateKind kind, RawPointerPoint rawPoint)
: this(modifiers, kind, rawPoint.Twist, rawPoint.Pressure, rawPoint.XTilt, rawPoint.YTilt)
{
}
internal PointerPointProperties(PointerPointProperties basedOn, RawPointerPoint rawPoint)
{
IsLeftButtonPressed = basedOn.IsLeftButtonPressed;

6
src/Avalonia.Base/Input/TouchDevice.cs

@ -87,7 +87,7 @@ namespace Avalonia.Input
target.RaiseEvent(new PointerPressedEventArgs(target, pointer,
(Visual)args.Root, args.Position, ev.Timestamp,
new PointerPointProperties(GetModifiers(args.InputModifiers, true), updateKind),
new PointerPointProperties(GetModifiers(args.InputModifiers, true), updateKind, args.Point),
keyModifier, _clickCount));
}
@ -99,7 +99,7 @@ namespace Avalonia.Input
target = gestureTarget ?? target;
var e = new PointerReleasedEventArgs(target, pointer,
(Visual)args.Root, args.Position, ev.Timestamp,
new PointerPointProperties(GetModifiers(args.InputModifiers, false), updateKind),
new PointerPointProperties(GetModifiers(args.InputModifiers, false), updateKind, args.Point),
keyModifier, MouseButton.Left);
if (gestureTarget != null)
{
@ -127,7 +127,7 @@ namespace Avalonia.Input
target = gestureTarget ?? target;
var e = new PointerEventArgs(InputElement.PointerMovedEvent, target, pointer!, (Visual)args.Root,
args.Position, ev.Timestamp,
new PointerPointProperties(GetModifiers(args.InputModifiers, true), updateKind),
new PointerPointProperties(GetModifiers(args.InputModifiers, true), updateKind, args.Point),
keyModifier, args.IntermediatePoints);
if (gestureTarget != null)

Loading…
Cancel
Save