지붕면 할당 시 index 추가

This commit is contained in:
hyojun.choi 2025-01-07 10:05:34 +09:00
parent afa3e367b2
commit d7b179638b
2 changed files with 13 additions and 8 deletions

View File

@ -108,15 +108,18 @@ export function useRoofAllocationSetting(id) {
// 지붕재 오른쪽 마우스 클릭 후 단일로 지붕재 변경 필요한 경우
const handleSaveContext = () => {
const newRoofList = currentRoofList.map((roof, idx) => {
return { ...roof, index: idx }
})
setBasicSetting((prev) => {
return {
...prev,
selectedRoofMaterial: currentRoofList.find((roof) => roof.selected),
selectedRoofMaterial: newRoofList.find((roof) => roof.selected),
}
})
setRoofList(currentRoofList)
const selectedRoofMaterial = currentRoofList.find((roof) => roof.selected)
setRoofList(newRoofList)
const selectedRoofMaterial = newRoofList.find((roof) => roof.selected)
setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial)
closeAll()
}
@ -180,14 +183,18 @@ export function useRoofAllocationSetting(id) {
canvas.remove(wallLine)
})
const newRoofList = currentRoofList.map((roof, idx) => {
return { ...roof, index: idx }
})
setBasicSetting((prev) => {
return {
...prev,
selectedRoofMaterial: currentRoofList.find((roof) => roof.selected),
selectedRoofMaterial: newRoofList.find((roof) => roof.selected),
}
})
setRoofList(currentRoofList)
setRoofList(newRoofList)
const roofs = canvas.getObjects().filter((obj) => obj.name === 'roof')

View File

@ -224,9 +224,7 @@ export const roofMaterialsAtom = atom({
export const selectedRoofMaterialSelector = selector({
key: 'selectedRoofMaterialSelector',
get: ({ get }) => {
const addedRoofs = get(addedRoofsState)
return addedRoofs.find((roof) => roof.selected)
return get(basicSettingState).selectedRoofMaterial
},
})