mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 09:48:44 +00:00
30 lines
560 B
TypeScript
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,
|
|
};
|
|
}
|