diff --git a/README.md b/README.md index c8f4f09..4110d62 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ This website will be the homepage for all of my projects. Any and all projects w image ## Todo for this page: -- Add ability to resize and recalculate number of circles - Add links to pages - Update favicon to be an ico diff --git a/web/util/Canvas.tsx b/web/util/Canvas.tsx index 35b4fa2..a3fb00f 100644 --- a/web/util/Canvas.tsx +++ b/web/util/Canvas.tsx @@ -37,6 +37,16 @@ var mouse = { const useCanvas = () => { const canvasRef: React.MutableRefObject = useRef(null); + addEventListener("resize", () => { + const canvas = canvasRef.current; + if (canvas) { + canvas.width = window.innerWidth; + canvas.height = window.innerHeight; + // redo setup at frame 0 + setup(canvas.getContext("2d")!, 0); + } + }); + useEffect(() => { const canvas = canvasRef.current