Merge branch 'bug/JAL-2666' into releases/Release_2_10_4_Branch
authorJim Procter <jprocter@issues.jalview.org>
Thu, 22 Feb 2018 14:48:58 +0000 (14:48 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 22 Feb 2018 14:48:58 +0000 (14:48 +0000)
1  2 
src/jalview/gui/AlignmentPanel.java

@@@ -874,17 -874,15 +874,17 @@@ public class AlignmentPanel extends GAl
    @Override
    public void paintComponent(Graphics g)
    {
 -    invalidate();
 +    invalidate(); // needed so that the id width adjuster works correctly
  
      Dimension d = getIdPanel().getIdCanvas().getPreferredSize();
      idPanelHolder.setPreferredSize(d);
      hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));
 -    validate();
 +
 +    validate(); // needed so that the id width adjuster works correctly
  
      /*
 -     * set scroll bar positions
 +     * set scroll bar positions - tried to remove but necessary for split panel to resize correctly
 +     * though I still think this call should be elsewhere.
       */
      ViewportRanges ranges = av.getRanges();
      setScrollValues(ranges.getStartRes(), ranges.getStartSeq());
     */
    protected void scrollToCentre(SearchResultsI sr, int verticalOffset)
    {
-     /*
-      * To avoid jumpy vertical scrolling (if some sequences are gapped or not
-      * mapped), we can make the scroll-to location a sequence above the one
-      * actually mapped.
-      */
-     SequenceI mappedTo = sr.getResults().get(0).getSequence();
-     List<SequenceI> seqs = av.getAlignment().getSequences();
-     /*
-      * This is like AlignmentI.findIndex(seq) but here we are matching the
-      * dataset sequence not the aligned sequence
-      */
-     boolean matched = false;
-     for (SequenceI seq : seqs)
-     {
-       if (mappedTo == seq.getDatasetSequence())
-       {
-         matched = true;
-         break;
-       }
-     }
-     if (!matched)
-     {
-       return; // failsafe, shouldn't happen
-     }
-     /*
-      * Scroll to position but centring the target residue.
-      */
      scrollToPosition(sr, verticalOffset, true, true);
    }