Skip to content

Commit 9feca22

Browse files
committed
fixup! front: add start and destination icons in the scenario map
1 parent d884aee commit 9feca22

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

front/src/modules/simulationResult/components/SimulationResultsMap/RenderItinerary.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ export default function RenderItinerary(props: RenderItineraryProps) {
2323
'line-color': '#158DCF',
2424
};
2525

26-
const startCoordinate = geojsonPath.geometry.coordinates[0];
27-
const endCoordinate =
28-
geojsonPath.geometry.coordinates[geojsonPath.geometry.coordinates.length - 1];
26+
// We know we have a geometry so we have at least 2 coordinates
27+
const [startLongitude, startLatitude] = geojsonPath.geometry.coordinates.at(0)!;
28+
const [endLongitude, endLatitude] = geojsonPath.geometry.coordinates.at(-1)!;
2929

3030
return (
3131
<Source type="geojson" data={geojsonPath}>
32-
<Marker longitude={startCoordinate[0]} latitude={startCoordinate[1]} anchor="bottom">
32+
<Marker longitude={startLongitude} latitude={startLatitude} anchor="bottom">
3333
<img src={originIcon} alt="origin" />
3434
</Marker>
3535
<OrderedLayer
@@ -40,7 +40,7 @@ export default function RenderItinerary(props: RenderItineraryProps) {
4040
layerOrder={layerOrder}
4141
/>
4242
<OrderedLayer id="geojsonPathLine" type="line" paint={paintLine} layerOrder={layerOrder} />
43-
<Marker longitude={endCoordinate[0]} latitude={endCoordinate[1]} anchor="bottom">
43+
<Marker longitude={endLongitude} latitude={endLatitude} anchor="bottom">
4444
<img src={destinationIcon} alt="destination" />
4545
</Marker>
4646
</Source>

0 commit comments

Comments
 (0)