RyanMullins / angular-hammer

Hammer.js v2 support for AngularJS
http://ryanmullins.github.io/angular-hammer/
MIT License
188 stars 55 forks source link

Added support for requireFailure when multiple gestured are attached #57

Open blakgeek opened 8 years ago

blakgeek commented 8 years ago

The existing requireFailure implementation doesn't always work because each gesture is a separate directive and not guaranteed to have been added to hammer instance. I added a new directive with higher priority to ensure that runs after all gestures have been added.

blakgeek commented 8 years ago

Usage would be as follows.

<div hm-tap="foo" 
     hm-doubletap="bar"
     hm-require-failure"{tap: 'doubletap', 'doubletap': ['pan', 'zoom']}">
</div>

This would cancel tap on doubletap. Since the pan and zoom gestures aren't registered they are ignored and a warning is logged to the console. The quotes around the key event name is optional.