Skip to content
Permalink
Browse files

Sortable: Optimize `_intersectsWithPointer()`

Closes gh-1574
  • Loading branch information...
victor-homyakov authored and scottgonzalez committed Jul 8, 2015
1 parent b3a9b13 commit f7ee8524b3371663b2484299036c5e14363d5b71
Showing with 7 additions and 5 deletions.
  1. +7 −5 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) );

},

0 comments on commit f7ee852

Please sign in to comment.
You can’t perform that action at this time.