Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Update UIGestureRecognizer state machine so UIKit can properly handle… (
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamEssenmacher committed May 1, 2023
1 parent 204bbe2 commit f2b8a2b
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public override void TouchesBegan(NSSet touches, UIEvent evt)

HandleTouch(TouchStatus.Started, TouchInteractionStatus.Started).SafeFireAndForget();

State = UIGestureRecognizerState.Began;
base.TouchesBegan(touches, evt);
}

Expand All @@ -149,6 +150,7 @@ public override void TouchesEnded(NSSet touches, UIEvent evt)

IsCanceled = true;

State = UIGestureRecognizerState.Ended;
base.TouchesEnded(touches, evt);
}

Expand All @@ -161,6 +163,7 @@ public override void TouchesCancelled(NSSet touches, UIEvent evt)

IsCanceled = true;

State = UIGestureRecognizerState.Cancelled;
base.TouchesCancelled(touches, evt);
}

Expand All @@ -180,6 +183,7 @@ public override void TouchesMoved(NSSet touches, UIEvent evt)
{
HandleTouch(TouchStatus.Canceled, TouchInteractionStatus.Completed).SafeFireAndForget();
IsCanceled = true;
State = UIGestureRecognizerState.Cancelled;
base.TouchesMoved(touches, evt);
return;
}
Expand All @@ -195,6 +199,7 @@ public override void TouchesMoved(NSSet touches, UIEvent evt)
if (status == TouchStatus.Canceled)
IsCanceled = true;

State = UIGestureRecognizerState.Changed;
base.TouchesMoved(touches, evt);
}

Expand Down

0 comments on commit f2b8a2b

Please sign in to comment.