mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-06 17:57:43 +02:00
[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:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user