From cce7a27fac3a9915a733021fd85368ab0a1e862b Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 22 Aug 2017 13:24:24 +0100 Subject: [PATCH] JAL-2609 corrections for print wrapped view --- src/jalview/gui/SeqCanvas.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index a4c7da5..55e6182 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -179,6 +179,7 @@ public class SeqCanvas extends JComponent implements ViewportListenerI * Draw the scale to the left or right of a wrapped alignment * * @param g + * graphics context, positioned at the start of the scale to be drawn * @param startx * first column of wrapped width (0.. excluding any hidden columns) * @param endx @@ -237,9 +238,7 @@ public class SeqCanvas extends JComponent implements ViewportListenerI g.setColor(Color.white); int y = (ypos + (i * charHeight)) - (charHeight / 5); y -= charHeight; // fillRect: origin is top left of rectangle - int xpos = left ? 0 : labelWidthWest + charWidth - * av.getRanges().getViewportWidth(); - g.fillRect(xpos, y, left ? labelWidthWest : labelWidthEast, + g.fillRect(0, y, left ? labelWidthWest : labelWidthEast, charHeight + 1); y += charHeight; // drawString: origin is bottom left of text @@ -252,9 +251,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI */ String valueAsString = String.valueOf(value); int justify = fm.stringWidth(valueAsString) + charWidth; - xpos = left ? labelWidthWest - justify + charWidth / 2 - : getWidth() - justify - charWidth / 2; - + int xpos = left ? labelWidthWest - justify + charWidth / 2 + : labelWidthEast - justify + charWidth / 2; g.setColor(Color.black); g.drawString(valueAsString, xpos, y); } @@ -712,7 +710,10 @@ public class SeqCanvas extends JComponent implements ViewportListenerI if (av.getScaleRightWrapped()) { + int x = labelWidthWest + viewportWidth * charWidth; + g.translate(x, 0); drawVerticalScale(g, startColumn, endColumn, ypos, false); + g.translate(-x, 0); } /* @@ -777,7 +778,7 @@ public class SeqCanvas extends JComponent implements ViewportListenerI xMiddle + charHeight / 4, xMiddle }; int yTop = ypos - (charHeight / 2); int[] yPoints = new int[] { yTop, yTop, yTop + 8 }; - gg.fillPolygon(xPoints, yPoints, 3); + g.fillPolygon(xPoints, yPoints, 3); } } -- 1.7.10.2