X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FIdCanvas.java;h=cd7b0b77d8733a2c8d72d688c1a19ff0849c1042;hb=36192ebcb63fc6f2a832b06121fb93976a2e6ca2;hp=ae134447d68b342f3aaf0685e23df3d5243ebc1e;hpb=8d113b111f2f1aa1376c84efb4337751ddfeb092;p=jalview.git diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index ae13444..cd7b0b7 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -83,7 +83,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI this.av = av; PaintRefresher.Register(this, av.getSequenceSetId()); av.getRanges().addPropertyChangeListener(this); - } + } /** * DOCUMENT ME! @@ -204,7 +204,11 @@ public class IdCanvas extends JPanel implements ViewportListenerI gg.translate(0, -transY); fastPaint = true; - repaint(); + + // Call repaint on alignment panel so that repaints from other alignment + // panel components can be aggregated. Otherwise performance of the overview + // window and others may be adversely affected. + av.getAlignPanel().repaint(); } /** @@ -220,39 +224,39 @@ public class IdCanvas extends JPanel implements ViewportListenerI g.setColor(Color.white); g.fillRect(0, 0, getWidth(), getHeight()); - + if (fastPaint) { fastPaint = false; g.drawImage(image, 0, 0, this); - + return; } - + int oldHeight = imgHeight; - + imgHeight = getHeight(); imgHeight -= (imgHeight % av.getCharHeight()); - + if (imgHeight < 1) { return; } - + if (oldHeight != imgHeight || image.getWidth(this) != getWidth()) { - image = new BufferedImage(getWidth(), imgHeight, - BufferedImage.TYPE_INT_RGB); + image = new BufferedImage(getWidth(), imgHeight, + BufferedImage.TYPE_INT_RGB); } - + gg = (Graphics2D) image.getGraphics(); - + // Fill in the background gg.setColor(Color.white); gg.fillRect(0, 0, getWidth(), imgHeight); - + drawIds(av.getRanges().getStartSeq(), av.getRanges().getEndSeq()); - + g.drawImage(image, 0, 0, this); } @@ -376,7 +380,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI if (av.hasHiddenColumns()) { maxwidth = av.getAlignment().getHiddenColumns() - .findColumnPosition(maxwidth) - 1; + .absoluteToVisibleColumn(maxwidth) - 1; } int annotationHeight = 0; @@ -571,5 +575,9 @@ public class IdCanvas extends JPanel implements ViewportListenerI fastPaint(((int[]) evt.getNewValue())[1] - ((int[]) evt.getOldValue())[1]); } + else if (propertyName.equals(ViewportRanges.MOVE_VIEWPORT)) + { + repaint(); + } } }