refactor: update speed handling in ConveyorMechanics and related types to support string values
This commit is contained in:
@@ -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>
|
||||
)}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
2
app/src/types/world/worldTypes.d.ts
vendored
2
app/src/types/world/worldTypes.d.ts
vendored
@@ -300,7 +300,7 @@ interface ConveyorEventsSchema {
|
||||
}[];
|
||||
assetPosition: [number, number, number];
|
||||
assetRotation: [number, number, number];
|
||||
speed: number;
|
||||
speed: number | string;
|
||||
}
|
||||
|
||||
interface VehicleEventsSchema {
|
||||
|
||||
Reference in New Issue
Block a user