src/hg/hgTracks/simpleTracks.c 1.131

1.131 2010/04/07 03:38:15 markd
Better handling of rounding when capping width of label area to 1/2 of width of size of image
Index: src/hg/hgTracks/simpleTracks.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/simpleTracks.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -b -B -U 4 -r1.130 -r1.131
--- src/hg/hgTracks/simpleTracks.c	1 Apr 2010 03:18:02 -0000	1.130
+++ src/hg/hgTracks/simpleTracks.c	7 Apr 2010 03:38:15 -0000	1.131
@@ -231,13 +231,14 @@
 leftLabelWidthChars = cartUsualInt(cart, "hgt.labelWidth", leftLabelWidthDefaultChars);
 if (leftLabelWidthChars < 2)
     leftLabelWidthChars = leftLabelWidthDefaultChars;
 tl.leftLabelWidth = leftLabelWidthChars*tl.nWidth + trackTabWidth;
-if (tl.leftLabelWidth > 0.5*tl.picWidth)
+int maxLabelWidth = 0.5*tl.picWidth;
+if (tl.leftLabelWidth  > maxLabelWidth)
     {
     // overflow, force to 1/2 width
-    tl.leftLabelWidth = 0.5*tl.picWidth;
-    leftLabelWidthChars = tl.leftLabelWidth/tl.nWidth;
+    leftLabelWidthChars = maxLabelWidth/tl.nWidth;
+    tl.leftLabelWidth = leftLabelWidthChars * tl.nWidth;
     }
 }
 
 static boolean isTooLightForTextOnWhite(struct hvGfx *hvg, Color color)