I've been working on creating a directive to intercept single tap and double tap using HammerJs, but I'm facing some issues. The current implementation doesn't work as expected, and I'm running out of ideas on how to fix it.
Here's what I tried:
@HostListener('tap', ['$event'])
handleTaps(event) {
if(event.tapCount == 2) {
this.doubleTap.emit();
event.prevenDefault();
} else {
this.singleTap.emit();
event.prevenDefault();
}
}
The problem I'm encountering is that it triggers both the Single Tap and Double Tap events. Does anyone have any suggestions for preventing this issue? Should I use a set timeout? Any help would be greatly appreciated. Thanks!