Improve drag and drop animation.

This commit is contained in:
Greyson Parrelli
2026-07-26 23:27:20 -04:00
parent 08a2e74067
commit 76e08ceb17
2 changed files with 5 additions and 3 deletions
BIN
View File
Binary file not shown.
+5 -3
View File
@@ -39,9 +39,11 @@ export function ArrangePhase({ view, you, send }: Props) {
const locked = you.ready const locked = you.ready
// The arrow buttons reorder `order` and the cards glide to their new slot. // The arrow buttons reorder `order` and the cards glide to their new slot.
// Drag-and-drop reorders instantly instead: a drag fires continuously, so // A drag reorders live too, and the neighbors the dragged card passes should
// animating every crossing looks frantic — we suppress it while dragging. // glide into the gap it opens — so animation stays on. Only the dragged card
const arrangeAnim = useCardAnimations(order, (c) => c.id, !dragging) // itself is excluded (`dragId`): its inner wrapper already tracks the finger,
// so FLIP-sliding its box on top of that would fight the follow transform.
const arrangeAnim = useCardAnimations(order, (c) => c.id, true, dragId ?? undefined)
// Resync only if the deck's actual contents changed — every broadcast // Resync only if the deck's actual contents changed — every broadcast
// creates a fresh array, and blindly resetting would wipe an in-progress // creates a fresh array, and blindly resetting would wipe an in-progress