mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-17 07:04:36 +00:00
20 lines
443 B
TypeScript
20 lines
443 B
TypeScript
import { useCallback } from "react";
|
|
import { canDrop, dragItem } from "~/pages/PageEnigma/store";
|
|
import { MediaItem } from "~/pages/PageEnigma/models";
|
|
|
|
export default function useUpdateDragDrop() {
|
|
const startDrag = useCallback((item: MediaItem) => {
|
|
dragItem.value = item;
|
|
}, []);
|
|
|
|
const endDrag = useCallback(() => {
|
|
dragItem.value = null;
|
|
canDrop.value = false;
|
|
}, []);
|
|
|
|
return {
|
|
startDrag,
|
|
endDrag,
|
|
};
|
|
}
|