Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken button when adding PGR implicitly #15419

Merged
merged 2 commits into from
Jun 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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