From 0308f6175bbbb29678ca9bac33feaea67d2973e0 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 17 Aug 2015 11:38:52 +0100 Subject: [PATCH] JAL-1691 scan full width and depth of alignment for smoother scrolling --- src/jalview/gui/AlignmentPanel.java | 12 ++++++++---- src/jalview/viewmodel/AlignmentViewport.java | 7 ++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index ad7e75c..d88e207 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -362,8 +362,9 @@ public class AlignmentPanel extends GAlignmentPanel implements } int start = r[0]; int end = r[1]; - // System.err.println("Seq : "+seqIndex+" Scroll to "+start+","+end); // // DEBUG +// System.err.println(this.av.viewName + " Seq : " + seqIndex +// + " Scroll to " + start + "," + end); /* * To centre results, scroll to positions half the visible width @@ -373,7 +374,7 @@ public class AlignmentPanel extends GAlignmentPanel implements { int offset = (av.getEndRes() - av.getStartRes() + 1) / 2 - 1; start = Math.max(start - offset, 0); - end = Math.min(end + offset, seq.getEnd() - 1); + end = end + offset - 1; } if (start < 0) { @@ -402,6 +403,9 @@ public class AlignmentPanel extends GAlignmentPanel implements */ seqIndex = Math.max(0, seqIndex - verticalOffset); + // System.out.println("start=" + start + ", end=" + end + ", startv=" + // + av.getStartRes() + ", endv=" + av.getEndRes() + ", starts=" + // + av.getStartSeq() + ", ends=" + av.getEndSeq()); if (!av.getWrapAlignment()) { if ((startv = av.getStartRes()) >= start) @@ -668,14 +672,14 @@ public class AlignmentPanel extends GAlignmentPanel implements * Adjust row/column scrollers to show a visible position in the alignment. * * @param x - * visible column to scroll to DOCUMENT ME! + * visible column to scroll to * @param y * visible row to scroll to * */ public void setScrollValues(int x, int y) { - // System.err.println("Scroll to "+x+","+y); + // System.err.println("Scroll " + this.av.viewName + " to " + x + "," + y); if (av == null || av.getAlignment() == null) { return; diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 899e8a7..a3b7527 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -2531,7 +2531,12 @@ public abstract class AlignmentViewport implements AlignViewportI, int middleColumn = getStartRes() + (getEndRes() - getStartRes()) / 2; final HiddenSequences hiddenSequences = getAlignment() .getHiddenSequences(); - for (int seqNo = getStartSeq(); seqNo < getEndSeq(); seqNo++, seqOffset++) + + /* + * searching to the bottom of the alignment gives smoother scrolling across all gapped visible regions + */ + int lastSeq = alignment.getHeight() - 1; + for (int seqNo = getStartSeq(); seqNo < lastSeq; seqNo++, seqOffset++) { sequence = getAlignment().getSequenceAt(seqNo); if (hiddenSequences != null && hiddenSequences.isHidden(sequence)) -- 1.7.10.2