From 1cca51e652063d873789e825086f0e121f52ce0b Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B <jerald@hexrfactory.com> Date: Sat, 29 Mar 2025 13:46:31 +0530 Subject: [PATCH] fix: prevent speed change when no action sphere is selected in VehicleMechanics --- .../sidebarRight/mechanics/VehicleMechanics.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/components/layout/sidebarRight/mechanics/VehicleMechanics.tsx b/app/src/components/layout/sidebarRight/mechanics/VehicleMechanics.tsx index 42ad965..39773ab 100644 --- a/app/src/components/layout/sidebarRight/mechanics/VehicleMechanics.tsx +++ b/app/src/components/layout/sidebarRight/mechanics/VehicleMechanics.tsx @@ -62,7 +62,22 @@ const VehicleMechanics: React.FC = () => { }, [handleActionUpdate]); const handleSpeedChange = React.useCallback((speed: number) => { - + if (!selectedActionSphere?.point?.uuid) return; + + const updatedPaths = simulationPaths.map((path) => { + if (path.type === "Vehicle" && path.point.uuid === selectedActionSphere.point.uuid) { + return { + ...path, + point: { + ...path.point, + speed: speed + } + }; + } + return path; + }); + + setSimulationPaths(updatedPaths); }, [selectedActionSphere?.point?.uuid, simulationPaths, setSimulationPaths]); return (