diff --git a/src/hooks/useMode.js b/src/hooks/useMode.js index c7f2f5b2..2d7356a4 100644 --- a/src/hooks/useMode.js +++ b/src/hooks/useMode.js @@ -123,14 +123,10 @@ export function useMode() { }, [guideLineInfo]) const drawMouseLines = (e) => { - console.log('guideLineInfo', guideLineInfo) - let isGuideLineMode = false, isGuideDotMode = false let guideDotLength, guideLineLengthHori, guideLineLengthVert, horizontalLineArray, verticalLineArray - console.log() - if (isObjectNotEmpty(guideLineInfo)) { const guideLineState = guideLineInfo.filter((item) => item.guideMode === 'guideLine') const guideDotState = guideLineInfo.filter((item) => item.guideMode === 'guideDot') @@ -4217,38 +4213,49 @@ export function useMode() { } } - //셀이 생성될 지붕의 흐름방향을 정함 - templateCenterLine.some((centerLine) => { + console.log('templateCenterLine', templateCenterLine) + + if (templateCenterLine.length > 0) { + //셀이 생성될 지붕의 흐름방향을 정함 + templateCenterLine.some((centerLine) => { + if (templateType === 2) { + trestlePolygon.set({ + referenceDirection: referenceDirection, + startIndex: parallelPoint, + }) //기준면 방향 + trestlePolygon.points.forEach((trestleLine, index) => { + if (trestleLine.x === centerLine.x1 - 12) { + trestlePolygon.set({ wallDirection: 'left' }) + return true + } else if (trestleLine.x === centerLine.x1 + 12) { + trestlePolygon.set({ wallDirection: 'right' }) + return true + } + }) + } else if (templateType === 3) { + trestlePolygon.set({ + referenceDirection: referenceDirection, + startIndex: parallelPoint, + }) //기준면 방향 + trestlePolygon.points.forEach((trestleLine, index) => { + if (trestleLine.y === centerLine.y1 - 12) { + trestlePolygon.set({ wallDirection: 'top' }) + return true + } else if (trestleLine.y === centerLine.y1 + 12) { + trestlePolygon.set({ wallDirection: 'bottom' }) + return true + } + }) + } + }) + } else { if (templateType === 2) { - trestlePolygon.set({ - referenceDirection: referenceDirection, - startIndex: parallelPoint, - }) //기준면 방향 - trestlePolygon.points.forEach((trestleLine, index) => { - if (trestleLine.x === centerLine.x1 - 12) { - trestlePolygon.set({ wallDirection: 'left' }) - return true - } else if (trestleLine.x === centerLine.x1 + 12) { - trestlePolygon.set({ wallDirection: 'right' }) - return true - } - }) + index === 0 ? trestlePolygon.set({ wallDirection: 'left' }) : trestlePolygon.set({ wallDirection: 'right' }) } else if (templateType === 3) { - trestlePolygon.set({ - referenceDirection: referenceDirection, - startIndex: parallelPoint, - }) //기준면 방향 - trestlePolygon.points.forEach((trestleLine, index) => { - if (trestleLine.y === centerLine.y1 - 12) { - trestlePolygon.set({ wallDirection: 'top' }) - return true - } else if (trestleLine.y === centerLine.y1 + 12) { - trestlePolygon.set({ wallDirection: 'bottom' }) - return true - } - }) + index === 0 ? trestlePolygon.set({ wallDirection: 'top' }) : trestlePolygon.set({ wallDirection: 'bottom' }) } - }) + trestlePolygon.set({ referenceDirection: 'none' }) + } /** * 가대 선택 이벤트