fix(card-sorting): end drag immediately when card becomes locked

Previously, if a card was dragged into its correct position (making
it part of the prefix/suffix), the drag would continue while the
auto-arrange effect tried to reposition it, causing thrashing.

Now:
- Check if card becomes locked during pointer move
- If locked, immediately release pointer capture and end drag
- Auto-arrange effect smoothly positions the card
- No more state thrashing

The card will smoothly animate to its correct position in the
prefix/suffix grid once it's determined to be correctly placed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-10-23 22:20:25 -05:00
parent e3184dd0d4
commit ae45298ec4
1 changed files with 9 additions and 0 deletions

View File

@ -1464,6 +1464,15 @@ export function PlayingPhaseDrag() {
const handlePointerMove = (e: React.PointerEvent, cardId: string) => {
if (!dragStateRef.current || dragStateRef.current.cardId !== cardId) return
// Check if card has become locked during drag - if so, end the drag
if (isCardLocked(cardId)) {
const target = e.currentTarget as HTMLElement
target.releasePointerCapture(e.pointerId)
dragStateRef.current = null
setDraggingCardId(null)
return
}
const { offsetX, offsetY } = dragStateRef.current
// Calculate new position in pixels