Ticket #3121: ui.droppable.js.patch
| File ui.droppable.js.patch, 2.5 KB (added by jeffkretz, 5 years ago) |
|---|
-
ui.droppable.js
64 64 if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { 65 65 $.ui.plugin.call(this, 'over', [e, this.ui(draggable)]); 66 66 this.element.triggerHandler("dropover", [e, this.ui(draggable)], this.options.over); 67 68 // For an exclusive draggable, note which drop zone it is currently over. 69 if (draggable.options.exclusive) 70 draggable.options.isover = this; 67 71 } 68 72 69 73 }, … … 75 79 if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { 76 80 $.ui.plugin.call(this, 'out', [e, this.ui(draggable)]); 77 81 this.element.triggerHandler("dropout", [e, this.ui(draggable)], this.options.out); 82 83 // Add exclusive code. 84 draggable.options.isover = null; 78 85 } 79 86 80 87 }, … … 188 195 189 196 }, 190 197 drop: function(draggable, e) { 191 198 199 // Check if the draggable is set for exclusive and if it has already been flagged as over the first element. 200 var exclusive = draggable.options.exclusive; 201 var isover = draggable.options.isover; 202 192 203 var dropped = false; 193 204 $.each($.ui.ddmanager.droppables, function() { 194 205 195 206 if(!this.options) return; 196 if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))207 if (!this.options.disabled && this.visible && (!exclusive || !isover || isover==this) && $.ui.intersect(draggable, this, this.options.tolerance)) 197 208 dropped = this.drop.call(this, e); 198 209 199 210 if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { … … 213 224 //Run through all droppables and check their positions based on specific tolerance options 214 225 $.each($.ui.ddmanager.droppables, function() { 215 226 227 // Check if the draggable is set for exclusive and if it has already been flagged as over the first element. 228 var exclusive = draggable.options.exclusive; 229 var isover = draggable.options.isover; 230 216 231 if(this.options.disabled || this.greedyChild || !this.visible) return; 217 var intersects = $.ui.intersect(draggable, this, this.options.tolerance);232 var intersects = (!exclusive || !isover || isover==this) && $.ui.intersect(draggable, this, this.options.tolerance); 218 233 219 234 var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); 220 235 if(!c) return;
