Changeset 468 for trunk/ui/ui.draggable.js
- Timestamp:
- 07/17/08 09:13:10 (20 months ago)
- Files:
-
- 1 modified
-
trunk/ui/ui.draggable.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ui/ui.draggable.js
r467 r468 380 380 var inst = $(this).data("draggable"); 381 381 inst.snapElements = []; 382 $(ui.options.snap === true ? ':data(draggable)' : ui.options.snap).each(function() { 382 383 $(ui.options.snap.constructor != String ? ( ui.options.snap.items || ':data(draggable)' ) : ui.options.snap).each(function() { 383 384 var $t = $(this); var $o = $t.offset(); 384 385 if(this != inst.element[0]) inst.snapElements.push({ … … 391 392 }, 392 393 drag: function(e, ui) { 393 394 394 395 var inst = $(this).data("draggable"); 395 396 var d = ui.options.snapTolerance || 20; … … 403 404 404 405 //Yes, I know, this is insane ;) 405 if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) continue; 406 if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { 407 if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, null, $.extend(inst.uiHash(), { snapItem: inst.snapElements[i].item }))); 408 inst.snapElements[i].snapping = false; 409 continue; 410 } 406 411 407 412 if(ui.options.snapMode != 'inner') { … … 416 421 } 417 422 423 var first = (ts || bs || ls || rs); 424 418 425 if(ui.options.snapMode != 'outer') { 419 426 var ts = Math.abs(t - y1) <= 20; … … 427 434 } 428 435 429 }; 436 if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) 437 (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, null, $.extend(inst.uiHash(), { snapItem: inst.snapElements[i].item }))); 438 inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 439 440 }; 441 430 442 } 431 443 });