Skip to content

Commit

Permalink
minor performance improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-m1 committed Jun 14, 2019
1 parent d2ea90c commit a22474b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
}

direction = _getSwapDirection(
evt, target, vertical,
evt, target, targetRect, vertical,
differentRowCol ? 1 : options.swapThreshold,
options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold,
isCircumstantialInvert,
Expand Down Expand Up @@ -1721,9 +1721,8 @@ function _ghostIsLast(evt, vertical, sortable) {
(evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer);
}

function _getSwapDirection(evt, target, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
let targetRect = getRect(target),
mouseOnAxis = vertical ? evt.clientY : evt.clientX,
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
let mouseOnAxis = vertical ? evt.clientY : evt.clientX,
targetLength = vertical ? targetRect.height : targetRect.width,
targetS1 = vertical ? targetRect.top : targetRect.left,
targetS2 = vertical ? targetRect.bottom : targetRect.right,
Expand Down

0 comments on commit a22474b

Please sign in to comment.