Update DriveableCrossSections to show knob values live
authorBen Morrow <childoftv@gmail.com>
Mon, 19 Aug 2013 04:22:28 +0000 (21:22 -0700)
committerBen Morrow <childoftv@gmail.com>
Mon, 19 Aug 2013 04:22:28 +0000 (21:22 -0700)
BenMorrow.pde

index 9294250cda3e5740a688ccfe61724de74c28c0dd..c632b8df26ec66b57a2a059d62364505e0dcdebb 100644 (file)
@@ -151,13 +151,27 @@ class DriveableCrossSections extends CrossSections
                        {
                                if(interactive())
                                {
-                                       xd.setValue(x.getValue()/200);
-                                       yd.setValue(y.getValue()/200);
-                                       zd.setValue(z.getValue()/100);
+                                       copyValuesToKnobs();
+                               }else{
+                                       copyKnobsToValues();
                                }
                        }
        }
 
+       void copyValuesToKnobs()
+       {
+               xd.setValue(x.getValue()/200);
+               yd.setValue(y.getValue()/115);
+               zd.setValue(z.getValue()/100);
+       }
+
+       void copyKnobsToValues()
+       {
+               x.setValue(xd.getValue()*200);
+               y.setValue(yd.getValue()*115);
+               z.setValue(zd.getValue()*100);
+       }
+
        boolean interactive()
        {
                return Math.round(mode.getValuef())>0.5;
@@ -168,10 +182,11 @@ class DriveableCrossSections extends CrossSections
                if(interactive())
                {
                        xv = xd.getValuef()*200;
-                   yv = yd.getValuef()*200;
+                   yv = yd.getValuef()*115;
                    zv = zd.getValuef()*100;
                }else{
                        super.updateXYZVals();
+                       copyValuesToKnobs();
                }
        }