From 38ae1e61b0cd4fdbf6c9be24cb5f53382a4e6d51 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 11 Sep 2006 15:27:34 +0000 Subject: [PATCH] visWidth allows borders to be drawn around offscreen images when making images --- src/jalview/gui/SeqCanvas.java | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 50d1f7b..fca9199 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -698,6 +698,7 @@ public class SeqCanvas extends JComponent int sy = -1; int ex = -1; int groupIndex = -1; + int visWidth = (endRes - startRes +1) * av.charWidth; if ((group == null) && (av.alignment.getGroups().size() > 0)) { @@ -705,6 +706,7 @@ public class SeqCanvas extends JComponent groupIndex = 0; } + if (group != null) { do @@ -722,7 +724,7 @@ public class SeqCanvas extends JComponent ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) - 1; - if(sx+ex<0 || sx>imgWidth) + if(sx+ex<0 || sx>visWidth) { continue; } @@ -769,10 +771,10 @@ public class SeqCanvas extends JComponent { if (inGroup) { - if (sx >= 0 && sx < imgWidth) + if (sx >= 0 && sx < visWidth) g.drawLine(sx, oldY, sx, sy); - if (sx + ex < imgWidth) + if (sx + ex < visWidth) g.drawLine(sx + ex, oldY, sx + ex, sy); if (sx < 0) @@ -781,8 +783,8 @@ public class SeqCanvas extends JComponent sx = 0; } - if (sx + ex > imgWidth) - ex = imgWidth; + if (sx + ex > visWidth) + ex = visWidth; else if (sx + ex >= (endRes - startRes + 1) * av.charWidth) ex = (endRes - startRes + 1) * av.charWidth; @@ -807,10 +809,10 @@ public class SeqCanvas extends JComponent if (inGroup) { sy = offset + ( (i - startSeq) * av.charHeight); - if (sx >= 0 && sx < imgWidth) + if (sx >= 0 && sx < visWidth) g.drawLine(sx, oldY, sx, sy); - if (sx + ex < imgWidth) + if (sx + ex < visWidth) g.drawLine(sx + ex, oldY, sx + ex, sy); if (sx < 0) @@ -819,8 +821,8 @@ public class SeqCanvas extends JComponent sx = 0; } - if (sx + ex > imgWidth) - ex = imgWidth; + if (sx + ex > visWidth) + ex = visWidth; else if (sx + ex >= (endRes - startRes + 1) * av.charWidth) ex = (endRes - startRes + 1) * av.charWidth; @@ -841,6 +843,8 @@ public class SeqCanvas extends JComponent groupIndex++; + g.setStroke(new BasicStroke()); + if (groupIndex >= av.alignment.getGroups().size()) { break; @@ -848,7 +852,7 @@ public class SeqCanvas extends JComponent group = (SequenceGroup) av.alignment.getGroups().elementAt(groupIndex); - g.setStroke(new BasicStroke()); + } while (groupIndex < av.alignment.getGroups().size()); -- 1.7.10.2