From: amwaterhouse Date: Thu, 7 Apr 2005 10:42:03 +0000 (+0000) Subject: find top and bottom of group X-Git-Tag: Release_2_0~476 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bf43fc3b83300a46b185265068b95e8fd934cf44;p=jalview.git find top and bottom of group --- diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index ef11e2d..ff9488e 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -244,23 +244,34 @@ public void fastPaint(int horizontal, int vertical) int oldY = -1; int i = 0; boolean inGroup = false; + int top=-1, bottom =-1; for (i = y1; i < y2; i++) { sx = (group.getStartRes() - startx) * av.charWidth; sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight); ex = (group.getEndRes() + 1 - group.getStartRes()) * av.charWidth; - if (group.sequences.contains(av.alignment.getSequenceAt(i)) - && sx < getWidth() - && ex > 0) + + if (sx < getWidth() + && ex > 0 + && group.sequences.contains(av.alignment.getSequenceAt(i))) { + + if (bottom == -1 && + !group.sequences.contains(av.alignment.getSequenceAt(i + 1))) + bottom = sy + av.charHeight - 1; + if (!inGroup) { + if (top == -1 && i==0 || + !group.sequences.contains(av.alignment.getSequenceAt(i - 1))) + top = sy; + oldY = sy; inGroup = true; if (group == av.getSelectionGroup()) { - // g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 3f, new float[]{5f,2f,2f}, 0f )); + g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 3f, new float[]{5f,3f}, 0f )); g.setColor(Color.RED); } else @@ -274,18 +285,32 @@ public void fastPaint(int horizontal, int vertical) { if (inGroup) { - g.drawRect(sx, oldY, ex, (sy - oldY)); + + g.drawLine(sx, oldY, sx, sy ); + g.drawLine(sx+ex, oldY, sx+ex, sy ); + if (top != -1) + g.drawLine(sx, top, sx + ex, top); + if (bottom != -1) + g.drawLine(sx, bottom, sx + ex, bottom); + inGroup = false; } } } + if (inGroup) { + + if(top!=-1) + g.drawLine(sx,top, sx+ex, top); + if(bottom!=-1) + g.drawLine(sx,bottom, sx+ex, bottom); + sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight); - g.drawRect(sx, oldY, ex, (sy - oldY)); + g.drawLine(sx, oldY, sx, sy ); + g.drawLine(sx+ex, oldY, sx+ex, sy ); inGroup = false; } - groupIndex++; if (groupIndex >= groups.size()) break;