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

Function finishDrag

src/handlers/editorFileTab.js:234–264  ·  view source on GitHub ↗
(shouldSettleClone)

Source from the content-addressed store, hash-verified

232}
233
234function finishDrag(shouldSettleClone) {
235 cancelAnimationFrame(animationFrame);
236
237 document.removeEventListener("mousemove", onDrag, opts);
238 document.removeEventListener("touchmove", onDrag, opts);
239 document.removeEventListener("mouseup", releaseDrag, opts);
240 document.removeEventListener("touchend", releaseDrag, opts);
241 document.removeEventListener("touchcancel", releaseDrag, opts);
242 document.removeEventListener("mouseleave", releaseDrag, opts);
243
244 $parent.removeEventListener("scroll", preventDefaultScroll);
245
246 if (shouldSettleClone) {
247 const rect = $tab.getBoundingClientRect();
248 const anim = $tabClone.animate(
249 [{ transform: `translate3d(${rect.left}px, ${rect.top}px, 0)` }],
250 {
251 duration: document.body.classList.contains("no-animation")
252 ? 0
253 : RELEASE_DURATION,
254 easing: SPRING_EASING,
255 fill: "forwards",
256 },
257 );
258 anim.onfinish = cleanupDrag;
259 anim.oncancel = cleanupDrag;
260 return;
261 }
262
263 cleanupDrag();
264}
265
266function cleanupDrag() {
267 $tab.style.opacity = "";

Callers 1

releaseDragFunction · 0.85

Calls 2

cleanupDragFunction · 0.85
animateMethod · 0.80

Tested by

no test coverage detected