Skip to content

Commit

Permalink
fix(ionList): make reorder position work if list is offset
Browse files Browse the repository at this point in the history
Addresses #1202
  • Loading branch information
ajoslin committed Apr 25, 2014
1 parent c1918f3 commit 90da2da
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 238 deletions.
7 changes: 6 additions & 1 deletion js/views/listView.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
var ReorderDrag = function(opts) {
this.dragThresholdY = opts.dragThresholdY || 0;
this.onReorder = opts.onReorder;
this.listEl = opts.listEl;
this.el = opts.el;
this.scrollEl = opts.scrollEl;
this.scrollView = opts.scrollView;
Expand All @@ -190,7 +191,10 @@
ReorderDrag.prototype = new DragOp();

ReorderDrag.prototype._moveElement = function(e) {
var y = e.gesture.center.pageY - this._currentDrag.elementHeight + this._currentDrag.scrollDelta;
var y = e.gesture.center.pageY -
this._currentDrag.elementHeight +
this._currentDrag.scrollDelta -
this.listEl.offsetTop;
this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(0, '+y+'px, 0)';
};

Expand Down Expand Up @@ -463,6 +467,7 @@

if(item) {
this._dragOp = new ReorderDrag({
listEl: this.el,
el: item,
scrollEl: this.scrollEl,
scrollView: this.scrollView,
Expand Down
Loading

0 comments on commit 90da2da

Please sign in to comment.