new human event mangaer

This commit is contained in:
2025-07-22 16:33:33 +05:30
parent 88361b1623
commit 708c8a4ba1
19 changed files with 1355 additions and 992 deletions

View File

@@ -1,4 +1,4 @@
import { createContext, useContext, useMemo } from 'react';
import { createContext, useContext, useMemo, useRef } from 'react';
import { createAssetStore, AssetStoreType } from '../../store/builder/useAssetStore';
import { createWallAssetStore, WallAssetStoreType } from '../../store/builder/useWallAssetStore';
@@ -38,6 +38,8 @@ type SceneContextValue = {
storageUnitStore: StorageUnitStoreType;
humanStore: HumanStoreType;
humanEventManagerRef: React.RefObject<HumanEventManagerState>;
clearStores: () => void;
layout: 'Main Layout' | 'Comparison Layout';
@@ -71,6 +73,8 @@ export function SceneProvider({
const storageUnitStore = useMemo(() => createStorageUnitStore(), []);
const humanStore = useMemo(() => createHumanStore(), []);
const humanEventManagerRef = useRef<HumanEventManagerState>({ humanStates: [] });
const clearStores = useMemo(() => () => {
assetStore.getState().clearAssets();
wallAssetStore.getState().clearWallAssets();
@@ -87,6 +91,7 @@ export function SceneProvider({
vehicleStore.getState().clearVehicles();
storageUnitStore.getState().clearStorageUnits();
humanStore.getState().clearHumans();
humanEventManagerRef.current.humanStates = [];
}, [assetStore, wallAssetStore, wallStore, aisleStore, zoneStore, floorStore, eventStore, productStore, materialStore, armBotStore, machineStore, conveyorStore, vehicleStore, storageUnitStore, humanStore]);
const contextValue = useMemo(() => (
@@ -106,6 +111,7 @@ export function SceneProvider({
vehicleStore,
storageUnitStore,
humanStore,
humanEventManagerRef,
clearStores,
layout
}