doing some more polishing...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-02-18 20:12:36 +04:00
parent 3d130dac6c
commit 88d0494f17
2 changed files with 14 additions and 6 deletions

View File

@ -109,6 +109,7 @@ $(document).ready(function(){
var _x = null
var _t = null
var _s = null
var _scale = null
// XXX this is a stub, but need to keep the two types of events
// seporated as mouse events sometimes interfere with touch events...
@ -122,6 +123,7 @@ $(document).ready(function(){
scrolling = true
//togglePageDragging('on')
_s = getMagazineShift()
_scale = getMagazineScale()
})
.on('touchmove', function(evt){
evt.preventDefault()
@ -134,7 +136,7 @@ $(document).ready(function(){
if(scrolling){
//logger.log('>>>' + s)
_s += x - _x
shiftMagazineTo(_s)
shiftMagazineTo(_s, _scale)
}
_x = x
})
@ -144,6 +146,7 @@ $(document).ready(function(){
//togglePageDragging('off')
_x = null
_s = null
_scale = null
})
} else {
@ -156,6 +159,7 @@ $(document).ready(function(){
scrolling = true
//togglePageDragging('on')
_s = getMagazineShift()
_scale = getMagazineScale()
})
.on('mousemove', function(evt){
//var t = evt.timeStamp || Date.now();
@ -168,7 +172,7 @@ $(document).ready(function(){
var x = pos_x
if(scrolling){
_s += x - _x
shiftMagazineTo(_s)
shiftMagazineTo(_s, _scale)
}
_x = x
})
@ -178,9 +182,12 @@ $(document).ready(function(){
//togglePageDragging('off')
_x = null
_s = null
_scale = null
})
}
setMagazineScale(0.5)
// XXX need to setup style for android to work...
$('.viewer').css({overflow: 'hidden'})

View File

@ -216,10 +216,11 @@ function getPageAt(n){
return $(page[n])
}
function shiftMagazineTo(offset){
function shiftMagazineTo(offset, scale){
var mag = $('.magazine')
//var scale = getPageScale()
var scale = 1
if(scale == null){
var scale = getElementScale(mag)
}
if(USE_TRANSFORM){
var transform = 'translate('+ offset +'px, 0px) scale('+ scale +') translateZ(0px)'
mag.css({