(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget)
| 2261 | return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top; |
| 2262 | } |
| 2263 | function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) { |
| 2264 | var mouseOnAxis = vertical ? evt.clientY : evt.clientX, |
| 2265 | targetLength = vertical ? targetRect.height : targetRect.width, |
| 2266 | targetS1 = vertical ? targetRect.top : targetRect.left, |
| 2267 | targetS2 = vertical ? targetRect.bottom : targetRect.right, |
| 2268 | invert = false; |
| 2269 | if (!invertSwap) { |
| 2270 | // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold |
| 2271 | if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) { |
| 2272 | // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2 |
| 2273 | // check if past first invert threshold on side opposite of lastDirection |
| 2274 | if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) { |
| 2275 | // past first invert threshold, do not restrict inverted threshold to dragEl shadow |
| 2276 | pastFirstInvertThresh = true; |
| 2277 | } |
| 2278 | if (!pastFirstInvertThresh) { |
| 2279 | // dragEl shadow (target move distance shadow) |
| 2280 | if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow |
| 2281 | : mouseOnAxis > targetS2 - targetMoveDistance) { |
| 2282 | return -lastDirection; |
| 2283 | } |
| 2284 | } else { |
| 2285 | invert = true; |
| 2286 | } |
| 2287 | } else { |
| 2288 | // Regular |
| 2289 | if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) { |
| 2290 | return _getInsertDirection(target); |
| 2291 | } |
| 2292 | } |
| 2293 | } |
| 2294 | invert = invert || invertSwap; |
| 2295 | if (invert) { |
| 2296 | // Invert of regular |
| 2297 | if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) { |
| 2298 | return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1; |
| 2299 | } |
| 2300 | } |
| 2301 | return 0; |
| 2302 | } |
| 2303 | |
| 2304 | /** |
| 2305 | * Gets the direction dragEl must be swapped relative to target in order to make it |
no test coverage detected
searching dependent graphs…