mirror of
https://github.com/flynx/PortableMag.git
synced 2025-10-31 20:10:13 +00:00
more digging...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
718297df69
commit
4b3bb3dfc5
@ -109,52 +109,68 @@ $(document).ready(function(){
|
|||||||
var _x = null
|
var _x = null
|
||||||
var _t = null
|
var _t = null
|
||||||
USE_TRANSFORM = true
|
USE_TRANSFORM = true
|
||||||
$('.viewer')
|
|
||||||
|
|
||||||
.on('mousedown touchstart', function(){
|
// XXX this is a stub, but need to keep the two types of events
|
||||||
logger.log('[touchstart]')
|
// seporated as mouse events sometimes interfere with touch events...
|
||||||
//_t = evt.timeStamp || Date.now();
|
if('touchmove' in window){
|
||||||
scrolling = true
|
$('.viewer')
|
||||||
togglePageDragging('on')
|
.on('touchstart', function(){
|
||||||
})
|
logger.log('[touchstart]')
|
||||||
|
//_t = evt.timeStamp || Date.now();
|
||||||
|
scrolling = true
|
||||||
|
togglePageDragging('on')
|
||||||
|
})
|
||||||
|
.on('touchmove', function(evt){
|
||||||
|
evt.preventDefault()
|
||||||
|
var pos_x = event.touches[0].pageX
|
||||||
|
|
||||||
.on('touchmove', function(evt){
|
if(_x == null){
|
||||||
evt.preventDefault()
|
_x = pos_x
|
||||||
var pos_x = event.touches[0].pageX
|
}
|
||||||
|
var x = pos_x
|
||||||
|
if(scrolling){
|
||||||
|
var s = getMagazineShift()
|
||||||
|
//logger.log('>>>' + s)
|
||||||
|
shiftMagazineTo(s + (x - _x))
|
||||||
|
}
|
||||||
|
_x = x
|
||||||
|
})
|
||||||
|
.on('touchend', function(){
|
||||||
|
logger.log('[touchend]')
|
||||||
|
scrolling = false
|
||||||
|
togglePageDragging('off')
|
||||||
|
})
|
||||||
|
|
||||||
if(_x == null){
|
} else {
|
||||||
_x = pos_x
|
$('.viewer')
|
||||||
}
|
.on('mousedown', function(){
|
||||||
var x = pos_x
|
logger.log('[touchstart]')
|
||||||
if(scrolling){
|
//_t = evt.timeStamp || Date.now();
|
||||||
var s = getMagazineShift()
|
scrolling = true
|
||||||
//logger.log('>>>' + s)
|
togglePageDragging('on')
|
||||||
shiftMagazineTo(s + (x - _x))
|
})
|
||||||
}
|
.on('mousemove', function(evt){
|
||||||
_x = x
|
//var t = evt.timeStamp || Date.now();
|
||||||
})
|
evt.preventDefault()
|
||||||
.on('mousemove', function(evt){
|
var pos_x = evt.clientX
|
||||||
//var t = evt.timeStamp || Date.now();
|
|
||||||
evt.preventDefault()
|
|
||||||
var pos_x = evt.clientX
|
|
||||||
|
|
||||||
if(_x == null){
|
if(_x == null){
|
||||||
_x = pos_x
|
_x = pos_x
|
||||||
}
|
}
|
||||||
var x = pos_x
|
var x = pos_x
|
||||||
if(scrolling){
|
if(scrolling){
|
||||||
var s = getMagazineShift()
|
var s = getMagazineShift()
|
||||||
logger.log('>>>' + s)
|
shiftMagazineTo(s + (x - _x))
|
||||||
shiftMagazineTo(s + (x - _x))
|
}
|
||||||
}
|
_x = x
|
||||||
_x = x
|
})
|
||||||
})
|
.on('mouseup', function(){
|
||||||
|
logger.log('[touchend]')
|
||||||
|
scrolling = false
|
||||||
|
togglePageDragging('off')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
.on('mouseup touchend', function(){
|
|
||||||
logger.log('[touchend]')
|
|
||||||
scrolling = false
|
|
||||||
togglePageDragging('off')
|
|
||||||
})
|
|
||||||
|
|
||||||
// XXX need to setup style for android to work...
|
// XXX need to setup style for android to work...
|
||||||
$('.viewer').css({overflow: 'hidden'})
|
$('.viewer').css({overflow: 'hidden'})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user