Draw waypoint markers for the selected flight.

https://github.com/dcs-liberation/dcs_liberation/issues/2039
This commit is contained in:
Dan Albert
2022-03-01 23:06:03 -08:00
parent 030675812e
commit aac333e132
3 changed files with 103 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import { Flight } from "../../api/flight";
import { Polyline } from "react-leaflet";
import WaypointMarker from "../waypointmarker";
const BLUE_PATH = "#0084ff";
const RED_PATH = "#c85050";
@@ -35,10 +36,33 @@ function FlightPlanPath(props: FlightPlanProps) {
);
}
const WaypointMarkers = (props: FlightPlanProps) => {
if (!props.selected || props.flight.waypoints == null) {
return <></>;
}
return (
<>
{props.flight.waypoints
.filter((p) => p.should_mark)
.map((p, idx) => {
return (
<WaypointMarker
key={idx}
number={idx}
waypoint={p}
></WaypointMarker>
);
})}
</>
);
};
export default function FlightPlan(props: FlightPlanProps) {
return (
<>
<FlightPlanPath {...props} />
<WaypointMarkers {...props} />
</>
);
}