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

Call CaptureLost on gestures when pointer loses capture #12666

Merged
merged 5 commits into from
Aug 29, 2023
Merged

Conversation

emmauss
Copy link
Contributor

@emmauss emmauss commented Aug 25, 2023

What does the pull request do?

Ensures that the pointer capture lost event is called on all gesture recognizers attached to an input element.

What is the current behavior?

All gestures receive the PointerPressed event, and they set states to start tracking the pointer. If PointerMoveD is received and the conditions for the gesture is met, the gesture captures the pointer, and no other gesture receives events. When the pointer is released, all gestures receive the Released events and reset their states.

In the case of Touch, if the device sends a TouchCancel event, it's interpreted as a CaptureLost event. Only the captured InputElement and the CapturedGesture handles this. For other gestures on the input element that have received the PointerPressed event and set their initial state, they don't receive any event to reset it. This is also true when none of the gestures have captured the pointer

What is the updated/expected behavior with this PR?

When an input element loses pointer capture, all gesture recognizers attached to it that was not the source of the CaptureLost gets
notified. When the pointer loses capture or is cancelled, all gesture recognizers of the last caputed element will be notified.

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #12083

@emmauss emmauss marked this pull request as ready for review August 25, 2023 14:07
@timunie
Copy link
Contributor

timunie commented Aug 25, 2023

cool. This should also unblock #12558 now.

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0038792-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@@ -61,6 +62,7 @@ protected override void PointerPressed(PointerPressedEventArgs e)
{
if (Target != null && Target is Visual visual && (e.Pointer.Type == PointerType.Touch || e.Pointer.Type == PointerType.Pen))
{
Debug.WriteLine($"Pointer with ID: {e.Pointer.Id} pressed");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug code @emmauss

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0038805-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0038822-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@emmauss emmauss requested a review from maxkatz6 August 28, 2023 16:54
@maxkatz6 maxkatz6 added this pull request to the merge queue Aug 29, 2023
Merged via the queue into master with commit 5710953 Aug 29, 2023
7 checks passed
@maxkatz6 maxkatz6 deleted the gesture_cancel branch August 29, 2023 04:30
@emmauss emmauss added the backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch label Oct 2, 2023
grokys pushed a commit that referenced this pull request Oct 2, 2023
Call CaptureLost on gestures when pointer loses capture
@grokys grokys added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[11.0.0] Android touch control breaks after swiping back
5 participants