fix: prevent speed change when no action sphere is selected in VehicleMechanics

This commit is contained in:
Jerald-Golden-B 2025-03-29 13:46:31 +05:30
parent 8606cbbe54
commit 1cca51e652
1 changed files with 16 additions and 1 deletions

View File

@ -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 (