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

GestureRecognizerCollection remove method #12764

Conversation

edgarfgp
Copy link

@edgarfgp edgarfgp commented Sep 2, 2023

What does the pull request do?

  • Updates GestureRecognizerCollection exposing a Remove method

What is the current behavior?

GestureRecognizerCollection does not expose Remove option

What is the updated/expected behavior with this PR?

Being able to remove a gesture recognizer.

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

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #12558

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0039129-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-cibuild0039135-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@kekekeks
Copy link
Member

kekekeks commented Sep 2, 2023

What happens to pointers that are currently captured by removed gesture recognizer?

@edgarfgp
Copy link
Author

edgarfgp commented Sep 2, 2023

What happens to pointers that are currently captured by removed gesture recognizer?

I am still going through the codebase to understand the implementation, which is why It is still a DRAFT.

I think this is taken care of by a previously merged PR #12666 ?

@timunie
Copy link
Contributor

timunie commented Sep 4, 2023

@edgarfgp no this PR will make sure a gesture is freed once focus was lost. If you want to remove a gesture, one must check if it is in use currently before removing it. So I think the API should be TryRemove(). Inside

  1. check if gesture is in use
  2. if 1 is true -> return false and exit method
  3. if 2 passed, continue to remove and return true

Similar for TryRemoveAll, if we want to provide this.

@kekekeks
Copy link
Member

kekekeks commented Sep 4, 2023

We could release capture for removed recognizers too.

@timunie
Copy link
Contributor

timunie commented Sep 4, 2023

@kekekeks in that case I would prefer to have TryRemove and ForceRemove where force remove will release the capture where TryRemove gives the user the chance to finish the action. What do you think?

Talking to Nikita seems like removing the capture during remove should be the way to go. So ignore my comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Remove option to GestureRecognizerCollection
5 participants