From 7ab187cef14911fc1969bc17f44f70dc88f1cd75 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Wed, 15 Jul 2026 19:55:30 -0700 Subject: [PATCH] [eric] dashboard: grab-to-drag selects the card so the next spawn docks beside it (was deselect-all, so spawns flew to viewport-center) --- .../src/app/pages/Dashboard/hooks/interaction/useCardDrag.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/pages/Dashboard/hooks/interaction/useCardDrag.ts b/frontend/src/app/pages/Dashboard/hooks/interaction/useCardDrag.ts index 5a8e3280..17fed1ac 100644 --- a/frontend/src/app/pages/Dashboard/hooks/interaction/useCardDrag.ts +++ b/frontend/src/app/pages/Dashboard/hooks/interaction/useCardDrag.ts @@ -79,12 +79,13 @@ export function useCardDrag({ edgePanFrameRef.current = requestAnimationFrame(tickEdgePan); }, [viewportRef, canvasActions]); - const handleCardDragStart = useCallback((id: string, _type: CardType) => { + const handleCardDragStart = useCallback((id: string, type: CardType) => { activeDragCardRef.current = id; if (selection.isSelected(id)) { isMultiDragRef.current = true; } else { - selection.deselectAll(); + // Grabbing an unselected card SELECTS just it (was deselectAll, which left nothing selected, so the next spawn had no anchor and flew to viewport-center far from the card you just moved). Also survives the stale-read where the capture-phase click already selected it. + selection.selectCard(id, type, false); isMultiDragRef.current = false; } }, [selection]);