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

Fix 2D element touchend event firing #1218

Merged
merged 2 commits into from Jun 5, 2018
Merged

Fix 2D element touchend event firing #1218

merged 2 commits into from Jun 5, 2018

Conversation

Maclay74
Copy link
Contributor

This PR fixes annoying issue with 2D elements events.
Reproduce:

  1. Tap on element and keep holding it
  2. Tap somewhere else
  3. Release element. Touchend event doesn't fire then.

It appears because in _handleTouchStart we overwrite _touchedElements, which contains also a previously tapped event.
So instead of replacing, we merge it and then it works in appropriate way.

There is also a more clear solution with Object.assign, but I'm not sure about that, since it's on ES6.

Test project: https://playcanvas.com/project/557165/overview/touch-issue

I confirm I have signed the Contributor License Agreement.

This PR fixes annoying issue with 2D elements events.
Reproduce: 
1. Tap on element and keep holding it
2. Tap somewhere else
3. Release element. `Touchend` event doesn't fire then.

It appears because in _handleTouchStart we overwrite _touchedElements, which contains also a previously tapped event.
So instead of replacing, we merge it and then it works in appropriate way.

There is also a more clear solution with Object.assign, but I'm not sure about that, since it's on ES6.

Test project: https://playcanvas.com/project/557165/overview/touch-issue
@yayhi yayhi self-requested a review June 5, 2018 15:59
@daredevildave daredevildave merged commit 164374a into playcanvas:master Jun 5, 2018
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 this pull request may close these issues.

None yet

3 participants