[eric] dashboard: grab-to-drag selects the card so the next spawn docks beside it (was deselect-all, so spawns flew to viewport-center)

This commit is contained in:
ciregenz
2026-07-15 19:55:30 -07:00
parent b1a343ed78
commit 7ab187cef1
@@ -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]);