From bc2326e30a7eb23fb623beea0721bd01725956b6 Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 25 Jun 2012 15:21:25 +0800 Subject: [PATCH] cancel singleTap event when swipe --- touch.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/touch.js b/touch.js index 6ad5639..80cf549 100644 --- a/touch.js +++ b/touch.js @@ -34,10 +34,12 @@ define(['zepto', 'proxy'], function ($, proxy) { el.trigger('tap', { action: 'doubleTap' }); } else if (info.touchTime) { - this.tapTimer = setTimeout(function() { - el.trigger('tap', { action: 'singleTap' }); - delete info.touchTime; - }, thresholds.singleTap); + if (!(info.finishX || info.finishY)){ + this.tapTimer = setTimeout(function() { + el.trigger('tap', { action: 'singleTap' }); + delete info.touchTime; + }, thresholds.singleTap); + } } if (this.holdTimer) {