From 2959d102cb701ba58489e7222cd101d0eb02ead6 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 16 Mar 2006 15:30:41 +0000 Subject: [PATCH] getWidth and getHeight just once --- src/jalview/gui/AlignmentPanel.java | 41 ++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 0acf425..7ef6763 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -407,30 +407,36 @@ public class AlignmentPanel extends GAlignmentPanel */ public void setScrollValues(int x, int y) { - av.setEndRes( (x + (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) - - 1); + + int width = av.alignment.getWidth(); + int height = av.alignment.getHeight(); + + if(av.hasHiddenColumns) + width = av.getColumnSelection().findColumnPosition(width); + + av.setEndRes( (x + (seqPanel.seqCanvas.getWidth() / av.charWidth)) -1); hextent = seqPanel.seqCanvas.getWidth() / av.charWidth; vextent = seqPanel.seqCanvas.getHeight() / av.charHeight; - if (hextent > av.alignment.getWidth()) + if (hextent > width) { - hextent = av.alignment.getWidth(); + hextent = width; } - if (vextent > av.alignment.getHeight()) + if (vextent > height) { - vextent = av.alignment.getHeight(); + vextent = height; } - if ( (hextent + x) > av.getAlignment().getWidth()) + if ( (hextent + x) > width) { - x = av.getAlignment().getWidth() - hextent; + x = width - hextent; } - if ( (vextent + y) > av.getAlignment().getHeight()) + if ( (vextent + y) > height) { - y = av.getAlignment().getHeight() - vextent; + y = height - vextent; } if (y < 0) @@ -443,8 +449,8 @@ public class AlignmentPanel extends GAlignmentPanel x = 0; } - hscroll.setValues(x, hextent, 0, av.getAlignment().getWidth()); - vscroll.setValues(y, vextent, 0, av.getAlignment().getHeight()); + hscroll.setValues(x, hextent, 0, width); + vscroll.setValues(y, vextent, 0, height); } /** @@ -454,7 +460,6 @@ public class AlignmentPanel extends GAlignmentPanel */ public void adjustmentValueChanged(AdjustmentEvent evt) { - int oldX = av.getStartRes(); int oldY = av.getStartSeq(); @@ -539,6 +544,8 @@ public class AlignmentPanel extends GAlignmentPanel { int max = av.alignment.getWidth() / seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth()) +1; + + vscroll.setMaximum(max); vscroll.setUnitIncrement(1); vscroll.setVisibleAmount(1); @@ -548,12 +555,10 @@ public class AlignmentPanel extends GAlignmentPanel setScrollValues(av.getStartRes(), av.getStartSeq()); } - - if( this.getVisibleRect().getBounds() == g.getClipBounds() ) - { - if (overviewPanel != null) + if( this.getVisibleRect().getBounds() == g.getClipBounds() + && overviewPanel != null) overviewPanel.updateOverviewImage(); - } + } /** -- 1.7.10.2