feat: Enhance conveyor actions and event handling
- Added detailed logging for default conveyor actions in useConveyorActions. - Integrated play and reset button states into useActionHandler for better control flow. - Updated PointsCreator to conditionally render based on play state and improved event handling. - Modified MaterialAnimator to support pause and resume functionality based on play state. - Enhanced MaterialInstance to trigger actions upon animation completion. - Implemented material clearing logic in Materials component on reset or stop. - Updated Simulator to respect play and reset states during action handling. - Improved trigger handling logic to accommodate new event retrieval methods. - Added utility functions in useProductStore for fetching events by trigger and point UUIDs. - Created a new file for default action handling in conveyor actions.
This commit is contained in:
@@ -6,6 +6,7 @@ type MaterialsStore = {
|
||||
|
||||
addMaterial: (material: MaterialSchema) => MaterialSchema | undefined;
|
||||
removeMaterial: (materialId: string) => MaterialSchema | undefined;
|
||||
clearMaterials: () => void;
|
||||
updateMaterial: (materialId: string, updates: Partial<MaterialSchema>) => MaterialSchema | undefined;
|
||||
|
||||
setCurrentLocation: (
|
||||
@@ -35,6 +36,7 @@ type MaterialsStore = {
|
||||
setIsRendered: (materialId: string, isRendered: boolean) => MaterialSchema | undefined;
|
||||
|
||||
getMaterialById: (materialId: string) => MaterialSchema | undefined;
|
||||
getMaterialByCurrentModelUuid: (currentModelUuid: string) => MaterialSchema | undefined;
|
||||
getMaterialsByPoint: (pointUuid: string) => MaterialSchema[];
|
||||
getMaterialsByModel: (modelUuid: string) => MaterialSchema[];
|
||||
};
|
||||
@@ -63,6 +65,12 @@ export const useMaterialStore = create<MaterialsStore>()(
|
||||
return updatedMaterial;
|
||||
},
|
||||
|
||||
clearMaterials: () => {
|
||||
set((state) => {
|
||||
state.materials = [];
|
||||
});
|
||||
},
|
||||
|
||||
updateMaterial: (materialId, updates) => {
|
||||
let updatedMaterial: MaterialSchema | undefined;
|
||||
set((state) => {
|
||||
@@ -186,6 +194,10 @@ export const useMaterialStore = create<MaterialsStore>()(
|
||||
getMaterialById: (materialId) => {
|
||||
return get().materials.find(m => m.materialId === materialId);
|
||||
},
|
||||
|
||||
getMaterialByCurrentModelUuid: (currentModelUuid) => {
|
||||
return get().materials.find(m => m.current?.modelUuid === currentModelUuid);
|
||||
},
|
||||
|
||||
getMaterialsByPoint: (pointUuid) => {
|
||||
return get().materials.filter(m =>
|
||||
|
||||
Reference in New Issue
Block a user