-
Notifications
You must be signed in to change notification settings - Fork 2
/
J3Cub-mice.xml
100 lines (86 loc) · 4.14 KB
/
J3Cub-mice.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2015 onox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<PropertyList>
<mouse n="0">
<mode n="0">
<button n="3">
<binding n="0">
<script></script>
</binding>
<binding n="1">
<condition>
<property>/sim/current-view/can-change-z-offset</property>
</condition>
<command>nasal</command>
<script>
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");
# Round distance to a multiple of the step
distance = math.round(std.min(-min_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meter", abs(getprop("/sim/current-view/z-offset-m"))));
</script>
</binding>
<binding n="2">
<condition>
<and>
<not>
<property>/sim/current-view/can-change-z-offset</property>
</not>
<property>/devices/status/mice/mouse[0]/button[2]</property>
<not><property>/sim/mouse/right-button-mode-cycle-enabled</property></not>
</and>
</condition>
<command>nasal</command>
<script>view.decrease()</script>
</binding>
</button>
<button n="4">
<binding n="0">
<script></script>
</binding>
<binding n="1">
<condition>
<property>/sim/current-view/can-change-z-offset</property>
</condition>
<command>nasal</command>
<script>
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");
# Round distance to a multiple of the step
distance = math.round(std.max(-max_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meter", abs(getprop("/sim/current-view/z-offset-m"))));
</script>
</binding>
<binding n="2">
<condition>
<and>
<not>
<property>/sim/current-view/can-change-z-offset</property>
</not>
<property>/devices/status/mice/mouse[0]/button[2]</property>
<not><property>/sim/mouse/right-button-mode-cycle-enabled</property></not>
</and>
</condition>
<command>nasal</command>
<script>view.increase()</script>
</binding>
</button>
</mode>
</mouse>
</PropertyList>