mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
List item reordering!
This commit is contained in:
14
dist/js/ionic.js
vendored
14
dist/js/ionic.js
vendored
@ -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;
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user