Fix z/Z key-binding.
Don't require the Environment dialog to have been opened, before this keybinding works for basic (global) weather.
This commit is contained in:
parent
21ff9d9680
commit
e4ec7a6e56
1 changed files with 15 additions and 18 deletions
|
@ -20,26 +20,13 @@ var decreaseVisibility = func {
|
||||||
var adjustVisibility = func( factor ) {
|
var adjustVisibility = func( factor ) {
|
||||||
var val = 0;
|
var val = 0;
|
||||||
var aux_val = 0;
|
var aux_val = 0;
|
||||||
var local = getprop("sim/gui/dialogs/metar/mode/local-weather");
|
# better to use a non gui/dialog property here, but there doesn't
|
||||||
var global = getprop("sim/gui/dialogs/metar/mode/global-weather");
|
# seem to be one for local-weather.
|
||||||
|
var localWeatherEnabled = getprop("sim/gui/dialogs/metar/mode/local-weather");
|
||||||
var max_aux_vis = 12.429216196;
|
var max_aux_vis = 12.429216196;
|
||||||
var min_aux_vis = 9.90348;
|
var min_aux_vis = 9.90348;
|
||||||
|
|
||||||
if(global)
|
if (localWeatherEnabled) {
|
||||||
{
|
|
||||||
val = visibilityProp.getValue() * factor;
|
|
||||||
|
|
||||||
if( val < 1.0 ) val = getprop("/environment/visibility-m");
|
|
||||||
|
|
||||||
if( val > 30 ) {
|
|
||||||
visibilityProp.setDoubleValue(val);
|
|
||||||
visibilityOverrideProp.setBoolValue(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
gui.popupTip(sprintf("Visibility: %.0f m", val));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (factor == 1.1)
|
if (factor == 1.1)
|
||||||
factor = 1.001;
|
factor = 1.001;
|
||||||
else
|
else
|
||||||
|
@ -55,9 +42,19 @@ var adjustVisibility = func( factor ) {
|
||||||
auxvisibilityProp.setDoubleValue(aux_val);
|
auxvisibilityProp.setDoubleValue(aux_val);
|
||||||
|
|
||||||
gui.popupTip(sprintf("Max Visibility: %.0f m", getprop("/local-weather/config/max-vis-range-m")));
|
gui.popupTip(sprintf("Max Visibility: %.0f m", getprop("/local-weather/config/max-vis-range-m")));
|
||||||
}
|
} else {
|
||||||
|
val = visibilityProp.getValue() * factor;
|
||||||
|
|
||||||
|
if( val < 1.0 ) val = getprop("/environment/visibility-m");
|
||||||
|
|
||||||
|
if( val > 30 ) {
|
||||||
|
visibilityProp.setDoubleValue(val);
|
||||||
|
visibilityOverrideProp.setBoolValue(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
gui.popupTip(sprintf("Visibility: %.0f m", val));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# Handler. Reset visibility to default.
|
# Handler. Reset visibility to default.
|
||||||
|
|
Loading…
Add table
Reference in a new issue