Ticket #2571: greedy.2.patch
| File greedy.2.patch, 2.0 kB (added by scott.gonzalez, 10 months ago) |
|---|
-
ui.droppable.js
112 112 if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element 113 113 114 114 var childrenIntersection = false; 115 this.element. children(".ui-droppable").each(function() {115 this.element.find(".ui-droppable").each(function() { 116 116 var inst = $.data(this, 'droppable'); 117 if(inst.options.greedy && $.ui.intersect(draggable, { item: inst, offset: inst.element.offset() }, inst.options.tolerance)) childrenIntersection = true; 117 if(inst.options.greedy && $.ui.intersect(draggable, { item: inst, offset: inst.element.offset() }, inst.options.tolerance)) { 118 childrenIntersection = true; 119 return false; 120 } 118 121 }); 119 122 if(childrenIntersection) return; 120 123 … … 220 223 //Run through all droppables and check their positions based on specific tolerance options 221 224 $.each($.ui.ddmanager.droppables, function() { 222 225 223 if(this.item.disabled ) return;226 if(this.item.disabled || this.greedyChild) return; 224 227 var intersects = $.ui.intersect(draggable, this, this.item.options.tolerance); 225 228 226 229 var c = !intersects && this.over == 1 ? 'out' : (intersects && this.over == 0 ? 'over' : null); 227 230 if(!c) return; 228 231 232 var instance = $.data(this.item.element[0], 'droppable'); 233 if (instance.options.greedy) { 234 this.item.element.parents('.ui-droppable').each(function() { 235 var parent = this; 236 $.each($.ui.ddmanager.droppables, function() { 237 if (this.item.element[0] != parent) return; 238 this[c] = 0; 239 this[c == 'out' ? 'over' : 'out'] = 1; 240 this.greedyChild = (c == 'over' ? 1 : 0); 241 this.item[c == 'out' ? 'over' : 'out'].call(this.item, e); 242 return false; 243 }); 244 }); 245 } 246 229 247 this[c] = 1; this[c == 'out' ? 'over' : 'out'] = 0; 230 248 this.item[c].call(this.item, e); 231 249
