Skip to content

Commit

Permalink
fixup! front: fix train on map (ts v2)
Browse files Browse the repository at this point in the history
  • Loading branch information
clarani committed Jul 1, 2024
1 parent f85e791 commit 487c0ba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ export const enableInteractivityV2 = <
const positionLocal = chart.x.invert(pointer(event, event.currentTarget)[0]) as number;
timePositionLocal = interpolateOnPositionV2(
selectedTrainData as { speed: PositionSpeedTime[] },
positionLocal,
Math.max(positionLocal, 0),
isoDateWithTimezoneToSec(selectedTrainDepartureDate)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const getSelectedTrainHoverPositions = (
geojsonPath: Feature<LineString>,
positionValues: PositionsSpeedTimes<Date>,
trainId: number
): TrainCurrentInfo | null => {
): TrainCurrentInfo | undefined => {
const { headPosition, tailPosition } = positionValues;

if (headPosition === undefined || tailPosition === undefined) {
return null;
return undefined;
}

const headDistanceAlong = mToKm(headPosition.position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const SimulationResultMapV2: FC<MapProps> = ({ geometry, trainSimulation }) => {
positionValues,
trainSimulation.trainId
);
if (selectedTrainPosition) setSelectedTrainHoverPosition(selectedTrainPosition);
setSelectedTrainHoverPosition(selectedTrainPosition);
}
},
'simulation-result-map',
Expand Down

0 comments on commit 487c0ba

Please sign in to comment.