Skip to content

Commit

Permalink
fix off by one errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlacey committed Feb 26, 2025
1 parent c46094c commit 5b1dd60
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions NuGet/RapidXaml.MAUI/GestureRecognizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private static void OnSingleTapChanged(BindableObject bindable, object oldValue,
{
if (oldValue is ICommand oldCmd)
{
for (int i = view.GestureRecognizers.Count; i >= 0; i--)
for (int i = view.GestureRecognizers.Count - 1; i >= 0; i--)
{
if (view.GestureRecognizers[i] is TapGestureRecognizer oldTgr && oldTgr.Command == oldCmd)
{
Expand Down Expand Up @@ -63,7 +63,7 @@ private static void OnDoubleTapChanged(BindableObject bindable, object oldValue,
{
if (oldValue is ICommand oldCmd)
{
for (int i = view.GestureRecognizers.Count; i >= 0; i--)
for (int i = view.GestureRecognizers.Count - 1; i >= 0; i--)
{
if (view.GestureRecognizers[i] is TapGestureRecognizer oldTgr && oldTgr.Command == oldCmd)
{
Expand Down Expand Up @@ -98,7 +98,7 @@ private static void OnSecondaryTapChanged(BindableObject bindable, object oldVal
{
if (oldValue is ICommand oldCmd)
{
for (int i = view.GestureRecognizers.Count; i >= 0; i--)
for (int i = view.GestureRecognizers.Count - 1; i >= 0; i--)
{
if (view.GestureRecognizers[i] is TapGestureRecognizer oldTgr && oldTgr.Command == oldCmd)
{
Expand Down Expand Up @@ -134,7 +134,7 @@ private static void OnPanChanged(BindableObject bindable, object oldValue, objec
{
if (oldValue is ICommand oldCmd)
{
for (int i = view.GestureRecognizers.Count; i >= 0; i--)
for (int i = view.GestureRecognizers.Count - 1; i >= 0; i--)
{
if (view.GestureRecognizers[i] is PanGestureRecognizer oldPgr)
{
Expand Down Expand Up @@ -173,7 +173,7 @@ private static void OnPanCompletedChanged(BindableObject bindable, object oldVal
{
if (oldValue is ICommand oldCmd)
{
for (int i = view.GestureRecognizers.Count; i >= 0; i--)
for (int i = view.GestureRecognizers.Count - 1; i >= 0; i--)
{
if (view.GestureRecognizers[i] is PanGestureRecognizer oldPgr)
{
Expand Down Expand Up @@ -213,7 +213,7 @@ private static void OnSwipeChanged(BindableObject bindable, object oldValue, obj
{
if (oldValue is Command<SwipeDirection> oldCmd)
{
for (int i = view.GestureRecognizers.Count; i >= 0; i--)
for (int i = view.GestureRecognizers.Count - 1; i >= 0; i--)
{
if (view.GestureRecognizers[i] is SwipeGestureRecognizer oldSgr)
{
Expand Down Expand Up @@ -253,7 +253,7 @@ private static void OnSwipeLeftChanged(BindableObject bindable, object oldValue,
{
if (oldValue is ICommand oldCmd)
{
for (int i = view.GestureRecognizers.Count; i >= 0; i--)
for (int i = view.GestureRecognizers.Count - 1; i >= 0; i--)
{
if (view.GestureRecognizers[i] is SwipeGestureRecognizer oldSgr)
{
Expand Down Expand Up @@ -293,7 +293,7 @@ private static void OnSwipeRightChanged(BindableObject bindable, object oldValue
{
if (oldValue is ICommand oldCmd)
{
for (int i = view.GestureRecognizers.Count; i >= 0; i--)
for (int i = view.GestureRecognizers.Count - 1; i >= 0; i--)
{
if (view.GestureRecognizers[i] is SwipeGestureRecognizer oldSgr)
{
Expand Down Expand Up @@ -333,7 +333,7 @@ private static void OnSwipeUpChanged(BindableObject bindable, object oldValue, o
{
if (oldValue is ICommand oldCmd)
{
for (int i = view.GestureRecognizers.Count; i >= 0; i--)
for (int i = view.GestureRecognizers.Count - 1; i >= 0; i--)
{
if (view.GestureRecognizers[i] is SwipeGestureRecognizer oldSgr)
{
Expand Down Expand Up @@ -373,7 +373,7 @@ private static void OnSwipeDownChanged(BindableObject bindable, object oldValue,
{
if (oldValue is ICommand oldCmd)
{
for (int i = view.GestureRecognizers.Count; i >= 0; i--)
for (int i = view.GestureRecognizers.Count - 1; i >= 0; i--)
{
if (view.GestureRecognizers[i] is SwipeGestureRecognizer oldSgr)
{
Expand Down Expand Up @@ -413,7 +413,7 @@ private static void OnPinchChanged(BindableObject bindable, object oldValue, obj
{
if (oldValue is ICommand oldCmd)
{
for (int i = view.GestureRecognizers.Count; i >= 0; i--)
for (int i = view.GestureRecognizers.Count - 1; i >= 0; i--)
{
if (view.GestureRecognizers[i] is PinchGestureRecognizer oldPgr)
{
Expand Down

0 comments on commit 5b1dd60

Please sign in to comment.