Browse Source
Merge pull request #3594 from AvaloniaUI/fix-gesture-pointercapturelost
Fix gesture recognizers
pull/3613/head
Nikita Tsukanov
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
10 additions and
6 deletions
-
src/Avalonia.Input/GestureRecognizers/GestureRecognizerCollection.cs
-
src/Avalonia.Input/GestureRecognizers/IGestureRecognizer.cs
-
src/Avalonia.Input/GestureRecognizers/ScrollGestureRecognizer.cs
|
|
|
@ -111,9 +111,7 @@ namespace Avalonia.Input.GestureRecognizers |
|
|
|
_pointerGrabs.Remove(e.Pointer); |
|
|
|
foreach (var r in _recognizers) |
|
|
|
{ |
|
|
|
if(e.Handled) |
|
|
|
break; |
|
|
|
r.PointerCaptureLost(e); |
|
|
|
r.PointerCaptureLost(e.Pointer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -121,6 +119,11 @@ namespace Avalonia.Input.GestureRecognizers |
|
|
|
{ |
|
|
|
pointer.Capture(_inputElement); |
|
|
|
_pointerGrabs[pointer] = recognizer; |
|
|
|
foreach (var r in _recognizers) |
|
|
|
{ |
|
|
|
if (r != recognizer) |
|
|
|
r.PointerCaptureLost(pointer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -6,7 +6,7 @@ namespace Avalonia.Input.GestureRecognizers |
|
|
|
void PointerPressed(PointerPressedEventArgs e); |
|
|
|
void PointerReleased(PointerReleasedEventArgs e); |
|
|
|
void PointerMoved(PointerEventArgs e); |
|
|
|
void PointerCaptureLost(PointerCaptureLostEventArgs e); |
|
|
|
void PointerCaptureLost(IPointer pointer); |
|
|
|
} |
|
|
|
|
|
|
|
public interface IGestureRecognizerActionsDispatcher |
|
|
|
|
|
|
|
@ -116,9 +116,9 @@ namespace Avalonia.Input.GestureRecognizers |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void PointerCaptureLost(PointerCaptureLostEventArgs e) |
|
|
|
public void PointerCaptureLost(IPointer pointer) |
|
|
|
{ |
|
|
|
if (e.Pointer == _tracking) EndGesture(); |
|
|
|
if (pointer == _tracking) EndGesture(); |
|
|
|
} |
|
|
|
|
|
|
|
void EndGesture() |
|
|
|
@ -148,6 +148,7 @@ namespace Avalonia.Input.GestureRecognizers |
|
|
|
EndGesture(); |
|
|
|
else |
|
|
|
{ |
|
|
|
_tracking = null; |
|
|
|
var savedGestureId = _gestureId; |
|
|
|
var st = Stopwatch.StartNew(); |
|
|
|
var lastTime = TimeSpan.Zero; |
|
|
|
|