From 7af288d91959ba5bcdf906d0cd41e22ca5dad52f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20de=20l=27Hamaide?= <clemaez@hotmail.fr>
Date: Thu, 22 Aug 2013 15:13:50 +0200
Subject: [PATCH] Add translation movement in spring-loaded-view mode

---
 mice.xml | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/mice.xml b/mice.xml
index 1265506a9..b41927cc8 100644
--- a/mice.xml
+++ b/mice.xml
@@ -309,11 +309,38 @@ current mode for each mouse is held in the
    <constrained type="bool">true</constrained>
    <pass-through type="bool">false</pass-through>
 
+   <!-- extra buttons control FoV -->
+   <!-- these are often assigned to mouse-wheel motion in Linux -->
+   <button n="3">
+    <binding>
+     <condition>
+       <property>/devices/status/mice/mouse[0]/button[2]</property>
+     </condition>
+      <command>nasal</command>
+      <script>view.decrease()</script>
+    </binding>
+   </button>
+
+   <button n="4">
+    <binding>
+     <condition>
+       <property>/devices/status/mice/mouse[0]/button[2]</property>
+     </condition>
+      <command>nasal</command>
+      <script>view.increase()</script>
+    </binding>
+   </button>
+
    <!-- Mouse left/right motion -->
    <x-axis>
 
     <!-- rotate the view left or right -->
     <binding>
+     <condition>
+      <not>
+       <property>/devices/status/mice/mouse[0]/button[1]</property>
+      </not>
+     </condition>
      <command>property-adjust</command>
      <property>/sim/current-view/heading-offset-deg</property>
      <factor type="double">-360</factor>
@@ -322,6 +349,17 @@ current mode for each mouse is held in the
      <wrap type="bool">true</wrap>
     </binding>
 
+    <!-- Middle button pressed: move the view position left or right -->
+    <binding>
+     <condition>
+      <property>/devices/status/mice/mouse[0]/button[1]</property>
+     </condition>
+     <command>property-adjust</command>
+     <property>/sim/current-view/x-offset-m</property>
+     <factor type="double">1</factor>
+     <wrap type="bool">false</wrap>
+    </binding>
+
    </x-axis>
 
    <!-- Mouse up/down motion -->
@@ -329,6 +367,11 @@ current mode for each mouse is held in the
 
     <!-- tilt the view up and down -->
     <binding>
+     <condition>
+      <not>
+       <property>/devices/status/mice/mouse[0]/button[1]</property>
+      </not>
+     </condition>
      <command>property-adjust</command>
      <property>/sim/current-view/pitch-offset-deg</property>
      <factor type="double">-180</factor>
@@ -337,8 +380,51 @@ current mode for each mouse is held in the
      <wrap type="bool">false</wrap>
     </binding>
 
+    <!-- Middle button pressed move the view up and down -->
+    <binding>
+     <condition>
+      <property>/devices/status/mice/mouse[0]/button[1]</property>
+     </condition>
+     <command>property-adjust</command>
+     <property>/sim/current-view/y-offset-m</property>
+     <factor type="double">-1</factor>
+     <wrap type="bool">false</wrap>
+    </binding>
+
    </y-axis>
 
+   <y-axis-ctrl>
+       <!-- Middle button and Ctrl pressed: move the view forward and backward -->
+       <binding>
+        <condition>
+         <property>/devices/status/mice/mouse[0]/button[1]</property>
+        </condition>
+        <command>property-adjust</command>
+        <property>/sim/current-view/z-offset-m</property>
+        <factor type="double">1</factor>
+        <wrap type="bool">false</wrap>
+       </binding>
+
+       <binding>
+         <condition>
+           <not><property>/devices/status/mice/mouse[0]/button[1]</property></not>
+         </condition>
+         <command>property-adjust</command>
+         <property>/sim/current-view/y-offset-m</property>
+         <factor type="double">-1</factor>
+         <wrap type="bool">false</wrap>
+       </binding>
+    </y-axis-ctrl>
+
+    <x-axis-ctrl>
+       <binding>
+         <command>property-adjust</command>
+         <property>/sim/current-view/x-offset-m</property>
+         <factor type="double">1</factor>
+         <wrap type="bool">false</wrap>
+       </binding>
+    </x-axis-ctrl>
+
   </mode>
     
  </mouse> <!-- of mouse 0 -->