visWidth allows borders to be drawn around offscreen images when making images
authoramwaterhouse <Andrew Waterhouse>
Mon, 11 Sep 2006 15:27:34 +0000 (15:27 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 11 Sep 2006 15:27:34 +0000 (15:27 +0000)
src/jalview/gui/SeqCanvas.java

index 50d1f7b..fca9199 100755 (executable)
@@ -698,6 +698,7 @@ public class SeqCanvas extends JComponent
         int sy = -1;\r
         int ex = -1;\r
         int groupIndex = -1;\r
+        int visWidth = (endRes - startRes +1) * av.charWidth;\r
 \r
         if ((group == null) && (av.alignment.getGroups().size() > 0))\r
         {\r
@@ -705,6 +706,7 @@ public class SeqCanvas extends JComponent
             groupIndex = 0;\r
         }\r
 \r
+\r
         if (group != null)\r
         {\r
             do\r
@@ -722,7 +724,7 @@ public class SeqCanvas extends JComponent
                     ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) -\r
                         1;\r
 \r
-                    if(sx+ex<0 || sx>imgWidth)\r
+                    if(sx+ex<0 || sx>visWidth)\r
                     {\r
                       continue;\r
                     }\r
@@ -769,10 +771,10 @@ public class SeqCanvas extends JComponent
                     {\r
                       if (inGroup)\r
                       {\r
-                        if (sx >= 0 && sx < imgWidth)\r
+                        if (sx >= 0 && sx < visWidth)\r
                           g.drawLine(sx, oldY, sx, sy);\r
 \r
-                        if (sx + ex < imgWidth)\r
+                        if (sx + ex < visWidth)\r
                           g.drawLine(sx + ex, oldY, sx + ex, sy);\r
 \r
                         if (sx < 0)\r
@@ -781,8 +783,8 @@ public class SeqCanvas extends JComponent
                           sx = 0;\r
                         }\r
 \r
-                        if (sx + ex > imgWidth)\r
-                          ex = imgWidth;\r
+                        if (sx + ex > visWidth)\r
+                          ex = visWidth;\r
 \r
                         else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
                           ex = (endRes - startRes + 1) * av.charWidth;\r
@@ -807,10 +809,10 @@ public class SeqCanvas extends JComponent
                 if (inGroup)\r
                 {\r
                   sy = offset + ( (i - startSeq) * av.charHeight);\r
-                  if (sx >= 0 && sx < imgWidth)\r
+                  if (sx >= 0 && sx < visWidth)\r
                     g.drawLine(sx, oldY, sx, sy);\r
 \r
-                  if (sx + ex < imgWidth)\r
+                  if (sx + ex < visWidth)\r
                     g.drawLine(sx + ex, oldY, sx + ex, sy);\r
 \r
                   if (sx < 0)\r
@@ -819,8 +821,8 @@ public class SeqCanvas extends JComponent
                     sx = 0;\r
                   }\r
 \r
-                  if (sx + ex > imgWidth)\r
-                    ex = imgWidth;\r
+                  if (sx + ex > visWidth)\r
+                    ex = visWidth;\r
                   else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
                     ex = (endRes - startRes + 1) * av.charWidth;\r
 \r
@@ -841,6 +843,8 @@ public class SeqCanvas extends JComponent
 \r
                 groupIndex++;\r
 \r
+                g.setStroke(new BasicStroke());\r
+\r
                 if (groupIndex >= av.alignment.getGroups().size())\r
                 {\r
                     break;\r
@@ -848,7 +852,7 @@ public class SeqCanvas extends JComponent
 \r
                 group = (SequenceGroup) av.alignment.getGroups().elementAt(groupIndex);\r
 \r
-                g.setStroke(new BasicStroke());\r
+\r
             }\r
             while (groupIndex < av.alignment.getGroups().size());\r
 \r