Skip to content

Commit

Permalink
fixup! charts: add weight property to operational points
Browse files Browse the repository at this point in the history
  • Loading branch information
Akctarus committed Dec 4, 2024
1 parent d9263b8 commit 1586b7e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ui-speedspacechart/src/__tests__/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ describe('getSnappedStop', () => {
])('should find the correct snapped stop', (stopPositions, cursorX, expectedPos) => {
const stops = stopPositions.map((pos) => ({
position: { start: pos },
value: 'MyTestStop',
value: { name: 'MyTestStop' },
}));
const storeWithStops: Store = {
...store,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const drawCursor = ({ ctx, width, height, store }: DrawFunctionParams) =>
snapToStop = true;
cursorPosition = snappedStop.position.start;
reticleX = positionToPosX(cursorPosition, maxPosition, width, ratioX, leftOffset);
stopText = snappedStop.value;
stopText = snappedStop.value.name;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const drawSteps = ({ ctx, width, height, store }: DrawFunctionParams) =>
ctx.textAlign = 'left';

// Draw the text at the origin, since the context is already transformed
ctx.fillText(value!, 0, 0);
ctx.fillText(value!.name, 0, 0);
ctx.restore();
});

Expand Down
2 changes: 1 addition & 1 deletion ui-speedspacechart/src/stories/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const formatStops = (operationalPoints: PathProperties['operational_points']) =>
position: {
start: convertMmToKM(position),
},
value: `${extensions.identifier.name} ${extensions.ch !== '00' ? extensions.ch : ''}`,
value: { name: `${extensions.identifier.name} ${extensions.ch !== '00' ? extensions.ch : ''}` },
}));

const formatElectrifications = (electrifications: PathProperties['electrifications']) =>
Expand Down
1 change: 1 addition & 0 deletions ui-speedspacechart/src/types/simulationTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ export type PathProperties = {
};
};
position: number;
weight?: number;
}[];
};

0 comments on commit 1586b7e

Please sign in to comment.