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

Add requireFailure for custom events #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TimChebotarev
Copy link

If you need to set single tap and double tap on one element, you have to set requireFailure option for Hammer (http://hammerjs.github.io/require-failure/)

var hammer = new Hammer(el, {});

var singleTap = new Hammer.Tap({ event: 'singletap' });
var doubleTap = new Hammer.Tap({event: 'doubletap', taps: 2 });
var tripleTap = new Hammer.Tap({event: 'tripletap', taps: 3 });

hammer.add([tripleTap, doubleTap, singleTap]);

tripleTap.recognizeWith([doubleTap, singleTap]);
doubleTap.recognizeWith(singleTap);

doubleTap.requireFailure(tripleTap);
singleTap.requireFailure([tripleTap, doubleTap]);

So, I added parsing a requireFailure option for custom events

import { VueHammer } from 'vue2-hammer';
VueHammer.customEvents = {
  doubletap: { type: 'tap', event: 'doubletap', taps: 2 },
  singletap: { type: 'tap', event: 'singletap', requireFailure: ['doubletap'] }
};
Vue.use(VueHammer);

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

1 participant