refactor(web): extract timeline drag cleanup
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
} from "./timelineAllocationMultiDrag.js";
|
||||
import { resolveAllocationRelease } from "./timelineAllocationRelease.js";
|
||||
import { createAllocationDragState } from "./timelineAllocationDragState.js";
|
||||
import { cleanupTimelineDragState } from "./timelineDragCleanup.js";
|
||||
import { attachDocumentMouseDrag } from "./timelineDocumentDrag.js";
|
||||
import { buildProjectShiftMutationInput, createProjectDragState } from "./timelineProjectDrag.js";
|
||||
import {
|
||||
@@ -1005,20 +1006,22 @@ export function useTimelineDrag({
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
projectDragCleanupRef.current?.();
|
||||
allocDragCleanupRef.current?.();
|
||||
multiSelectCleanupRef.current?.();
|
||||
projectDragCleanupRef.current = null;
|
||||
allocDragCleanupRef.current = null;
|
||||
multiSelectCleanupRef.current = null;
|
||||
clearLivePreview(projectPreviewRef.current);
|
||||
clearLivePreview(allocPreviewRef.current);
|
||||
projectPreviewRef.current = null;
|
||||
allocPreviewRef.current = null;
|
||||
dragStateRef.current = INITIAL_DRAG_STATE;
|
||||
allocDragRef.current = INITIAL_ALLOC_DRAG;
|
||||
rangeStateRef.current = INITIAL_RANGE_STATE;
|
||||
multiSelectRef.current = INITIAL_MULTI_SELECT;
|
||||
cleanupTimelineDragState({
|
||||
projectDragCleanupRef,
|
||||
allocDragCleanupRef,
|
||||
multiSelectCleanupRef,
|
||||
projectPreviewRef,
|
||||
allocPreviewRef,
|
||||
dragStateRef,
|
||||
allocDragRef,
|
||||
rangeStateRef,
|
||||
multiSelectRef,
|
||||
initialDragState: INITIAL_DRAG_STATE,
|
||||
initialAllocDragState: INITIAL_ALLOC_DRAG,
|
||||
initialRangeState: INITIAL_RANGE_STATE,
|
||||
initialMultiSelectState: INITIAL_MULTI_SELECT,
|
||||
clearPreview: clearLivePreview,
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user