diff options
author | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-10-28 18:05:02 +0000 |
---|---|---|
committer | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-10-28 18:05:02 +0000 |
commit | 95980d34da7f4ef6637a107df5fd669c624fd9c6 (patch) | |
tree | 022d8b5d0442f01b0542b4389e7120fe7c0cf346 /ui/ui.sortable.js | |
parent | fe12e22f47263a5956065c831cccf0f907c0177d (diff) | |
download | jquery-ui-95980d34da7f4ef6637a107df5fd669c624fd9c6.tar.gz jquery-ui-95980d34da7f4ef6637a107df5fd669c624fd9c6.zip |
Sortable - delta direction improved
Diffstat (limited to 'ui/ui.sortable.js')
-rw-r--r-- | ui/ui.sortable.js | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index 572725529..5406575d0 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -128,12 +128,24 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { if (this.floating) { if (isOverElement) { - return horizontalDirection == "right" ? 2 : 1; + + if (horizontalDirection == false) { + return false; + } + + var direction = horizontalDirection == "right" ? 2 : 1; + return direction; } } else { if (isOverElement) { - return verticalDirection == "down" ? 2 : 1; + + if (verticalDirection == false) { + return false; + } + + var direction = verticalDirection == "down" ? 2 : 1; + return direction; } } @@ -143,14 +155,26 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { _getDragVerticalDirection: function() { var helperTop = this.positionAbs.top; var lastTop = this.lastPositionAbs.top; - var direction = helperTop - lastTop > 0 ? "down" : "up"; + var delta = helperTop - lastTop; + + if (delta == 0) { + return false; + } + + var direction = delta > 0 ? "down" : "up"; return direction; }, _getDragHorizontalDirection: function() { var helperLeft = this.positionAbs.left; var lastLeft = this.lastPositionAbs.left; - var direction = helperLeft - lastLeft > 0 ? "right" : "left"; + var delta = helperLeft - lastLeft; + + if (delta == 0) { + return false; + } + + var direction = delta > 0 ? "right" : "left"; return direction; }, |