From 12debfc889eb91692327ac4659f05b6b71c6d1e2 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Wed, 26 Jun 2024 23:11:25 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B2=84=EA=B7=B8=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useMode.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/hooks/useMode.js b/src/hooks/useMode.js index 7c64917a..b04fc985 100644 --- a/src/hooks/useMode.js +++ b/src/hooks/useMode.js @@ -105,12 +105,15 @@ export function useMode() { const length = Number(prompt('길이를 입력하세요:')) // length 값이 숫자가 아닌 경우 if (isNaN(length) || length === 0) { - // 기존에 추가된 circle과 pointer를 제거합니다. - points.current.forEach((point) => { - canvas?.remove(point) - }) + //마지막 추가 된 points 제거합니다. + + const lastPoint = + historyPoints.current[historyPoints.current.length - 1] + + canvas?.remove(lastPoint) + historyPoints.current.pop() - points.current = [] + points.current.pop() return }