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

'tap' events are firing on 'doubletap' #155

Closed
JohnKis opened this issue Jan 22, 2015 · 3 comments
Closed

'tap' events are firing on 'doubletap' #155

JohnKis opened this issue Jan 22, 2015 · 3 comments

Comments

@JohnKis
Copy link

JohnKis commented Jan 22, 2015

Hi there,

I'm having a problem with doubletap events. My interactable is listening to both tap and doubletap events but when a doubletap occurs the tap event listener will be called twice and the doubletap event listener once. What I was expecting is that only the doubletap listener will be called. I haven't found a way to achieve that, although I'm might missing something obvious.

@taye
Copy link
Owner

taye commented Jan 23, 2015

That's also the behaviour of DOM click and dblclick events so for this and a few other reasons, I think it's better to keep this behaviour. However, you raise a good point: there should be a way to tell if a tap will lead to a double tap so that it can be ignored.

I could add a double property to tap events to indicate whether a doubletap follows so that you could then do something like:

interact(target)
  .on('tap', function (event) {
    if (event.double) { return; }

    // code for first tap
  })
  .on('doubletap', function (event) {
    // code for doubletap
  });

@JohnKis
Copy link
Author

JohnKis commented Jan 23, 2015

Thanks for the quick response. You're right, that's how the DOM click and dblclick work.

As you suggested a 'double' property on the tap event would certainly be useful. If you could add it, that would be great.

@taye taye closed this as completed in 864acf2 Jan 24, 2015
@taye
Copy link
Owner

taye commented Jan 24, 2015

https://rawgit.com/taye/interact.js/master/interact.js

This fix should be available in the next release.

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

No branches or pull requests

2 participants