945f5d7edf71441361f635d0f7bdbfde854e9f8a
braney
  Mon Mar 7 17:31:15 2016 -0800
fix problem with chain line disappearing when way zoomed in #15209 note
35

diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index 45563ab..4ba21a7 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -3453,30 +3453,34 @@
 	int s, e, qGap, tGap;
 	int x1, x2, w;
 	if (sf->start >= sf->next->end)
 	    {
 	    s = sf->next->end;
 	    e = sf->start;
 	    }
 	else
 	    {
 	    s = sf->end;
 	    e = sf->next->start;
 	    }
 	if (rangeIntersection(winStart, winEnd, s, e) <= 0)
 	    continue;
 	tGap = e - s;
+        if (s < winStart)
+            s = winStart;
+        if (e > winEnd)
+            e = winEnd;
 	if (sf->qStart >= sf->next->qEnd)
 	    qGap = sf->qStart - sf->next->qEnd;
 	else
 	    qGap = sf->next->qStart - sf->qEnd;
 
 	x1 = round((double)((int)s-winStart)*scale) + xOff;
 	x2 = round((double)((int)e-winStart)*scale) + xOff;
 	w = x2 - x1;
 	if (chainLines && tGap > 0)
 	    {
 	    /* Compensate for innerLine's lopping off of a pixel at each end: */
 	    x1 -= 1;
 	    w += 2;
             /* If the gap in the target is more than gapFactor times the gap
              * in the query we draw only one line, otherwise two. */