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
|
||||
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);
|
||||
|
||||
@ -2002,8 +2002,7 @@ window.ionic = {
|
||||
|
||||
|
||||
this._currentDrag = {
|
||||
startOffsetY: offsetY,
|
||||
startOffsetTop: this.el.offsetTop,
|
||||
startOffsetTop: offsetY,
|
||||
placeholder: placeholder
|
||||
};
|
||||
};
|
||||
@ -2019,18 +2018,15 @@ window.ionic = {
|
||||
|
||||
// Check if we should start dragging. Check if we've dragged past the threshold,
|
||||
// or we are starting from the open state.
|
||||
if(!_this._isDragging &&
|
||||
((Math.abs(e.gesture.deltaY) > _this.dragThresholdY) ||
|
||||
(Math.abs(_this._currentDrag.startOffsetY) > 0)))
|
||||
{
|
||||
if(!_this._isDragging && Math.abs(e.gesture.deltaY) > _this.dragThresholdY) {
|
||||
_this._isDragging = true;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
_this.el.style.top = newY + 'px';//webkitTransform = 'translate3d(0, ' + newY + 'px, 0)';
|
||||
_this.el.style.top = newY + 'px';
|
||||
|
||||
_this._currentDrag.currentY = newY;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user