diff --git a/src/hooks/module/useTrestle.js b/src/hooks/module/useTrestle.js index 9c580971..fffe27c9 100644 --- a/src/hooks/module/useTrestle.js +++ b/src/hooks/module/useTrestle.js @@ -2,9 +2,10 @@ import { useRecoilValue } from 'recoil' import { canvasState, currentAngleTypeSelector } from '@/store/canvasAtom' import { POLYGON_TYPE } from '@/common/common' import { moduleSelectionDataState } from '@/store/selectedModuleOptions' -import { getDegreeByChon, getTrestleLength } from '@/util/canvas-util' +import { getDegreeByChon } from '@/util/canvas-util' import { v4 as uuidv4 } from 'uuid' import { useMasterController } from '@/hooks/common/useMasterController' +import { basicSettingState } from '@/store/settingAtom' // 회로 및 가대설정 export const useTrestle = () => { @@ -12,6 +13,7 @@ export const useTrestle = () => { const moduleSelectionData = useRecoilValue(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터 const { getQuotationItem } = useMasterController() const currentAngleType = useRecoilValue(currentAngleTypeSelector) + const roofSizeSet = useRecoilValue(basicSettingState).roofSizeSet const apply = () => { try { @@ -1787,6 +1789,16 @@ export const useTrestle = () => { return groups } + // 각도에 따른 길이 반환 + function getTrestleLength(length, degree) { + if (roofSizeSet !== 1) { + // 복시도 입력이 아닌경우 그냥 길이 return + return length + } + const radians = (degree * Math.PI) / 180 + return length * Math.cos(radians) + } + // 견적서 아이템 조회 api parameter 생성 const getTrestleParams = (surface) => { const result = calculateForApi(surface) diff --git a/src/util/canvas-util.js b/src/util/canvas-util.js index 2204eaec..a0442d9f 100644 --- a/src/util/canvas-util.js +++ b/src/util/canvas-util.js @@ -1031,8 +1031,3 @@ export function calculateVisibleModuleHeight(sourceWidth, sourceHeight, angle, d height: Number(visibleHeight.toFixed(1)), // 소수점 두 자리로 고정 } } - -export function getTrestleLength(length, degree) { - const radians = (degree * Math.PI) / 180 - return length * Math.cos(radians) -}