9ca1124c0c987a2669356f171ff681934cfebf16 chmalee Mon Feb 7 11:06:18 2022 -0800 Fix disappearing barCharts when zooming in, refs #28876 diff --git src/hg/hgTracks/barChartTrack.c src/hg/hgTracks/barChartTrack.c index 0b518c1..6fcea00 100644 --- src/hg/hgTracks/barChartTrack.c +++ src/hg/hgTracks/barChartTrack.c @@ -637,32 +637,33 @@ AllocVar(itemInfo); itemInfo->bed = (struct bed *)bed; slAddHead(&list, itemInfo); itemInfo->height = barChartItemHeight(tg, itemInfo); } slReverse(&list); tg->items = list; } /***********************************************/ /* Draw */ static int barChartX(struct bed *bed) /* Locate chart on X, relative to viewport. */ { -// int start = max(bed->chromStart, winStart); // Consider making this simply bed->chromStart -jk -int start = bed->chromStart; +// use the max() here because otherwise items that begin to the left +// of the window may not be visible +int start = max(bed->chromStart, winStart); double scale = scaleForWindow(insideWidth, winStart, winEnd); int x1 = round((start - winStart) * scale); return x1; } static void drawGraphBox(struct track *tg, struct barChartItem *itemInfo, struct hvGfx *hvg, int x, int y) /* Draw white background for graph */ { Color lighterGray = MAKECOLOR_32(0xE8, 0xE8, 0xE8); int width = chartWidth(tg, itemInfo); int height = chartHeight(tg, itemInfo); hvGfxOutlinedBox(hvg, x, y-height, width, height, MG_WHITE, lighterGray); }