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

View File

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