af461ddaef211c16a3ca52913df3f4c9a95ed48d kate Thu Sep 12 13:38:55 2019 -0700 Extend labelOnFeature setting to support dense mode w/o labels (as usual in our tracks). Using this feature in chromatin state tracks. refs #24128 diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index 15a1913..7a18109 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -3883,31 +3883,32 @@ && e + 6 >= winStart && s - 6 < winEnd && (e-s <= 3 || !baseColorNeedsCodons)) baseColorDrawItem(tg, lf, sf->grayIx, hvg, xOff, y, scale, font, s, e, heightPer, zoomedToCodonLevel, mrnaSeq, sf, psl, drawOpt, MAXPIXELS, winStart, color); else { if (lf->highlightColor && (lf->highlightMode == highlightOutline)) { drawScaledBox(hvg, s, e, scale, xOff, y, heightPer, lf->highlightColor); drawScaledBox(hvg, s, e, scale, xOff+1, y+1, heightPer-2, color); } else { - if (tg->drawLabelInBox) + if (tg->drawLabelInBox && + !(tg->drawLabelInBoxNotDense && vis == tvDense)) { drawScaledBoxLabel(hvg, s, e, scale, xOff, y, heightPer, color, font, lf->name ); // exon arrows would overlap the text exonArrowsAlways = FALSE; exonArrows = FALSE; } else drawScaledBox(hvg, s, e, scale, xOff, y, heightPer, color); } /* Display barbs only if no intron is visible on the item. This occurs when the exon completely spans the window, or when it is the first or last intron in the feature and @@ -10910,31 +10911,41 @@ if (isSubtrackVisible(subtrack)) ct++; return ct; } enum trackVisibility limitVisibility(struct track *tg) /* Return default visibility limited by number of items and * by parent visibility if part of a coposite track. * This also sets tg->height. */ { if (!tg->limitedVisSet) { tg->limitedVisSet = TRUE; // Prevents recursive loop! // optional setting to draw labels onto the feature boxes, not next to them - tg->drawLabelInBox = cartOrTdbBoolean(cart, tg->tdb, "labelOnFeature" , FALSE); + char *setting = cartOrTdbString(cart, tg->tdb, "labelOnFeature", NULL); + if (setting) + { + if (sameString(setting, "on") || sameString(setting, "true")) + tg->drawLabelInBox = TRUE; + else if (sameString(setting, "noDense")) + { + tg->drawLabelInBox = TRUE; + tg->drawLabelInBoxNotDense = TRUE; + } + } enum trackVisibility vis = tg->visibility; int h; int maxHeight = maximumTrackHeight(tg); if (vis == tvHide) { tg->height = 0; tg->limitedVis = tvHide; return tvHide; } if (tg->subtracks != NULL) { struct track *subtrack; int subCnt = subtrackCount(tg->subtracks); maxHeight = maxHeight * max(subCnt,1);