diff --git a/package-lock.json b/package-lock.json
index 9294ec9..a87dd7b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21,6 +21,7 @@
"html2canvas": "^1.4.1",
"husky": "^8.0.3",
"lint-staged": "13.2.3",
+ "lodash.debounce": "^4.0.8",
"lottie-web": "^5.12.2",
"msw": "^1.2.2",
"react": "^18.2.0",
@@ -36,6 +37,7 @@
"@jest/globals": "^29.6.2",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.3",
+ "@types/lodash.debounce": "^4.0.7",
"@types/node": "^20.4.5",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
@@ -3909,6 +3911,21 @@
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
"dev": true
},
+ "node_modules/@types/lodash": {
+ "version": "4.14.196",
+ "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.196.tgz",
+ "integrity": "sha512-22y3o88f4a94mKljsZcanlNWPzO0uBsBdzLAngf2tp533LzZcQzb6+eZPJ+vCTt+bqF2XnvT9gejTLsAcJAJyQ==",
+ "dev": true
+ },
+ "node_modules/@types/lodash.debounce": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/@types/lodash.debounce/-/lodash.debounce-4.0.7.tgz",
+ "integrity": "sha512-X1T4wMZ+gT000M2/91SYj0d/7JfeNZ9PeeOldSNoE/lunLeQXKvkmIumI29IaKMotU/ln/McOIvgzZcQ/3TrSA==",
+ "dev": true,
+ "dependencies": {
+ "@types/lodash": "*"
+ }
+ },
"node_modules/@types/ms": {
"version": "0.7.31",
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz",
diff --git a/package.json b/package.json
index 6b73bbd..0aef91e 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,7 @@
"html2canvas": "^1.4.1",
"husky": "^8.0.3",
"lint-staged": "13.2.3",
+ "lodash.debounce": "^4.0.8",
"lottie-web": "^5.12.2",
"msw": "^1.2.2",
"react": "^18.2.0",
@@ -46,6 +47,7 @@
"@jest/globals": "^29.6.2",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.3",
+ "@types/lodash.debounce": "^4.0.7",
"@types/node": "^20.4.5",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
diff --git a/src/App.tsx b/src/App.tsx
index 4386229..181ddd7 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -13,7 +13,6 @@ export default function App() {
{elem}
-
);
}
diff --git a/src/components/Game/GameBoard/CanvasDrawingApp/index.tsx b/src/components/Game/GameBoard/CanvasDrawingApp/index.tsx
index 79a556e..914a0b0 100644
--- a/src/components/Game/GameBoard/CanvasDrawingApp/index.tsx
+++ b/src/components/Game/GameBoard/CanvasDrawingApp/index.tsx
@@ -21,6 +21,7 @@ import {
import useDidMountEffect from '@/hooks/useDidMountEffect';
import html2canvas from 'html2canvas';
import { restFetcher } from '@/queryClient';
+import debounce from 'lodash.debounce';
type Props = {
setCurrentFocus: React.Dispatch>;
@@ -55,6 +56,23 @@ const CanvasDrawingApp = forwardRef((props, ref) => {
const roundGameInfo = useRecoilValue(roundGameState);
const nickname = useRecoilValue(nicknameState);
+ const [windowSize, setWindowSize] = useState({ width: 0, height: 0 });
+
+ // 창 크기 변화 이벤트 핸들러
+ const handleWindowResize = () => {
+ setWindowSize({
+ width: window.innerWidth,
+ height: window.innerHeight,
+ });
+ };
+
+ useEffect(() => {
+ window.addEventListener('resize', handleWindowResize);
+ return () => {
+ window.removeEventListener('resize', handleWindowResize);
+ };
+ }, []);
+
//그리기 시작
const startDrawing = (event: React.MouseEvent) => {
const { offsetX, offsetY } = event.nativeEvent;
@@ -250,8 +268,8 @@ const CanvasDrawingApp = forwardRef((props, ref) => {
{roundGameInfo.word && `정답 : ${roundGameInfo.word}`}