IanLunn/Sequence — Issue #45: Swipe threshold not working
Author: TranceGeniK
Created: 2012-03-01 19:12:05+00:00
State: open

I have tested the swipe threshold on an iPad, and it appears that it isn't working.
Here is a fix :
```
if(self.settings.touchEnabled && self.hasTouch){
var touches = {
"touchstart": -1,
"touchmove" : -1,
"swipeDirection" : ""
};
self.sequence.on("touchstart touchmove touchend", function(e){
e.preventDefault();
switch(e.originalEvent.type){
case "touchstart":
case "touchmove":
touches[e.originalEvent.type] = e.originalEvent.touches[0].pageX;
break;
case 'touchend':
if(touches["touchmove"] > -1)
{
if(touches["touchstart"] < touches["touchmove"])
{
if( (touches["touchmove"] - touches["touchstart"]) > self.settings.calculatedSwipeThreshold)
{

self.next();
}
}
else
{
if( (touches["touchstart"] - touches["touchmove"]) > self.settings.calculatedSwipeThreshold)
{

self.prev();
}
}

}
touches = {
"touchstart": -1,
"touchmove" : -1
};
default:
break;
}

});
}
```