vapolia / MauiGestures

Advanced gestures with positions
https://vapolia.eu
Apache License 2.0
17 stars 5 forks source link

Multipe gestures fired #1

Open SophisticatedConsulting opened 1 year ago

SophisticatedConsulting commented 1 year ago

Hi! Thanks for the library. It is really useful and filled a big gap in Xamarin to MAUI migration. I have one issue: I want the behaviour of a tap verses a press on an object to trigger different behaviours (the latter brings up a context menu) whilst the former loads a new page, however both commands get triggered so the context menu appears on the wrong page. Is there a way to avoid the long press also triggering the tap command? Thanks.

tranb3r commented 1 year ago

I've also having this issue: LongPressCommand and TapCommand are triggered simultaneously on iOS.

fredericoregateiro commented 1 year ago

On Android it's working ok like this:

<Label Text="{Binding InfoDisplay}" 
  mg:Gestures.LongPressCommand="{Binding EditCommand}"
  mg:Gestures.TapCommand="{Binding SelectCommand}">
</Label>

mixing with the gesture recognizers will cause the two commands to trigger

<Label Text="{Binding InfoDisplay}"
  mg:Gestures.LongPressCommand="{Binding EditCommand}">
  <Label.GestureRecognizers>
    <TapGestureRecognizer Command="{Binding SelectBillingNumberCommand}" />
  </Label.GestureRecognizers>
</Label>
Hackmodford commented 1 year ago

I have the same issue on Windows.

image

This using longPress instead of double tap seems to work.

image
softlion commented 3 weeks ago

Is there a way to avoid the long press also triggering the tap command?

Both on Windows and iOS, the native GestureRecognizer is used to select the best command.

To choose between a tap and a long press, this recognizer has to wait the full delay of a long press before firing a tap.

I think I chose to deliver the tap immediatly instead. Can you suggest a change in the existing code in this repo ? It's quite simple to read.