Skip to content

Commit 7989bf1

Browse files
author
Paul Bakaus
committed
draggable: fixed numerous issues with over/out logic on connected sortable lists (fixes #3988)
1 parent 51c338b commit 7989bf1

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

ui/ui.draggable.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,17 @@ $.ui.plugin.add("draggable", "connectToSortable", {
500500
};
501501

502502
$.each(inst.sortables, function(i) {
503-
504-
if(checkPos.call(inst, this.instance.containerCache)) {
503+
504+
//Copy over some variables to allow calling the sortable's native _intersectsWith
505+
this.instance.positionAbs = inst.positionAbs;
506+
this.instance.helperProportions = inst.helperProportions;
507+
this.instance.offset.click = inst.offset.click;
508+
509+
if(this.instance._intersectsWith(this.instance.containerCache)) {
505510

506511
//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
507512
if(!this.instance.isOver) {
513+
508514
this.instance.isOver = 1;
509515
//Now we fake the start of dragging for the sortable instance,
510516
//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", {
539545
//If it doesn't intersect with the sortable, and it intersected before,
540546
//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
541547
if(this.instance.isOver) {
548+
542549
this.instance.isOver = 0;
543550
this.instance.cancelHelperRemoval = true;
544-
this.instance.options.revert = false; //No revert here
551+
552+
//Prevent reverting on this forced stop
553+
this.instance.options.revert = false;
554+
555+
// The out event needs to be triggered independently
556+
this.instance._trigger('out', event, this.instance._uiHash(this.instance));
557+
545558
this.instance._mouseStop(event, true);
546559
this.instance.options.helper = this.instance.options._helper;
547560

0 commit comments

Comments
 (0)