ecd4f71ea1c566e01e66eb050657f0270f5dc278
angie
  Tue Dec 6 08:58:41 2011 -0800
Feature #3711 (VCF haplo-sorting display): David requested that non-leafbranches always appear as rectangles.  Now the triangular vs. rectangular
option applies only to leaf clusters.

diff --git src/hg/hgTracks/vcfTrack.c src/hg/hgTracks/vcfTrack.c
index 5456212..b051fa9 100644
--- src/hg/hgTracks/vcfTrack.c
+++ src/hg/hgTracks/vcfTrack.c
@@ -811,60 +811,54 @@
 	// returned both yStart and yEnd. However, the time to draw a tree of
 	// 2188 hap's (1kG phase1 interim) is in the noise, so I consider it
 	// not worth the effort of refactoring to save a sub-millisecond here.
 	int yStartLeft = rDrawTreeInLabelArea(ht->left, hvg, yrtStart, x+branchW,
 					      yFromNode, yh, th, drawRectangle);
 	int yEndLeft = rDrawTreeInLabelArea(ht->left, hvg, yrtEnd, x+branchW,
 					    yFromNode, yh, th, drawRectangle);
 	int yStartRight = rDrawTreeInLabelArea(ht->right, hvg, yrtStart, x+branchW,
 					       yFromNode, yh, th, drawRectangle);
 	int yEndRight = rDrawTreeInLabelArea(ht->right, hvg, yrtEnd, x+branchW,
 					     yFromNode, yh, th, drawRectangle);
 	int yStart = min(yStartLeft, yStartRight);
 	int yEnd = max(yEndLeft, yEndRight);
 	midY = (yStart + yEnd) / 2;
 	Color col = (ht->childDistance == 0) ? purple : MG_BLACK;
-	if (drawRectangle)
+	if (drawRectangle || ht->childDistance != 0)
 	    {
 	    hvGfxLine(hvg, x+branchW-1, yStart, x+branchW-1, yEnd-1, col);
 	    hvGfxLine(hvg, x+branchW, yStart, labelEnd, yStart, col);
 	    hvGfxLine(hvg, x+branchW, yEnd-1, labelEnd, yEnd-1, col);
 	    }
 	else
 	    {
-	    hvGfxLine(hvg, x, midY, labelEnd, yStart, col);
-	    hvGfxLine(hvg, x, midY, labelEnd, yEnd-1, col);
+	    hvGfxLine(hvg, x, midY, labelEnd-1, yStart, col);
+	    hvGfxLine(hvg, x, midY, labelEnd-1, yEnd-1, col);
 	    }
 	addClusterMapItem(ht, x, yStart, labelEnd, yEnd-1, th);
 	}
     else
 	{
 	int leftMid = rDrawTreeInLabelArea(ht->left, hvg, yrtMidPoint, x+branchW,
 					   yFromNode, yh, th, drawRectangle);
 	int rightMid = rDrawTreeInLabelArea(ht->right, hvg, yrtMidPoint, x+branchW,
 					    yFromNode, yh, th, drawRectangle);
 	midY = (leftMid + rightMid) / 2;
-	if (drawRectangle)
 	    hvGfxLine(hvg, x+branchW-1, leftMid, x+branchW-1, rightMid, MG_BLACK);
-	else
-	    {
-	    hvGfxLine(hvg, x, midY, x+branchW-1, leftMid, MG_BLACK);
-	    hvGfxLine(hvg, x, midY, x+branchW-1, rightMid, MG_BLACK);
-	    }
 	addClusterMapItem(ht, x, min(leftMid, rightMid), x+branchW-1, max(leftMid, rightMid), th);
 	}
-    if (drawRectangle)
+    if (drawRectangle || ht->childDistance != 0)
 	hvGfxLine(hvg, x, midY, x+branchW-1, midY, MG_BLACK);
     return midY;
     }
 else if (ht->left != NULL)
     return rDrawTreeInLabelArea(ht->left, hvg, yType, x, yFromNode, yh, th, drawRectangle);
 else if (ht->right != NULL)
     return rDrawTreeInLabelArea(ht->right, hvg, yType, x, yFromNode, yh, th, drawRectangle);
 // Leaf node -- return pixel height. Draw a line if yType is midpoint.
 int y = yFromNode(ht->itemOrCluster, yh, yType);
 if (yType == yrtMidPoint && x < labelEnd)
     {
     hvGfxLine(hvg, x, y, labelEnd, y, purple);
     addClusterMapItem(ht, x, y, labelEnd, y+1, th);
     }
 return y;