From a7a6a26be1a9a8c3332a97635b76c9df3c0d2690 Mon Sep 17 00:00:00 2001 From: yjnoh Date: Tue, 20 Aug 2024 16:47:59 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=97=EB=B3=80=20=ED=85=8D=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80=20(=EC=A3=BC=EC=84=9D=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=B2=98=EB=A6=AC=ED=95=B4=EB=86=93=EC=9D=8C),=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=A0=80=EC=9E=A5=EC=8B=9C=20?= =?UTF-8?q?=EA=B0=80=EC=9D=B4=EB=93=9C=20=EB=9D=BC=EC=9D=B8=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useCanvas.js | 3 ++- src/hooks/useMode.js | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/hooks/useCanvas.js b/src/hooks/useCanvas.js index 4f5035bc..cd4fbbc3 100644 --- a/src/hooks/useCanvas.js +++ b/src/hooks/useCanvas.js @@ -503,8 +503,8 @@ export function useCanvas(id) { * @param {string} title - 저장할 이미지 이름 */ const saveImage = (title = 'canvas') => { + removeMouseLines() const dataURL = canvas?.toDataURL('png') - // 이미지 다운로드 링크 생성 const link = document.createElement('a') link.download = `${title}.png` @@ -627,5 +627,6 @@ export function useCanvas(id) { handleFlip, setCanvasBackgroundWithDots, addCanvas, + removeMouseLines, } } diff --git a/src/hooks/useMode.js b/src/hooks/useMode.js index 349b5149..a7522274 100644 --- a/src/hooks/useMode.js +++ b/src/hooks/useMode.js @@ -7,6 +7,8 @@ import { getDirection, getStartIndex, rearrangeArray, + getRoofHeight, + getDegreeByChon, } from '@/util/canvas-util' import { useRecoilState, useRecoilValue } from 'recoil' @@ -1351,7 +1353,7 @@ export function useMode() { const applyTemplateA = () => { changeMode(canvas, Mode.EDIT) const polygon = drawWallPolygon(false) - handleClear() + // handleClear() if (polygon.lines.length === 4) { //4각형 @@ -1538,6 +1540,7 @@ export function useMode() { lines.push(line) canvas.add(line) } + canvas?.remove(polygon) //폴리곤 let highLineLength = 0 let lowLineLength = 0 @@ -1644,6 +1647,10 @@ export function useMode() { ) canvas.add(horiCenterLine1) + //나중에 기울기 길이 적용할때 쓸라고 대충 냅둠 + // canvas?.renderAll() + // console.log('horiCenterLine1', horiCenterLine1) + // horiCenterLine1.text.set('text', getRoofHeight(horiCenterLine1.length, getDegreeByChon(4)).toString()) let horiCenterLine2 = new QLine( [