Offsets
[jalview.git] / src / jalview / appletgui / SeqCanvas.java
index f6ef577..02c9990 100755 (executable)
@@ -141,7 +141,7 @@ public class SeqCanvas
           continue;\r
         }\r
 \r
-        value = av.alignment.getSequenceAt(i).findPosition(index);\r
+        value = seq.findPosition(index);\r
         break;\r
       }\r
       if (value != -1)\r
@@ -294,6 +294,8 @@ public class SeqCanvas
   int LABEL_WEST, LABEL_EAST;\r
   public int getWrappedCanvasWidth(int cwidth)\r
   {\r
+      cwidth -= cwidth % av.charWidth;\r
+\r
       FontMetrics fm = getFontMetrics(av.getFont());\r
 \r
       LABEL_EAST = 0;\r
@@ -334,15 +336,12 @@ public class SeqCanvas
 \r
     FontMetrics fm = getFontMetrics(av.getFont());\r
 \r
-    int LABEL_EAST = 0;\r
 \r
     if (av.scaleRightWrapped)\r
     {\r
         LABEL_EAST = fm.stringWidth(getMask());\r
     }\r
 \r
-    int LABEL_WEST = 0;\r
-\r
     if (av.scaleLeftWrapped)\r
     {\r
         LABEL_WEST = fm.stringWidth(getMask());\r
@@ -366,7 +365,7 @@ public class SeqCanvas
 \r
     while ((ypos <= canvasHeight) && (startRes < av.alignment.getWidth()))\r
     {\r
-      endx = startRes + cWidth;\r
+      endx = startRes + cWidth -1;\r
 \r
       if (endx > al.getWidth())\r
       {\r
@@ -407,7 +406,7 @@ public class SeqCanvas
           if(annotations==null)\r
             annotations = new AnnotationPanel(av);\r
 \r
-          annotations.drawComponent( g, startRes, endx );\r
+          annotations.drawComponent( g, startRes, endx+1 );\r
           g.translate(0, -cHeight - ypos-4);\r
         }\r
         g.translate(-LABEL_WEST, 0);\r
@@ -496,7 +495,7 @@ public class SeqCanvas
       groupIndex = 0;\r
   }\r
 \r
-  if ( group != null)\r
+  if ( group != null )\r
   {\r
       do\r
       {\r
@@ -505,6 +504,7 @@ public class SeqCanvas
           boolean inGroup = false;\r
           int top = -1;\r
           int bottom = -1;\r
+          int alHeight = av.alignment.getHeight()-1;\r
 \r
           for (i = startSeq; i < endSeq; i++)\r
           {\r
@@ -522,11 +522,11 @@ public class SeqCanvas
                       group.sequences.contains(av.alignment.getSequenceAt(\r
                               i)))\r
               {\r
-                if (bottom == -1)\r
+                if ( (bottom == -1) &&\r
+                    (i >= alHeight ||\r
+                     !group.sequences.contains(\r
+                         av.alignment.getSequenceAt(i + 1))))\r
                 {\r
-                 if(i == endSeq-1 || // Dont check for i+1 if on the bottom row\r
-                  !group.sequences.contains(av.alignment.getSequenceAt(i+1 )))\r
-\r
                     bottom = sy + av.charHeight;\r
                 }\r
 \r