/** DOCUMENT ME!! */
public AlignmentPanel ap;
+ /*
+ * last column position for mouseMoved event
+ */
+ private int lastMouseColumn;
+
+ /*
+ * last sequence offset for mouseMoved event
+ */
+ private int lastMouseSeq;
+
protected int lastres;
protected int startseq;
ssm.addStructureViewerListener(this);
ssm.addSelectionListener(this);
}
+
+ lastMouseColumn = -1;
+ lastMouseSeq = -1;
}
int startWrapBlock = -1;
endEditing();
if (av.getWrapAlignment())
{
- ap.scrollToWrappedVisible(seqCanvas.cursorX);
+ av.getRanges().scrollToWrappedVisible(seqCanvas.cursorX);
}
else
{
- while (seqCanvas.cursorY < av.getRanges().getStartSeq())
- {
- ap.scrollUp(true);
- }
- while (seqCanvas.cursorY > av.getRanges().getEndSeq())
- {
- ap.scrollUp(false);
- }
- if (!av.getWrapAlignment())
- {
- HiddenColumns hidden = av.getAlignment().getHiddenColumns();
- while (seqCanvas.cursorX < hidden.adjustForHiddenColumns(av
- .getRanges().getStartRes()))
- {
- if (!ap.scrollRight(false))
- {
- break;
- }
- }
- while (seqCanvas.cursorX > hidden.adjustForHiddenColumns(av
- .getRanges().getEndRes()))
- {
- if (!ap.scrollRight(true))
- {
- break;
- }
- }
- }
+ av.getRanges().scrollToVisible(seqCanvas.cursorX, seqCanvas.cursorY,
+ av);
}
setStatusMessage(av.getAlignment().getSequenceAt(seqCanvas.cursorY),
seqCanvas.cursorX, seqCanvas.cursorY);
if (av.isFollowHighlight())
{
- /*
- * if scrollToPosition requires a scroll adjustment, this flag prevents
- * another scroll event being propagated back to the originator
- *
- * @see AlignmentPanel#adjustmentValueChanged
- */
- ap.setDontScrollComplement(true);
+ // don't allow highlight of protein/cDNA to also scroll a complementary
+ // panel,as this sets up a feedback loop (scrolling panel 1 causes moused
+ // over residue to change abruptly, causing highlighted residue in panel 2
+ // to change, causing a scroll in panel 1 etc)
+ ap.setToScrollComplementPanel(false);
if (ap.scrollToPosition(results, false))
{
seqCanvas.revalidate();
}
+ ap.setToScrollComplementPanel(true);
}
setStatusMessage(results);
seqCanvas.highlightSearchResults(results);
{
return;
}
+ if (column == lastMouseColumn && seq == lastMouseSeq)
+ {
+ /*
+ * just a pixel move without change of residue
+ */
+ return;
+ }
+ lastMouseColumn = column;
+ lastMouseSeq = seq;
SequenceI sequence = av.getAlignment().getSequenceAt(seq);
}
}
- if (av.isShowSequenceFeatures())
+ if (av.isShowSequenceFeatures() && pos != -1)
{
List<SequenceFeature> features = ap.getFeatureRenderer()
.findFeaturesAtRes(sequence.getDatasetSequence(), pos);
}
else
{
- if (lastTooltip == null
- || !lastTooltip.equals(tooltipText.toString()))
+ String textString = tooltipText.toString();
+ if (lastTooltip == null || !lastTooltip.equals(textString))
{
String formatedTooltipText = JvSwingUtils.wrapTooltip(true,
- tooltipText.toString());
- // String formatedTooltipText = tooltipText.toString();
+ textString);
setToolTipText(formatedTooltipText);
- lastTooltip = tooltipText.toString();
+ lastTooltip = textString;
}
-
}
-
}
private Point lastp = null;
/**
* Sets the status message in alignment panel, showing the sequence number
* (index) and id, residue and residue position for the given sequence and
- * column position. Returns the calculated residue position in the sequence.
+ * column position. Returns the calculated residue position in the sequence,
+ * or -1 for a gapped column position.
*
* @param sequence
* aligned sequence object
* alignment column
* @param seq
* index of sequence in alignment
- * @return position of res in sequence
+ * @return position of column in sequence or -1 if at a gap
*/
int setStatusMessage(SequenceI sequence, final int column, int seq)
{
}
int pos = -1;
- pos = sequence.findPosition(column);
if (residue != null)
{
+ pos = sequence.findPosition(column);
text.append(" (").append(Integer.toString(pos)).append(")");
}
ap.alignFrame.statusBar.setText(text.toString());
{
if (e.isShiftDown())
{
- ap.scrollRight(true);
+ av.getRanges().scrollRight(true);
}
else
{
- ap.scrollUp(false);
+ av.getRanges().scrollUp(false);
}
}
else
{
if (e.isShiftDown())
{
- ap.scrollRight(false);
+ av.getRanges().scrollRight(false);
}
else
{
- ap.scrollUp(true);
+ av.getRanges().scrollUp(true);
}
}
// TODO Update tooltip for new position.
if (mouseDragging && (evt.getY() < 0)
&& (av.getRanges().getStartSeq() > 0))
{
- running = ap.scrollUp(true);
+ running = av.getRanges().scrollUp(true);
}
if (mouseDragging && (evt.getY() >= getHeight())
&& (av.getAlignment().getHeight() > av.getRanges()
.getEndSeq()))
{
- running = ap.scrollUp(false);
+ running = av.getRanges().scrollUp(false);
}
if (mouseDragging && (evt.getX() < 0))
{
- running = ap.scrollRight(false);
+ running = av.getRanges().scrollRight(false);
}
else if (mouseDragging && (evt.getX() >= getWidth()))
{
- running = ap.scrollRight(true);
+ running = av.getRanges().scrollRight(true);
}
}