Files
artcraft/app/pages/PageEnigma/contexts/TrackContext/utils/useUpdateDragDrop.ts
T

30 lines
560 B
TypeScript

import { useCallback } from "react";
import {
canDrop,
clipLength,
dragId,
dragType,
} from "~/pages/PageEnigma/store";
export default function useUpdateDragDrop() {
const startDrag = useCallback(
(type: "animations" | "lipSync", id: string, length: number) => {
dragId.value = id;
dragType.value = type;
clipLength.value = length;
},
[],
);
const endDrag = useCallback(() => {
dragId.value = null;
dragType.value = null;
canDrop.value = false;
}, []);
return {
startDrag,
endDrag,
};
}