]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.g3d/src/org/simantics/g3d/property/DoubleArrayPropertyManipulator2.java
Eliminate rounding errors in property tabs.
[simantics/3d.git] / org.simantics.g3d / src / org / simantics / g3d / property / DoubleArrayPropertyManipulator2.java
index 82e9a0622b56be02123b27d33889f85af2968236..9275bfead2e9dbdfc63bf1dc196472eeb1fbaf1f 100644 (file)
@@ -11,6 +11,8 @@
  *******************************************************************************/
 package org.simantics.g3d.property;
 
+import org.simantics.g3d.math.MathTools;
+
 public class DoubleArrayPropertyManipulator2 implements PropertyManipulator {
        
        ValueProvider provider;
@@ -51,11 +53,13 @@ public class DoubleArrayPropertyManipulator2 implements PropertyManipulator {
                }
                try {
                    double[] val = getValue();
+                   if (val == null)
+                       return null;
                    if (val.length == i)
                        return "New";
             if (val.length < i)
                 return null;
-            return Double.toString(val[i]);
+            return Double.toString(MathTools.round(val[i], 10));
                } catch (Exception e) {
                        return null;
                }