Fixes for tab demo

This commit is contained in:
Max Lynch
2013-10-14 16:10:59 -05:00
parent 38b8c6e4b1
commit b0923f84b5
12 changed files with 79 additions and 75 deletions

16
dist/js/ionic.js vendored
View File

@ -1920,8 +1920,6 @@ window.ionic = {
newX = Math.min(-buttonsWidth, -buttonsWidth + (((e.gesture.deltaX + buttonsWidth) * 0.4)));
}
console.log(newX);
_this._currentDrag.content.style.webkitTransform = 'translate3d(' + newX + 'px, 0, 0)';
}
});
@ -2024,7 +2022,6 @@ window.ionic = {
if(_this._isDragging) {
var newY = _this._currentDrag.startOffsetTop + e.gesture.deltaY;
console.log(newY);
_this.el.style.top = newY + 'px';
@ -2046,25 +2043,12 @@ window.ionic = {
var index = siblings.indexOf(this._currentDrag.placeholder);
var topSibling = siblings[Math.max(0, index - 1)];
var bottomSibling = siblings[Math.min(siblings.length, index+1)];
/*
console.log('Reordering from index', index);
console.dir(this.el);
console.dir(topSibling);
console.dir(bottomSibling);
*/
var thisOffsetTop = this._currentDrag.currentY;// + this._currentDrag.startOffsetTop;
console.log('Comparing', thisOffsetTop, 'with', (topSibling && topSibling.offsetTop + topSibling.offsetHeight/2), (bottomSibling && bottomSibling.offsetTop + bottomSibling.offsetHeight/2));
if(topSibling && (thisOffsetTop < topSibling.offsetTop + topSibling.offsetHeight/2)) {
console.log('Swapping up with index', index - 1);
ionic.DomUtil.swapNodes(this._currentDrag.placeholder, topSibling);
return index - 1;
} else if(bottomSibling && thisOffsetTop > (bottomSibling.offsetTop + bottomSibling.offsetHeight/2)) {
console.log('Swapping down with index', index + 1);
ionic.DomUtil.swapNodes(bottomSibling, this._currentDrag.placeholder);
return index + 1;
}