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

Holding gesture not working properly on mobile. #7130

Closed
PhilippeAudet-Stratejia opened this issue Sep 17, 2021 · 10 comments · Fixed by #7377
Closed

Holding gesture not working properly on mobile. #7130

PhilippeAudet-Stratejia opened this issue Sep 17, 2021 · 10 comments · Fixed by #7377
Assignees
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification

Comments

@PhilippeAudet-Stratejia

Current behavior

When using the holding gesture, the event is only called after moving the pointer, and when moving further will then set the holding state to canceled.
HoldingAndroid

On UWP, the gesture is working as intended.
HoldingUWP

Expected behavior

When holding down and not moving at all on mobile, the Holding event should be raised without having to move the cursor. Although it's hard to press completely still, it does happen and the intended behavior when holding isn't executed.

How to reproduce it (as minimally and precisely as possible)

HoldingSample.zip

On UWP :

  • Launch the project in simulator mode.
  • Select the basic touch input on the right pane.
  • Press and hold on the blue rectangle.
  • Notice the text on top of the blue rectangle displaying the state of holding, which would be Started.
  • Move the cursor while still holding
  • The state should go to canceled.

On Android/iOS:

  • Launch the project (It's easier to reproduce on simulator)
  • Press down and hold without moving
  • Notice how the holding state isn't "Started"
  • While still holding, move a little in any direction. The state should then be "Started"
  • Keep moving and the state will be canceled.

Workaround

The holding still works, but it's not consistent. It can also be archieved manually with the pressed event and timers, but it's also not as consistent.

Works on UWP/WinUI

Yes

Environment

Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia, Uno.UI.RemoteControl / Uno.WinUI.RemoteControl

NuGet package version(s)

Uno.UI : 3.11.0-dev.113
Uno.RemoteControl : 3.11.0-dev.113
Uno.Core: 2.4.0

Affected platforms

iOS, Android

IDE

Visual Studio 2019

IDE version

16.11.13

Relevant plugins

No response

Anything else we need to know?

No response

@PhilippeAudet-Stratejia PhilippeAudet-Stratejia added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Sep 17, 2021
@dr1rrb
Copy link
Member

dr1rrb commented Sep 21, 2021

This is the expected behavior: for perf consideration we don't start a timer on each pointer pressed to detect the "hold gesture" instead we rely on the fact that touches are imprecise and we continuously get a lot of pointer move when holding with a finger. So the "bug" is present only in the emulator where your are simulating fingers using a "precise" pointer (i.e. the mouse).

But if you have a device onto which getting the Holding event is really difficult, it might be because tolerance thresholds are too low for this device (noticeably regarding the DPI) and we can adjust them.

@jeromelaban
Copy link
Member

@jeanplevesque @PhilippeAudet-Stratejia Can you validate if the same repro works on a physical device?

@PhilippeAudet-Stratejia
Copy link
Author

I didn't think about that, but it's a good idea if it improves the perfs. As I said, it didn't happen often where I could stay completely still on a physical device, but i'll try again to see if the threshold good on the devices I own.

@jeromelaban
Copy link
Member

@PhilippeAudet-Stratejia have you had the chance to validate ?

@PhilippeAudet-Stratejia
Copy link
Author

I have tested it out, and I believe the threshold could be lower. From the sample in this issue, I am able to hold on the rectangle and not trigger the event pretty reliably. Also, sometimes it's also that I would expect the holding event to be fired earlier, but I haven't moved enough for it to be recognised, even though it does get called after a little while.

@dr1rrb
Copy link
Member

dr1rrb commented Oct 7, 2021

@PhilippeAudet-Stratejia you mean the duration threshold? The issue here is that it's really subjective, last time that I've checked, I was found that it was easier to trigger the holding on uno than on UWP (both on touch devices obviously). If you were able to give me any measurable data/comparison it would be nice.

@PhilippeAudet-Stratejia
Copy link
Author

I agree, this is really subjective and it's pretty hard to have any measurable data.
With the current implementation, it's odd to have the HoldingStates Started and Canceled since, on UWP, the Canceled state is called when we move the cursor when holding, but on uno, we need to move to trigger the holding event.

As for the event, I believe it's a matter of luck, as sometimes I found myself holding and wondering why the event isn't called, when in fact it's because I haven't moved enough yet.

@PhilippeAudet-Stratejia
Copy link
Author

I have modified the sample so I can see the time elapsed since first pressing the rectangle.
The time stops once the holding event has been raised.

I can get many different delays before the event is raised (here 1100, 4200, 5000 and 700 milliseconds)
HoldingSample_iOS2

this example is done on an iPhone 8, iOS 14.7.1

@jeanplevesque
Copy link
Member

@PhilippeAudet-Stratejia Can you re-test this with the latest version of Uno.UI now that a fix was merged?

@PhilippeAudet-Stratejia
Copy link
Author

@dr1rrb @jeanplevesque I just tested this and I couldn't get the holding event to fire past 800ms, which works really well now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants