기준 : jquery mobile 1.3.0 기준
1. 터치 시간 변경
durationThreshold: 1000, // More time than this, and it isn't a swipe.
=>
durationThreshold: 600, // More time than this, and it isn't a swipe.
2. 터치 각도 조절
if ( stop.time - start.time < $.event.special.swipe.durationThreshold &&
Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold &&
Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) {
start.origin.trigger( "swipe" ).trigger( start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight" );
}
=> 변경
터치 각도 계산을 하여 45도 ~ 125도까지는 right 처리 , 225도~315도까지는 left 처리 함
var rad = rad = Math.atan2(stop.coords[ 0 ]-start.coords[ 0 ],stop.coords[ 1 ]-start.coords[ 1 ])*180.0/3.14;
if (rad < 0.0) {
deg = 360.0+rad;
} else {
deg = rad;
}
if ( stop.time - start.time < $.event.special.swipe.durationThreshold) {
if(deg>=45 && deg<=125)
{
//alert("right:"+deg);
start.origin.trigger( "swipe" ).trigger("swiperight");
}
//left
if(deg>=225 && deg<=315)
{
//alert("left:"+deg);
start.origin.trigger( "swipe" ).trigger("swipeleft");
}
3. 스크롤링 조금더 브드럽게
scrollSupressionThreshold: 30, // More than this horizontal displacement, and we will suppress scrolling.
=>
scrollSupressionThreshold: 40, // More than this horizontal displacement, and we will suppress scrolling.