refactor(web): extract allocation drag bootstrap
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
startAllocationMultiDrag,
|
||||
updateAllocationMultiDrag,
|
||||
} from "./timelineAllocationMultiDrag.js";
|
||||
import { createAllocationDragState } from "./timelineAllocationDragState.js";
|
||||
import { buildProjectShiftMutationInput, createProjectDragState } from "./timelineProjectDrag.js";
|
||||
import {
|
||||
createMultiSelectState,
|
||||
@@ -682,25 +683,20 @@ export function useTimelineDrag({
|
||||
|
||||
// ── Single allocation drag ────────────────────────────────────────────
|
||||
|
||||
const initial: AllocDragState = {
|
||||
isActive: true,
|
||||
const initial = createAllocationDragState<AllocDragState, AllocDragMode, AllocDragScope>({
|
||||
mode: opts.mode,
|
||||
scope: opts.scope ?? "allocation",
|
||||
scope: opts.scope,
|
||||
allocationId: opts.allocationId,
|
||||
mutationAllocationId: opts.mutationAllocationId ?? opts.allocationId,
|
||||
mutationAllocationId: opts.mutationAllocationId,
|
||||
projectId: opts.projectId,
|
||||
projectName: opts.projectName,
|
||||
resourceId: opts.resourceId,
|
||||
allocationStartDate: opts.allocationStartDate ?? opts.startDate,
|
||||
allocationEndDate: opts.allocationEndDate ?? opts.endDate,
|
||||
originalStartDate: opts.startDate,
|
||||
originalEndDate: opts.endDate,
|
||||
currentStartDate: opts.startDate,
|
||||
currentEndDate: opts.endDate,
|
||||
allocationStartDate: opts.allocationStartDate,
|
||||
allocationEndDate: opts.allocationEndDate,
|
||||
startDate: opts.startDate,
|
||||
endDate: opts.endDate,
|
||||
startMouseX: e.clientX,
|
||||
pointerDeltaX: 0,
|
||||
daysDelta: 0,
|
||||
};
|
||||
});
|
||||
allocDragRef.current = initial;
|
||||
setAllocDragState(initial);
|
||||
setAllocationPreviewTarget(e.currentTarget, opts.mode);
|
||||
|
||||
Reference in New Issue
Block a user