2f494eb90ce50b0d297a03576d2e90e764ae3252
kate
  Thu Oct 11 13:31:07 2018 -0700
More fixing grab box on flipped curves.  I think I've got it now.  refs #21917

diff --git src/hg/hgTracks/interactTrack.c src/hg/hgTracks/interactTrack.c
index 5e2f132..6fc8280 100644
--- src/hg/hgTracks/interactTrack.c
+++ src/hg/hgTracks/interactTrack.c
@@ -747,31 +747,35 @@
         int peakX = ((upperX - lowerX + 1) / 2) + lowerX;
         int fudge = 30;
         int peakY = peak + fudge; // admittedly a hack (obscure how to define ypeak of curve)
         int y1 = isReversed ? yTarget : ySource;
         int y2 = isReversed ? ySource : yTarget;
         if (drawUp)
             {
             y1 = flipY(tg, y1);
             y2 = flipY(tg, y2);
             peakY = flipY(tg, peakY);
             }
         int maxY = hvGfxCurve(hvg, lowerX, y1, peakX, peakY, upperX, y2, color, isReversed && doDashes);
         // curve drawer does not use peakY as expected, so it returns actual max Y used
         // draw grab box and map box on peak
         if (drawUp)
-            maxY = (maxY - peakY)/2 + tg->customInt;
+            {
+            maxY = (maxY - peakY + 1)/2 + tg->customInt;
+            if (tInfo->offset)
+                maxY += abs(yTarget - ySource)/4;
+            }
         drawPeakMapbox(tg, hvg, inter->chromStart, inter->chromEnd, inter->name, statusBuf,
                             peakX, maxY, peakColor, highlightColor, drawUp);
         }
     else if (draw == DRAW_ELLIPSE)
         {
         // can not support offsets
         int yLeft = yOff + peakHeight;
         int yTop = yOff - peakHeight;
         int ellipseOrient = ELLIPSE_BOTTOM;
         if (drawUp)
             {
             ellipseOrient = ELLIPSE_TOP;
             yLeft = yOff + tg->height - peakHeight;
             yTop = yOff + tg->height + peakHeight;
             }