From 7a0db7abfbfbe1dcc4dd16e46740520e4ab3ed82 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Thu, 7 Aug 2025 18:21:54 +0900 Subject: [PATCH 1/3] =?UTF-8?q?capture=20=EC=B2=98=EB=A6=AC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/common.js | 1 + .../circuitTrestle/CircuitTrestleSetting.jsx | 34 ++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/common/common.js b/src/common/common.js index d2461d28..61fdabd1 100644 --- a/src/common/common.js +++ b/src/common/common.js @@ -214,6 +214,7 @@ export const SAVE_KEY = [ 'isSortedPoints', 'isMultipleOf45', 'from', + 'originColor', ] export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype, fabric.Group.prototype] diff --git a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx index f7ad4d7c..44deb1a0 100644 --- a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx +++ b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx @@ -103,11 +103,11 @@ export default function CircuitTrestleSetting({ id }) { }, []) const capture = async (type) => { - beforeCapture() + beforeCapture(type) await handleCanvasToPng(type) - afterCapture() + afterCapture(type) return new Promise((resolve) => { setTimeout(() => { @@ -117,11 +117,23 @@ export default function CircuitTrestleSetting({ id }) { } // 캡쳐 전 처리 - const beforeCapture = () => { + const beforeCapture = (type) => { setCanvasZoom(100) canvas.set({ zoom: 1 }) canvas.viewportTransform = [1, 0, 0, 1, 0, 0] + const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE) + const circuitNumberTexts = canvas.getObjects().filter((obj) => obj.name === 'circuitNumber') + + if (type === 2) { + modules.forEach((module) => { + module.set({ originColor: module.fill, fill: null, strokeWidth: 2 }) + }) + circuitNumberTexts.forEach((text) => { + text.set({ visible: false }) + }) + } + canvas.renderAll() // roof polygon들의 중간점 계산 @@ -169,13 +181,27 @@ export default function CircuitTrestleSetting({ id }) { } // 캡쳐 후 처리 - const afterCapture = () => { + const afterCapture = (type) => { setCanvasZoom(100) canvas.set({ zoom: 1 }) canvas.viewportTransform = [1, 0, 0, 1, 0, 0] changeFontSize('lengthText', lengthText.fontSize.value) changeFontSize('circuitNumber', circuitNumberText.fontSize.value) changeFontSize('flowText', flowText.fontSize.value) + + const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE) + const circuitNumberTexts = canvas.getObjects().filter((obj) => obj.name === 'circuitNumber') + if (type === 2) { + modules.forEach((module) => { + module.set({ + fill: module.originColor, + strokeWidth: 0.3, + }) + }) + circuitNumberTexts.forEach((text) => { + text.set({ visible: true }) + }) + } canvas.renderAll() } From cb42ad82de80a21dd534d752a38a0a2cd6e6da6d Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Fri, 8 Aug 2025 10:57:28 +0900 Subject: [PATCH 2/3] =?UTF-8?q?innerLine=20size=20=EB=B3=B4=EC=A1=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/usePolygon.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hooks/usePolygon.js b/src/hooks/usePolygon.js index a36b0982..feea596b 100644 --- a/src/hooks/usePolygon.js +++ b/src/hooks/usePolygon.js @@ -847,7 +847,8 @@ export const usePolygon = () => { // innerLine의 type을 polygonLine의 type으로 변경 if (polygonLine.attributes?.type && innerLine.attributes) { // polygonLine.need = false - innerLine.attributes = { ...polygonLine.attributes } + innerLine.attributes.planeSize = innerLine.attributes.planeSize ?? polygonLine.attributes.planeSize + innerLine.attributes.actualSize = innerLine.attributes.actualSize ?? polygonLine.attributes.actualSize innerLine.direction = polygonLine.direction innerLine.attributes.isStart = true } From d03937cc92e48c5b10b4aec9aeac078ae2de8695 Mon Sep 17 00:00:00 2001 From: ysCha Date: Fri, 8 Aug 2025 14:51:07 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[1237]=20=EB=AA=A8=EB=93=88=EC=84=A4?= =?UTF-8?q?=EC=A0=95,=20=EA=B3=B5=EB=B2=95=EC=84=A4=EC=A0=95=EC=8B=9C?= =?UTF-8?q?=EC=97=90=20=EB=AF=B8=EB=A6=AC=20=EA=B7=9C=EC=A0=95=EC=9D=98=20?= =?UTF-8?q?=EB=82=B4=EC=9A=A9=EC=9D=B4=20=EC=9E=85=EB=A0=A5=EB=90=98?= =?UTF-8?q?=EC=96=B4=EC=9E=88=EB=8A=94=EA=B2=83=EA=B3=BC=20=EA=B0=99?= =?UTF-8?q?=EC=9D=80=20=EC=84=A4=EC=A0=95=20-=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=ED=95=98=EC=84=B8=EC=9A=94=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/floor-plan/modal/basic/step/Orientation.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/floor-plan/modal/basic/step/Orientation.jsx b/src/components/floor-plan/modal/basic/step/Orientation.jsx index d815bd2c..0b603aed 100644 --- a/src/components/floor-plan/modal/basic/step/Orientation.jsx +++ b/src/components/floor-plan/modal/basic/step/Orientation.jsx @@ -262,6 +262,12 @@ export const Orientation = forwardRef((props, ref) => { setRoofsStore(newRoofs) } + useEffect(() => { + // 컴포넌트가 마운트될 때 selectedModules가 없으면 handleChangeModule 호출 + if (moduleList.length > 0 && (!selectedModules || !selectedModules.itemId)) { + handleChangeModule(moduleList[0]); + } + }, [moduleList]); // 빈 의존성 배열로 마운트 시 한 번만 실행 return ( <>