A32X: Add/update onox's view scrolling

This commit is contained in:
Joshua Davidson 2017-12-21 16:49:42 -05:00
parent ff57e4d2f6
commit f984b4075a
7 changed files with 212 additions and 5 deletions

View file

@ -42,7 +42,7 @@
</preview>
</previews>
<chase-distance-m type="double" archive="y">-95.0</chase-distance-m>
<chase-distance-m type="double" archive="y">-100.0</chase-distance-m>
<view>
<name>Pilot View</name>
<internal archive="y">true</internal>

View file

@ -42,7 +42,7 @@
</preview>
</previews>
<chase-distance-m type="double" archive="y">-95.0</chase-distance-m>
<chase-distance-m type="double" archive="y">-100.0</chase-distance-m>
<view>
<name>Pilot View</name>
<internal archive="y">true</internal>

View file

@ -42,7 +42,7 @@
</preview>
</previews>
<chase-distance-m type="double" archive="y">-95.0</chase-distance-m>
<chase-distance-m type="double" archive="y">-100.0</chase-distance-m>
<view>
<name>Pilot View</name>
<internal archive="y">true</internal>

View file

@ -148,6 +148,9 @@
<autopilot n="13">
<path>Aircraft/IDG-A32X/Systems/pfd.xml</path>
</autopilot>
<autopilot n="14">
<path>Aircraft/IDG-A32X/Systems/zoom-views.xml</path>
</autopilot>
</systems>
<sounde>
@ -337,6 +340,16 @@
<flight-recorder include="Systems/flight-recorder.xml"/>
<gui n="0" include="Systems/it-gui.xml"/>
<current-view>
<z-offset-dec-step type="double">0.0</z-offset-dec-step>
<z-offset-inc-step type="double">0.0</z-offset-inc-step>
<can-change-z-offset type="bool">false</can-change-z-offset>
<z-offset-default type="float">100.0</z-offset-default>
<z-offset-min-m type="float">30.0</z-offset-min-m>
<z-offset-max-m type="float">300.0</z-offset-max-m>
</current-view>
</sim>
<consumables>
@ -905,7 +918,73 @@
</modes>
<input>
<mice n="0">
<mouse n="0">
<mode n="0">
<button n="3">
<binding n="0">
<script></script>
</binding>
<binding n="1">
<command>nasal</command>
<script>
if (getprop("/sim/current-view/can-change-z-offset")) {
var distance = getprop("/sim/current-view/z-offset-m");
var multiple = getprop("/sim/current-view/z-offset-inc-step");
var min_dist = getprop("/sim/current-view/z-offset-min-m");
distance = math.round(std.min(-min_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meters", abs(distance)));
} else {
view.decrease();
}
</script>
</binding>
</button>
<button n="4">
<binding n="0">
<script></script>
</binding>
<binding n="1">
<command>nasal</command>
<script>
if (getprop("/sim/current-view/can-change-z-offset")) {
var distance = getprop("/sim/current-view/z-offset-m");
var multiple = getprop("/sim/current-view/z-offset-dec-step");
var max_dist = getprop("/sim/current-view/z-offset-max-m");
distance = math.round(std.max(-max_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meters", abs(distance)));
} else {
view.increase();
}
</script>
</binding>
</button>
</mode>
</mouse>
</mice>
<keyboard>
<key n="24">
<name>Ctrl-X</name>
<desc>Reset zoom to default</desc>
<binding>
<command>nasal</command>
<script>
if (getprop("/sim/current-view/can-change-z-offset")) {
setprop("/sim/current-view/z-offset-m", getprop("/sim/current-view/z-offset-default") * -1);
gui.popupTip(sprintf("%d meters", getprop("/sim/current-view/z-offset-default")));
} else {
setprop("/sim/current-view/field-of-view", getprop("/sim/view/config/default-field-of-view-deg"));
}
</script>
</binding>
</key>
<key n="33">
<name>PAGE UP</name>
<desc>Throttle Increase</desc>
@ -1119,6 +1198,50 @@
</script>
</binding>
</key>
<key n="88">
<name>X</name>
<desc>Increase field of view</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>
if (getprop("/sim/current-view/can-change-z-offset")) {
var distance = getprop("/sim/current-view/z-offset-m");
var multiple = getprop("/sim/current-view/z-offset-dec-step");
var max_dist = getprop("/sim/current-view/z-offset-max-m");
distance = math.round(std.max(-max_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meters", abs(distance)));
} else {
view.increase();
}
</script>
</binding>
</key>
<key n="120">
<name>x</name>
<desc>Decrease field of view</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>
if (getprop("/sim/current-view/can-change-z-offset")) {
var distance = getprop("/sim/current-view/z-offset-m");
var multiple = getprop("/sim/current-view/z-offset-inc-step");
var min_dist = getprop("/sim/current-view/z-offset-min-m");
distance = math.round(std.min(-min_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meters", abs(distance)));
} else {
view.decrease();
}
</script>
</binding>
</key>
<key n="127">
<name>DEL</name>
<desc>Simple Engage/Disengage reversers</desc>

View file

@ -42,7 +42,7 @@
</preview>
</previews>
<chase-distance-m type="double" archive="y">-95.0</chase-distance-m>
<chase-distance-m type="double" archive="y">-100.0</chase-distance-m>
<view>
<name>Pilot View</name>
<internal archive="y">true</internal>

View file

@ -42,7 +42,7 @@
</preview>
</previews>
<chase-distance-m type="double" archive="y">-95.0</chase-distance-m>
<chase-distance-m type="double" archive="y">-100.0</chase-distance-m>
<view>
<name>Pilot View</name>
<internal archive="y">true</internal>

84
Systems/zoom-views.xml Normal file
View file

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- IDG Distance Zooming -->
<!-- Copyright (c) 2015-2017 onox -->
<!-- Modified by Joshua Davidson (it0uchpods) -->
<PropertyList>
<logic>
<name>View Zoom Enabled</name>
<input>
<and>
<equals>
<property>/sim/current-view/type</property>
<value>lookat</value>
</equals>
<not-equals>
<property>/sim/current-view/name</property>
<value>Tower View</value>
</not-equals>
<not-equals>
<property>/sim/current-view/name</property>
<value>Fly-By View</value>
</not-equals>
<not-equals>
<property>/sim/current-view/name</property>
<value>Chase View</value>
</not-equals>
<not-equals>
<property>/sim/current-view/name</property>
<value>Chase View Without Yaw</value>
</not-equals>
<not-equals>
<property>/sim/current-view/name</property>
<value>Walk View</value>
</not-equals>
</and>
</input>
<output>
<property>/sim/current-view/can-change-z-offset</property>
</output>
</logic>
<filter>
<name>View Zoom Decrease Step</name>
<type>gain</type>
<input>
<condition>
<less-than-equals>
<property>/sim/current-view/z-offset-m</property>
<value>-50.0</value>
</less-than-equals>
</condition>
<value>-10.0</value>
</input>
<input>
<value>-5.0</value>
</input>
<output>
<property>/sim/current-view/z-offset-dec-step</property>
</output>
</filter>
<filter>
<name>View Zoom Increase Step</name>
<type>gain</type>
<input>
<condition>
<less-than>
<property>/sim/current-view/z-offset-m</property>
<value>-50.0</value>
</less-than>
</condition>
<value>10.0</value>
</input>
<input>
<value>5.0</value>
</input>
<output>
<property>/sim/current-view/z-offset-inc-step</property>
</output>
</filter>
</PropertyList>