From 10f77a4acdea7df168ecfb5672a72caf5c492594 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Wed, 5 Feb 2025 10:08:26 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B3=B5=EC=8B=9C=EB=8F=84=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=EC=9D=B4=20=EC=95=84=EB=8B=8C=20=EA=B2=BD=EC=9A=B0?= =?UTF-8?q?=EB=8A=94=20=EA=B0=81=EB=8F=84=20=EA=B3=84=EC=82=B0=20=ED=95=84?= =?UTF-8?q?=EC=9A=94=20x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useTrestle.js | 14 +++++++++++++- src/util/canvas-util.js | 5 ----- 2 files changed, 13 insertions(+), 6 deletions(-) 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) -}