git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-1691 trackpad scrolling goes to full width even with short sequences
[jalview.git]
/
src
/
jalview
/
gui
/
AlignmentPanel.java
diff --git
a/src/jalview/gui/AlignmentPanel.java
b/src/jalview/gui/AlignmentPanel.java
index
588411e
..
7228e1b
100644
(file)
--- a/
src/jalview/gui/AlignmentPanel.java
+++ b/
src/jalview/gui/AlignmentPanel.java
@@
-305,7
+305,7
@@
public class AlignmentPanel extends GAlignmentPanel implements
*/
public boolean scrollToPosition(SearchResults results)
{
*/
public boolean scrollToPosition(SearchResults results)
{
- return scrollToPosition(results, true, false);
+ return scrollToPosition(results, 0, true, false);
}
/**
}
/**
@@
-318,7
+318,7
@@
public class AlignmentPanel extends GAlignmentPanel implements
*/
public boolean scrollToPosition(SearchResults searchResults, boolean redrawOverview)
{
*/
public boolean scrollToPosition(SearchResults searchResults, boolean redrawOverview)
{
- return scrollToPosition(searchResults, redrawOverview, false);
+ return scrollToPosition(searchResults, 0, redrawOverview, false);
}
/**
}
/**
@@
-326,6
+326,9
@@
public class AlignmentPanel extends GAlignmentPanel implements
* (if any)
*
* @param results
* (if any)
*
* @param results
+ * @param verticalOffset
+ * if greater than zero, allows scrolling to a position below the
+ * first displayed sequence
* @param redrawOverview
* - when set, the overview will be recalculated (takes longer)
* @param centre
* @param redrawOverview
* - when set, the overview will be recalculated (takes longer)
* @param centre
@@
-333,6
+336,7
@@
public class AlignmentPanel extends GAlignmentPanel implements
* @return false if results were not found
*/
public boolean scrollToPosition(SearchResults results,
* @return false if results were not found
*/
public boolean scrollToPosition(SearchResults results,
+ int verticalOffset,
boolean redrawOverview, boolean centre)
{
int startv, endv, starts, ends;
boolean redrawOverview, boolean centre)
{
int startv, endv, starts, ends;
@@
-391,6
+395,12
@@
public class AlignmentPanel extends GAlignmentPanel implements
}
}
}
}
}
}
+
+ /*
+ * allow for offset of target sequence (actually scroll to one above it)
+ */
+ seqIndex = Math.max(0, seqIndex - verticalOffset);
+
if (!av.getWrapAlignment())
{
if ((startv = av.getStartRes()) >= start)
if (!av.getWrapAlignment())
{
if ((startv = av.getStartRes()) >= start)
@@
-1727,10
+1737,10
@@
public class AlignmentPanel extends GAlignmentPanel implements
* @param sr
* holds mapped region(s) of this alignment that we are scrolling
* 'to'; may be modified for sequence offset by this method
* @param sr
* holds mapped region(s) of this alignment that we are scrolling
* 'to'; may be modified for sequence offset by this method
- * @param seqOffset
+ * @param verticalOffset
* the number of visible sequences to show above the mapped region
*/
* the number of visible sequences to show above the mapped region
*/
- public void scrollToCentre(SearchResults sr, int seqOffset)
+ public void scrollToCentre(SearchResults sr, int verticalOffset)
{
/*
* To avoid jumpy vertical scrolling (if some sequences are gapped or not
{
/*
* To avoid jumpy vertical scrolling (if some sequences are gapped or not
@@
-1744,7
+1754,6
@@
public class AlignmentPanel extends GAlignmentPanel implements
* This is like AlignmentI.findIndex(seq) but here we are matching the
* dataset sequence not the aligned sequence
*/
* This is like AlignmentI.findIndex(seq) but here we are matching the
* dataset sequence not the aligned sequence
*/
- int sequenceIndex = 0;
boolean matched = false;
for (SequenceI seq : seqs)
{
boolean matched = false;
for (SequenceI seq : seqs)
{
@@
-1753,20
+1762,16
@@
public class AlignmentPanel extends GAlignmentPanel implements
matched = true;
break;
}
matched = true;
break;
}
- sequenceIndex++;
}
if (!matched)
{
return; // failsafe, shouldn't happen
}
}
if (!matched)
{
return; // failsafe, shouldn't happen
}
- sequenceIndex = Math.max(0, sequenceIndex - seqOffset);
- sr.getResults().get(0)
- .setSequence(av.getAlignment().getSequenceAt(sequenceIndex));
/*
* Scroll to position but centring the target residue.
*/
/*
* Scroll to position but centring the target residue.
*/
- scrollToPosition(sr, true, true);
+ scrollToPosition(sr, verticalOffset, true, true);
}
/**
}
/**