From d831bcc3b5ac5e26c724cfbae3482c57b05f4d83 Mon Sep 17 00:00:00 2001 From: Heejin Na <105726712+heegenie@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:03:14 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20zoom=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=20=EC=8B=9C=20=EB=A0=8C=EB=8D=94=EB=A7=81=20?= =?UTF-8?q?=EC=84=B1=EB=8A=A5=20=EA=B0=9C=EC=84=A0=20(#203)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor: zoom 기능 사용 시 렌더링 성능 최적화 --- packages/frontend/src/hooks/useZoomSpace.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/frontend/src/hooks/useZoomSpace.ts b/packages/frontend/src/hooks/useZoomSpace.ts index b3483c8d..17faeba9 100644 --- a/packages/frontend/src/hooks/useZoomSpace.ts +++ b/packages/frontend/src/hooks/useZoomSpace.ts @@ -46,8 +46,6 @@ export function useZoomSpace({ minScale = 0.5, maxScale = 2.5, }: UseZoomSpaceProps) { - const animationFrameId = useRef(null); - const zoomSpace = (event: KonvaEventObject) => { event.evt.preventDefault(); @@ -80,16 +78,8 @@ export function useZoomSpace({ } const newPosition = calculateNewPosition(pointer, mousePointTo, newScale); - - if (animationFrameId.current) { - cancelAnimationFrame(animationFrameId.current); - } - - animationFrameId.current = requestAnimationFrame(() => { - stage.scale({ x: newScale, y: newScale }); - stage.position(newPosition); - stage.batchDraw(); - }); + stage.scale({ x: newScale, y: newScale }); + stage.position(newPosition); } };