Ticket #2571: greedy.patch
| File greedy.patch, 1.8 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 117 if(inst.options.greedy && $.ui.intersect(draggable, { item: inst, offset: inst.element.offset() }, inst.options.tolerance)) childrenIntersection = true; 118 118 }); … … 220 220 //Run through all droppables and check their positions based on specific tolerance options 221 221 $.each($.ui.ddmanager.droppables, function() { 222 222 223 if(this.item.disabled ) return;223 if(this.item.disabled || this.greedyChild) return; 224 224 var intersects = $.ui.intersect(draggable, this, this.item.options.tolerance); 225 225 226 226 var c = !intersects && this.over == 1 ? 'out' : (intersects && this.over == 0 ? 'over' : null); 227 227 if(!c) return; 228 228 229 var instance = $.data(this.item.element[0], 'droppable'); 230 if (instance.options.greedy) { 231 this.item.element.parents('.ui-droppable').each(function() { 232 var parent = this; 233 $.each($.ui.ddmanager.droppables, function() { 234 if (this.item.element[0] != parent) return; 235 this[c] = 0; 236 this[c == 'out' ? 'over' : 'out'] = 1; 237 this.greedyChild = (c == 'over' ? 1 : 0); 238 this.item[c == 'out' ? 'over' : 'out'].call(this.item, e); 239 return false; 240 }); 241 }); 242 } 243 229 244 this[c] = 1; this[c == 'out' ? 'over' : 'out'] = 0; 230 245 this.item[c].call(this.item, e); 231 246
