added fix for drag lagging, not sure if it works...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-01-21 05:25:57 +04:00
parent b44ae760f0
commit 6ff15c5df4

View File

@ -35,32 +35,32 @@ function swipeUpdate(evt, phase, direction, distance){
var n = pages.index(cur) var n = pages.index(cur)
var scale = getElementScale($('.scaler')) var scale = getElementScale($('.scaler'))
if( phase=="move" && (direction=="left" || direction=="right") ){ if( phase=='move' && (direction=='left' || direction=='right') ){
// XXX set the transition time to 0... // XXX set the transition time to 0...
// XXX var orig_duration = $('.magazine').css('-webkit-transition-duration')
if (direction == "left"){ $('.magazine').css({'-webkit-transition-duration': 0})
if (direction == 'left'){
//$('.magazine').css({left: -n*cur.width()-distance/scale}) //$('.magazine').css({left: -n*cur.width()-distance/scale})
$('.magazine').css({left: -n*800-distance/scale}) $('.magazine').css({left: -n*800-distance/scale})
} else if (direction == "right") { } else if (direction == 'right') {
//$('.magazine').css({left: -n*cur.width()+distance/scale}) //$('.magazine').css({left: -n*cur.width()+distance/scale})
$('.magazine').css({left: -n*800+distance/scale}) $('.magazine').css({left: -n*800+distance/scale})
} }
} else if ( phase == "cancel") { $('.magazine').css({'-webkit-transition-duration': orig_duration})
} else if ( phase == 'cancel') {
setCurrentPage(pages.index($('.current.page'))) setCurrentPage(pages.index($('.current.page')))
} else if ( phase =="end" ) { } else if ( phase =='end' ) {
// see which page is closer to the middle of the screen and set it... // see which page is closer to the middle of the screen and set it...
var p = Math.ceil((distance/scale)/cur.width()) var p = Math.ceil((distance/scale)/cur.width())
if(direction == "right") { if(direction == 'right') {
//prevPage() //prevPage()
setCurrentPage(Math.max(n-p, 0)) setCurrentPage(Math.max(n-p, 0))
} else if (direction == "left"){ } else if (direction == 'left'){
//nextPage() //nextPage()
setCurrentPage(Math.min(n+p, pages.length-1)) setCurrentPage(Math.min(n+p, pages.length-1))
} }
} }
} }