pitch, angle 추가

This commit is contained in:
hyojun.choi 2025-01-10 13:40:24 +09:00
parent 7b2e7fd362
commit f0e6056e32
3 changed files with 7 additions and 4 deletions

View File

@ -121,7 +121,7 @@ export default function RoofAllocationSetting(props) {
onChange={(e) => {
handleChangeInput(e, 'pitch', index)
}}
defaultValue={currentAngleType === 'slope' ? roof.pitch : getDegreeByChon(roof.pitch)}
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
/>
</div>
<span>{pitchText}</span>

View File

@ -135,7 +135,8 @@ export function useCanvasSetting() {
raft: item.raftBase && parseInt(item.raftBase),
layout: ['ROOF_ID_SLATE', 'ROOF_ID_SINGLE'].includes(item.roofMatlCd) ? ROOF_MATERIAL_LAYOUT.STAIRS : ROOF_MATERIAL_LAYOUT.PARALLEL,
hajebichi: item.roofPchBase && parseInt(item.roofPchBase),
pitch: item.pitch && parseInt(item.pitch),
pitch: item.pitch ? parseInt(item.pitch) : 4,
angle: item.angle ? parseInt(item.angle) : 21.8,
}))
setRoofMaterials(roofLists)
const selectedRoofMaterial = roofLists[0]

View File

@ -23,7 +23,7 @@ import { menuTypeState } from '@/store/menuAtom'
import { useRoofFn } from '@/hooks/common/useRoofFn'
import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
import { globalLocaleStore } from '@/store/localeAtom'
import { getChonByDegree } from '@/util/canvas-util'
import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util'
// 지붕면 할당
export function useRoofAllocationSetting(id) {
@ -473,7 +473,9 @@ export function useRoofAllocationSetting(id) {
const value = e.target.value
const newRoofList = currentRoofList.map((roof, idx) => {
if (idx === index) {
return { ...roof, pitch: value }
const result =
currentAngleType === 'slope' ? { pitch: value, angle: getDegreeByChon(value) } : { pitch: getChonByDegree(value), angle: value }
return { ...roof, ...result }
}
return roof
})