061029a5f7327cbb496212416eb708b7c19a3fab
braney
  Tue Apr 29 12:24:16 2014 -0700
prevent rmsk track from making map box off-screen
diff --git src/hg/hgTracks/rmskTrack.c src/hg/hgTracks/rmskTrack.c
index 09ed8ca..ece7cf5 100644
--- src/hg/hgTracks/rmskTrack.c
+++ src/hg/hgTracks/rmskTrack.c
@@ -102,30 +102,34 @@
 	safecpy(class, sizeof(class), ro.repClass);
 	char *p = &(class[strlen(class)-1]);
 	if (*p == '?')
 	    *p = '\0';
 	if (endsWith(class, "RNA"))
 	    safecpy(class, sizeof(class), "RNA");
 	ri = hashFindVal(hash, class);
 	if (ri == NULL)
 	   ri = otherRepeatItem;
 	percId = 1000 - ro.milliDiv - ro.milliDel - ro.milliIns;
 	grayLevel = grayInRange(percId, 500, 1000);
 	col = shadesOfGray[grayLevel];
 	x1 = roundingScale(ro.genoStart-winStart, width, baseWidth)+xOff;
 	x1 = max(x1, 0);
 	x2 = roundingScale(ro.genoEnd-winStart, width, baseWidth)+xOff;
+	if (x1 < insideX)
+	    x1 = insideX;
+	if (x2 > insideX+width)
+	    x2 = insideX+width;
 	w = x2-x1;
 	if (w <= 0)
 	    w = 1;
 	hvGfxBox(hvg, x1, ri->yOffset, w, heightPer, col);
 	if (baseWidth <= 100000)
 	    {
 	    if (ri == otherRepeatItem)
 		{
 		sprintf(statusLine, "Repeat %s, family %s, class %s",
 		    ro.repName, ro.repFamily, ro.repClass);
 		}
 	    else
 		{
 		sprintf(statusLine, "Repeat %s, family %s",
 		    ro.repName, ro.repFamily);