mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix more not-cleared flight plan elements.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1745
This commit is contained in:
parent
bc819d59f4
commit
acd63fdeac
@ -808,6 +808,7 @@ class Flight {
|
|||||||
this.flightPlan = this.flight.flightPlan.map((p) => new Waypoint(p, this));
|
this.flightPlan = this.flight.flightPlan.map((p) => new Waypoint(p, this));
|
||||||
this.aircraft = null;
|
this.aircraft = null;
|
||||||
this.path = null;
|
this.path = null;
|
||||||
|
this.markers = [];
|
||||||
this.commitBoundary = null;
|
this.commitBoundary = null;
|
||||||
this.flight.selectedChanged.connect(() => this.draw());
|
this.flight.selectedChanged.connect(() => this.draw());
|
||||||
this.flight.positionChanged.connect(() => this.drawAircraftLocation());
|
this.flight.positionChanged.connect(() => this.drawAircraftLocation());
|
||||||
@ -891,18 +892,36 @@ class Flight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearFlightPlan() {
|
||||||
|
for (const marker of this.markers) {
|
||||||
|
marker
|
||||||
|
.removeFrom(selectedFlightPlansLayer)
|
||||||
|
.removeFrom(this.flightPlanLayer())
|
||||||
|
.removeFrom(allFlightPlansLayer);
|
||||||
|
}
|
||||||
|
this.markers = [];
|
||||||
|
if (this.path != null) {
|
||||||
|
this.path
|
||||||
|
.removeFrom(selectedFlightPlansLayer)
|
||||||
|
.removeFrom(this.flightPlanLayer())
|
||||||
|
.removeFrom(allFlightPlansLayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
drawFlightPlan() {
|
drawFlightPlan() {
|
||||||
|
this.clearFlightPlan();
|
||||||
this.flight.flightIsInAto().then((inAto) => {
|
this.flight.flightIsInAto().then((inAto) => {
|
||||||
if (!inAto) {
|
if (!inAto) {
|
||||||
// HACK: The signal to redraw the ATO following package/flight deletion
|
// HACK: The signal to redraw the ATO following package/flight deletion
|
||||||
// and the signal to change flight/package selection due to UI selection
|
// and the signal to change flight/package selection due to UI selection
|
||||||
// change come in an arbitrary order. If redraw signal comes first the UI
|
// change come in an arbitrary order. If redraw signal comes first the
|
||||||
// will clear the map and redraw, but then when the UI updates selection
|
// UI will clear the map and redraw, but then when the UI updates
|
||||||
// away from the (now deleted) flight/package it calls deselect, which
|
// selection away from the (now deleted) flight/package it calls
|
||||||
// redraws the deleted flight plan in its deselected state.
|
// deselect, which redraws the deleted flight plan in its deselected
|
||||||
|
// state.
|
||||||
//
|
//
|
||||||
// Avoid this by checking that the flight is still in the coalition's ATO
|
// Avoid this by checking that the flight is still in the coalition's
|
||||||
// before drawing.
|
// ATO before drawing.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const path = [];
|
const path = [];
|
||||||
@ -915,6 +934,7 @@ class Flight {
|
|||||||
.addTo(selectedFlightPlansLayer)
|
.addTo(selectedFlightPlansLayer)
|
||||||
.addTo(this.flightPlanLayer())
|
.addTo(this.flightPlanLayer())
|
||||||
.addTo(allFlightPlansLayer);
|
.addTo(allFlightPlansLayer);
|
||||||
|
this.markers.push(waypoint.marker);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user