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 single/double tap workaround. #654

Merged
merged 2 commits into from
May 22, 2017
Merged

Fix single/double tap workaround. #654

merged 2 commits into from
May 22, 2017

Conversation

ericsoco
Copy link
Contributor

This update to the single/double-tap workaround from events-refactor allows hammer.js to handle requireFailure() on its own, and instead drops the single tap / click recognizer interval to 0 by default and bumps it up when doubletap functionality is required.

@ericsoco ericsoco requested a review from Pessimistress May 22, 2017 19:46
@@ -80,7 +80,7 @@ export const RECOGNIZERS = [
[Swipe, {enable: false}],
[Press, {enable: false}],
[Tap, {event: 'doubletap', taps: 2, enable: false}],
[Tap, {enable: false, interval: 0}]
[Tap, {enable: false, interval: 0}, null, 'doubletap']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless this is obvious to any Hammer.js user, perhaps add a comment here about what this does (the same comment you made in this PR)?

@ericsoco
Copy link
Contributor Author

Turns out I was optimizing for a use case we don't really have -- this tinkering with recognizers was enabling us to have a) fast single-clicking and b) prevent single tap events from firing on a doubletap.

However, I'm not seeing any clear way, with recognizer configs or hammer-time.js, to enable that behavior without incurring a single click delay when recognizing doubletaps.

So, I'm clearing out these attempts at a workaround; the resulting behavior is:

  • fast single click when no doubletap handlers are registered;
  • a doubletap handler, when registered, works as expected;
  • single clicks are fired on the way to a doubletap.

If we need doubletaps to not fire single click events, we need to find a way to enable that without incurring a single click delay. react-map-gl adds a doubletap handler and we don't want to slow down clicks.

@ericsoco ericsoco merged commit 0dc4ef6 into master May 22, 2017
@ericsoco ericsoco deleted the events-cleanup branch May 22, 2017 22:57
Firenze11 pushed a commit to Firenze11/deck.gl that referenced this pull request May 31, 2017
* Fix single/double tap workaround.

* Back out recognizer workaround completely. (See forthocoming comment on GitHub.)
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.

2 participants