Skip to content

Commit 3df6fbc

Browse files
Math-Rnicolaswurtz
authored andcommitted
front:fix selected projection displayed ops
1 parent 1dcf908 commit 3df6fbc

File tree

1 file changed

+8
-4
lines changed
  • front/src/modules/simulationResult/components/SpaceTimeChart

1 file changed

+8
-4
lines changed

front/src/modules/simulationResult/components/SpaceTimeChart/d3Helpers.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import {
1515
} from './types';
1616
import { CHART_AXES } from '../simulationResultsConsts';
1717

18-
function drawOPs(chartLocal: Chart, selectedTrainSimulation: Train, rotate: boolean) {
18+
function drawOPs(chartLocal: Chart, projectedTrainSimulation: Train, rotate: boolean) {
1919
const operationalPointsZone = chartLocal.drawZone
2020
.append('g')
2121
.attr('id', 'get-operationalPointsZone');
22-
selectedTrainSimulation.base.stops.forEach((stop) => {
22+
projectedTrainSimulation.base.stops.forEach((stop) => {
2323
operationalPointsZone
2424
.append('line')
2525
.datum(stop.position)
@@ -83,8 +83,12 @@ const drawAllTrains = (
8383
rotate
8484
);
8585

86-
if (selectedTrain) {
87-
drawOPs(chartLocal, selectedTrain, rotate);
86+
const projectedSimulationTrain = simulationTrains.find(
87+
(train) => train.id === selectedProjection?.id
88+
);
89+
90+
if (projectedSimulationTrain) {
91+
drawOPs(chartLocal, projectedSimulationTrain, rotate);
8892
}
8993

9094
drawAxisTitle(chartLocal, rotate);

0 commit comments

Comments
 (0)