1
0
Fork 0

Fix mouse MMB+LMB: this reset to view[0] parameters independent of the

current view, so it was only usable in cockpit view, and messed up every
other view.
This commit is contained in:
mfranz 2007-08-01 21:10:04 +00:00
parent 397ee8296f
commit 3132b5c962
2 changed files with 29 additions and 34 deletions

View file

@ -48,11 +48,28 @@ decrease = func {
##
# Handler. Reset FOV to default.
#
resetFOV = func {
var resetFOV = func {
setprop("/sim/current-view/field-of-view",
getprop("/sim/current-view/config/default-field-of-view-deg"));
}
var resetViewPos = func {
var n = getprop("/sim/current-view/view-number");
var v = views[n].getNode("config");
setprop("/sim/current-view/x-offset-m", v.getNode("x-offset-m", 1).getValue() or 0);
setprop("/sim/current-view/y-offset-m", v.getNode("y-offset-m", 1).getValue() or 0);
setprop("/sim/current-view/z-offset-m", v.getNode("z-offset-m", 1).getValue() or 0);
}
var resetViewDir = func {
setprop("/sim/current-view/goal-heading-offset-deg",
getprop("/sim/current-view/config/heading-offset-deg"));
setprop("/sim/current-view/goal-pitch-offset-deg",
getprop("/sim/current-view/config/pitch-offset-deg"));
setprop("/sim/current-view/goal-roll-offset-deg",
getprop("/sim/current-view/config/roll-offset-deg"));
}
##
# Handler. Reset view to default.
#
@ -60,12 +77,8 @@ resetView = func {
if (getprop("/sim/current-view/view-number") == 6)
return flyby.setpos(1);
setprop("/sim/current-view/goal-heading-offset-deg",
getprop("/sim/current-view/config/heading-offset-deg"));
setprop("/sim/current-view/goal-pitch-offset-deg",
getprop("/sim/current-view/config/pitch-offset-deg"));
setprop("/sim/current-view/goal-roll-offset-deg",
getprop("/sim/current-view/config/roll-offset-deg"));
resetViewPos();
resetViewDir();
resetFOV();
}

View file

@ -167,38 +167,20 @@ current mode for each mouse is held in the
<!-- left button centres view direction; middle + left also resets view point -->
<button n="0">
<binding>
<command>property-assign</command>
<property>/sim/current-view/heading-offset-deg</property>
<property>/sim/view/config/front-direction-deg</property>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/current-view/goal-pitch-offset-deg</property>
<property>/sim/view/config/pitch-offset-deg</property>
<command>nasal</command>
<script>
view.resetViewDir();
view.resetFOV();
</script>
</binding>
<binding>
<condition>
<property>/devices/status/mice/mouse[0]/button[1]</property>
</condition>
<command>property-assign</command>
<property>/sim/current-view/x-offset-m</property>
<property>/sim/view/config/x-offset-m</property>
</binding>
<binding>
<condition>
<property>/devices/status/mice/mouse[0]/button[1]</property>
</condition>
<command>property-assign</command>
<property>/sim/current-view/y-offset-m</property>
<property>/sim/view/config/y-offset-m</property>
</binding>
<binding>
<condition>
<property>/devices/status/mice/mouse[0]/button[1]</property>
</condition>
<command>property-assign</command>
<property>/sim/current-view/z-offset-m</property>
<property>/sim/view/config/z-offset-m</property>
<command>nasal</command>
<script>
view.resetViewPos();
</script>
</binding>
</button>