From 3a455483336b530b45d449270069815a933151d2 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 30 Jan 2006 14:54:54 +0000 Subject: [PATCH] Fast paint update --- src/jalview/gui/AlignmentPanel.java | 39 +++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 3ebc57c..fdd01d3 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -81,9 +81,7 @@ public class AlignmentPanel extends GAlignmentPanel annotationPanel = new AnnotationPanel(this); alabels = new AnnotationLabels(this); - annotationSpaceFillerHolder.setPreferredSize(annotationPanel. - getPreferredSize()); - annotationScroller.setPreferredSize(annotationPanel.getPreferredSize()); + annotationScroller.setViewportView(annotationPanel); annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER); @@ -491,28 +489,33 @@ public class AlignmentPanel extends GAlignmentPanel overviewPanel.setBoxPosition(); } - int xShift = av.getStartRes() - oldX; - int yShift = av.getStartSeq() - oldY; + int scrollX = av.startRes - oldX; + int scrollY = av.startSeq - oldY; - if ( (xShift != 0 && yShift != 0) || - (Math.abs(xShift) > av.getEndRes() - av.getStartRes() - || Math.abs(yShift) > av.getEndSeq() - av.getStartSeq()) - || av.getWrapAlignment() - || !fastPaint) + if (av.getWrapAlignment() || !fastPaint) { - // Either no shift at all, or shift greater than visible amount repaint(); } else { - idPanel.idCanvas.fastPaint(yShift); - seqPanel.seqCanvas.fastPaint(xShift, yShift); - - scalePanel.repaint(); - - if (av.getShowAnnotation()) + // Make sure we're not trying to draw a panel + // larger than the visible window + if(scrollX>av.endRes-av.startRes) + scrollX = av.endRes-av.startRes; + else if(scrollX