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

[EventSystem] tap event never fires #8438

Closed
SerG-Y opened this issue Jun 24, 2022 · 0 comments · Fixed by #8439
Closed

[EventSystem] tap event never fires #8438

SerG-Y opened this issue Jun 24, 2022 · 0 comments · Fixed by #8439

Comments

@SerG-Y
Copy link
Contributor

SerG-Y commented Jun 24, 2022

Tap event never fires on mobile or even in Chrome device simulator.

The root cause of this issue is in normalizeToPointerData function

if (typeof touch.button === 'undefined') touch.button = event.touches.length ? 1 : 0;
if (typeof touch.buttons === 'undefined') touch.buttons = event.touches.length ? 1 : 0;

So, on touchstart event event.touches.length equal to 1 but when your remove finger and on touchend event it equal to 0. It means that we map it to different buttons in trackingData.clicksByButton which cause the issue. Regarding to the spec (https://w3c.github.io/pointerevents/#the-button-property) we should always use 0 for button and 1 for buttons.

Expected Behavior

tap event fires

Current Behavior

tap event never fires

Possible Solution

The solution would be easy like

if (typeof touch.button === 'undefined') touch.button = 0; 
if (typeof touch.buttons === 'undefined') touch.buttons = 1; 

Steps to Reproduce

Before visiting pixiplayground make sure that the mobile emulator is enabled (important)
https://www.pixiplayground.com/#/edit/M7QmJOCtsKqeUo1JJq-T5

Environment

Doesn't matter in this case

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

Successfully merging a pull request may close this issue.

1 participant