\r
SequenceI nextSeq;\r
SequenceGroup group=null;\r
- boolean newGroup=false;\r
+ boolean inGroup=false; // are we in a defined group?\r
+ boolean inRB=false; //Are we in a rubberband group?\r
int sx=-1, sy=-1, ex=-1, ey=-1;\r
int oldStartX=0,oldEndX=0,oldY=0;\r
+ int oldRStartX=0,oldREndX=0,oldRY=0;\r
for (int i = y1 ; i < y2 ;i++)\r
{\r
nextSeq = av.getAlignment().getSequenceAt(i);\r
- if(group==null || group!=av.alignment.findGroup( nextSeq ))\r
- newGroup = true;\r
- else\r
- newGroup = false;\r
\r
- group = av.alignment.findGroup( nextSeq );\r
+ group = av.alignment.findGroup( nextSeq );\r
\r
- sr.drawSequence(g, nextSeq, group,x1,x2,\r
+ sr.drawSequence(g, nextSeq, group,x1,x2,\r
(x1 - startx) * charWidth,\r
offset + AlignmentUtil.getPixelHeight(starty, i, av.getCharHeight()),\r
charWidth,charHeight,null, i);\r
ey = offset + AlignmentUtil.getPixelHeight(starty, i+1, av.getCharHeight());\r
\r
\r
- if (newGroup)\r
+ if (!inGroup)\r
{\r
- g.drawLine(oldStartX, oldY, oldEndX, oldY); // Horizontal, bottom of old box\r
g.drawLine(sx, sy, ex, sy); // Horizontal, top of new box\r
+ inGroup=true;\r
}\r
\r
g.drawLine(sx, sy, sx, ey ); // vertical line, left hand side\r
oldY = ey;\r
\r
}\r
- else if(sx>-1)\r
+ else if(inGroup)\r
{\r
g.setColor(Color.lightGray);\r
- g.drawLine(sx, ey, ex, ey); // Horizontal, bottom of old box\r
+ g.drawLine(oldStartX, oldY, oldEndX, oldY); // Horizontal, bottom of old box\r
}\r
+ else\r
+ inGroup = false;\r
\r
group = av.getRubberbandGroup();\r
- if( group !=null && group.sequences.contains(nextSeq) )\r
+ if( group != null && group.sequences.contains(nextSeq) )\r
{\r
- g.setColor(Color.red);\r
-\r
+ g.setColor(Color.RED.brighter());\r
sx = (group.getStartRes() - startx) * charWidth;\r
sy = offset +\r
AlignmentUtil.getPixelHeight(starty, i, av.getCharHeight());\r
ey = offset +\r
AlignmentUtil.getPixelHeight(starty, i + 1, av.getCharHeight());\r
\r
- if (newGroup)\r
+ if (!inRB)\r
{\r
- g.drawLine(oldStartX, oldY, oldEndX, oldY); // Horizontal, bottom of old box\r
+\r
g.drawLine(sx, sy, ex, sy); // Horizontal, top of new box\r
+ inRB = true;\r
}\r
\r
g.drawLine(sx, sy, sx, ey); // vertical line, left hand side\r
if (i == y2 - 1) // last line of alignment, seal the box\r
g.drawLine(sx, ey, ex, ey); // Horizontal, bottom of old box\r
\r
- // oldStartX = sx;\r
- // oldEndX = ex;\r
- // oldY = ey;\r
-\r
+ oldRStartX = sx;\r
+ oldREndX = ex;\r
+ oldRY = ey;\r
+ }\r
+ else if(inRB)\r
+ {\r
+ g.setColor(Color.RED.brighter());\r
+ g.drawLine(oldRStartX, oldRY, oldREndX, oldRY); // Horizontal, bottom of old box\r
+ inRB = false;\r
}\r
+ else\r
+ inRB = false;\r
\r
}\r
\r