]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/utils/GridSpacing.java
Two rendering glitch fixes for time series charts
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / utils / GridSpacing.java
index 3702bc4b1a5a2923b1ca55291b1bfb81792d04af..a692b09ea44a66246fcead734584a7d93dca335b 100644 (file)
@@ -79,7 +79,8 @@ public final class GridSpacing implements Serializable {
                double minPixels)
     {
         if (controlWidth==0) controlWidth = 1;
-        if (Math.abs(viewboxSize) < GRID_MIN_USER_SIZE) viewboxSize = GRID_MIN_USER_SIZE * Math.signum(viewboxSize);
+        // This prevents clients from getting the proper GridSpacing information.
+        //if (Math.abs(viewboxSize) < GRID_MIN_USER_SIZE) viewboxSize = GRID_MIN_USER_SIZE * Math.signum(viewboxSize);
 
         double unitsPerPixel = viewboxSize / Math.max(controlWidth, minPixels);
         double [] gridSpacing = getGridSpacing(unitsPerPixel, minPixels);
@@ -115,4 +116,16 @@ public final class GridSpacing implements Serializable {
         return GridUtils.snapToGrid(pos, segment);
     }
 
+    @Override
+    public String toString() {
+        return String.format("%s [minPixels=%.15f, segment=%.15f, segmentExp=%.15f, pixelsPerUnit=%.15f, unitsPerPixel=%.15f, pixelsPerSegment=%.15f]",
+                getClass().getName(),
+                minPixels,
+                segment,
+                segmentExp,
+                pixelsPerUnit,
+                unitsPerPixel,
+                pixelsPerSegment);
+    }
+
 }