* is found, the result will be empty.
*/
SearchResults sr = new SearchResults();
- int seqOffset = findComplementScrollTarget(sr);
+ int verticalOffset = findComplementScrollTarget(sr);
if (!sr.isEmpty())
{
// TODO would like next line without cast but needs more refactoring...
final AlignmentPanel complementPanel = ((AlignViewport) getCodingComplement()).getAlignPanel();
complementPanel.setFollowingComplementScroll(true);
- complementPanel.scrollToCentre(sr, seqOffset);
+ complementPanel.scrollToCentre(sr, verticalOffset);
}
}
*/
public boolean scrollToPosition(SearchResults results)
{
- return scrollToPosition(results, true, false);
+ return scrollToPosition(results, 0, true, false);
}
/**
*/
public boolean scrollToPosition(SearchResults searchResults, boolean redrawOverview)
{
- return scrollToPosition(searchResults, redrawOverview, false);
+ return scrollToPosition(searchResults, 0, redrawOverview, false);
}
/**
* (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
* @return false if results were not found
*/
public boolean scrollToPosition(SearchResults results,
+ int verticalOffset,
boolean redrawOverview, boolean centre)
{
int startv, endv, starts, ends;
}
}
}
+
+ /*
+ * 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)
* @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
*/
- 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
* 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)
{
matched = true;
break;
}
- sequenceIndex++;
}
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.
*/
- scrollToPosition(sr, true, true);
+ scrollToPosition(sr, verticalOffset, true, true);
}
/**
*/
protected int findComplementScrollTarget(SearchResults sr)
{
- final AlignViewportI codingComplement = getCodingComplement();
- if (codingComplement == null || !codingComplement.isFollowHighlight())
+ final AlignViewportI complement = getCodingComplement();
+ if (complement == null || !complement.isFollowHighlight())
{
return 0;
}
boolean iAmProtein = !getAlignment().isNucleotide();
AlignmentI proteinAlignment = iAmProtein ? getAlignment()
- : codingComplement.getAlignment();
+ : complement.getAlignment();
if (proteinAlignment == null)
{
return 0;
.findMappingsForSequence(sequence, mappings);
if (!seqMappings.isEmpty())
{
- break;
+ break;
}
}