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:
parent
397ee8296f
commit
3132b5c962
2 changed files with 29 additions and 34 deletions
|
@ -48,11 +48,28 @@ decrease = func {
|
||||||
##
|
##
|
||||||
# Handler. Reset FOV to default.
|
# Handler. Reset FOV to default.
|
||||||
#
|
#
|
||||||
resetFOV = func {
|
var resetFOV = func {
|
||||||
setprop("/sim/current-view/field-of-view",
|
setprop("/sim/current-view/field-of-view",
|
||||||
getprop("/sim/current-view/config/default-field-of-view-deg"));
|
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.
|
# Handler. Reset view to default.
|
||||||
#
|
#
|
||||||
|
@ -60,12 +77,8 @@ resetView = func {
|
||||||
if (getprop("/sim/current-view/view-number") == 6)
|
if (getprop("/sim/current-view/view-number") == 6)
|
||||||
return flyby.setpos(1);
|
return flyby.setpos(1);
|
||||||
|
|
||||||
setprop("/sim/current-view/goal-heading-offset-deg",
|
resetViewPos();
|
||||||
getprop("/sim/current-view/config/heading-offset-deg"));
|
resetViewDir();
|
||||||
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"));
|
|
||||||
resetFOV();
|
resetFOV();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
36
mice.xml
36
mice.xml
|
@ -167,38 +167,20 @@ current mode for each mouse is held in the
|
||||||
<!-- left button centres view direction; middle + left also resets view point -->
|
<!-- left button centres view direction; middle + left also resets view point -->
|
||||||
<button n="0">
|
<button n="0">
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-assign</command>
|
<command>nasal</command>
|
||||||
<property>/sim/current-view/heading-offset-deg</property>
|
<script>
|
||||||
<property>/sim/view/config/front-direction-deg</property>
|
view.resetViewDir();
|
||||||
</binding>
|
view.resetFOV();
|
||||||
<binding>
|
</script>
|
||||||
<command>property-assign</command>
|
|
||||||
<property>/sim/current-view/goal-pitch-offset-deg</property>
|
|
||||||
<property>/sim/view/config/pitch-offset-deg</property>
|
|
||||||
</binding>
|
</binding>
|
||||||
<binding>
|
<binding>
|
||||||
<condition>
|
<condition>
|
||||||
<property>/devices/status/mice/mouse[0]/button[1]</property>
|
<property>/devices/status/mice/mouse[0]/button[1]</property>
|
||||||
</condition>
|
</condition>
|
||||||
<command>property-assign</command>
|
<command>nasal</command>
|
||||||
<property>/sim/current-view/x-offset-m</property>
|
<script>
|
||||||
<property>/sim/view/config/x-offset-m</property>
|
view.resetViewPos();
|
||||||
</binding>
|
</script>
|
||||||
<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>
|
|
||||||
</binding>
|
</binding>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue