From d0541b161da2f784b52f94f8af32a5fd643aaafa Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Mon, 8 Jul 2024 12:58:38 +0900 Subject: [PATCH] =?UTF-8?q?=ED=95=84=EC=9A=94=20=EC=97=86=EB=8A=94=20?= =?UTF-8?q?=EB=82=B4=EC=9A=A9=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useCanvas.js | 2 -- src/hooks/useMode.js | 32 -------------------------------- 2 files changed, 34 deletions(-) diff --git a/src/hooks/useCanvas.js b/src/hooks/useCanvas.js index 9d860234..f1b98031 100644 --- a/src/hooks/useCanvas.js +++ b/src/hooks/useCanvas.js @@ -176,7 +176,6 @@ export function useCanvas(id) { strokeWidth: 1, selectable: false, name: 'mouseLine', - strokeDashArray: [5, 5], }, ) @@ -188,7 +187,6 @@ export function useCanvas(id) { strokeWidth: 1, selectable: false, name: 'mouseLine', - strokeDashArray: [5, 5], }, ) diff --git a/src/hooks/useMode.js b/src/hooks/useMode.js index 90366ce4..256b4968 100644 --- a/src/hooks/useMode.js +++ b/src/hooks/useMode.js @@ -62,38 +62,6 @@ export function useMode() { } const editMode = () => { - let distanceText = null // 거리를 표시하는 텍스트 객체를 저장할 변수 - canvas?.on('mouse:move', function (options) { - const pointer = canvas?.getPointer(options.e) - - if (historyLines.current.length === 0) return - const direction = getDirection(historyLines.current[0], pointer) - - // 각 선과 마우스 위치 사이의 거리를 계산합니다. - const dx = historyLines.current[0].x1 - pointer.x - const dy = 0 - - const minDistance = Math.sqrt(dx * dx + dy * dy) - - // 거리를 표시하는 텍스트 객체를 생성하거나 업데이트합니다. - if (distanceText) { - distanceText.set({ - left: pointer.x, - top: pointer.y, - text: `${minDistance.toFixed(2)}`, - }) - } else { - distanceText = new fabric.Text(`${minDistance.toFixed(2)}`, { - left: pointer.x, - top: pointer.y, - fontSize: fontSize, - }) - canvas?.add(distanceText) - } - - // 캔버스를 다시 그립니다. - canvas?.renderAll() - }) canvas?.on('mouse:down', function (options) { const pointer = canvas?.getPointer(options.e) const circle = new fabric.Circle({