X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FIdCanvas.java;h=abcbd70becc49ea109d8aeaa117744d2dd7b41df;hb=fc4aebb30bebcd7582b549053a353e528119a5fe;hp=5204094d21079cb859ad0e8597ce1d0968920a31;hpb=685909b39c1c85ff304ecea9763925de75b2cf77;p=jalview.git diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index 5204094..abcbd70 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -21,6 +21,7 @@ package jalview.appletgui; import jalview.datamodel.SequenceI; +import jalview.viewmodel.ViewportRanges; import java.awt.Color; import java.awt.Font; @@ -57,8 +58,7 @@ public class IdCanvas extends Panel } public void drawIdString(Graphics gg, boolean hiddenRows, SequenceI s, - int i, int starty, - int ypos) + int i, int starty, int ypos) { int charHeight = av.getCharHeight(); @@ -104,28 +104,32 @@ public class IdCanvas extends Panel return; } + ViewportRanges ranges = av.getRanges(); + gg.copyArea(0, 0, getSize().width, imgHeight, 0, -vertical * av.getCharHeight()); - int ss = av.startSeq, es = av.endSeq, transY = 0; + int ss = ranges.getStartSeq(), es = ranges.getEndSeq(), transY = 0; if (vertical > 0) // scroll down { ss = es - vertical; - if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time + if (ss < ranges.getStartSeq()) // ie scrolling too fast, more than a page + // at a + // time { - ss = av.startSeq; + ss = ranges.getStartSeq(); } else { - transY = imgHeight - vertical * av.getCharHeight(); + transY = imgHeight - ((vertical + 1) * av.getCharHeight()); } } else if (vertical < 0) { es = ss - vertical; - if (es > av.endSeq) + if (es > ranges.getEndSeq()) { - es = av.endSeq; + es = ranges.getEndSeq(); } } @@ -139,11 +143,13 @@ public class IdCanvas extends Panel repaint(); } + @Override public void update(Graphics g) { paint(g); } + @Override public void paint(Graphics g) { if (getSize().height < 0 || getSize().width < 0) @@ -179,7 +185,7 @@ public class IdCanvas extends Panel gg.setFont(italic); gg.fillRect(0, 0, getSize().width, getSize().height); - drawIds(av.startSeq, av.endSeq); + drawIds(av.getRanges().getStartSeq(), av.getRanges().getEndSeq()); g.drawImage(image, 0, 0, this); } @@ -187,6 +193,7 @@ public class IdCanvas extends Panel * local copy of av.getCharHeight set at top of drawIds */ private int avcharHeight; + void drawIds(int starty, int endy) { // hardwired italic IDs in applet currently @@ -231,9 +238,10 @@ public class IdCanvas extends Panel int cHeight = alheight * avcharHeight + hgap + annotationHeight; - int rowSize = av.getEndRes() - av.getStartRes(); + int rowSize = av.getRanges().getEndRes() + - av.getRanges().getStartRes(); // Draw the rest of the panels - for (int ypos = hgap, row = av.startRes; (ypos <= getSize().height) + for (int ypos = hgap, row = av.getRanges().getStartRes(); (ypos <= getSize().height) && (row < maxwidth); ypos += cHeight, row += rowSize) { for (int i = starty; i < alheight; i++) @@ -261,7 +269,7 @@ public class IdCanvas extends Panel { // Now draw the id strings SequenceI seq; - for (int i = starty; i < endy; i++) + for (int i = starty; i <= endy; i++) { seq = av.getAlignment().getSequenceAt(i); @@ -356,19 +364,17 @@ public class IdCanvas extends Panel gg.setColor(Color.blue); if (below) { - gg.fillPolygon(new int[] - { getSize().width - avcharHeight, getSize().width - avcharHeight, - getSize().width }, new int[] - { (i - starty) * avcharHeight + yoffset, + gg.fillPolygon(new int[] { getSize().width - avcharHeight, + getSize().width - avcharHeight, getSize().width }, new int[] { + (i - starty) * avcharHeight + yoffset, (i - starty) * avcharHeight + yoffset + avcharHeight / 4, (i - starty) * avcharHeight + yoffset }, 3); } if (above) { - gg.fillPolygon(new int[] - { getSize().width - avcharHeight, getSize().width - avcharHeight, - getSize().width }, new int[] - { (i - starty + 1) * avcharHeight + yoffset, + gg.fillPolygon(new int[] { getSize().width - avcharHeight, + getSize().width - avcharHeight, getSize().width }, new int[] { + (i - starty + 1) * avcharHeight + yoffset, (i - starty + 1) * avcharHeight + yoffset - avcharHeight / 4, (i - starty + 1) * avcharHeight + yoffset }, 3); @@ -380,7 +386,7 @@ public class IdCanvas extends Panel Font bold = new Font(av.getFont().getName(), Font.BOLD, av.getFont() .getSize()); - if (av.isHiddenRepSequence(seq)) + if (av.isReferenceSeq(seq) || av.isHiddenRepSequence(seq)) { gg.setFont(bold); return true;