From 79d873c135a9bae5105cc7cb1e10a1b4543382a8 Mon Sep 17 00:00:00 2001 From: yjnoh Date: Thu, 20 Mar 2025 16:00:02 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=84=EC=A7=9C=20=EC=B2=98=EB=A7=88?= =?UTF-8?q?=EB=A9=B4=EC=9D=B8=EC=A7=80=20=ED=99=95=EC=9D=B8=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/surface/useSurfaceShapeBatch.js | 30 +++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/hooks/surface/useSurfaceShapeBatch.js b/src/hooks/surface/useSurfaceShapeBatch.js index 52c35b02..4658e75a 100644 --- a/src/hooks/surface/useSurfaceShapeBatch.js +++ b/src/hooks/surface/useSurfaceShapeBatch.js @@ -1069,6 +1069,11 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) { canvas?.renderAll() } + /** + * 면형상 작도시 라인 속성 넣는 로직 + * + * @param { } polygon + */ const changeSurfaceLineType = (polygon) => { polygon.lines.forEach((line) => { line.attributes.type = LINE_TYPE.WALLLINE.GABLE @@ -1103,8 +1108,6 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) { (polygon.direction === 'south' || polygon.direction === 'east' ? a : b)[coord1], )[0] - console.log(maxLine) - if (maxLine) { if ( (polygon.direction === 'south' && maxLine.direction === 'left') || @@ -1121,6 +1124,29 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) { }) } } + + /** + * 진짜 처마 라인인지 확인하는 로직 -> 특정 모양에 따라 처마가 없는 경우가 있는데 위에 로직으로는 + * 용마루도 처마로 만들어서 재보정 + */ + const maxLineCoord = polygon.lines.sort( + (a, b) => + (polygon.direction === 'south' || polygon.direction === 'east' ? b : a)[coord1] - + (polygon.direction === 'south' || polygon.direction === 'east' ? a : b)[coord1], + )[0] + + const isRealEavesLine = polygon.lines.find((line) => line.attributes.type === LINE_TYPE.WALLLINE.EAVES) + if (isRealEavesLine) { + if (polygon.direction === 'south' || polygon.direction === 'north') { + if (maxLineCoord.y1 !== isRealEavesLine.y1) { + isRealEavesLine.attributes.type = LINE_TYPE.SUBLINE.RIDGE + } + } else if (polygon.direction === 'east' || polygon.direction === 'west') { + if (maxLineCoord.x1 !== isRealEavesLine.x1) { + isRealEavesLine.attributes.type = LINE_TYPE.SUBLINE.RIDGE + } + } + } } const updateFlippedPoints = (polygon) => {