Bug Tracker

Changeset 5125

Show
Ignore:
Timestamp:
03/25/08 16:03:15 (10 months ago)
Author:
paul.bakaus
Message:

droppables: greedy affects the hover state now, too (fixes #2571)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ui/ui.droppable.js

    r5123 r5125  
    113113             
    114114            var childrenIntersection = false; 
    115             this.element.children(".ui-droppable").each(function() { 
     115            this.element.find(".ui-droppable").each(function() { 
    116116                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; return false; 
     119                } 
    118120            }); 
    119121            if(childrenIntersection) return; 
     
    229231            $.each($.ui.ddmanager.droppables, function() { 
    230232 
    231                 if(this.item.options.disabled) return;  
     233                if(this.item.disabled || this.greedyChild) return;  
    232234                var intersects = $.ui.intersect(draggable, this, this.item.options.tolerance); 
    233235 
    234236                var c = !intersects && this.over == 1 ? 'out' : (intersects && this.over == 0 ? 'over' : null); 
    235237                if(!c) return; 
    236                      
     238 
     239                var instance = $.data(this.item.element[0], 'droppable');  
     240                if (instance.options.greedy) {  
     241                    this.item.element.parents('.ui-droppable').each(function() {  
     242                        var parent = this;  
     243                        $.each($.ui.ddmanager.droppables, function() {  
     244                            if (this.item.element[0] != parent) return;  
     245                            this[c] = 0;  
     246                            this[c == 'out' ? 'over' : 'out'] = 1;  
     247                            this.greedyChild = (c == 'over' ? 1 : 0);  
     248                            this.item[c == 'out' ? 'over' : 'out'].call(this.item, e);  
     249                            return false;  
     250                        });  
     251                    });  
     252                }  
     253 
    237254                this[c] = 1; this[c == 'out' ? 'over' : 'out'] = 0; 
    238255                this.item[c].call(this.item, e);