]> source.dussan.org Git - jquery-ui.git/commitdiff
Draggable: Fix a bug when dragging into nested sortables there are duplicated placeho...
authorJohn Chen <zhang.z.chen@intel.com>
Thu, 13 Sep 2012 04:10:01 +0000 (12:10 +0800)
committerScott González <scott.gonzalez@gmail.com>
Wed, 10 Oct 2012 18:46:52 +0000 (14:46 -0400)
ui/jquery.ui.draggable.js

index e110bd8a4498a4669edeb12a607478ef7075d40d..5d91a3d948b05a1b734162822b7bf037dada69dc 100644 (file)
@@ -571,13 +571,29 @@ $.ui.plugin.add("draggable", "connectToSortable", {
 
                $.each(inst.sortables, function(i) {
                        
+                       var innermostIntersecting = false;
+                       var thisSortable = this;
                        //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)) {
+                               innermostIntersecting = true;
+                               $.each(inst.sortables, function () {
+                                       this.instance.positionAbs = inst.positionAbs;
+                                       this.instance.helperProportions = inst.helperProportions;
+                                       this.instance.offset.click = inst.offset.click;
+                                       if  (this != thisSortable
+                                               && this.instance._intersectsWith(this.instance.containerCache)
+                                               && $.ui.contains(thisSortable.instance.element[0], this.instance.element[0]))
+                                               innermostIntersecting = false;
+                                               return innermostIntersecting;
+                               });
+                       }
+
 
+                       if(innermostIntersecting) {
                                //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) {