Files
yx-react-template/src/components/course-interactions/drag-drop/DragDropContext.tsx
T
2026-08-18 13:39:36 +08:00

23 lines
581 B
TypeScript

import type { Transform } from "@dnd-kit/utilities";
import { createContext, useContext } from "react";
interface DragDropContextValue {
scale: number;
inverseScale: number;
hasOverlay: boolean;
getScaledTransform: (transform: Transform | null) => Transform | null;
}
const DragDropContext = createContext<DragDropContextValue>({
scale: 1,
inverseScale: 1,
hasOverlay: false,
getScaledTransform: (transform) => transform,
});
export const DragDropContextProvider = DragDropContext.Provider;
export function useDragDropContext() {
return useContext(DragDropContext);
}