more digging...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-02-18 19:40:54 +04:00
parent af8394be69
commit f677c8369f
2 changed files with 4 additions and 4 deletions

View File

@ -128,11 +128,11 @@ $(document).ready(function(){
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('mousemove', function(evt){ .on('mousemove', function(evt){
//var t = evt.timeStamp || Date.now(); //var t = evt.timeStamp || Date.now();
evt.preventDefault() evt.preventDefault()
@ -142,14 +142,13 @@ $(document).ready(function(){
_x = pos_x _x = pos_x
} }
var x = pos_x var x = pos_x
//console.log(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 touchend', function(){ .on('mouseup touchend', function(){
logger.log('[touchend]') logger.log('[touchend]')

View File

@ -251,6 +251,7 @@ function shiftMagazineTo(offset){
// XXX this is almost the same as getElementScale... // XXX this is almost the same as getElementScale...
function getElementShift(elem){ function getElementShift(elem){
elem = $(elem) elem = $(elem)
// using transform...
if(USE_TRANSFORM){ if(USE_TRANSFORM){
var vendors = ['o', 'moz', 'ms', 'webkit'] var vendors = ['o', 'moz', 'ms', 'webkit']
var transform = elem.css('transform') var transform = elem.css('transform')
@ -269,11 +270,11 @@ function getElementShift(elem){
if(!transform || transform == 'none'){ if(!transform || transform == 'none'){
return {left: 0, top: 0} return {left: 0, top: 0}
} }
//return parseFloat(/translate\(([-.0-9]*),/.exec(transform)[1])
return { return {
left: parseFloat(/(translate\(|matrix\([^,]*,[^,]*,[^,]*,[^,]*,)([^,]*),/.exec(transform)[2]), left: parseFloat(/(translate\(|matrix\([^,]*,[^,]*,[^,]*,[^,]*,)([^,]*),/.exec(transform)[2]),
top: null top: null
} }
// using left...
} else { } else {
return { return {
left: elem.position().left, left: elem.position().left,