Skip to content

Commit 528dfc4

Browse files
committed
minor performance improvement
1 parent 0738f37 commit 528dfc4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Sortable.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
11691169
}
11701170

11711171
direction = _getSwapDirection(
1172-
evt, target, vertical,
1172+
evt, target, targetRect, vertical,
11731173
differentRowCol ? 1 : options.swapThreshold,
11741174
options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold,
11751175
isCircumstantialInvert,
@@ -1721,9 +1721,8 @@ function _ghostIsLast(evt, vertical, sortable) {
17211721
(evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer);
17221722
}
17231723

1724-
function _getSwapDirection(evt, target, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
1725-
let targetRect = getRect(target),
1726-
mouseOnAxis = vertical ? evt.clientY : evt.clientX,
1724+
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
1725+
let mouseOnAxis = vertical ? evt.clientY : evt.clientX,
17271726
targetLength = vertical ? targetRect.height : targetRect.width,
17281727
targetS1 = vertical ? targetRect.top : targetRect.left,
17291728
targetS2 = vertical ? targetRect.bottom : targetRect.right,

0 commit comments

Comments
 (0)