보조선 지붕재 할당 시 로직 수정
This commit is contained in:
parent
6dc2b8a037
commit
079f3a7ff2
@ -1,28 +1,25 @@
|
||||
import { useRecoilState, useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'
|
||||
import { canvasState, currentAngleTypeSelector, currentMenuState, currentObjectState } from '@/store/canvasAtom'
|
||||
import { useContext, useEffect, useRef, useState } from 'react'
|
||||
import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil'
|
||||
import { canvasState, currentAngleTypeSelector, currentObjectState } from '@/store/canvasAtom'
|
||||
import { useContext, useEffect, useState } from 'react'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { useSwal } from '@/hooks/useSwal'
|
||||
import { usePolygon } from '@/hooks/usePolygon'
|
||||
import {
|
||||
correntObjectNoState,
|
||||
addedRoofsState,
|
||||
basicSettingState,
|
||||
correntObjectNoState,
|
||||
corridorDimensionSelector,
|
||||
roofDisplaySelector,
|
||||
roofMaterialsSelector,
|
||||
selectedRoofMaterialSelector,
|
||||
settingModalFirstOptionsState,
|
||||
corridorDimensionSelector,
|
||||
} from '@/store/settingAtom'
|
||||
import { usePopup } from '@/hooks/usePopup'
|
||||
import { POLYGON_TYPE } from '@/common/common'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import ActualSizeSetting from '@/components/floor-plan/modal/roofAllocation/ActualSizeSetting'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import useMenu from '@/hooks/common/useMenu'
|
||||
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
|
||||
import { useRoofFn } from '@/hooks/common/useRoofFn'
|
||||
import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
|
||||
import { globalLocaleStore } from '@/store/localeAtom'
|
||||
import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util'
|
||||
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||
@ -44,8 +41,10 @@ export function useRoofAllocationSetting(id) {
|
||||
const roofMaterials = useRecoilValue(roofMaterialsSelector)
|
||||
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector)
|
||||
const [basicSetting, setBasicSetting] = useRecoilState(basicSettingState)
|
||||
const [currentRoofMaterial, setCurrentRoofMaterial] = useState(roofMaterials[0]) /** 팝업 내 기준 지붕재 */
|
||||
const [roofList, setRoofList] = useRecoilState(addedRoofsState) /** 배치면 초기설정에서 선택한 지붕재 배열 */
|
||||
const [currentRoofMaterial, setCurrentRoofMaterial] = useState(roofMaterials[0])
|
||||
/** 팝업 내 기준 지붕재 */
|
||||
const [roofList, setRoofList] = useRecoilState(addedRoofsState)
|
||||
/** 배치면 초기설정에서 선택한 지붕재 배열 */
|
||||
const [editingLines, setEditingLines] = useState([])
|
||||
const [currentRoofList, setCurrentRoofList] = useState([])
|
||||
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
|
||||
@ -178,7 +177,11 @@ export function useRoofAllocationSetting(id) {
|
||||
selectedRoofMaterial: selectRoofs.find((roof) => roof.selected),
|
||||
})
|
||||
|
||||
setBasicInfo({ planNo: '' + res[0].planNo, roofSizeSet: '' + res[0].roofSizeSet, roofAngleSet: '' + res[0].roofAngleSet })
|
||||
setBasicInfo({
|
||||
planNo: '' + res[0].planNo,
|
||||
roofSizeSet: '' + res[0].roofSizeSet,
|
||||
roofAngleSet: '' + res[0].roofAngleSet,
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Data fetching error:', error)
|
||||
@ -339,11 +342,18 @@ export function useRoofAllocationSetting(id) {
|
||||
* 지붕면 할당
|
||||
*/
|
||||
const handleAlloc = () => {
|
||||
if (!checkInnerLines()) {
|
||||
apply()
|
||||
} else {
|
||||
swalFire({ type: 'alert', icon: 'error', text: getMessage('modal.roof.allocation.auxiliary.size.form') })
|
||||
const roofBases = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF) // roofPolygon.innerLines
|
||||
roofBases.forEach((roof) => {
|
||||
if (roof.separatePolygon.length === 0) {
|
||||
roof.innerLines.forEach((line) => {
|
||||
if ((!line.attributes.actualSize || line.attributes?.actualSize === 0) && line.length > 1) {
|
||||
line.set({ attributes: { ...line.attributes, actualSize: line.attributes.planeSize } })
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
apply()
|
||||
}
|
||||
|
||||
/**
|
||||
@ -546,7 +556,12 @@ export function useRoofAllocationSetting(id) {
|
||||
const newRoofList = currentRoofList.map((roof, idx) => {
|
||||
if (idx === index) {
|
||||
const result =
|
||||
currentAngleType === 'slope' ? { pitch: value, angle: getDegreeByChon(value) } : { pitch: getChonByDegree(value), angle: value }
|
||||
currentAngleType === 'slope'
|
||||
? {
|
||||
pitch: value,
|
||||
angle: getDegreeByChon(value),
|
||||
}
|
||||
: { pitch: getChonByDegree(value), angle: value }
|
||||
return { ...roof, ...result }
|
||||
}
|
||||
return roof
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user