Translation should not be adjusted outside annotation loop
[jalview.git] / src / jalview / gui / SeqCanvas.java
index 56e70ac..8a873a2 100755 (executable)
@@ -418,7 +418,16 @@ public class SeqCanvas extends JComponent
     String getMask()\r
     {\r
       String mask = "00";\r
-      for (int i = av.alignment.getWidth(); i > 0; i /= 10)\r
+      int maxWidth = 0;\r
+      int tmp;\r
+      for(int i=0; i<av.alignment.getHeight(); i++)\r
+      {\r
+        tmp = av.alignment.getSequenceAt(i).getEnd();\r
+        if(tmp>maxWidth)\r
+          maxWidth = tmp;\r
+      }\r
+\r
+      for (int i = maxWidth; i > 0; i /= 10)\r
       {\r
         mask += "0";\r
       }\r
@@ -554,14 +563,12 @@ public class SeqCanvas extends JComponent
                 annotations = new AnnotationPanel(av);\r
 \r
               annotations.drawComponent( (Graphics2D) g, startRes, endx+1);\r
-              g.translate(0, -cHeight - ypos);\r
+              g.translate(0, -cHeight - ypos -3);\r
             }\r
             g.setClip(clip);\r
             g.translate(-LABEL_WEST, 0);\r
 \r
             ypos += cHeight+getAnnotationHeight()+hgap;\r
-            if(av.showAnnotation)\r
-              ypos -= 3;\r
 \r
             startRes += cWidth;\r
         }\r