refactor: update speed handling in ConveyorMechanics and related types to support string values
This commit is contained in:
parent
991fd4328a
commit
8606cbbe54
|
@ -216,7 +216,7 @@ const ConveyorMechanics: React.FC = () => {
|
||||||
setSimulationPaths(updatedPaths);
|
setSimulationPaths(updatedPaths);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSpeedChange = (speed: number) => {
|
const handleSpeedChange = (speed: number | string) => {
|
||||||
if (!selectedPath) return;
|
if (!selectedPath) return;
|
||||||
|
|
||||||
const updatedPaths = simulationPaths.map((path) =>
|
const updatedPaths = simulationPaths.map((path) =>
|
||||||
|
@ -630,11 +630,12 @@ const ConveyorMechanics: React.FC = () => {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{selectedPath && !selectedItem && (
|
{selectedPath && !selectedItem && (
|
||||||
<div className="speed-control">
|
<div key={selectedPath?.path.modeluuid || "none"} className="speed-control">
|
||||||
<InputWithDropDown
|
<InputWithDropDown
|
||||||
label="Conveyor Speed"
|
label="Conveyor Speed"
|
||||||
value={selectedPath.path.speed.toString()}
|
min={0}
|
||||||
onChange={(value) => handleSpeedChange(parseFloat(value))}
|
value={selectedPath.path.speed === "Inherit" ? "" : selectedPath.path.speed.toString()}
|
||||||
|
onChange={(value) => handleSpeedChange((value === "") ? "Inherit" : parseInt(value))}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import * as THREE from "three";
|
||||||
// Define the shape of the selected card
|
// Define the shape of the selected card
|
||||||
interface SelectedCard {
|
interface SelectedCard {
|
||||||
assetName: string;
|
assetName: string;
|
||||||
uploadedOn: string;
|
uploadedOn: number;
|
||||||
price: number;
|
price: number;
|
||||||
rating: number;
|
rating: number;
|
||||||
views: number;
|
views: number;
|
||||||
|
|
|
@ -52,7 +52,7 @@ function Behaviour() {
|
||||||
],
|
],
|
||||||
assetPosition: [...item.position],
|
assetPosition: [...item.position],
|
||||||
assetRotation: [item.rotation.x, item.rotation.y, item.rotation.z],
|
assetRotation: [item.rotation.x, item.rotation.y, item.rotation.z],
|
||||||
speed: 1,
|
speed: 'Inherit',
|
||||||
};
|
};
|
||||||
|
|
||||||
newPaths.push(newPath);
|
newPaths.push(newPath);
|
||||||
|
|
|
@ -300,7 +300,7 @@ interface ConveyorEventsSchema {
|
||||||
}[];
|
}[];
|
||||||
assetPosition: [number, number, number];
|
assetPosition: [number, number, number];
|
||||||
assetRotation: [number, number, number];
|
assetRotation: [number, number, number];
|
||||||
speed: number;
|
speed: number | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface VehicleEventsSchema {
|
interface VehicleEventsSchema {
|
||||||
|
|
Loading…
Reference in New Issue