From a4d74bb41b84ff09e9be448102f900268a0a40d0 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Mon, 7 Jul 2025 16:15:38 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=EB=B3=B4=EC=A1=B0=EC=84=A0=20=EC=9E=90?= =?UTF-8?q?=EB=A5=B4=EA=B8=B0=20=EC=9E=91=EB=8F=99=20=EC=9D=B4=EC=83=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/roofcover/useAuxiliaryDrawing.js | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/hooks/roofcover/useAuxiliaryDrawing.js b/src/hooks/roofcover/useAuxiliaryDrawing.js index c854ae77..aad5a715 100644 --- a/src/hooks/roofcover/useAuxiliaryDrawing.js +++ b/src/hooks/roofcover/useAuxiliaryDrawing.js @@ -710,9 +710,34 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) { //보조선과 만나는 점을 찾는다. innerLines.forEach((line2) => { + // line1이 canvas에 없는 경우 return + if (!canvas.getObjects().includes(line1)) { + return + } + if (line1 === line2) { return } + // const originLine1 = { + // stroke : line1.stroke, + // strokeWidth: line1.strokeWidth + // } + // const originLine2 = { + // stroke: line2.stroke, + // strokeWidth: line2.strokeWidth + // } + // line1.set({stroke: 'red', strokeWidth: 10}) + // line2.set({stroke: 'blue', strokeWidth: 10}) + // + // canvas.renderAll() + // + // debugger + // + // line1.set(originLine1) + // line2.set(originLine2) + // canvas.renderAll() + + const intersectionPoint = calculateIntersection(line1, line2) if (!intersectionPoint) { return @@ -723,7 +748,7 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) { const distance1 = distanceBetweenPoints({ x: line1.x1, y: line1.y1 }, intersectionPoint) const distance2 = distanceBetweenPoints({ x: line1.x2, y: line1.y2 }, intersectionPoint) - if (distance1 < 1 || distance2 < 1) { + if (distance1 < 2 || distance2 < 2) { return } //historyLine에서 기존 line을 제거한다. From 7ccdda6405e8cf4d017b1aa434a8d075dae254df Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Mon, 7 Jul 2025 17:05:59 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=EC=BA=A1=EC=B3=90=20=EC=A0=84=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../circuitTrestle/CircuitTrestleSetting.jsx | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx index 2e301026..bf3c40cc 100644 --- a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx +++ b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx @@ -109,10 +109,10 @@ export default function CircuitTrestleSetting({ id }) { const capture = (type) => { beforeCapture() - setTimeout(() => { - handleCanvasToPng(type) - afterCapture() - }, 1000) + + handleCanvasToPng(type) + + afterCapture() return new Promise((resolve) => { setTimeout(() => { @@ -124,8 +124,22 @@ export default function CircuitTrestleSetting({ id }) { // 캡쳐 전 처리 const beforeCapture = () => { // setCanvasZoom(100) - const x = 0 - const y = 0 + const arrows = canvas.getObjects().filter((obj) => obj.name === 'arrow') + + let x,y + + x = canvas.width / 2 + y = canvas.height / 2 + + // 화살표가 음수 영역에 있을 경우 0,0 기준으로 50% 축소 + if(arrows.every((arrow) => arrow.left > 0) && arrows.every((arrow) => arrow.top > 0)) { + x = 0 + y = 0 + } + + + + canvas.zoomToPoint(new fabric.Point(x, y), 0.5) changeFontSize('lengthText', '28') changeFontSize('circuitNumber', '28') From 8354770a9ef0d9786299442a455a3dfe7ad79a4c Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Mon, 7 Jul 2025 17:36:33 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=EB=B0=9C=EC=A0=84=20=EC=8B=9C=EB=AE=AC?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=85=98=20=EA=B0=81=EB=8F=84=20=EA=B3=84?= =?UTF-8?q?=EC=82=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useTrestle.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/module/useTrestle.js b/src/hooks/module/useTrestle.js index 29f2d664..9fa75e67 100644 --- a/src/hooks/module/useTrestle.js +++ b/src/hooks/module/useTrestle.js @@ -811,7 +811,7 @@ export const useTrestle = () => { return -surfaceCompass } - let resultAzimuth = surfaceCompass || moduleCompass + let resultAzimuth = moduleCompass @@ -840,7 +840,7 @@ export const useTrestle = () => { if (resultAzimuth > 90) { return -180 + (resultAzimuth - 90) } - return 180 + (90 - resultAzimuth) + return 180 + (resultAzimuth - 90) } else if (resultAzimuth === 180) { return -180 + (resultAzimuth - 90) }