Skip to content

Commit e90c04d

Browse files
authored
Merge pull request #2 from hackrmomo/feature/recalculate-squares
add ability to resize
2 parents fec834c + 67f687c commit e90c04d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ This website will be the homepage for all of my projects. Any and all projects w
99
<img width="1753" alt="image" src="https://user-images.githubusercontent.com/5733032/192616453-aa1774b1-12bf-495c-8706-4707c1185e8c.png">
1010

1111
## Todo for this page:
12-
- Add ability to resize and recalculate number of circles
1312
- Add links to pages
1413
- Update favicon to be an ico
1514

web/util/Canvas.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ var mouse = {
3737
const useCanvas = () => {
3838
const canvasRef: React.MutableRefObject<HTMLCanvasElement | null> = useRef(null);
3939

40+
addEventListener("resize", () => {
41+
const canvas = canvasRef.current;
42+
if (canvas) {
43+
canvas.width = window.innerWidth;
44+
canvas.height = window.innerHeight;
45+
// redo setup at frame 0
46+
setup(canvas.getContext("2d")!, 0);
47+
}
48+
});
49+
4050
useEffect(() => {
4151

4252
const canvas = canvasRef.current

0 commit comments

Comments
 (0)