clear selection when switching to build mode

This commit is contained in:
wass08
2026-02-12 10:50:02 +09:00
parent cfa7b8bfc1
commit 83cd28b01b
+16 -2
View File
@@ -1,9 +1,15 @@
'use client'
import { type BuildingNode, type ItemNode, type LevelNode, type Space, useScene } from '@pascal-app/core'
import type { AssetInput } from '@pascal-app/core'
import {
type BuildingNode,
type ItemNode,
type LevelNode,
type Space,
useScene,
} from '@pascal-app/core'
import { useViewer } from '@pascal-app/viewer'
import { create } from 'zustand'
import type { AssetInput } from '@pascal-app/core'
export type Phase = 'site' | 'structure' | 'furnish'
@@ -139,6 +145,14 @@ const useEditor = create<EditorState>()((set, get) => ({
const { phase, structureLayer, tool } = get()
if (mode === 'build') {
// Clear selection when entering build mode
const viewer = useViewer.getState()
viewer.setSelection({
selectedIds: [],
zoneId: null,
})
}
// When entering build mode in structure phase with zones layer, activate zone tool
if (mode === 'build' && phase === 'structure' && structureLayer === 'zones') {
set({ tool: 'zone' })