if (value != -1)
{
/*
- * draw scale value, justified, with half a character width
+ * white fill the space for the scale
+ */
+ g.setColor(Color.white);
+ int y = (ypos + (i * charHeight)) - (charHeight / 5);
+ y -= charHeight; // fillRect: origin is top left of rectangle
+ int xpos = left ? 0 : getWidth() - labelWidthEast;
+ g.fillRect(xpos, y, left ? labelWidthWest : labelWidthEast,
+ charHeight + 1);
+ y += charHeight; // drawString: origin is bottom left of text
+
+ /*
+ * draw scale value, right justified, with half a character width
* separation from the sequence data
*/
String valueAsString = String.valueOf(value);
int justify = fm.stringWidth(valueAsString) + charWidth;
- int xpos = left ? labelWidthWest - justify + charWidth / 2
+ xpos = left ? labelWidthWest - justify + charWidth / 2
: getWidth() - justify - charWidth / 2;
- g.setColor(Color.white);
- int y = (ypos + (i * charHeight)) - (charHeight / 5);
- y -= charHeight; // fillRect starts from top right of rectangle
- g.fillRect(xpos, y, justify - charWidth, charHeight + 1);
- y += charHeight; // drawString starts from bottom right of text
g.setColor(Color.black);
g.drawString(valueAsString, xpos, y);
}
}
/**
+ * Draws one width of a wrapped alignment, including scales left, right or
+ * above, and annnotations, if shown
+ *
* @param g
* @param startRes
* @param canvasHeight
if (av.getScaleLeftWrapped())
{
- drawVerticalScale(gg, xpos, xpos + viewportWidth, y + hgap, true);
+ drawVerticalScale(gg, xpos, xpos + viewportWidth - 1, y + hgap,
+ true);
}
if (av.getScaleRightWrapped())
{
- drawVerticalScale(gg, xpos, xpos + viewportWidth, y + hgap, false);
+ drawVerticalScale(gg, xpos, xpos + viewportWidth - 1, y + hgap,
+ false);
}
y -= repeatHeight;