diff options
author | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-07-09 19:34:11 +0000 |
---|---|---|
committer | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-07-09 19:34:11 +0000 |
commit | d1eaa41e7fe8e2021b3b320e16214bdca3d39aab (patch) | |
tree | 9f2b7ff331fef100e404ff687801da473ff61498 /ui/ui.sortable.js | |
parent | 4e06fa6304c30dd3bfcfa818a84d7fb7e92eea33 (diff) | |
download | jquery-ui-d1eaa41e7fe8e2021b3b320e16214bdca3d39aab.tar.gz jquery-ui-d1eaa41e7fe8e2021b3b320e16214bdca3d39aab.zip |
Sortable minor intersectWidth maths accuracy
Diffstat (limited to 'ui/ui.sortable.js')
-rw-r--r-- | ui/ui.sortable.js | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index a42ba67b8..c234cbcc6 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -86,21 +86,18 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }, /* Be careful with the following core functions */ intersectsWith: function(item) { - var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width, y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height; var l = item.left, r = l + item.width, t = item.top, b = t + item.height; - if(this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) { + if (this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) { return (y1 + this.offset.click.top > t && y1 + this.offset.click.top < b && x1 + this.offset.click.left > l && x1 + this.offset.click.left < r); } else { - return (l < x1 + (this.helperProportions.width / 2) // Right Half && x2 - (this.helperProportions.width / 2) < r // Left Half && t < y1 + (this.helperProportions.height / 2) // Bottom Half && y2 - (this.helperProportions.height / 2) < b ); // Top Half - } }, @@ -111,17 +108,17 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { t = item.top, b = t + item.height; if(this.options.tolerance == "pointer" || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) { - + if(!(y1 + this.offset.click.top > t && y1 + this.offset.click.top < b && x1 + this.offset.click.left > l && x1 + this.offset.click.left < r)) return false; if(this.floating) { if(x1 + this.offset.click.left > l && x1 + this.offset.click.left < l + item.width/2) return 2; if(x1 + this.offset.click.left > l+item.width/2 && x1 + this.offset.click.left < r) return 1; } else { - if(y1 + this.offset.click.top > t && y1 + this.offset.click.top < t + item.height/2) return 2; - if(y1 + this.offset.click.top > t+item.height/2 && y1 + this.offset.click.top < b) return 1; + if(y1 + this.offset.click.top > t && y1 + this.offset.click.top < t) return 2; + if(y1 + this.offset.click.top > t && y1 + this.offset.click.top < b) return 1; } - + } else { if (!(l < x1 + (this.helperProportions.width / 2) // Right Half |