mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Eliminate unnecessary waypoint API call in map.
I added the with_waypoints option for the react map. Use it in the old one.
This commit is contained in:
parent
79b471b41c
commit
4dfc42528d
@ -924,10 +924,9 @@ class Flight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawFlightPlan() {
|
drawFlightPlan() {
|
||||||
getJson(`/waypoints/${this.flight.id}`).then((waypoints) => {
|
|
||||||
this.clearFlightPlan();
|
this.clearFlightPlan();
|
||||||
const path = [];
|
const path = [];
|
||||||
waypoints.map((raw, idx) => {
|
this.flight.waypoints.map((raw, idx) => {
|
||||||
const waypoint = new Waypoint(raw, idx, this);
|
const waypoint = new Waypoint(raw, idx, this);
|
||||||
if (waypoint.includeInPath()) {
|
if (waypoint.includeInPath()) {
|
||||||
path.push(waypoint.position());
|
path.push(waypoint.position());
|
||||||
@ -941,7 +940,6 @@ class Flight {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.drawPath(path);
|
this.drawPath(path);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -953,7 +951,7 @@ function drawAircraft() {
|
|||||||
selectedFlightPlansLayer.clearLayers();
|
selectedFlightPlansLayer.clearLayers();
|
||||||
allFlightPlansLayer.clearLayers();
|
allFlightPlansLayer.clearLayers();
|
||||||
|
|
||||||
getJson("/flights").then((flights) => {
|
getJson("/flights?with_waypoints=true").then((flights) => {
|
||||||
for (const flight of flights) {
|
for (const flight of flights) {
|
||||||
new Flight(flight).draw();
|
new Flight(flight).draw();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user