dc12783aae8e908620e0c768f7c9d03e5142858c
kate
  Sun Jan 28 19:58:53 2018 -0800
More fixes to other chrom labels. refs #17512

diff --git src/hg/hgTracks/interactTrack.c src/hg/hgTracks/interactTrack.c
index 451bafa..0108dbf 100644
--- src/hg/hgTracks/interactTrack.c
+++ src/hg/hgTracks/interactTrack.c
@@ -81,36 +81,37 @@
     if (width > maxWidth)
         maxWidth = width;
     }
 //uglyf("Max width is %d. ", maxWidth);
 for (inter=inters; inter; inter=inter->next)
     {
     if (sameString(inter->chrom1, inter->chrom2))
         nSame++;
     else
         {
         nOther++;
         if (!doOtherLabels)
             continue;
         int labelWidth = vgGetFontStringWidth(hvg->vg, font, inter->chrom2);
         // TODO: simplify now that center approach is abandoned
-        int sx = ((inter->chromStart1 - seqStart) + .5) * scale + xOff; // x coord of center
+        int sx = ((inter->chromStart - seqStart) + .5) * scale + xOff; // x coord of center
         int labelStart = (double)sx - labelWidth/2;
         int labelEnd = labelStart + labelWidth - 1;
+        char *otherChrom = (inter->strand[0] == '+') ? inter->chrom2 : inter->chrom1;
         if (labelStart <= prevLabelEnd && 
                 !(labelStart == prevLabelStart && labelEnd == prevLabelEnd && 
-                    sameString(inter->chrom1, prevLabel)))
+                    sameString(otherChrom, prevLabel)))
             doOtherLabels = FALSE;
         prevLabelStart = labelStart;
         prevLabelEnd = labelEnd;
         prevLabel = inter->chrom2;
         }
     }
 int fontHeight = vgGetFontPixelHeight(hvg->vg, font);
 int otherHeight = (nOther) ? 3 * fontHeight : 0;
 int sameHeight = (nSame) ? tg->height - otherHeight: 0;
 
 // Draw items
 //uglyf("IN seqStart=%d", seqStart);
 for (inter=inters; inter; inter=inter->next)
     {
     safef(itemBuf, sizeof itemBuf, "%s", inter->name);
@@ -131,30 +132,36 @@
     unsigned lowStart, lowEnd, highStart, highEnd;
     if (inter->chromStart1 < inter->chromStart2)
         {
         lowStart = inter->chromStart1;
         lowEnd = inter->chromEnd1;
         highStart = inter->chromStart2;
         highEnd = inter->chromEnd2;
         }
     else
         {
         lowStart = inter->chromStart2;
         lowEnd = inter->chromEnd2;
         highStart = inter->chromStart1;
         highEnd = inter->chromEnd1;
         }
+    // TODO: cleanup
+    if (differentString(inter->chrom1, inter->chrom2))
+        {
+        lowStart = inter->chromStart;
+        lowEnd = inter->chromEnd;
+        }
     unsigned s = lowStart + ((double)(lowEnd - lowStart + .5) / 2);
     int sx = ((s - seqStart) + .5) * scale + xOff; // x coord of center (lower region)
 //uglyf("<br>IN seqStart=%d, start=%d, start1=%d, end1=%d, start2=%d, end2=%d, end=%d, s=%d, sx=%d. ", 
         //seqStart, inter->chromStart, inter->chromStart1, inter->chromEnd1, 
         //inter->chromStart2, inter->chromEnd2, inter->chromEnd, s, sx);
     unsigned sw = lowEnd - lowStart;
     int sFootWidth = scale * (double)sw / 2;       // width in pixels of half foot (lower)
     if (sFootWidth == 0)
         sFootWidth = 1;
 
     unsigned e = highStart + (double)(highEnd - highStart + .5) / 2;
     int ex = ((e - seqStart) + .5) * scale + xOff;
     unsigned ew = highEnd - highStart;
     int eFootWidth = scale * (double)ew / 2;
     if (eFootWidth == 0)