1a973ee0a19b9831e204f6b45a3079ac8f563cfa fanhsu Tue Jul 5 15:51:58 2011 -0700 Fixed a bug in bedPlusLabelDrawAt() when zone to a few bases level. diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index e83cf20..925b161 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -3967,30 +3967,35 @@ tg->items = itemList; } static void bedPlusLabelDrawAt(struct track *tg, void *item, struct hvGfx *hvg, int xOff, int y, double scale, MgFont *font, Color color, enum trackVisibility vis) /* Draw a single bed item at position. If vis is full, draw the associated label to the left * of the item. */ { struct bedPlusLabel *bpl = item; struct bed *bed = item; int heightPer = tg->heightPer; int x1 = round((double)((int)bed->chromStart-winStart)*scale) + xOff; int x2 = round((double)((int)bed->chromEnd-winStart)*scale) + xOff; int w; +// if x1 is calulated to be way off to the left, +// i.e. it has a negative number that will cause the item has a starting position off the screen, +// this may cause a problem that the item does not get displayed, so set x1 to 0 if it is negative. +if (x1 < 0 ) x1 = 0; + if (tg->itemColor != NULL) color = tg->itemColor(tg, bed, hvg); w = x2-x1; if (w < 1) w = 1; hvGfxBox(hvg, x1, y, w, heightPer, color); // In full mode, draw bpl->label to the left of item: if (vis == tvFull) { int textWidth = mgFontStringWidth(font, bpl->label); hvGfxTextRight(hvg, x1-textWidth-2, y, textWidth, heightPer, color, font, bpl->label); } }