aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorVictor Homyakov <vkhomyackov@gmail.com>2015-07-08 13:53:13 +0300
committerScott González <scott.gonzalez@gmail.com>2015-07-08 13:00:50 -0400
commitf7ee8524b3371663b2484299036c5e14363d5b71 (patch)
treea071861880f02b7a752e606ae42807d9feb1bc5b /ui
parentb3a9b13a218cd90b7cf67be5d5f8ad6e76c557b0 (diff)
downloadjquery-ui-f7ee8524b3371663b2484299036c5e14363d5b71.tar.gz
jquery-ui-f7ee8524b3371663b2484299036c5e14363d5b71.zip
Sortable: Optimize `_intersectsWithPointer()`
Closes gh-1574
Diffstat (limited to 'ui')
-rw-r--r--ui/sortable.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/ui/sortable.js b/ui/sortable.js
index 6d872cbe6..bf1bf6a89 100644
--- a/ui/sortable.js
+++ b/ui/sortable.js
@@ -588,18 +588,20 @@ return $.widget("ui.sortable", $.ui.mouse, {
_intersectsWithPointer: function(item) {
- var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
+ var verticalDirection, horizontalDirection,
+ isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
- isOverElement = isOverElementHeight && isOverElementWidth,
- verticalDirection = this._getDragVerticalDirection(),
- horizontalDirection = this._getDragHorizontalDirection();
+ isOverElement = isOverElementHeight && isOverElementWidth;
if (!isOverElement) {
return false;
}
+ verticalDirection = this._getDragVerticalDirection();
+ horizontalDirection = this._getDragHorizontalDirection();
+
return this.floating ?
- ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
+ ( (horizontalDirection === "right" || verticalDirection === "down") ? 2 : 1 )
: ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
},