Skip to content

Commit

Permalink
fix tabs drag and drop behavior, #8
Browse files Browse the repository at this point in the history
  • Loading branch information
dnbard committed Aug 25, 2014
1 parent 3bf936f commit ddc0ac3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions bindings/drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ define(function(require, exports){
})),
whereIndex = _.indexOf(workingSet, _.find(workingSet, function(el){
return el._path === where;
}));
})),
diff = whereIndex - whoIndex,
direction = diff / Math.abs(diff);

DocumentManager.swapWorkingSetIndexes(whoIndex, whereIndex);
if (Math.abs(diff) <= 1){
DocumentManager.swapWorkingSetIndexes(whoIndex, whereIndex);
} else {
while(whoIndex !== whereIndex){
DocumentManager.swapWorkingSetIndexes(whoIndex, whereIndex);
whereIndex -= direction;
}
}

dragWho = null;
dragWhere = null;
Expand Down

0 comments on commit ddc0ac3

Please sign in to comment.