mirror of
https://github.com/drawdb-io/drawdb.git
synced 2026-06-01 02:00:44 +08:00
Abstract TransformContext
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { createContext, useState } from "react";
|
||||
|
||||
export const TransformContext = createContext(null);
|
||||
|
||||
export default function TransformContextProvider({ children }) {
|
||||
const [transform, setTransform] = useState({
|
||||
zoom: 1,
|
||||
pan: { x: 0, y: 0 },
|
||||
});
|
||||
|
||||
return (
|
||||
<TransformContext.Provider value={{ transform, setTransform }}>
|
||||
{children}
|
||||
</TransformContext.Provider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user