*/
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);
}