-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Make PreventGestureRecognition
pointer scope, and not event scope.
#13351
Conversation
src/Avalonia.Base/Input/Pointer.cs
Outdated
/// The previously captured element. This is set when a <see cref="GestureRecognizer"/> captures | ||
/// the pointer. | ||
/// </summary> | ||
internal IInputElement? PreviousCaptured { get; private set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to be careful here to not memory leak anything. Leak test with simulated gestures would be nice as well.
/// element if available. If no gesture is currently started by the pointer, no changes are made. | ||
/// </summary> | ||
/// <param name="pointer">The pointer with the captured gesture</param> | ||
public void CancelCurrentGesture(Pointer pointer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API usage is unclear. Which element one would call this method on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i. e.
<ScrollViewer> <!-- captured here -->
<StackPanel>
<TextBox/> <-- I assume it's the control that would want to cancel the gesture -->
</StackPanel>
</ScrollViewer>
On which element should CancelCurrentGesture be called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ScrollViewer, in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to know that we actually canceled some active gesture?
I could call that at the root level and the method would walk down the visual tree to find a matching control. Do you think this is really needed or should the caller implement this?
899fc94
to
3671e82
Compare
PreventGestureRecognition
pointer scope, and not event scope.
What does the pull request do?
PreventGestureRecognition
now prevents gestures from receiving events from the pointer, until pointer is released.What is the current behavior?
What is the updated/expected behavior with this PR?
How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
This is a change in behaviour
Obsoletions / Deprecations
Fixed issues