X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=420e369d62a8f754a8d698b49e099ee7fc47540d;hb=ac07859006686a2c62bcf57b24742eb610bc46f0;hp=28744946978ca71223ed91857f35dfe65a220274;hpb=c59fb56cb143b05c5643a71f5b39996ac1cd2fef;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 2874494..420e369 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -23,7 +23,15 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio static Color HELIX_COLOUR = Color.red.darker(); static Color SHEET_COLOUR = Color.green.darker().darker(); - BufferedImage bi; + + BufferedImage image; + Graphics2D gg; + FontMetrics fm; + int imgWidth=0; + + boolean fastPaint = false; + + public static int GRAPH_HEIGHT = 40; @@ -64,7 +72,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio aa[i].height += 16; if (aa[i].isGraph) - aa[i].height += 50; + aa[i].height += GRAPH_HEIGHT; if(aa[i].height==0) aa[i].height = 20; @@ -303,7 +311,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio } int res = evt.getX() / av.getCharWidth() + av.getStartRes(); - if(row>-1 && aa[row].annotations[res]!=null) + if(row>-1 && res0) // scrollbar pulled right, image to the left + { + transX = (er-sr-horizontal)*av.charWidth; + sr = er - horizontal ; + } + else if(horizontal<0) + { + er = sr-horizontal; + } + + + gg.translate(transX, 0); + + drawComponent(gg, sr, er); + + gg.translate( -transX, 0 ); + + fastPaint = true; + repaint(); +} + + + public void drawComponent(Graphics2D g, int startRes, int endRes) + { + g.setColor(Color.white); + g.fillRect(0,0,(endRes-startRes) *av.charWidth, getHeight()); if(av.alignment.getAlignmentAnnotation()==null || av.alignment.getAlignmentAnnotation().length<1) { + g.setColor(Color.white); + g.fillRect(0,0,getWidth(), getHeight()); g.setColor(Color.black); g.drawString("Alignment has no annotations",20,15); return; @@ -348,6 +403,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio int iconOffset = av.charHeight/2; boolean validRes = false; //\u03B2 \u03B1 + for(int i=0; i1) { @@ -461,10 +517,10 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio } total/=row.windowLength; - height = (int)( (total / row.graphMax) *50); + height = (int)( (total / row.graphMax) *GRAPH_HEIGHT); } - + g.setColor(row.annotations[j].colour); g.fillRect(x, y-height, av.charWidth, height ); } @@ -515,7 +571,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio for(int j=0; j