X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FSeqCanvas.java;h=02c99902e6ff1204b65d14c2b4b96bdfeac49992;hb=bceadbb394604c88ac18e2dcf4b33e735377d7ac;hp=5afbe234b99f75a39aca0eff325866f1c425abe2;hpb=dc086b020537a18c3ce575fbb220033979270a65;p=jalview.git diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 5afbe23..02c9990 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -37,12 +37,13 @@ public class SeqCanvas SearchResults searchResults = null; - int chunkHeight; - int chunkWidth; - boolean fastPaint = false; + int cursorX = 0; + int cursorY = 0; + + public SeqCanvas(AlignViewport av) { this.av = av; @@ -140,7 +141,7 @@ public class SeqCanvas continue; } - value = av.alignment.getSequenceAt(i).findPosition(index); + value = seq.findPosition(index); break; } if (value != -1) @@ -293,6 +294,8 @@ public class SeqCanvas int LABEL_WEST, LABEL_EAST; public int getWrappedCanvasWidth(int cwidth) { + cwidth -= cwidth % av.charWidth; + FontMetrics fm = getFontMetrics(av.getFont()); LABEL_EAST = 0; @@ -333,15 +336,12 @@ public class SeqCanvas FontMetrics fm = getFontMetrics(av.getFont()); - int LABEL_EAST = 0; if (av.scaleRightWrapped) { LABEL_EAST = fm.stringWidth(getMask()); } - int LABEL_WEST = 0; - if (av.scaleLeftWrapped) { LABEL_WEST = fm.stringWidth(getMask()); @@ -359,12 +359,19 @@ public class SeqCanvas av.endRes = av.startRes + cWidth; - int endx = (startRes + cWidth) - 1; + int endx; int ypos = hgap; while ((ypos <= canvasHeight) && (startRes < av.alignment.getWidth())) { + endx = startRes + cWidth -1; + + if (endx > al.getWidth()) + { + endx = al.getWidth(); + } + g.setColor(Color.black); if (av.scaleLeftWrapped) @@ -386,13 +393,6 @@ public class SeqCanvas drawNorthScale(g, startRes, endx, ypos); } - - if (av.vconsensus!=null && av.alignment.getWidth() >= av.vconsensus.size()) - { - endx = av.vconsensus.size() - 2; - } - - if(g.getClip()==null) g.setClip(0, 0, cWidth * av.charWidth, canvasHeight); @@ -406,7 +406,7 @@ public class SeqCanvas if(annotations==null) annotations = new AnnotationPanel(av); - annotations.drawComponent( g, startRes, endx + 1); + annotations.drawComponent( g, startRes, endx+1 ); g.translate(0, -cHeight - ypos-4); } g.translate(-LABEL_WEST, 0); @@ -415,12 +415,6 @@ public class SeqCanvas startRes += cWidth; - endx = (startRes + cWidth) - 1; - - if (endx > al.getWidth()) - { - endx = al.getWidth(); - } } } @@ -474,6 +468,14 @@ public class SeqCanvas av.charWidth, av.charHeight); } } + + if (av.cursorMode && cursorY == i + && cursorX >= startRes && cursorX <= endRes) + { + sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * av.charWidth, + offset + ( (i - startSeq) * av.charHeight)); + } + } // @@ -493,7 +495,7 @@ public class SeqCanvas groupIndex = 0; } - if ( group != null) + if ( group != null ) { do { @@ -502,6 +504,7 @@ public class SeqCanvas boolean inGroup = false; int top = -1; int bottom = -1; + int alHeight = av.alignment.getHeight()-1; for (i = startSeq; i < endSeq; i++) { @@ -519,11 +522,11 @@ public class SeqCanvas group.sequences.contains(av.alignment.getSequenceAt( i))) { - if (bottom == -1) + if ( (bottom == -1) && + (i >= alHeight || + !group.sequences.contains( + av.alignment.getSequenceAt(i + 1)))) { - if(i == endSeq-1 || // Dont check for i+1 if on the bottom row - !group.sequences.contains(av.alignment.getSequenceAt(i+1 ))) - bottom = sy + av.charHeight; }