From a4ae33d66fbd65267a96f470c73b5b48c32e6997 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, 26 Feb 2025 14:11:46 +0900 Subject: [PATCH 1/3] =?UTF-8?q?-=20=EA=B2=AC=EC=A0=81=EC=84=9C,=20?= =?UTF-8?q?=EC=8B=9C=EB=AE=AC=EB=A0=88=EC=9D=B4=EC=85=98=20=EB=A9=94?= =?UTF-8?q?=EB=89=B4=EC=97=90=EC=84=9C=EB=8A=94=20=EB=AA=A8=EB=AE=AC=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=EB=A9=94=EB=89=B4=20=EC=A0=9C=EC=99=B8?= =?UTF-8?q?=ED=95=9C=20=EB=A9=94=EB=89=B4=EB=A1=9C=20=EC=9D=B4=EB=8F=99=20?= =?UTF-8?q?=EB=B6=88=EA=B0=80=ED=95=98=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/floor-plan/CanvasMenu.jsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/floor-plan/CanvasMenu.jsx b/src/components/floor-plan/CanvasMenu.jsx index e94c1ff2..9c2db6bd 100644 --- a/src/components/floor-plan/CanvasMenu.jsx +++ b/src/components/floor-plan/CanvasMenu.jsx @@ -409,7 +409,8 @@ export default function CanvasMenu(props) { return ( (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.type === 'outline') || (selectedMenu === 'module' && ['drawing', 'placement'].includes(menu.type)) || - (isExistModule() && ['placement', 'outline'].some((num) => num === menu.type)) + (isExistModule() && ['placement', 'outline'].some((num) => num === menu.type)) || + (['estimate', 'simulation'].includes(selectedMenu) && ['drawing', 'placement', 'outline', 'surface'].includes(menu.type)) ) } @@ -533,9 +534,7 @@ export default function CanvasMenu(props) { key={`canvas-menu-${menu.type}`} className={`canvas-menu-item ${selectedMenu === menu.type ? 'active' : ''}`} onClick={async () => { - if (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.type === 'outline') return - if (selectedMenu === 'module' && ['drawing', 'placement'].includes(menu.type)) return - if (isExistModule() && ['placement', 'outline'].some((num) => num === menu.type)) return + if (checkMenuState(menu)) return await onClickNav(menu) }} > From e03823b15320c06d988a2650d74a82edf011e636 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, 26 Feb 2025 14:11:57 +0900 Subject: [PATCH 2/3] =?UTF-8?q?-=20=EC=B9=98=EC=88=98=EC=84=A0=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dimensionLine/DimensionLineSetting.jsx | 98 +++++++++++++------ 1 file changed, 69 insertions(+), 29 deletions(-) diff --git a/src/components/floor-plan/modal/dimensionLine/DimensionLineSetting.jsx b/src/components/floor-plan/modal/dimensionLine/DimensionLineSetting.jsx index 9e2ce27b..81395b31 100644 --- a/src/components/floor-plan/modal/dimensionLine/DimensionLineSetting.jsx +++ b/src/components/floor-plan/modal/dimensionLine/DimensionLineSetting.jsx @@ -7,6 +7,9 @@ import { contextPopupPositionState } from '@/store/popupAtom' import QSelectBox from '@/components/common/select/QSelectBox' 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' export default function DimensionLineSetting(props) { const contextPopupPosition = useRecoilValue(contextPopupPositionState) @@ -18,7 +21,11 @@ export default function DimensionLineSetting(props) { const SelectOption01 = defaultSlope const [basicLength, setBasicLength] = useState(0) const [slopeAble, setSlopeAble] = useState(false) + const basicSetting = useRecoilValue(basicSettingState) const changeSlopeRef = useRef() + const [options, setOptions] = useState([]) + const [selectedSlope1, setSelectedSlope1] = useState(null) + const [selectedSlope2, setSelectedSlope2] = useState(null) let slopeInput1, slopeInput2 @@ -26,10 +33,30 @@ export default function DimensionLineSetting(props) { if (canvas) { const dimensionObject = canvas.getActiveObject() const id = dimensionObject.groupId - const textObj = dimensionObject._objects.filter((obj) => obj.name === 'dimensionLineText' && obj.id === id)[0] + const textObj = dimensionObject._objects.filter((obj) => obj.name === 'dimensionLineText' && obj.group.groupId === id)[0] + if (!textObj) return setBasicLength(parseInt(textObj.text)) } + if (basicSetting.roofAngleSet === 'slope') { + setOptions( + Array.from({ length: 21 }).map((_, index) => { + return { + name: index * 0.5, + value: index * 0.5, + } + }), + ) + } else { + setOptions( + Array.from({ length: 7 }).map((_, index) => { + return { + name: index * 5, + value: index * 5, + } + }), + ) + } return () => { setBasicLength(0) } @@ -41,45 +68,40 @@ export default function DimensionLineSetting(props) { if (canvas) { const dimensionObject = canvas.getActiveObject() const id = dimensionObject.groupId - const textObj = dimensionObject._objects.filter((obj) => obj.name === 'dimensionLineText' && obj.id === id)[0] + const textObj = dimensionObject._objects.filter((obj) => obj.name === 'dimensionLineText' && obj.group.groupId === id)[0] let resultText = changeLength.value > 0 ? changeLength.value : '0' if (slopeAble) { - if (slopeInput1) { - resultText = calculateLength(basicLength, slopeInput1.angleValue).toFixed(0) - - if (slopeInput2) { - const length = calculateLength(basicLength, slopeInput1.angleValue, slopeInput2.angleValue) - resultText = length.toFixed(0) - } - } + resultText = !selectedSlope2 + ? calculateLength(basicLength, selectedSlope1.value).toFixed(0) + : calculateLength(basicLength, selectedSlope1.value, selectedSlope2.value).toFixed(0) } textObj.set({ text: String(resultText), }) + setBasicLength(resultText) canvas.renderAll() } } - const handleSelectbox = (option, params) => { - const index = params.index - if (index === 1) slopeInput1 = option - if (index === 2) slopeInput2 = option - } - - function calculateLength(originalLength, angle) { - const angleInRadians = angle * (Math.PI / 180) - const result = Math.sqrt(Math.pow(originalLength * Math.tan(angleInRadians), 2) + Math.pow(originalLength, 2)) - return result - } - - function calculateLength(originalLength, angle1, angle2) { - const numerator = Math.sqrt(Math.pow(angle1, 2) + 100 + Math.pow((10 * angle1) / angle2, 2)) * originalLength - const denominator = Math.sqrt(Math.pow((10 * angle1) / angle2, 2) + 100) - const result = numerator / denominator - return result + function calculateLength(originalLength, angle, angle1) { + console.log(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) + return result + } else { + 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 + console.log('2222222222222222') + return result + } } return ( @@ -123,14 +145,32 @@ export default function DimensionLineSetting(props) {
{getMessage('slope')}
- + setSelectedSlope1(e)} + showKey={'name'} + sourceKey={'value'} + targetKey={'value'} + />
{pitchText}
{getMessage('slope')}
- + setSelectedSlope2(e)} + showKey={'name'} + sourceKey={'value'} + targetKey={'value'} + />
{pitchText}
From 94896b983727b3c85e1b1604c7271b1ace22c19c 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, 26 Feb 2025 14:13:18 +0900 Subject: [PATCH 3/3] =?UTF-8?q?-=20=EB=B3=B4=EC=A1=B0=EC=84=A0=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/roofcover/useAuxiliaryDrawing.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/roofcover/useAuxiliaryDrawing.js b/src/hooks/roofcover/useAuxiliaryDrawing.js index 7cacdd03..dd5a2a49 100644 --- a/src/hooks/roofcover/useAuxiliaryDrawing.js +++ b/src/hooks/roofcover/useAuxiliaryDrawing.js @@ -129,6 +129,7 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) { const copy = (object, x, y) => { return addLine([object.x1 + x, object.y1 + y, object.x2 + x, object.y2 + y], { + attributes: object.attributes, stroke: 'red', strokeWidth: 1, selectable: true,