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) => {