Emmanuel Hansen
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
9 additions and
3 deletions
-
src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizer.cs
-
src/Avalonia.Base/Input/GestureRecognizers/PullGestureRecognizer.cs
-
src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs
|
|
|
@ -2,6 +2,7 @@ |
|
|
|
{ |
|
|
|
public abstract class GestureRecognizer : StyledElement |
|
|
|
{ |
|
|
|
private PointerEventArgs? _currentPointerEventArgs; |
|
|
|
protected internal IInputElement? Target { get; internal set; } |
|
|
|
|
|
|
|
protected abstract void PointerPressed(PointerPressedEventArgs e); |
|
|
|
@ -11,17 +12,23 @@ |
|
|
|
|
|
|
|
internal void PointerPressedInternal(PointerPressedEventArgs e) |
|
|
|
{ |
|
|
|
_currentPointerEventArgs = e; |
|
|
|
PointerPressed(e); |
|
|
|
_currentPointerEventArgs = null; |
|
|
|
} |
|
|
|
|
|
|
|
internal void PointerReleasedInternal(PointerReleasedEventArgs e) |
|
|
|
{ |
|
|
|
_currentPointerEventArgs = e; |
|
|
|
PointerReleased(e); |
|
|
|
_currentPointerEventArgs = null; |
|
|
|
} |
|
|
|
|
|
|
|
internal void PointerMovedInternal(PointerEventArgs e) |
|
|
|
{ |
|
|
|
_currentPointerEventArgs = e; |
|
|
|
PointerMoved(e); |
|
|
|
_currentPointerEventArgs = null; |
|
|
|
} |
|
|
|
|
|
|
|
internal void PointerCaptureLostInternal(IPointer pointer) |
|
|
|
@ -32,6 +39,8 @@ |
|
|
|
protected void Capture(IPointer pointer) |
|
|
|
{ |
|
|
|
(pointer as Pointer)?.CaptureGestureRecognizer(this); |
|
|
|
|
|
|
|
_currentPointerEventArgs?.PreventGestureRecognition(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -44,7 +44,6 @@ namespace Avalonia.Input |
|
|
|
{ |
|
|
|
var currentPosition = e.GetPosition(visual); |
|
|
|
Capture(e.Pointer); |
|
|
|
e.PreventGestureRecognition(); |
|
|
|
|
|
|
|
Vector delta = default; |
|
|
|
switch (PullDirection) |
|
|
|
|
|
|
|
@ -124,8 +124,6 @@ namespace Avalonia.Input.GestureRecognizers |
|
|
|
_trackedRootPoint.Y - (_trackedRootPoint.Y >= rootPoint.Y ? ScrollStartDistance : -ScrollStartDistance)); |
|
|
|
|
|
|
|
Capture(e.Pointer); |
|
|
|
|
|
|
|
e.PreventGestureRecognition(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|