feature/ysCha #23
@ -16,12 +16,13 @@ import { usePopup } from '@/hooks/usePopup'
|
||||
import { useState } from 'react'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { useSurfaceShapeBatch } from '@/hooks/surface/useSurfaceShapeBatch'
|
||||
import { useRecoilValue } from 'recoil'
|
||||
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||
import { canvasState, currentMenuState } from '@/store/canvasAtom'
|
||||
import { MENU } from '@/common/common'
|
||||
import { useTrestle } from '@/hooks/module/useTrestle'
|
||||
import { usePolygon } from '@/hooks/usePolygon'
|
||||
import { useOrientation } from '@/hooks/module/useOrientation'
|
||||
import { settingModalFirstOptionsState } from '@/store/settingAtom'
|
||||
|
||||
/**
|
||||
* 메뉴 처리 훅
|
||||
@ -36,8 +37,22 @@ export default function useMenu() {
|
||||
const { deleteAllSurfacesAndObjects } = useSurfaceShapeBatch({})
|
||||
const { clear: trestleClear, setAllModuleSurfaceIsComplete } = useTrestle()
|
||||
const { nextStep } = useOrientation()
|
||||
const [settingModalFirstOptions, setSettingModalFirstOptions] = useRecoilState(settingModalFirstOptionsState)
|
||||
const handleMenu = (type) => {
|
||||
if (type === 'outline') {
|
||||
// 지붕 덮개 메뉴의 경우는 복도치수로 적용한다.
|
||||
setSettingModalFirstOptions((prev) => {
|
||||
return {
|
||||
...prev,
|
||||
dimensionDisplay: prev.dimensionDisplay.map((item, index) => {
|
||||
if (index === 0) {
|
||||
return { ...item, selected: true }
|
||||
} else {
|
||||
return { ...item, selected: false }
|
||||
}
|
||||
}),
|
||||
}
|
||||
})
|
||||
switch (currentMenu) {
|
||||
case MENU.ROOF_COVERING.EXTERIOR_WALL_LINE:
|
||||
addPopup(popupId, 1, <WallLineSetting id={popupId} />)
|
||||
@ -67,6 +82,19 @@ export default function useMenu() {
|
||||
}
|
||||
|
||||
if (type === 'surface') {
|
||||
// 배치면 메뉴의 경우는 실치수로 적용한다.
|
||||
setSettingModalFirstOptions((prev) => {
|
||||
return {
|
||||
...prev,
|
||||
dimensionDisplay: prev.dimensionDisplay.map((item, index) => {
|
||||
if (index === 1) {
|
||||
return { ...item, selected: true }
|
||||
} else {
|
||||
return { ...item, selected: false }
|
||||
}
|
||||
}),
|
||||
}
|
||||
})
|
||||
switch (currentMenu) {
|
||||
// case MENU.BATCH_CANVAS.SLOPE_SETTING:
|
||||
// addPopup(popupId, 1, <Slope id={popupId} />)
|
||||
@ -87,6 +115,19 @@ export default function useMenu() {
|
||||
}
|
||||
|
||||
if (type === 'module') {
|
||||
// 모듈,회로 구성 메뉴의 경우는 실치수로 적용한다.
|
||||
setSettingModalFirstOptions((prev) => {
|
||||
return {
|
||||
...prev,
|
||||
dimensionDisplay: prev.dimensionDisplay.map((item, index) => {
|
||||
if (index === 1) {
|
||||
return { ...item, selected: true }
|
||||
} else {
|
||||
return { ...item, selected: false }
|
||||
}
|
||||
}),
|
||||
}
|
||||
})
|
||||
switch (currentMenu) {
|
||||
case MENU.MODULE_CIRCUIT_SETTING.BASIC_SETTING:
|
||||
trestleClear()
|
||||
|
||||
@ -11,6 +11,7 @@ import {
|
||||
roofDisplaySelector,
|
||||
roofMaterialsSelector,
|
||||
selectedRoofMaterialSelector,
|
||||
settingModalFirstOptionsState,
|
||||
} from '@/store/settingAtom'
|
||||
import { usePopup } from '@/hooks/usePopup'
|
||||
import { POLYGON_TYPE } from '@/common/common'
|
||||
@ -58,6 +59,7 @@ export function useRoofAllocationSetting(id) {
|
||||
const [roofsStore, setRoofsStore] = useRecoilState(roofsState)
|
||||
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
|
||||
const resetPoints = useResetRecoilState(outerLinePointsState)
|
||||
const [settingModalFirstOptions, setSettingModalFirstOptions] = useRecoilState(settingModalFirstOptionsState)
|
||||
|
||||
useEffect(() => {
|
||||
/** 배치면 초기설정에서 선택한 지붕재 배열 설정 */
|
||||
@ -433,6 +435,19 @@ export function useRoofAllocationSetting(id) {
|
||||
setEditingLines([])
|
||||
closeAll()
|
||||
setSelectedMenu('surface')
|
||||
//지붕면 완성 후 실측치 로 보이도록 수정
|
||||
setSettingModalFirstOptions((prev) => {
|
||||
return {
|
||||
...prev,
|
||||
dimensionDisplay: prev.dimensionDisplay.map((item, index) => {
|
||||
if (index === 1) {
|
||||
return { ...item, selected: true }
|
||||
} else {
|
||||
return { ...item, selected: false }
|
||||
}
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
/** 모듈 선택 데이터 초기화 */
|
||||
// modifyModuleSelectionData()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user