From: gmungoc Date: Mon, 3 Jul 2017 14:27:01 +0000 (+0100) Subject: JAL-147 correct width out-by-one drawing ids X-Git-Tag: Release_2_10_3b1~132^2~58 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2de7aa8723cfe5071041cdf5b2c61c71646f637f;p=jalview.git JAL-147 correct width out-by-one drawing ids --- diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index 991f3ea..48c0c40 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -101,7 +101,7 @@ public class IdCanvas extends Panel implements ViewportListenerI public void fastPaint(int vertical) { - if (gg == null) + if (gg == null || av.getWrapAlignment()) { repaint(); return; @@ -306,8 +306,7 @@ public class IdCanvas extends Panel implements ViewportListenerI int cHeight = alheight * avcharHeight + hgap + annotationHeight; - int rowSize = av.getRanges().getEndRes() - - av.getRanges().getStartRes(); + int rowSize = av.getRanges().getViewportWidth(); // hardwired italic IDs in applet currently Font italic = new Font(av.getFont().getName(), Font.ITALIC, av @@ -318,8 +317,9 @@ public class IdCanvas extends Panel implements ViewportListenerI * draw repeating sequence ids until out of sequence data or * out of visible space, whichever comes first */ - for (int ypos = hgap, row = av.getRanges().getStartRes(); (ypos <= getSize().height) - && (row < maxwidth); ypos += cHeight, row += rowSize) + int ypos = hgap; + int row = av.getRanges().getStartRes(); + while ((ypos <= getHeight()) && (row < maxwidth)) { for (int i = starty; i < alheight; i++) { @@ -339,6 +339,8 @@ public class IdCanvas extends Panel implements ViewportListenerI labels.drawComponent(gg, getSize().width); gg.translate(0, -ypos - (alheight * avcharHeight)); } + ypos += cHeight; + row += rowSize; } } diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 2ebdbba..052c527 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -404,15 +404,15 @@ public class IdCanvas extends JPanel implements ViewportListenerI ViewportRanges ranges = av.getRanges(); - int rowSize = ranges.getEndRes() - ranges.getStartRes(); + int rowSize = ranges.getViewportWidth(); /* * draw repeating sequence ids until out of sequence data or * out of visible space, whichever comes first */ int ypos = hgap; - for (int row = ranges.getStartRes(); (ypos <= getHeight()) - && (row < maxwidth);) + int row = ranges.getStartRes(); + while ((ypos <= getHeight()) && (row < maxwidth)) { for (int i = starty; i < alheight; i++) {