fix:解决拖拽问题

This commit is contained in:
zhongyidian committed 2025-10-20 17:50:42 +08:00
1 parent ce06ad0214
commit 6367014e1f
34 files changed
+1712 -397

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
import { createContext, useContext, ReactNode } from "react";
export interface ScaleContextValue {
scale: number;
offsetX: number;
offsetY: number;
DESIGN_WIDTH: number;
DESIGN_HEIGHT: number;
}
const ScaleContext = createContext<ScaleContextValue | null>(null);
export function ScaleProvider({
children,
value,
}: {
children: ReactNode;
value: ScaleContextValue;
}) {
return (
<ScaleContext.Provider value={value}>{children}</ScaleContext.Provider>
);
}
export function useScale() {
const context = useContext(ScaleContext);
if (!context) {
throw new Error("useScale must be used within ScaleProvider");
}
return context;
}