JAL-147 correct width out-by-one drawing ids
[jalview.git] / src / jalview / gui / IdCanvas.java
index 2ebdbba..052c527 100755 (executable)
@@ -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++)
       {