ab923da8deeb3fc3bd5d04fa84e36090c6bcb129
tdreszer
  Tue Apr 22 16:47:33 2014 -0700
Added a trap for when map items are written outside the track they are supposed to be for.  The trap is only on for genome-test and sandboxes.  I found one bug with it: gold in dense had wild map item ending coordinates.  Fixed.  Redmine #13087
diff --git src/hg/hgTracks/goldTrack.c src/hg/hgTracks/goldTrack.c
index 955f706..e8dfd58 100644
--- src/hg/hgTracks/goldTrack.c
+++ src/hg/hgTracks/goldTrack.c
@@ -92,30 +92,34 @@
     {
     int midY = y + midLineOff;
     for (gap = tg->customPt; gap != NULL; gap = gap->next)
 	{
 	if (!sameWord(gap->bridge, "no"))
 	    {
 	    drawScaledBox(hvg, gap->chromStart, gap->chromEnd, scale, xOff, midY, 1, brown);
 	    }
 	}
     }
 
 for (frag = tg->items; frag != NULL; frag = frag->next)
     {
     x1 = round((double)((int)frag->chromStart-winStart)*scale) + xOff;
     x2 = round((double)((int)frag->chromEnd-winStart)*scale) + xOff;
+    if (x1 < insideX)
+        x1 = insideX;
+    if (x2 > insideX+width)
+        x2 = insideX+width;
     w = x2-x1;
     color =  ((ix&1) ? gold : brown);
     pink = ((ix&1) ? pink1 : pink2);
     if (w < 1)
 	w = 1;
     if (sameString(frag->type, "A")) color = pink;
     hvGfxBox(hvg, x1, y, w, heightPer, color);
     if (isFull)
 	y += lineHeight;
     else if (baseWidth < 10000000)
 	{
 	char status[256];
 	sprintf(status, "%s:%d-%d %s %s:%d-%d", 
 	    frag->frag, frag->fragStart, frag->fragEnd,
 	    frag->strand,