Browse Source
Add method to cancel currently ongoing gesture on a pointer (#13351)
* add method to cancel currently ongoing gesture on a pointer
* skip gesture recognition for pointer capture session, revert cancel gesture changes
pull/13420/head
Emmanuel Hansen
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
19 additions and
1 deletions
-
src/Avalonia.Base/Input/Pointer.cs
-
src/Avalonia.Base/Input/PointerEventArgs.cs
|
|
|
@ -56,6 +56,11 @@ namespace Avalonia.Input |
|
|
|
|
|
|
|
if (Captured != null) |
|
|
|
CaptureGestureRecognizer(null); |
|
|
|
|
|
|
|
if(Captured == null && CapturedGestureRecognizer == null) |
|
|
|
{ |
|
|
|
IsGestureRecognitionSkipped = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static IInputElement? GetNextCapture(Visual parent) |
|
|
|
@ -79,6 +84,8 @@ namespace Avalonia.Input |
|
|
|
/// </summary>
|
|
|
|
internal GestureRecognizer? CapturedGestureRecognizer { get; private set; } |
|
|
|
|
|
|
|
public bool IsGestureRecognitionSkipped { get; set; } |
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
Capture(null); |
|
|
|
|
|
|
|
@ -58,7 +58,18 @@ namespace Avalonia.Input |
|
|
|
/// </summary>
|
|
|
|
public ulong Timestamp { get; } |
|
|
|
|
|
|
|
internal bool IsGestureRecognitionSkipped { get; private set; } |
|
|
|
internal bool IsGestureRecognitionSkipped |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return (Pointer as Pointer)?.IsGestureRecognitionSkipped ?? false; |
|
|
|
} |
|
|
|
private set |
|
|
|
{ |
|
|
|
if (Pointer is Pointer pointer) |
|
|
|
pointer.IsGestureRecognitionSkipped = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a value that indicates which key modifiers were active at the time that the pointer event was initiated.
|
|
|
|
|