Changeset 334
- Timestamp:
- 06/24/08 08:28:12 (21 months ago)
- Location:
- trunk/ui
- Files:
-
- 2 modified
-
ui.draggable.js (modified) (2 diffs)
-
ui.sortable.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ui/ui.draggable.js
r329 r334 444 444 shouldRevert: sortable.options.revert 445 445 }); 446 sortable.refresh (); //Do a one-time refresh at start to refresh the containerCache446 sortable.refreshItems(); //Do a one-time refresh at start to refresh the containerCache 447 447 sortable.propagate("activate", e, inst); 448 448 } … … 503 503 504 504 e.target = this.instance.currentItem[0]; 505 this.instance.mouseCapture(e, true , true);505 this.instance.mouseCapture(e, true); 506 506 this.instance.mouseStart(e, true, true); 507 508 console.log(this.instance.items); 507 509 508 510 //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes -
trunk/ui/ui.sortable.js
r332 r334 173 173 items.push({ 174 174 item: $(this), 175 instance: queries[i][1], 175 176 width: 0, height: 0, 176 177 left: 0, top: 0 … … 191 192 } 192 193 193 for (var i = this.items.length - 1; i >= 0; i--){ 194 for (var i = this.items.length - 1; i >= 0; i--){ 195 196 //We ignore calculating positions of all connected containers when we're not over them 197 if(this.items[i].instance != this.currentContainer && this.currentContainer && this.items[i].item[0] != this.currentItem[0]) 198 continue; 199 194 200 var t = this.items[i].item; 201 195 202 if(!fast) this.items[i].width = (this.options.toleranceElement ? $(this.options.toleranceElement, t) : t).outerWidth(); 196 203 if(!fast) this.items[i].height = (this.options.toleranceElement ? $(this.options.toleranceElement, t) : t).outerHeight(); 204 197 205 var p = (this.options.toleranceElement ? $(this.options.toleranceElement, t) : t).offset(); 198 206 this.items[i].left = p.left; 199 207 this.items[i].top = p.top; 200 }; 208 209 }; 210 201 211 for (var i = this.containers.length - 1; i >= 0; i--){ 202 212 var p =this.containers[i].element.offset(); … … 206 216 this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); 207 217 }; 218 208 219 }, 209 220 destroy: function() { … … 266 277 } 267 278 268 269 itemWithLeastDistance ? this.rearrange(e, itemWithLeastDistance ) : this.rearrange(e, null, this.containers[i].element);279 this.currentContainer = this.containers[i]; 280 itemWithLeastDistance ? this.rearrange(e, itemWithLeastDistance, null, true) : this.rearrange(e, null, this.containers[i].element, true); 270 281 this.propagate("change", e); //Call plugins and callbacks 271 282 this.containers[i].propagate("change", e, this); //Call plugins and callbacks 272 this.currentContainer = this.containers[i];273 283 274 284 } … … 519 529 520 530 }, 521 rearrange: function(e, i, a ) {531 rearrange: function(e, i, a, hardRefresh) { 522 532 a ? a.append(this.currentItem) : i.item[this.direction == 'down' ? 'before' : 'after'](this.currentItem); 523 this.refreshPositions( true); //Precompute after each DOM insertion, NOT on mousemove533 this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove 524 534 if(this.options.placeholder) this.options.placeholder.update.call(this.element, this.currentItem, this.placeholder); 525 535 },