From 096316a4a43473bd4f91f271acd4a8387b0cedfa Mon Sep 17 00:00:00 2001 From: Gianluca Guarini Date: Sun, 16 Mar 2014 00:56:49 +0100 Subject: [PATCH] v0.0.8 --- README.md | 7 +++++-- Tocca.js | 6 +++--- Tocca.min.js | 4 ++-- package.json | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d6a82eb..170d942 100755 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Anytime you will use a Tocca.js event the callback function will receive a speci - y { Int }: latest y position of pointer at the end of the event - originalEvent { Object }: the original javascript native event that has been triggered - distance: this property is available only for the swipe events - - x { Int }: the x absolute difference between the beginning and the end of the swipe gesture + - x { Int }: the x absolute difference between the beginning and the end of the swipe gesture - y { Int }: the y absolute difference between the beginning and the end of the swipe gesture Examples: @@ -115,6 +115,9 @@ On the old browsers all the Tocca.js events cannot be triggered. ## Changelog +### 0.0.8 + - 'touchcancel' event removed to fix and android issue on page scroll + ### 0.0.7 - nothing important (just a workaround to fix the tests on the motherfucker Phantomjs) @@ -123,7 +126,7 @@ On the old browsers all the Tocca.js events cannot be triggered. - added: new JUST_ON_TOUCH_DEVICES option to block all the Tocca.js events on the no-touch devices ### 0.0.5 - - tap precision option included + - tap precision option included ### 0.0.4 - dpltap renamed dbltap diff --git a/Tocca.js b/Tocca.js index 9253c89..d13f7ef 100755 --- a/Tocca.js +++ b/Tocca.js @@ -1,6 +1,6 @@ /** * -* Version: 0.0.7 +* Version: 0.0.8 * Author: Gianluca Guarini * Contact: gianluca.guarini@gmail.com * Website: http://www.gianlucaguarini.com/ @@ -49,7 +49,7 @@ }, sendEvent = function(elm, eventName, originalEvent, data) { var customEvent = doc.createEvent('Event'); - + data = data || {}; data.x = currX; data.y = currY; @@ -104,7 +104,7 @@ }, taptreshold); }); - setListener(doc, isTouch ? 'touchend touchcancel' : 'mouseup', function(e) { + setListener(doc, isTouch ? 'touchend' : 'mouseup', function(e) { var eventsArr = [], deltaY = cachedY - currY, deltaX = cachedX - currX; diff --git a/Tocca.min.js b/Tocca.min.js index 4095fd7..14828af 100755 --- a/Tocca.min.js +++ b/Tocca.min.js @@ -1,2 +1,2 @@ -/*! Tocca.js v0.0.7 || Gianluca Guarini */ -!function(a,b){"use strict";if("function"!=typeof a.createEvent)return!1;var c,d,e,f,g,h="undefined"!=typeof jQuery,i=!!("ontouchstart"in window)&&navigator.userAgent.indexOf("PhantomJS")<0,j=function(a,b,c){for(var d=b.split(" "),e=d.length;e--;)a.addEventListener(d[e],c,!1)},k=function(a){return a.targetTouches?a.targetTouches[0]:a},l=function(b,e,f,g){var i=a.createEvent("Event");if(g=g||{},g.x=c,g.y=d,g.distance=g.distance,h)jQuery(b).trigger(e,g);else{i.originalEvent=f;for(var j in g)i[j]=g[j];i.initEvent(e,!0,!0),b.dispatchEvent(i)}},m=!1,n=b.SWIPE_TRESHOLD||80,o=b.TAP_TRESHOLD||200,p=b.TAP_PRECISION/2||30,q=0;i=b.JUST_ON_TOUCH_DEVICES?!0:i,j(a,i?"touchstart":"mousedown",function(a){var b=k(a);e=c=b.pageX,f=d=b.pageY,m=!0,q++,clearTimeout(g),g=setTimeout(function(){e>=c-p&&c+p>=e&&f>=d-p&&d+p>=f&&!m&&l(a.target,2===q?"dbltap":"tap",a),q=0},o)}),j(a,i?"touchend touchcancel":"mouseup",function(a){var b=[],g=f-d,h=e-c;if(m=!1,-n>=h&&b.push("swiperight"),h>=n&&b.push("swipeleft"),-n>=g&&b.push("swipedown"),g>=n&&b.push("swipeup"),b.length)for(var i=0;i=c-p&&c+p>=e&&f>=d-p&&d+p>=f&&!m&&l(a.target,2===q?"dbltap":"tap",a),q=0},o)}),j(a,i?"touchend":"mouseup",function(a){var b=[],g=f-d,h=e-c;if(m=!1,-n>=h&&b.push("swiperight"),h>=n&&b.push("swipeleft"),-n>=g&&b.push("swipedown"),g>=n&&b.push("swipeup"),b.length)for(var i=0;i