X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=77f557bff87a4a488d7e50e8b6171a2a7db2c4ee;hb=5929445a0af66d200677bf23b26f4bdbab2e4c0c;hp=28744946978ca71223ed91857f35dfe65a220274;hpb=c59fb56cb143b05c5643a71f5b39996ac1cd2fef;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 2874494..77f557b 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,8 +311,15 @@ 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 +411,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio int iconOffset = av.charHeight/2; boolean validRes = false; //\u03B2 \u03B1 + for(int i=0; i0) { - int charOffset = (av.charWidth - - fm.charWidth(row.annotations[j].displayCharacter. - charAt(0))) / 2; + int charOffset = (av.charWidth - fm.charWidth(row.annotations[j].displayCharacter.charAt(0)))/2; g.setColor( row.annotations[j].colour); if(j==0) { @@ -447,7 +509,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio if (validRes && row.isGraph) { g.setColor(new Color(0,0,180)); - int height = (int)((row.annotations[j].value / row.graphMax)*50); + int height = (int)((row.annotations[j].value / row.graphMax)*GRAPH_HEIGHT); if(row.windowLength>1) { @@ -461,10 +523,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 +577,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio for(int j=0; j