Sortable: Optimize _intersectsWithPointer()

Closes gh-1574
This commit is contained in:
Victor Homyakov 2015-07-08 13:53:13 +03:00 committed by Scott González
parent b3a9b13a21
commit f7ee8524b3

View File

@ -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) );
},