Dirto : improve
This commit is contained in:
parent
bdd69e51a4
commit
bb622b661d
1 changed files with 7 additions and 4 deletions
|
@ -155,6 +155,11 @@ var flightPlanController = {
|
||||||
if (canvas_mcdu.myDirTo[n] != nil) {
|
if (canvas_mcdu.myDirTo[n] != nil) {
|
||||||
canvas_mcdu.myDirTo[n].updateTmpy();
|
canvas_mcdu.myDirTo[n].updateTmpy();
|
||||||
}
|
}
|
||||||
|
if (me.DirToIndex != nil) {
|
||||||
|
me.currentToWptIndex.setValue(me.DirToIndex);
|
||||||
|
me.DirToIndex = nil;
|
||||||
|
}
|
||||||
|
|
||||||
fmgc.windController.destroyTemporaryWinds(n, a);
|
fmgc.windController.destroyTemporaryWinds(n, a);
|
||||||
me.flightPlanChanged(n);
|
me.flightPlanChanged(n);
|
||||||
},
|
},
|
||||||
|
@ -344,6 +349,7 @@ var flightPlanController = {
|
||||||
# In either case, we delete the current FROM waypoint, index 0, and call flightPlanChanged to recalculate
|
# In either case, we delete the current FROM waypoint, index 0, and call flightPlanChanged to recalculate
|
||||||
# We attempt to get the distance from the aircraft current position to the chosen waypoint and update mcdu with it
|
# We attempt to get the distance from the aircraft current position to the chosen waypoint and update mcdu with it
|
||||||
|
|
||||||
|
DirToIndex: nil,
|
||||||
directTo: func(waypointGhost, plan) {
|
directTo: func(waypointGhost, plan) {
|
||||||
if (me.flightplans[plan].indexOfWP(waypointGhost) == -1) {
|
if (me.flightplans[plan].indexOfWP(waypointGhost) == -1) {
|
||||||
me.insertTP(plan, me.currentToWptIndex.getValue());
|
me.insertTP(plan, me.currentToWptIndex.getValue());
|
||||||
|
@ -353,8 +359,7 @@ var flightPlanController = {
|
||||||
me.flightplans[plan].insertWP(createWP(waypointGhost, waypointGhost.id), me.currentToWptIndex.getValue() + 1);
|
me.flightplans[plan].insertWP(createWP(waypointGhost, waypointGhost.id), me.currentToWptIndex.getValue() + 1);
|
||||||
fmgc.windController.insertWind(plan, me.currentToWptIndex.getValue() + 1, 0, waypointGhost.id);
|
fmgc.windController.insertWind(plan, me.currentToWptIndex.getValue() + 1, 0, waypointGhost.id);
|
||||||
me.addDiscontinuity(me.currentToWptIndex.getValue() + 2, plan);
|
me.addDiscontinuity(me.currentToWptIndex.getValue() + 2, plan);
|
||||||
print(me.currentToWptIndex.getValue());
|
me.DirToIndex = me.currentToWptIndex.getValue() + 1;
|
||||||
me.currentToWptIndex.setValue(me.currentToWptIndex.getValue() + 1);
|
|
||||||
} else {
|
} else {
|
||||||
# we want to delete the intermediate waypoints up to but not including the waypoint. Leave index 0, we delete it later.
|
# we want to delete the intermediate waypoints up to but not including the waypoint. Leave index 0, we delete it later.
|
||||||
# example - waypoint dirto is index 5, we want to delete indexes 1 -> 4. 5 - 1 = 4.
|
# example - waypoint dirto is index 5, we want to delete indexes 1 -> 4. 5 - 1 = 4.
|
||||||
|
@ -362,8 +367,6 @@ var flightPlanController = {
|
||||||
|
|
||||||
var indexWP = me.flightplans[plan].indexOfWP(waypointGhost);
|
var indexWP = me.flightplans[plan].indexOfWP(waypointGhost);
|
||||||
|
|
||||||
print(indexWP);
|
|
||||||
|
|
||||||
me.insertTP(plan, indexWP - 1);
|
me.insertTP(plan, indexWP - 1);
|
||||||
for (var i = 0; i < indexWP - 1; i = i + 1) {
|
for (var i = 0; i < indexWP - 1; i = i + 1) {
|
||||||
if (me.temporaryFlag[0]) {
|
if (me.temporaryFlag[0]) {
|
||||||
|
|
Loading…
Reference in a new issue