(clientX, clientY)
| 276 | } |
| 277 | |
| 278 | function updateDragPreview(clientX, clientY) { |
| 279 | const $target = document.elementFromPoint(clientX, clientY); |
| 280 | if ( |
| 281 | !$parent.contains($target) || |
| 282 | $target === $tab || |
| 283 | $tab.contains($target) |
| 284 | ) { |
| 285 | return; |
| 286 | } |
| 287 | |
| 288 | const $targetTab = $target.closest(".tile"); |
| 289 | if (!$targetTab) return; |
| 290 | |
| 291 | const rect = $targetTab.getBoundingClientRect(); |
| 292 | const midX = rect.left + rect.width / 2; |
| 293 | const pointerX = tabLeft + tabWidth / 2; |
| 294 | const $nextSibling = $targetTab.nextElementSibling; |
| 295 | const $insertBefore = midX < pointerX ? $nextSibling : $targetTab; |
| 296 | |
| 297 | if ($insertBefore === $tab || $tab.nextElementSibling === $insertBefore) |
| 298 | return; |
| 299 | |
| 300 | reorderTab($insertBefore); |
| 301 | didReorder = true; |
| 302 | } |
| 303 | |
| 304 | function restoreInitialTabPosition() { |
| 305 | reorderTab( |
no test coverage detected