지붕면 할당 시 index 추가
This commit is contained in:
parent
afa3e367b2
commit
d7b179638b
@ -108,15 +108,18 @@ export function useRoofAllocationSetting(id) {
|
|||||||
|
|
||||||
// 지붕재 오른쪽 마우스 클릭 후 단일로 지붕재 변경 필요한 경우
|
// 지붕재 오른쪽 마우스 클릭 후 단일로 지붕재 변경 필요한 경우
|
||||||
const handleSaveContext = () => {
|
const handleSaveContext = () => {
|
||||||
|
const newRoofList = currentRoofList.map((roof, idx) => {
|
||||||
|
return { ...roof, index: idx }
|
||||||
|
})
|
||||||
setBasicSetting((prev) => {
|
setBasicSetting((prev) => {
|
||||||
return {
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
selectedRoofMaterial: currentRoofList.find((roof) => roof.selected),
|
selectedRoofMaterial: newRoofList.find((roof) => roof.selected),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
setRoofList(currentRoofList)
|
setRoofList(newRoofList)
|
||||||
const selectedRoofMaterial = currentRoofList.find((roof) => roof.selected)
|
const selectedRoofMaterial = newRoofList.find((roof) => roof.selected)
|
||||||
setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial)
|
setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial)
|
||||||
closeAll()
|
closeAll()
|
||||||
}
|
}
|
||||||
@ -180,14 +183,18 @@ export function useRoofAllocationSetting(id) {
|
|||||||
canvas.remove(wallLine)
|
canvas.remove(wallLine)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const newRoofList = currentRoofList.map((roof, idx) => {
|
||||||
|
return { ...roof, index: idx }
|
||||||
|
})
|
||||||
|
|
||||||
setBasicSetting((prev) => {
|
setBasicSetting((prev) => {
|
||||||
return {
|
return {
|
||||||
...prev,
|
...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')
|
const roofs = canvas.getObjects().filter((obj) => obj.name === 'roof')
|
||||||
|
|
||||||
|
|||||||
@ -224,9 +224,7 @@ export const roofMaterialsAtom = atom({
|
|||||||
export const selectedRoofMaterialSelector = selector({
|
export const selectedRoofMaterialSelector = selector({
|
||||||
key: 'selectedRoofMaterialSelector',
|
key: 'selectedRoofMaterialSelector',
|
||||||
get: ({ get }) => {
|
get: ({ get }) => {
|
||||||
const addedRoofs = get(addedRoofsState)
|
return get(basicSettingState).selectedRoofMaterial
|
||||||
|
|
||||||
return addedRoofs.find((roof) => roof.selected)
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user