Ticket #2637: ui.droppable.js-recalc-position.patch
File ui.droppable.js-recalc-position.patch, 2.2 KB (added by , 14 years ago) |
---|
-
ui.droppable.js
old new 40 40 }); 41 41 42 42 //Store the droppable's proportions 43 this. proportions = { width: this.element.outerWidth(), height: this.element.outerHeight() };43 this.recalcProportions(); 44 44 45 45 // Add the reference and positions to the manager 46 46 $.ui.ddmanager.droppables.push({ item: this, over: 0, out: 1 }); … … 114 114 activate: function(e) { 115 115 116 116 var draggable = $.ui.ddmanager.current; 117 // recalculate proportions incase they've changed: 118 this.recalcProportions(); 119 117 120 $.ui.plugin.call(this, 'activate', [e, this.ui(draggable)]); 118 121 if(draggable) this.element.triggerHandler("dropactivate", [e, this.ui(draggable)], this.options.activate); 119 122 … … 124 127 $.ui.plugin.call(this, 'deactivate', [e, this.ui(draggable)]); 125 128 if(draggable) this.element.triggerHandler("dropdeactivate", [e, this.ui(draggable)], this.options.deactivate); 126 129 127 } 130 }, 131 recalcProportions: function() { 132 this.proportions = { width: this.element.outerWidth(), height: this.element.outerHeight() }; 133 }, 128 134 }); 129 135 130 136 $.ui.intersect = function(draggable, droppable, toleranceMode) { … … 148 154 && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half 149 155 break; 150 156 case 'pointer': 151 return ( l < (draggable.positionAbs.left + draggable.clickOffset.left) && (draggable.positionAbs.left + draggable.clickOffset.left) < r 152 && t < (draggable.positionAbs.top + draggable.clickOffset.top) && (draggable.positionAbs.top + draggable.clickOffset.top) < b); 157 var pX = draggable.positionAbs.left + draggable.clickOffset.left, 158 pY = draggable.positionAbs.top + draggable.clickOffset.top; 159 return ( l < pX && pX < r 160 && t < pY && pY < b); 153 161 break; 154 162 case 'touch': 155 163 return ( (l < x1 && x1 < r && t < y1 && y1 < b) // Top-Left Corner … … 205 213 206 214 //Run through all draggables and check their positions based on specific tolerance options 207 215 $.each($.ui.ddmanager.droppables, function() { 208 209 216 if(this.item.disabled) return false; 210 217 var intersects = $.ui.intersect(draggable, this, this.item.options.tolerance); 211 218