refactor(web): centralize multi-select release handling
This commit is contained in:
@@ -23,8 +23,8 @@ import { createAllocationDragState } from "./timelineAllocationDragState.js";
|
||||
import { attachDocumentMouseDrag } from "./timelineDocumentDrag.js";
|
||||
import { buildProjectShiftMutationInput, createProjectDragState } from "./timelineProjectDrag.js";
|
||||
import {
|
||||
completeMultiSelectDraft,
|
||||
createMultiSelectState,
|
||||
finalizeMultiSelectDraft,
|
||||
updateMultiSelectDraft,
|
||||
} from "./timelineMultiSelect.js";
|
||||
import { reconcileOptimisticEntries } from "./timelineOptimisticAllocations.js";
|
||||
@@ -896,21 +896,9 @@ export function useTimelineDrag({
|
||||
const ms = multiSelectRef.current;
|
||||
if (!ms.isSelecting) return;
|
||||
|
||||
const finished = finalizeMultiSelectDraft(ms, ev.clientX, ev.clientY);
|
||||
if (!finished) {
|
||||
// Minimal movement → not a drag selection, reset.
|
||||
// Let existing onContextMenu handlers on allocation blocks handle right-click.
|
||||
multiSelectRef.current = INITIAL_MULTI_SELECT;
|
||||
setMultiSelectState(INITIAL_MULTI_SELECT);
|
||||
return;
|
||||
}
|
||||
|
||||
// Keep the rectangle coordinates for the parent to compute intersection.
|
||||
// isSelecting is set to false to indicate the drag is done, but the
|
||||
// rectangle data (startX/Y, currentX/Y) is preserved so TimelineView
|
||||
// can resolve which allocations/resources fall within the selection.
|
||||
multiSelectRef.current = finished;
|
||||
setMultiSelectState(finished);
|
||||
const result = completeMultiSelectDraft(ms, ev.clientX, ev.clientY, INITIAL_MULTI_SELECT);
|
||||
multiSelectRef.current = result.nextState;
|
||||
setMultiSelectState(result.nextState);
|
||||
}
|
||||
|
||||
multiSelectCleanupRef.current = attachDocumentMouseDrag(document, handleMove, handleUp);
|
||||
|
||||
Reference in New Issue
Block a user