MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / updateDragPreview

Function updateDragPreview

src/handlers/editorFileTab.js:278–302  ·  view source on GitHub ↗
(clientX, clientY)

Source from the content-addressed store, hash-verified

276}
277
278function 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
304function restoreInitialTabPosition() {
305 reorderTab(

Callers 2

onDragFunction · 0.85
releaseDragFunction · 0.85

Calls 1

reorderTabFunction · 0.85

Tested by

no test coverage detected