d1d559e9bee7fcaec3a50ae43688ca436656ad7b kate Wed Nov 18 08:25:58 2015 -0800 Finish variable height item packing. Adds an optional rowSizes field to spaceSaver. refs #15645 diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index 8e8d0e1..70f30c5 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -3333,31 +3333,46 @@ int eClp = (e > winEnd) ? winEnd : e; int x1 = round((sClp - winStart)*scale) + xOff; int x2 = round((eClp - winStart)*scale) + xOff; int textX = x1; if (tg->drawLabelInBox) withLeftLabels = FALSE; if (tg->itemNameColor != NULL) { color = tg->itemNameColor(tg, item, hvg); labelColor = color; if (withLeftLabels && isTooLightForTextOnWhite(hvg, color)) labelColor = somewhatDarkerColor(hvg, color); } -int y = yOff + tg->lineHeight * sn->row; + +// get y offset for item in pack mode +int yRow = 0; +if (tg->ss && tg->ss->rowSizes != NULL) + { + int i; + for (i=0; i < sn->row; i++) + yRow += tg->ss->rowSizes[i]; + int itemHeight = tg->itemHeight(tg, item); + yRow += (tg->ss->rowSizes[sn->row] - itemHeight + 1); + tg->heightPer = itemHeight; + } +else + yRow = tg->lineHeight * sn->row; +int y = yOff + yRow; + tg->drawItemAt(tg, item, hvg, xOff, y, scale, font, color, vis); /* pgSnpDrawAt may change withIndividualLabels between items */ boolean withLabels = (withLeftLabels && withIndividualLabels && (vis == tvPack) && !tg->drawName); if (withLabels) { char *name = tg->itemName(tg, item); int nameWidth = mgFontStringWidth(font, name); int dotWidth = tl.nWidth/2; boolean snapLeft = FALSE; boolean drawNameInverted = highlightItem(tg, item); textX -= nameWidth + dotWidth; snapLeft = (textX < insideX); /* Special tweak for expRatio in pack mode: force all labels * left to prevent only a subset from being placed right: */