hover / selection viewer logic

This commit is contained in:
wass08
2026-01-21 09:47:08 +09:00
parent 7a0512bdce
commit e8737a6886
5 changed files with 120 additions and 72 deletions
+11
View File
@@ -1,6 +1,8 @@
"use client";
import { BuildingNode, ItemNode, LevelNode, Zone } from "@pascal-app/core";
import { Object3D } from "three";
import { create } from "zustand";
type SelectionPath = {
@@ -10,6 +12,11 @@ type SelectionPath = {
selectedIds: ItemNode["id"][]; // For items/assets (multi-select)
};
type Outliner = {
selectedObjects: Object3D[];
hoveredObjects: Object3D[];
};
type ViewerState = {
selection: SelectionPath;
levelMode: "stacked" | "exploded" | "solo" | "manual";
@@ -20,6 +27,8 @@ type ViewerState = {
// Smart selection update
setSelection: (updates: Partial<SelectionPath>) => void;
resetSelection: () => void;
outliner: Outliner; // No setter as we will manipulate directly the arrays
};
const useViewer = create<ViewerState>()((set, get) => ({
@@ -55,6 +64,8 @@ const useViewer = create<ViewerState>()((set, get) => ({
selectedIds: [],
},
}),
outliner: { selectedObjects: [], hoveredObjects: [] },
}));
export default useViewer;