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

[BUG] Dynamic joysticks freezes on fast interaction #151

Open
caiiiycuk opened this issue Sep 29, 2020 · 9 comments
Open

[BUG] Dynamic joysticks freezes on fast interaction #151

caiiiycuk opened this issue Sep 29, 2020 · 9 comments
Labels

Comments

@caiiiycuk
Copy link

Hi.

Describe the bug
Dynamic joysticks freeze at some time if you interact fastly. This bug reproduced on nipple js website.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://yoannmoi.net/nipplejs/
  2. Fast interact with in dynamic mode
  3. You should see some joysticks that are in freeze

Expected behavior
Joysticks should not freeze

Screenshots, Codepen or JSFiddle
Video: https://youtu.be/Rq1NxbSgD0I

Desktop (please complete the following information):

  • Can't reproduce

Smartphone (please complete the following information):

  • Device: [Lenovo Z6]; [Xiaomi Redmi 5A]; [Xiaomi Redmi 7A]; [Xiamoi Mi Max 2]
  • OS: Android
  • Chrome
@caiiiycuk caiiiycuk added the bug label Sep 29, 2020
@caiiiycuk caiiiycuk changed the title [BUG] [BUG] Dynamic joysticks freezes on fast interaction Sep 29, 2020
@caiiiycuk
Copy link
Author

caiiiycuk commented Sep 29, 2020

I found that problem is exactly same as in #94, but for pointer events. Affected devices sometimes does not send pointerremove event. But seems that workaround as for touch events is not possible because we can't get ids of current pointers.

As workaround I switched to "touch" mode for default:

var toBind;
var secondBind = {};
if (isTouch) {
    toBind = events.touch;
    secondBind = events.mouse;
} else if (isPointer) {
    toBind = events.pointer;
} else if (isMSPointer) {
    toBind = events.MSPointer;
} else {
    toBind = events.mouse;
}

This helps. I think it could be good if this order can be configurable. Why pointer is preferred over touch?

caiiiycuk added a commit to caiiiycuk/nipplejs that referenced this issue Sep 29, 2020
caiiiycuk added a commit to caiiiycuk/nipplejs that referenced this issue Oct 5, 2020
caiiiycuk added a commit to caiiiycuk/nipplejs that referenced this issue Oct 5, 2020
@caiiiycuk
Copy link
Author

I found that pointer events works much better then touch events. I added partial workaround for single touch mode it works fine in my case. Please look PR.

@binarybaba
Copy link

No activity here??

@yoannmoinet
Copy link
Owner

The PR that was fixing the issue has been closed due to not being robust enough unfortunately.

If you're willing to take over, feel free to do so.

@yoannmoinet
Copy link
Owner

I was able to reproduce on Chrome.
I'll have a look later today.
I'll also give some love to the lib, it's been drifting away for way too long.

@caiiiycuk
Copy link
Author

@yoannmoinet I tried to fix it many times, I think there is no way. The problem is that android literally do not send some events, idk why, maybe due performance problems. I did some workarounds to reset the state in certain cases, but they are very ugly, not worst to show them)

@yoannmoinet
Copy link
Owner

I'll give it a try, see if I can think of something new.

As a last resort, I can just discard the touch after a static timeout, like in, if it didn't move in the last second, just trigger touchend on it.
It would probably fix 95% of the issues, but it might annoy 5% of the people that remained static on their touch for more than 1s 🤔

@yoannmoinet
Copy link
Owner

Can you show the workarounds you did @caiiiycuk, maybe it'll trigger some ideas as well.
Promise, I won't judge 😃

@caiiiycuk
Copy link
Author

Can you show the workarounds you did @caiiiycuk, maybe it'll trigger some ideas as well. Promise, I won't judge 😃

This is what I ended with
master...caiiiycuk:nipplejs:gpx

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

No branches or pull requests

3 participants