b41f407745c2718df50d2a19553dd2b04d44f2f6 kate Thu Oct 11 13:05:10 2018 -0700 Revert overly complex approach to peak mapbox placement. refs #21917 diff --git src/hg/hgTracks/interactTrack.c src/hg/hgTracks/interactTrack.c index 25440cb..0b937c4 100644 --- src/hg/hgTracks/interactTrack.c +++ src/hg/hgTracks/interactTrack.c @@ -502,36 +502,35 @@ char buf[256]; safef(buf, sizeof(buf),"foot=%s", cgiEncode(item)); clickArg = cloneString(buf); } char *itemBuf = isEmptyTextField(item) ? status : item; if (drawUp) y = flipY(tg, y) - 3; hvGfxBox(hvg, x-1, y, 3, 2, peakColor); hvGfxBox(hvg, x, y, 1, 1, highlightColor); mapBoxHgcOrHgGene(hvg, start, end, x - width, y, width * 2, 4, tg->track, item, itemBuf, NULL, TRUE, clickArg); } void drawPeakMapbox(struct track *tg, struct hvGfx *hvg, int seqStart, int seqEnd, char *item, char *status, int x, int y, - Color peakColor, Color highlightColor, boolean drawUp, int drawMode) + Color peakColor, Color highlightColor, boolean drawUp) /* Draw grab box and add map box */ { -int yAdjust = (drawMode == DRAW_CURVE ? 3 : 0); if (drawUp) - y = flipY(tg, y) - yAdjust; + y = flipY(tg, y); hvGfxBox(hvg, x-1, y-1, 3, 3, peakColor); hvGfxBox(hvg, x, y, 1, 1, highlightColor); mapBoxHgcOrHgGene(hvg, seqStart, seqEnd, x-1, y-1, 3, 3, tg->track, item, status, NULL, TRUE, NULL); } static void drawInteractItems(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont *font, Color color, enum trackVisibility vis) /* Draw a list of interact items with connectors (e.g. curves) */ { // Determine drawing mode int draw = DRAW_LINE; boolean doDashes = FALSE; if (vis != tvDense) @@ -727,74 +726,74 @@ upperX = tOnScreen ? tX : xOff + width; } else { lowerX = tOnScreen ? tX : xOff; upperX = sOnScreen ? sX : xOff + width; } if (draw == DRAW_LINE || !sOnScreen || !tOnScreen || hvg->rc) { // draw horizontal line between region centers at 'peak' height drawLine(tg, hvg, lowerX, peak, upperX, peak, color, isReversed && doDashes, drawUp); // draw grab box and map box on mid-point of horizontal line int xMap = lowerX + (double)(upperX-lowerX)/2; drawPeakMapbox(tg, hvg, inter->chromStart, inter->chromEnd, itemBuf, statusBuf, - xMap, peak, peakColor, highlightColor, drawUp, DRAW_LINE); + xMap, peak, peakColor, highlightColor, drawUp); continue; } // Draw curves if (draw == DRAW_CURVE) { 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; drawPeakMapbox(tg, hvg, inter->chromStart, inter->chromEnd, inter->name, statusBuf, - peakX, maxY, peakColor, highlightColor, drawUp, draw); + 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; } hvGfxEllipseDraw(hvg, lowerX, yLeft, upperX, yTop, color, ellipseOrient, isReversed && doDashes); // draw grab box and map box on peak int maxY = peakHeight + yOff; int peakX = ((upperX - lowerX + 1) / 2) + lowerX; drawPeakMapbox(tg, hvg, inter->chromStart, inter->chromEnd, inter->name, statusBuf, - peakX, maxY, peakColor, highlightColor, drawUp, draw); + peakX, maxY, peakColor, highlightColor, drawUp); } } } void interactLinkedFeaturesDrawAt(struct track *tg, void *item, struct hvGfx *hvg, int xOff, int y, double scale, MgFont *font, Color color, enum trackVisibility vis) /* Draw an item with target in contrasting color */ { struct linkedFeatures *lf = item; if (vis == tvDense) { lf->filterColor = slightlyDarkerColor(hvg, MG_GRAY); // can't distinguish overlapping colors, so force to gray }