From 9f0044fe675b7556fc3af8cb7772b209eb6de281 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Wed, 4 Feb 2026 10:50:15 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B0=B0=EC=B9=98=EB=A9=B4=EC=9D=98=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20=EC=8B=A4=EC=A0=9C=20=EA=B8=B8=EC=9D=B4=20?= =?UTF-8?q?=EA=B3=84=EC=82=B0=20=EC=8B=9C=20=ED=86=B5=EC=9D=BC=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0,=20=EB=AA=A8=EB=93=88=20=EC=84=A4=EC=B9=98=20?= =?UTF-8?q?=EC=8B=9C=20=EC=98=81=EC=97=AD=20=EA=B2=80=EC=82=AC=20spare=20?= =?UTF-8?q?=EC=97=84=EA=B2=A9=ED=95=98=EA=B2=8C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/common/useTurf.js | 2 +- src/hooks/module/useModuleBasicSetting.js | 4 +- src/hooks/surface/usePlacementShapeDrawing.js | 1 + src/hooks/surface/useSurfaceShapeBatch.js | 1 + src/hooks/usePolygon.js | 45 +++++++++++-------- 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/hooks/common/useTurf.js b/src/hooks/common/useTurf.js index a9c1f202..95fa709c 100644 --- a/src/hooks/common/useTurf.js +++ b/src/hooks/common/useTurf.js @@ -8,7 +8,7 @@ export const useTurf = () => { * @param spare * @returns */ - const checkModuleDisjointSurface = (module, surface, spare = 1) => { + const checkModuleDisjointSurface = (module, surface, spare = 0) => { // 표면 영역을 spare만큼 수동 확장 const expandedSurface = { type: 'Polygon', diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 8d07b18f..c2b0398d 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -2229,7 +2229,7 @@ export function useModuleBasicSetting(tabNum) { //첫번재 모듈 설치 후 두번째 모듈을 몇개까지 설치 할 수 있는지 계산 if (installedModuleHeightCount > 0) { // moduleMaxRows = totalModuleMaxRows - installedModuleHeightCount //두번째 모듈일때 - isChidoriLine = installedModuleHeightCount % 2 != 0 ? true : false //첫번째에서 짝수에서 끝났으면 홀수는 치도리가 아님 짝수는 치도리 + isChidoriLine = installedModuleHeightCount % 2 !== 0 //첫번째에서 짝수에서 끝났으면 홀수는 치도리가 아님 짝수는 치도리 } for (let i = 0; i < calcModuleHeightCount; i++) { @@ -2249,7 +2249,7 @@ export function useModuleBasicSetting(tabNum) { widthMargin = j === 0 ? 0 : intvHor * j // 가로 마진값 chidoriLength = 0 //치도리가 아니여도 기본값을 5정도 준다 if (isChidori) { - chidoriLength = installedModuleHeightCount % 2 == 0 ? 0 : width / 2 - intvHor + chidoriLength = installedModuleHeightCount % 2 === 0 ? 0 : width / 2 - intvHor } //치도리 일때 는 짝수(1 기준) 일때만 치도리 라인으로 본다 diff --git a/src/hooks/surface/usePlacementShapeDrawing.js b/src/hooks/surface/usePlacementShapeDrawing.js index ee151307..1da292e8 100644 --- a/src/hooks/surface/usePlacementShapeDrawing.js +++ b/src/hooks/surface/usePlacementShapeDrawing.js @@ -241,6 +241,7 @@ export function usePlacementShapeDrawing(id) { originY: 'center', direction: 'south', pitch: globalPitch, + from: 'surface', }) setSurfaceShapePattern(roof, roofDisplay.column) diff --git a/src/hooks/surface/useSurfaceShapeBatch.js b/src/hooks/surface/useSurfaceShapeBatch.js index d485b719..de5534a5 100644 --- a/src/hooks/surface/useSurfaceShapeBatch.js +++ b/src/hooks/surface/useSurfaceShapeBatch.js @@ -1045,6 +1045,7 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) { newPolygon.set({ originWidth: width, originHeight: height, + from: 'surface', }) // 캔버스에 추가 diff --git a/src/hooks/usePolygon.js b/src/hooks/usePolygon.js index 9acfcfe9..9481af67 100644 --- a/src/hooks/usePolygon.js +++ b/src/hooks/usePolygon.js @@ -1950,25 +1950,32 @@ export const usePolygon = () => { return } - // createdRoofs들의 모든 lines를 확인해서 length값이 1이하인 차이가 있으면 통일 시킨다. - const allRoofs = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF) - const allRoofLines = allRoofs.flatMap((roof) => roof.lines) - for (let i = 0; i < allRoofLines.length; i++) { - for (let j = i + 1; j < allRoofLines.length; j++) { - const line1 = allRoofLines[i] - const line2 = allRoofLines[j] - const diff = Math.abs(line1.length - line2.length) - if (diff > 0 && diff <= 2) { - const maxLength = Math.max(line1.length, line2.length) - line1.setLengthByValue(maxLength * 10) - line2.setLengthByValue(maxLength * 10) - // attributes도 통일 - const maxPlaneSize = Math.max(line1.attributes.planeSize || 0, line2.attributes.planeSize || 0) - const maxActualSize = Math.max(line1.attributes.actualSize || 0, line2.attributes.actualSize || 0) - line1.attributes.planeSize = maxPlaneSize - line1.attributes.actualSize = maxActualSize - line2.attributes.planeSize = maxPlaneSize - line2.attributes.actualSize = maxActualSize + // 배치면으로 그린 내용은 업데이트를 해준다. + if (polygon.from === 'surface') { + forceUpdate = true + } + + if (polygon.from !== 'surface') { + // createdRoofs들의 모든 lines를 확인해서 length값이 1이하인 차이가 있으면 통일 시킨다. + const allRoofs = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF) + const allRoofLines = allRoofs.flatMap((roof) => roof.lines) + for (let i = 0; i < allRoofLines.length; i++) { + for (let j = i + 1; j < allRoofLines.length; j++) { + const line1 = allRoofLines[i] + const line2 = allRoofLines[j] + const diff = Math.abs(line1.length - line2.length) + if (diff > 0 && diff <= 2) { + const maxLength = Math.max(line1.length, line2.length) + line1.setLengthByValue(maxLength * 10) + line2.setLengthByValue(maxLength * 10) + // attributes도 통일 + const maxPlaneSize = Math.max(line1.attributes.planeSize || 0, line2.attributes.planeSize || 0) + const maxActualSize = Math.max(line1.attributes.actualSize || 0, line2.attributes.actualSize || 0) + line1.attributes.planeSize = maxPlaneSize + line1.attributes.actualSize = maxActualSize + line2.attributes.planeSize = maxPlaneSize + line2.attributes.actualSize = maxActualSize + } } } }