new human event mangaer
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user