diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2009-02-10 15:05:01 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2009-02-10 15:05:01 +0000 |
commit | 7989bf1bee9d6c224909741bd92dd905f783a3d5 (patch) | |
tree | da431f81c0bce0634036f3ce00c5604184d44185 /ui/ui.draggable.js | |
parent | 51c338b9edc14fe5b05138f3fc4093c4459c30ea (diff) | |
download | jquery-ui-7989bf1bee9d6c224909741bd92dd905f783a3d5.tar.gz jquery-ui-7989bf1bee9d6c224909741bd92dd905f783a3d5.zip |
draggable: fixed numerous issues with over/out logic on connected sortable lists (fixes #3988)
Diffstat (limited to 'ui/ui.draggable.js')
-rw-r--r-- | ui/ui.draggable.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js index 92dbc372d..3946a3c36 100644 --- a/ui/ui.draggable.js +++ b/ui/ui.draggable.js @@ -500,11 +500,17 @@ $.ui.plugin.add("draggable", "connectToSortable", { }; $.each(inst.sortables, function(i) { - - if(checkPos.call(inst, this.instance.containerCache)) { + + //Copy over some variables to allow calling the sortable's native _intersectsWith + this.instance.positionAbs = inst.positionAbs; + this.instance.helperProportions = inst.helperProportions; + this.instance.offset.click = inst.offset.click; + + if(this.instance._intersectsWith(this.instance.containerCache)) { //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once if(!this.instance.isOver) { + this.instance.isOver = 1; //Now we fake the start of dragging for the sortable instance, //by cloning the list group item, appending it to the sortable and using it as inst.currentItem @@ -539,9 +545,16 @@ $.ui.plugin.add("draggable", "connectToSortable", { //If it doesn't intersect with the sortable, and it intersected before, //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval if(this.instance.isOver) { + this.instance.isOver = 0; this.instance.cancelHelperRemoval = true; - this.instance.options.revert = false; //No revert here + + //Prevent reverting on this forced stop + this.instance.options.revert = false; + + // The out event needs to be triggered independently + this.instance._trigger('out', event, this.instance._uiHash(this.instance)); + this.instance._mouseStop(event, true); this.instance.options.helper = this.instance.options._helper; |