Refactor multiple components: streamline action handling in ActionsList, RoboticArmMechanics, and Trigger; update vehicle and robotic arm data management in Products and Vehicles; unify action naming in loadInitialFloorItems, copyPasteControls, and duplicationControls; enhance ArmBotUI with selected event sphere integration.

This commit is contained in:
2025-05-03 12:25:10 +05:30
parent 52c6017649
commit 75699e7199
12 changed files with 102 additions and 95 deletions

View File

@@ -15,7 +15,7 @@ interface VehicleAnimatorProps {
}
function VehicleAnimator({ path, handleCallBack, currentPhase, agvUuid, agvDetail, reset }: VehicleAnimatorProps) {
const { decrementVehicleLoad } = useVehicleStore();
const { decrementVehicleLoad, getVehicleById } = useVehicleStore();
const { isPaused } = usePauseButtonStore();
const { isPlaying } = usePlayButtonStore();
const { speed } = useAnimationPlaySpeed();
@@ -34,7 +34,6 @@ function VehicleAnimator({ path, handleCallBack, currentPhase, agvUuid, agvDetai
let coveredDistance = progressRef.current;
let objectRotation = (agvDetail.point?.action?.pickUpPoint?.rotation || { x: 0, y: 0, z: 0 }) as { x: number; y: number; z: number } | undefined;
useEffect(() => {
if (currentPhase === 'stationed-pickup' && path.length > 0) {
setCurrentPath(path);
@@ -69,9 +68,10 @@ function VehicleAnimator({ path, handleCallBack, currentPhase, agvUuid, agvDetai
isPausedRef.current = false;
pauseTimeRef.current = 0;
const object = scene.getObjectByProperty('uuid', agvUuid);
if (object) {
object.position.set(agvDetail.position[0], agvDetail.position[1], agvDetail.position[2]);
object.rotation.set(agvDetail.rotation[0], agvDetail.rotation[1], agvDetail.rotation[2]);
const vehicle = getVehicleById(agvDetail.modelUuid);
if (object && vehicle) {
object.position.set(vehicle.position[0], vehicle.position[1], vehicle.position[2]);
object.rotation.set(vehicle.rotation[0], vehicle.rotation[1], vehicle.rotation[2]);
}
}
}, [isReset, isPlaying])

View File

@@ -1,35 +1,18 @@
import React, { useEffect } from "react";
import { useEffect } from "react";
import VehicleInstances from "./instances/vehicleInstances";
import { useVehicleStore } from "../../../store/simulation/useVehicleStore";
import { useSelectedEventData, useSelectedEventSphere, useSelectedProduct } from "../../../store/simulation/useSimulationStore";
import { useSelectedEventData, useSelectedEventSphere } from "../../../store/simulation/useSimulationStore";
import VehicleUI from "../ui/vehicle/vehicleUI";
import { usePlayButtonStore } from "../../../store/usePlayButtonStore";
import { useProductStore } from "../../../store/simulation/useProductStore";
function Vehicles() {
const { products, getProductById } = useProductStore();
const { selectedProduct } = useSelectedProduct();
const { vehicles, addVehicle, clearvehicles } = useVehicleStore();
const { vehicles } = useVehicleStore();
const { selectedEventSphere } = useSelectedEventSphere();
const { selectedEventData } = useSelectedEventData();
const { isPlaying } = usePlayButtonStore();
useEffect(() => {
if (selectedProduct.productId) {
const product = getProductById(selectedProduct.productId);
if (product) {
clearvehicles();
product.eventDatas.forEach(events => {
if (events.type === 'vehicle') {
addVehicle(selectedProduct.productId, events);
}
});
}
}
}, [selectedProduct, products]);
useEffect(() => {
//
// console.log('vehicles: ', vehicles);
}, [vehicles])
return (