Skip to content

Commit

Permalink
Merge pull request madrobby#259 from gobhi/zepto
Browse files Browse the repository at this point in the history
---

When theres a tap, the swipe event is fired on Nokia Symbian and Playbook tablet devices (this should not be the case since this is just a tap and not a swipe).

It seems that there is a slight move when tap event is fired on these devices, so touch.x2 and touch.y2 get set.  But because the delta comparison Math.abs(touch.x1 - touch.x2) > 30) and Math.abs(touch.y1 - touch.y2) > 30) are inside the conditional block that checks if touch.x2 or touch.y2 > 0, the last conditional "else if (last in touch)" is never reached.  Moving the delta comparison in the conditional check fixes this issue.

This has been tested on Playbook, Nokia Symbian, iPad and iPhone devices.

Conflicts:
	src/touch.js
  • Loading branch information
madrobby committed Apr 8, 2012
2 parents cfe8b33 + b2e75d2 commit bda8af4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
if (touch.isDoubleTap) {
touch.el.trigger('doubleTap')
touch = {}
} else if (touch.x2 > 0 || touch.y2 > 0) {
(Math.abs(touch.x1 - touch.x2) > 30 || Math.abs(touch.y1 - touch.y2) > 30) &&
touch.el.trigger('swipe') &&
} else if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) ||
(touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)) {
touch.el.trigger('swipe') &&
touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)))
touch.x1 = touch.x2 = touch.y1 = touch.y2 = touch.last = 0
} else if ('last' in touch) {
Expand Down

0 comments on commit bda8af4

Please sign in to comment.