pukhalski / tap

1Kb library for easy unified handling of user interactions such as mouse, touch and pointer events.
https://github.com/pukhalski/tap/archive/master.zip
MIT License
527 stars 45 forks source link

Is it possible to ignore single touchend event? #45

Closed pablobirukov closed 8 years ago

pablobirukov commented 9 years ago

For test purposes I need to trigger single touchend event in several cases. The library throws an error at end handler at coords.offset[0] Is it possible to ignore single touchend

if (!coords.offset) return;

or it brakes common sense?

Thanks.

ezhlobo commented 8 years ago

@r00ger I think you talk about this part in end method:

if (coords.offset[0] < Tap.options.fingerMaxOffset && coords.offset[1] < Tap.options.fingerMaxOffset && !utils.fireFakeEvent(e, Tap.options.eventName)) {

Or more friendly:

if (coords.offset[0] < Tap.options.fingerMaxOffset 
    && coords.offset[1] < Tap.options.fingerMaxOffset 
    && !utils.fireFakeEvent(e, Tap.options.eventName)) {

If we return before this we will not fire tap event. You can share your case and I'll try to help.

pablobirukov commented 8 years ago

@ezhlobo yes. I hacked the library in the same manner for test purposes. But now I would agree on current solution because bad code isn't a reason to make any exceptions in library. Thanks for attention.