19 lines
No EOL
726 B
JavaScript
19 lines
No EOL
726 B
JavaScript
import { useRef, useState } from 'react'
|
|
import CanvasContext from './CanvasContext';
|
|
|
|
const CanvasContextProvider = ({ children }) => {
|
|
const canvasRef = useRef(null);
|
|
const [canvas, setCanvas] = useState(null);
|
|
const [canvasHeight, setCanvasHeight] = useState(0);
|
|
const [canvasWidth, setCanvasWidth] = useState(0);
|
|
const [screenWidth, setScreenWidth] = useState(0);
|
|
const fabricCanvasRef = useRef(null);
|
|
|
|
return (
|
|
<CanvasContext.Provider value={{ canvasRef, canvas, setCanvas, fabricCanvasRef, canvasHeight, setCanvasHeight, canvasWidth, setCanvasWidth, screenWidth, setScreenWidth }}>
|
|
{children}
|
|
</CanvasContext.Provider>
|
|
)
|
|
}
|
|
|
|
export default CanvasContextProvider |