refactor: update speed handling in ConveyorMechanics and related types to support string values

This commit is contained in:
Jerald-Golden-B 2025-03-29 13:43:29 +05:30
parent 991fd4328a
commit 8606cbbe54
4 changed files with 8 additions and 7 deletions

View File

@ -216,7 +216,7 @@ const ConveyorMechanics: React.FC = () => {
setSimulationPaths(updatedPaths);
};
const handleSpeedChange = (speed: number) => {
const handleSpeedChange = (speed: number | string) => {
if (!selectedPath) return;
const updatedPaths = simulationPaths.map((path) =>
@ -630,11 +630,12 @@ const ConveyorMechanics: React.FC = () => {
)}
{selectedPath && !selectedItem && (
<div className="speed-control">
<div key={selectedPath?.path.modeluuid || "none"} className="speed-control">
<InputWithDropDown
label="Conveyor Speed"
value={selectedPath.path.speed.toString()}
onChange={(value) => handleSpeedChange(parseFloat(value))}
min={0}
value={selectedPath.path.speed === "Inherit" ? "" : selectedPath.path.speed.toString()}
onChange={(value) => handleSpeedChange((value === "") ? "Inherit" : parseInt(value))}
/>
</div>
)}

View File

@ -9,7 +9,7 @@ import * as THREE from "three";
// Define the shape of the selected card
interface SelectedCard {
assetName: string;
uploadedOn: string;
uploadedOn: number;
price: number;
rating: number;
views: number;

View File

@ -52,7 +52,7 @@ function Behaviour() {
],
assetPosition: [...item.position],
assetRotation: [item.rotation.x, item.rotation.y, item.rotation.z],
speed: 1,
speed: 'Inherit',
};
newPaths.push(newPath);

View File

@ -300,7 +300,7 @@ interface ConveyorEventsSchema {
}[];
assetPosition: [number, number, number];
assetRotation: [number, number, number];
speed: number;
speed: number | string;
}
interface VehicleEventsSchema {