From cf6307d618f73e86688f091f213a07f0b8820917 Mon Sep 17 00:00:00 2001 From: kiramt Date: Fri, 5 May 2017 11:59:58 +0100 Subject: [PATCH] JAL-2491 Scrolling and interaction with overview/find working in desktop --- src/jalview/gui/AlignmentPanel.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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() { -- 1.7.10.2