diff options
author | Courthead <courtlandallen@gmail.com> | 2012-04-21 18:33:49 -0700 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-05-22 08:00:20 -0400 |
commit | c42bdcecf825e295f483413f8d20b2079947faec (patch) | |
tree | 7c4c7b81da0793d8aadd314f161cf5cb94b59440 | |
parent | 033f83ffebf2c25284796d661c01613936674a47 (diff) | |
download | jquery-ui-c42bdcecf825e295f483413f8d20b2079947faec.tar.gz jquery-ui-c42bdcecf825e295f483413f8d20b2079947faec.zip |
Sortable: calculating item positions on the fly and setting the direction variable when inserting an item into a different sortable. Fixed #8268 - Items may not be inserted into the correct position when dragged between connected sortables
-rw-r--r-- | ui/jquery.ui.sortable.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 55a64590b..88c8aa374 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -731,9 +731,10 @@ $.widget("ui.sortable", $.ui.mouse, { var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top']; for (var j = this.items.length - 1; j >= 0; j--) { if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; - var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top']; + var cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top; if(Math.abs(cur - base) < dist) { dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; + this.direction = (cur - base > 0) ? 'down' : 'up'; } } |