forked from zhongyidian/yx-react-template
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
23 lines
581 B
TypeScript
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);
|
|
}
|