From: gmungoc Date: Tue, 1 Aug 2017 14:48:30 +0000 (+0200) Subject: JAL-2609 white fill vertical scale before fast paint, corrected endres X-Git-Tag: Release_2_10_3b1~91^2~6^2~22 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4670e8f75896a4b6e2288d94ef48755e46b696c8;p=jalview.git JAL-2609 white fill vertical scale before fast paint, corrected endres --- diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 5796b63..9bab774 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -219,19 +219,25 @@ public class SeqCanvas extends JComponent implements ViewportListenerI 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); } @@ -515,6 +521,9 @@ public class SeqCanvas extends JComponent implements ViewportListenerI } /** + * Draws one width of a wrapped alignment, including scales left, right or + * above, and annnotations, if shown + * * @param g * @param startRes * @param canvasHeight @@ -1410,11 +1419,13 @@ public class SeqCanvas extends JComponent implements ViewportListenerI 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;