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:
2025-05-05 20:08:05 +05:30
parent 6b0ee0ae79
commit c89c4234a4
15 changed files with 656 additions and 362 deletions

View File

@@ -1,3 +1,4 @@
import { usePlayButtonStore, useResetButtonStore } from "../../../store/usePlayButtonStore";
import { useConveyorActions } from "./conveyor/useConveyorActions";
import { useMachineActions } from "./machine/useMachineActions";
import { useRoboticArmActions } from "./roboticArm/useRoboticArmActions";
@@ -6,6 +7,8 @@ import { useVehicleActions } from "./vehicle/useVehicleActions";
import { useCallback, useEffect } from "react";
export function useActionHandler() {
const { isReset } = useResetButtonStore();
const { isPlaying } = usePlayButtonStore();
const { handleConveyorAction, cleanup: cleanupConveyor } = useConveyorActions();
const { handleVehicleAction, cleanup: cleanupVehicle } = useVehicleActions();
const { handleRoboticArmAction, cleanup: cleanupRoboticArm } = useRoboticArmActions();
@@ -52,7 +55,7 @@ export function useActionHandler() {
return () => {
cleanup();
};
}, [cleanup]);
}, [cleanup, isReset, isPlaying]);
return {
handleAction,