From: kiramt Date: Fri, 5 May 2017 10:59:58 +0000 (+0100) Subject: JAL-2491 Scrolling and interaction with overview/find working in desktop X-Git-Tag: Release_2_10_2~3^2~64^2~23 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=cf6307d618f73e86688f091f213a07f0b8820917;p=jalview.git JAL-2491 Scrolling and interaction with overview/find working in desktop --- diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 8695583..795146d 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -48,6 +48,8 @@ import java.awt.Graphics; import java.awt.Insets; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; import java.awt.print.PageFormat; import java.awt.print.Printable; import java.awt.print.PrinterException; @@ -142,6 +144,28 @@ public class AlignmentPanel extends GAlignmentPanel implements hscroll.addAdjustmentListener(this); vscroll.addAdjustmentListener(this); + addComponentListener(new ComponentAdapter() + { + @Override + public void componentResized(ComponentEvent evt) + { + // reset the viewport ranges when the alignment panel is resized + // in particular, this initialises the end residue value when Jalview + // is initialised + int widthInRes = (getSeqPanel().seqCanvas.getWidth() / av + .getCharWidth()) - 1; + int currentStartRes = vpRanges.getStartRes(); + if (av.getWrapAlignment()) + { + widthInRes = getSeqPanel().seqCanvas + .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth()); + } + + vpRanges.setStartEndRes(currentStartRes, widthInRes); + } + + }); + final AlignmentPanel ap = this; propertyChangeListener = new PropertyChangeListener() {