Fix mouse MMB+LMB: this reset to view[0] parameters independent of the
[fg:toms-fgdata.git] / mice.xml
1 <?xml version="1.0"?>
2 <!--
3 Mouse binding definitions.
4
5 This is a independent configuration file: it is not part of the main
6 FlightGear property tree.
7
8 Currently, Glut supports only one mouse, but the configuration format
9 is designed to support additional mice in the future if possible.  The
10 current mode for each mouse is held in the
11 /devices/status/mice/mouse[n]/mode property.
12 -->
13
14 <PropertyList>
15
16  <mouse n="0">
17
18   <mode-count type="int">3</mode-count>
19   <mode archive="y" type="int">0</mode>
20
21
22   <mode n="0">
23    <cursor>inherit</cursor>
24    <constrained type="bool">false</constrained>
25    <pass-through type="bool">true</pass-through>
26
27    <button n="2">
28     <binding>
29      <command>property-assign</command>
30      <property>/devices/status/mice/mouse[0]/mode</property>
31      <value type="int">1</value>
32     </binding>
33    </button>
34
35    <!-- extra buttons control elevator trim -->
36    <!-- these are often assigned to mouse-wheel motion in Linux -->
37    <button n="3">
38     <binding>
39      <command>property-adjust</command>
40      <property>/controls/flight/elevator-trim</property>
41      <step type="double">0.002</step>
42     </binding>
43    </button>
44
45    <button n="4">
46     <binding>
47      <command>property-adjust</command>
48      <property>/controls/flight/elevator-trim</property>
49      <step type="double">-0.002</step>
50     </binding>
51    </button>
52
53   </mode>
54
55   <mode n="1">
56    <cursor>crosshair</cursor>
57    <constrained type="bool">true</constrained>
58    <pass-through type="bool">false</pass-through>
59
60    <button n="2">
61     <binding>
62      <command>property-assign</command>
63      <property>/devices/status/mice/mouse[0]/mode</property>
64      <value type="int">2</value>
65     </binding>
66    </button>
67
68    <!-- extra buttons control elevator trim -->
69    <!-- these are often assigned to mouse-wheel motion in Linux -->
70    <button n="3">
71     <binding>
72      <command>property-adjust</command>
73      <property>/controls/flight/elevator-trim</property>
74      <step type="double">0.01</step>
75     </binding>
76    </button>
77
78    <button n="4">
79     <binding>
80      <command>property-adjust</command>
81      <property>/controls/flight/elevator-trim</property>
82      <step type="double">-0.01</step>
83     </binding>
84    </button>
85
86    <!-- Mouse left/right motion. -->
87    <x-axis>
88
89     <!-- No buttons pressed: control ailerons -->
90     <binding>
91      <condition>
92       <and>
93        <not>
94         <property>/devices/status/mice/mouse[0]/button[0]</property>
95        </not>
96        <not>
97         <property>/devices/status/mice/mouse[0]/button[1]</property>
98        </not>
99       </and>
100      </condition>
101      <command>property-adjust</command>
102      <property>/controls/flight/aileron</property>
103      <factor type="double">4.0</factor>
104      <min type="double">-1.0</min>
105      <max type="double">1.0</max>
106      <wrap type="bool">false</wrap>
107     </binding>
108
109     <!-- Left button pressed: control rudder -->
110     <binding>
111      <condition>
112       <and>
113        <property>/devices/status/mice/mouse[0]/button[0]</property>
114        <not>
115         <property>/devices/status/mice/mouse[0]/button[1]</property>
116        </not>
117       </and>
118      </condition>
119      <command>property-adjust</command>
120      <property>/controls/flight/rudder</property>
121      <factor type="double">4.0</factor>
122      <min type="double">-1.0</min>
123      <max type="double">1.0</max>
124      <wrap type="bool">false</wrap>
125     </binding>
126
127    </x-axis>
128
129    <!-- Mouse up/down motion -->
130    <y-axis>
131
132     <!-- No buttons pressed: control elevator -->
133     <binding>
134      <condition>
135       <and>
136        <not>
137         <property>/devices/status/mice/mouse[0]/button[0]</property>
138        </not>
139        <not>
140         <property>/devices/status/mice/mouse[0]/button[1]</property>
141        </not>
142       </and>
143      </condition>
144      <command>property-adjust</command>
145      <property>/controls/flight/elevator</property>
146      <factor type="double">-4.0</factor>
147      <min type="double">-1.0</min>
148      <max type="double">1.0</max>
149      <wrap type="bool">false</wrap>
150     </binding>
151
152     <!-- Middle button pressed: control throttle -->
153     <binding>
154      <command>nasal</command>
155      <script>controls.throttleMouse()</script>
156     </binding>
157    </y-axis>
158
159   </mode>
160
161   <!-- Mode 2: view mode -->
162   <mode n="2">
163    <cursor>left-right</cursor>
164    <constrained type="bool">true</constrained>
165    <pass-through type="bool">false</pass-through>
166
167    <!-- left button centres view direction; middle + left also resets view point -->
168    <button n="0">
169     <binding>
170      <command>nasal</command>
171      <script>
172          view.resetViewDir();
173          view.resetFOV();
174      </script>
175     </binding>
176     <binding>
177      <condition>
178       <property>/devices/status/mice/mouse[0]/button[1]</property>
179      </condition>
180      <command>nasal</command>
181      <script>
182          view.resetViewPos();
183      </script>
184     </binding>
185    </button>
186
187    <!-- right button switches modes -->
188    <button n="2">
189     <binding>
190      <command>property-assign</command>
191      <property>/devices/status/mice/mouse[0]/mode</property>
192      <value type="int">0</value>
193     </binding>
194    </button>
195
196    <!-- extra buttons control elevator trim -->
197    <!-- these are often assigned to mouse-wheel motion in Linux -->
198    <button n="3">
199     <binding>
200      <command>property-adjust</command>
201      <property>/controls/flight/elevator-trim</property>
202      <step type="double">0.01</step>
203     </binding>
204    </button>
205
206    <button n="4">
207     <binding>
208      <command>property-adjust</command>
209      <property>/controls/flight/elevator-trim</property>
210      <step type="double">-0.01</step>
211     </binding>
212    </button>
213
214    <!-- Mouse left/right motion -->
215    <x-axis>
216
217     <!-- No buttons pressed: rotate the view left or right -->
218     <binding>
219      <condition>
220       <and>
221        <not>
222         <property>/devices/status/mice/mouse[0]/button[0]</property>
223        </not>
224        <not>
225         <property>/devices/status/mice/mouse[0]/button[1]</property>
226        </not>
227       </and>
228      </condition>
229      <command>property-adjust</command>
230      <property>/sim/current-view/heading-offset-deg</property>
231      <factor type="double">-360</factor>
232      <min type="double">0</min>
233      <max type="double">360</max>
234      <wrap type="bool">true</wrap>
235     </binding>
236
237
238     <!-- Middle button pressed: move the view position left or right -->
239     <binding>
240      <condition>
241       <and>
242        <not>
243         <property>/devices/status/mice/mouse[0]/button[0]</property>
244        </not>
245        <property>/devices/status/mice/mouse[0]/button[1]</property>
246       </and>
247      </condition>
248      <command>property-adjust</command>
249      <property>/sim/current-view/x-offset-m</property>
250      <factor type="double">1</factor>
251      <wrap type="bool">false</wrap>
252     </binding>
253
254    </x-axis>
255
256    <!-- Mouse up/down motion -->
257    <y-axis>
258
259     <!-- No buttons pressed: tilt the view up and down -->
260     <binding>
261      <condition>
262       <and>
263        <not>
264         <property>/devices/status/mice/mouse[0]/button[0]</property>
265        </not>
266        <not>
267         <property>/devices/status/mice/mouse[0]/button[1]</property>
268        </not>
269       </and>
270      </condition>
271      <command>property-adjust</command>
272      <property>/sim/current-view/pitch-offset-deg</property>
273      <factor type="double">-180</factor>
274      <min type="double">-90</min>
275      <max type="double">90</max>
276      <wrap type="bool">false</wrap>
277     </binding>
278
279     <!-- Middle button pressed, no Ctrl: move the view up and down -->
280     <binding>
281      <condition>
282       <and>
283        <not>
284         <property>/devices/status/mice/mouse[0]/button[0]</property>
285        </not>
286        <property>/devices/status/mice/mouse[0]/button[1]</property>
287        <not>
288         <property>/devices/status/keyboard/ctrl</property>
289        </not>
290       </and>
291      </condition>
292      <command>property-adjust</command>
293      <property>/sim/current-view/y-offset-m</property>
294      <factor type="double">-1</factor>
295      <wrap type="bool">false</wrap>
296     </binding>
297
298     <!-- Middle button and Ctrl pressed: move the view forward and backward -->
299     <binding>
300      <condition>
301       <and>
302        <not>
303         <property>/devices/status/mice/mouse[0]/button[0]</property>
304        </not>
305        <property>/devices/status/mice/mouse[0]/button[1]</property>
306        <property>/devices/status/keyboard/ctrl</property>
307       </and>
308      </condition>
309      <command>property-adjust</command>
310      <property>/sim/current-view/z-offset-m</property>
311      <factor type="double">1</factor>
312      <wrap type="bool">false</wrap>
313     </binding>
314
315    </y-axis>
316
317   </mode>
318
319  </mouse>
320
321 </PropertyList>
322