1
0
Fork 0

Nasal/view.nas: Allow view to be changed by setting /sim/current-view/view-number-raw.

This avoids problems when/if new default views numbers (between 0 and 99) are
added.
This commit is contained in:
Julian Smith 2021-04-25 16:39:00 +01:00
parent 4b4410becf
commit 768e11d0a6

View file

@ -942,6 +942,20 @@ setlistener("/sim/current-view/view-number", func(n) {
current = views[index = n.getValue()];
}, 1);
# Allow view changes by setting view-number-raw - avoids problems when/if we
# add new default views (between 0 and 99).
#
setlistener("/sim/current-view/view-number-raw", func(n) {
var index = n.getValue();
forindex (var i; views) {
if (views[i].getIndex() == index) {
props.globals.getNode("/sim/current-view/view-number", 1).setValue(i);
return;
}
}
printf("Failed to find view-number-raw=%s", index);
}, 1);
props.globals.initNode("/position/altitude-agl-ft"); # needed by Fly-By View
screenWidthCompens.init();
manager.init();