diff --git a/src/components/floor-plan/CanvasFrame.jsx b/src/components/floor-plan/CanvasFrame.jsx index 0b806d0c..09fdd89c 100644 --- a/src/components/floor-plan/CanvasFrame.jsx +++ b/src/components/floor-plan/CanvasFrame.jsx @@ -76,8 +76,12 @@ export default function CanvasFrame() { } initEvent() }) + } else { + setSelectedMenu(null) } Object.keys(currentCanvasPlan).length > 0 && canvas && handleModuleSelectionTotal() + } else { + setSelectedMenu(null) } gridInit() } diff --git a/src/hooks/usePlan.js b/src/hooks/usePlan.js index 15783727..d8e1c9d6 100644 --- a/src/hooks/usePlan.js +++ b/src/hooks/usePlan.js @@ -3,9 +3,17 @@ import { useContext, useEffect, useState } from 'react' import { usePathname, useRouter } from 'next/navigation' -import { useRecoilState, useResetRecoilState } from 'recoil' +import { useRecoilState, useResetRecoilState, useSetRecoilState } from 'recoil' -import { canvasState, currentCanvasPlanState, plansState, canvasSettingState, currentObjectState, moduleSetupSurfaceState } from '@/store/canvasAtom' +import { + canvasState, + currentCanvasPlanState, + plansState, + canvasSettingState, + currentObjectState, + moduleSetupSurfaceState, + currentMenuState, +} from '@/store/canvasAtom' import { useAxios } from '@/hooks/useAxios' import { useMessage } from '@/hooks/useMessage' import { useSwal } from '@/hooks/useSwal' @@ -33,7 +41,7 @@ export function usePlan(params = {}) { const { floorPlanState } = useContext(FloorPlanContext) const [selectedPlan, setSelectedPlan] = useState(null) - + const setCurrentMenu = useSetRecoilState(currentMenuState) const [canvas, setCanvas] = useRecoilState(canvasState) const [currentCanvasPlan, setCurrentCanvasPlan] = useRecoilState(currentCanvasPlanState) @@ -577,8 +585,10 @@ export function usePlan(params = {}) { * plan canvasStatus 초기화 */ const resetCanvasStatus = () => { - setCurrentCanvasPlan((prev) => ({ ...prev, canvasStatus: null })) + setCurrentCanvasPlan((prev) => ({ ...prev, canvasStatus: null, objectNo: null, planNo: null, id: null })) setPlans((plans) => plans.map((plan) => ({ ...plan, canvasStatus: null }))) + setCurrentMenu(null) + setSelectedMenu(null) } /**