List item reordering!

This commit is contained in:
Max Lynch
2013-10-14 12:05:25 -05:00
parent c6d33bfb72
commit 38b8c6e4b1
2 changed files with 10 additions and 18 deletions

14
dist/js/ionic.js vendored
View File

@ -1990,7 +1990,7 @@ window.ionic = {
// Grab the starting Y point for the item // Grab the starting Y point for the item
var offsetY = this.el.style.top;//parseFloat(this.el.style.webkitTransform.replace('translate3d(', '').split(',')[1]) || 0; var offsetY = this.el.offsetTop;//parseFloat(this.el.style.webkitTransform.replace('translate3d(', '').split(',')[1]) || 0;
var placeholder = this.el.cloneNode(true); var placeholder = this.el.cloneNode(true);
@ -2002,8 +2002,7 @@ window.ionic = {
this._currentDrag = { this._currentDrag = {
startOffsetY: offsetY, startOffsetTop: offsetY,
startOffsetTop: this.el.offsetTop,
placeholder: placeholder placeholder: placeholder
}; };
}; };
@ -2019,18 +2018,15 @@ window.ionic = {
// Check if we should start dragging. Check if we've dragged past the threshold, // Check if we should start dragging. Check if we've dragged past the threshold,
// or we are starting from the open state. // or we are starting from the open state.
if(!_this._isDragging && if(!_this._isDragging && Math.abs(e.gesture.deltaY) > _this.dragThresholdY) {
((Math.abs(e.gesture.deltaY) > _this.dragThresholdY) ||
(Math.abs(_this._currentDrag.startOffsetY) > 0)))
{
_this._isDragging = true; _this._isDragging = true;
} }
if(_this._isDragging) { if(_this._isDragging) {
var newY = _this._currentDrag.startOffsetTop + e.gesture.deltaY; //Math.min(0, _this._currentDrag.startOffsetY + e.gesture.deltaY); var newY = _this._currentDrag.startOffsetTop + e.gesture.deltaY;
console.log(newY); console.log(newY);
_this.el.style.top = newY + 'px';//webkitTransform = 'translate3d(0, ' + newY + 'px, 0)'; _this.el.style.top = newY + 'px';
_this._currentDrag.currentY = newY; _this._currentDrag.currentY = newY;

View File

@ -149,7 +149,7 @@
// Grab the starting Y point for the item // Grab the starting Y point for the item
var offsetY = this.el.style.top;//parseFloat(this.el.style.webkitTransform.replace('translate3d(', '').split(',')[1]) || 0; var offsetY = this.el.offsetTop;//parseFloat(this.el.style.webkitTransform.replace('translate3d(', '').split(',')[1]) || 0;
var placeholder = this.el.cloneNode(true); var placeholder = this.el.cloneNode(true);
@ -161,8 +161,7 @@
this._currentDrag = { this._currentDrag = {
startOffsetY: offsetY, startOffsetTop: offsetY,
startOffsetTop: this.el.offsetTop,
placeholder: placeholder placeholder: placeholder
}; };
}; };
@ -178,18 +177,15 @@
// Check if we should start dragging. Check if we've dragged past the threshold, // Check if we should start dragging. Check if we've dragged past the threshold,
// or we are starting from the open state. // or we are starting from the open state.
if(!_this._isDragging && if(!_this._isDragging && Math.abs(e.gesture.deltaY) > _this.dragThresholdY) {
((Math.abs(e.gesture.deltaY) > _this.dragThresholdY) ||
(Math.abs(_this._currentDrag.startOffsetY) > 0)))
{
_this._isDragging = true; _this._isDragging = true;
} }
if(_this._isDragging) { if(_this._isDragging) {
var newY = _this._currentDrag.startOffsetTop + e.gesture.deltaY; //Math.min(0, _this._currentDrag.startOffsetY + e.gesture.deltaY); var newY = _this._currentDrag.startOffsetTop + e.gesture.deltaY;
console.log(newY); console.log(newY);
_this.el.style.top = newY + 'px';//webkitTransform = 'translate3d(0, ' + newY + 'px, 0)'; _this.el.style.top = newY + 'px';
_this._currentDrag.currentY = newY; _this._currentDrag.currentY = newY;