mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Sortable: Optimize _intersectsWithPointer()
Closes gh-1574
This commit is contained in:
parent
b3a9b13a21
commit
f7ee8524b3
@ -588,18 +588,20 @@ return $.widget("ui.sortable", $.ui.mouse, {
|
|||||||
|
|
||||||
_intersectsWithPointer: function(item) {
|
_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),
|
isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
|
||||||
isOverElement = isOverElementHeight && isOverElementWidth,
|
isOverElement = isOverElementHeight && isOverElementWidth;
|
||||||
verticalDirection = this._getDragVerticalDirection(),
|
|
||||||
horizontalDirection = this._getDragHorizontalDirection();
|
|
||||||
|
|
||||||
if (!isOverElement) {
|
if (!isOverElement) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verticalDirection = this._getDragVerticalDirection();
|
||||||
|
horizontalDirection = this._getDragHorizontalDirection();
|
||||||
|
|
||||||
return this.floating ?
|
return this.floating ?
|
||||||
( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
|
( (horizontalDirection === "right" || verticalDirection === "down") ? 2 : 1 )
|
||||||
: ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
|
: ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
|
||||||
|
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user