int alignmentHeight = av.getAlignment().getHeight();
if (av.getWrapAlignment())
{
- int hgap = charHeight;
- if (av.getScaleAboveWrapped())
- {
- hgap += charHeight;
- }
+ seqCanvas.calculateWrappedGeometry(seqCanvas.getWidth(),
+ seqCanvas.getHeight());
+ // int gapHeight = charHeight;
+ // if (av.getScaleAboveWrapped())
+ // {
+ // gapHeight += charHeight;
+ // }
+ //
+ // final int alignmentHeightPixels = gapHeight
+ // + alignmentHeight * charHeight;
+ // int cHeight = alignmentHeightPixels;
+ // if (av.isShowAnnotation())
+ // {
+ // cHeight += (seqCanvas.getAnnotationHeight() +
+ // SeqCanvas.SEQS_ANNOTATION_GAP);
+ // }
- final int alignmentHeightPixels = alignmentHeight * charHeight + hgap;
- final int annotationHeight = seqCanvas.getAnnotationHeight();
- final int cHeight = alignmentHeightPixels + annotationHeight
- + SeqCanvas.SEQS_ANNOTATION_GAP;
+ /*
+ * yPos modulo repeating width height
+ */
+ int yOffsetPx = y % seqCanvas.wrappedRepeatHeightPx;
- int yOffsetPx = y % cHeight; // yPos below repeating width(s)
- if (yOffsetPx >= alignmentHeightPixels
- + SeqCanvas.SEQS_ANNOTATION_GAP)
+ /*
+ * height of sequences plus space / scale above,
+ * plus gap between sequences and annotations
+ */
+ int alignmentHeightPixels = seqCanvas.wrappedSpaceAboveAlignment
+ + alignmentHeight * charHeight
+ + SeqCanvas.SEQS_ANNOTATION_GAP;
+ if (yOffsetPx >= alignmentHeightPixels)
{
/*
- * mouse is over annotations; find annotation index, also
+ * mouse is over annotations; find annotation index, also set
* last sequence above (for backwards compatible behaviour)
*/
AlignmentAnnotation[] anns = av.getAlignment()
.getAlignmentAnnotation();
- int rowOffsetPx = yOffsetPx - alignmentHeightPixels
- - SeqCanvas.SEQS_ANNOTATION_GAP;
+ int rowOffsetPx = yOffsetPx - alignmentHeightPixels;
annIndex = AnnotationPanel.getRowIndex(rowOffsetPx, anns);
seqIndex = alignmentHeight - 1;
}
/*
* mouse is over sequence (or the space above sequences)
*/
- yOffsetPx -= hgap;
+ yOffsetPx -= seqCanvas.wrappedSpaceAboveAlignment;
if (yOffsetPx >= 0)
{
seqIndex = Math.min(yOffsetPx / charHeight, alignmentHeight - 1);
int startRes = av.getRanges().getStartRes();
if (av.getWrapAlignment())
{
-
int hgap = av.getCharHeight();
if (av.getScaleAboveWrapped())
{
// allow for wrapped view scrolled right (possible from Overview)
int startOffset = startRes % cwidth;
res = wrappedBlock * cwidth + startOffset
- + +Math.min(cwidth - 1, x / av.getCharWidth());
+ + Math.min(cwidth - 1, x / av.getCharWidth());
}
else
{
{
lastMousePosition = null;
setToolTipText(null);
+ lastTooltip = null;
ap.alignFrame.statusBar.setText("");
return;
}
@Override
public Point getToolTipLocation(MouseEvent event)
{
- int x = event.getX(), w = getWidth();
- int wdth = (w - x < 200) ? -(w / 2) : 5; // switch sides when tooltip is too
- // close to edge
+ if (tooltipText == null || tooltipText.length() <= 6)
+ {
+ lastp = null;
+ return null;
+ }
+
+ int x = event.getX();
+ int w = getWidth();
+ // switch sides when tooltip is too close to edge
+ int wdth = (w - x < 200) ? -(w / 2) : 5;
Point p = lastp;
if (!event.isShiftDown() || p == null)
{
- p = (tooltipText != null && tooltipText.length() > 6)
- ? new Point(event.getX() + wdth, event.getY() - 20)
- : null;
+ p = new Point(event.getX() + wdth, event.getY() - 20);
+ lastp = p;
}
/*
- * TODO: try to modify position region is not obcured by tooltip
+ * TODO: try to set position so region is not obscured by tooltip
*/
- return lastp = p;
+ return p;
}
String lastTooltip;