Skip to content

Commit

Permalink
[release/8.0.1xx-preview5] Fix broken button when adding PGR implicit…
Browse files Browse the repository at this point in the history
…ly (#15421)

* Fix broken button when adding PGR implicitly

* - fix conditional

---------

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
  • Loading branch information
github-actions[bot] and PureWeen committed Jun 2, 2023
1 parent 5a957e9 commit c635ed7
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,34 @@ void SetupGestures()
if (platformView == null)
return;

if (View.GestureController.CompositeGestureRecognizers.Count == 0)
bool shouldAddTouchEvent = false;

// This change is probably not 100 percent correct.
// The main purpose right now is to maintain the behavior of this code
// prior to this change
// https://github.com/dotnet/maui/commit/2c301d7988a06c3b41c2992bbee557aca04c9388#diff-2d78f02242798d0f2863f679e4dfdee230944be37db5e1a1446bfa4c6c43a5c6R183
// If the only CompositeGestureRecognizers is a PointerGestureRecognizer
//
// Most likely we should just not subscribe to Touch at all if the only gesture is a PGR
// But that will be re-evaluated for preview6
if (View.GestureRecognizers.Count == 0)
{
var recognizers = View.GestureController.CompositeGestureRecognizers;
foreach (var recognizer in recognizers)
{
if (recognizer is not PointerGestureRecognizer)
{
shouldAddTouchEvent = true;
break;
}
}
}
else
{
shouldAddTouchEvent = true;
}

if (!shouldAddTouchEvent)
{
platformView.Touch -= OnPlatformViewTouched;
}
Expand Down

0 comments on commit c635ed7

Please sign in to comment.