AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.05k stars 2.25k forks source link

Add Remove option to GestureRecognizerCollection #12558

Open edgarfgp opened 1 year ago

edgarfgp commented 1 year ago

Is your feature request related to a problem? Please describe. While working on Fabulous.Avalonia gesture recognizers, I found that GestureRecognizerCollection uses IReadOnlyCollection<GestureRecognizer> and only exposes Add.

Describe the solution you'd like

Describe alternatives you've considered

timunie commented 1 year ago

@emmauss adding an option to remove a gesture sounds like a valid thing to do to me. What do you think, could we accept a PR introducing this API?

If yes, @edgarfgp a PR would be welcome.

edgarfgp commented 1 year ago

@timunie I would be happy to contribute so I can complete the support of Avalonia in F# Fabulous

timunie commented 1 year ago

I've been talking to the team. In general we would accept a method Remove added to remove a GestureRecognizer. However, we need to make sure the gesture can be removed. If it's currently in use while removing, this would break things. So if you start working on this, keep in mind that you have to check if the Gesture is able to remove first.

Good luck 👍

edgarfgp commented 1 year ago

@timunie I was wondering if there are any issues with the gestures currently. Looking at https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/GesturePage.cs I could not trigger any gesture. Thanks in advance :)

emmauss commented 1 year ago

@timunie I was wondering if there are any issues with the gestures currently. Looking at https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/GesturePage.cs I could not trigger any gesture. Thanks in advance :)

Some gestures require touch input.