From 6a18c93fbcd5dc0f5b6cb9359b907ff40815c534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AF=BC=EC=8B=9D?= <43837214+Minsiki@users.noreply.github.com> Date: Wed, 5 Mar 2025 14:14:55 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B9=98=EC=88=98=EC=84=A0=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EA=B3=84=EC=82=B0=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modal/dimensionLine/DimensionLineSetting.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/floor-plan/modal/dimensionLine/DimensionLineSetting.jsx b/src/components/floor-plan/modal/dimensionLine/DimensionLineSetting.jsx index e08bc839..e4807c36 100644 --- a/src/components/floor-plan/modal/dimensionLine/DimensionLineSetting.jsx +++ b/src/components/floor-plan/modal/dimensionLine/DimensionLineSetting.jsx @@ -9,7 +9,7 @@ import { canvasState, pitchTextSelector } from '@/store/canvasAtom' import { defaultSlope } from '@/store/commonAtom' import { re } from 'mathjs' import { basicSettingState } from '@/store/settingAtom' -import { getChonByDegree } from '@/util/canvas-util' +import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util' export default function DimensionLineSetting(props) { const contextPopupPosition = useRecoilValue(contextPopupPositionState) @@ -106,14 +106,14 @@ export default function DimensionLineSetting(props) { } const calculateLength = (originalLength, angle, angle1) => { - const slope1 = basicSetting.roofAngleSet !== 'slope' ? getChonByDegree(angle) : angle - const slope2 = basicSetting.roofAngleSet !== 'slope' ? getChonByDegree(angle1 ?? 0) : angle1 if (!angle1) { - const angleInRadians = slope1 * (Math.PI / 180) - const result = Math.sqrt(Math.pow(originalLength * Math.tan(angleInRadians), 2) + Math.pow(originalLength, 2)) - console.log(angleInRadians, result) + const slope1 = basicSetting.roofAngleSet !== 'slope' ? getDegreeByChon(angle) : angle + const result = Math.sqrt(Math.pow(originalLength * Math.tan((getDegreeByChon(slope1) * Math.PI) / 180), 2) + Math.pow(originalLength, 2)) + console.log(result) return result } else { + const slope1 = basicSetting.roofAngleSet !== 'slope' ? getChonByDegree(angle) : angle + const slope2 = basicSetting.roofAngleSet !== 'slope' ? getChonByDegree(angle1 ?? 0) : angle1 const numerator = Math.sqrt(Math.pow(slope1, 2) + 100 + Math.pow((10 * slope1) / slope2, 2)) * originalLength const denominator = Math.sqrt(Math.pow((10 * slope1) / slope2, 2) + 100) const result = numerator / denominator