// define our cursor image
BufferedImage cursorImage = null;
+ int yoffset = 0;
+ int xoffset = 0;
+ int startx = startRes;
+ int endx = endRes;
+ if (av.getWrapAlignment())
+ {
+ // work out the correct offsets for the cursor
+ int charHeight = av.getCharHeight();
+ int charWidth = av.getCharWidth();
+ int canvasWidth = getWidth();
+ int canvasHeight = getHeight();
+
+ // height gap above each panel
+ int hgap = charHeight;
+ if (av.getScaleAboveWrapped())
+ {
+ hgap += charHeight;
+ }
+
+ int cWidth = (canvasWidth - labelWidthEast - labelWidthWest)
+ / charWidth;
+ int cHeight = av.getAlignment().getHeight() * charHeight;
+
+ endx = startx + cWidth - 1;
+ int ypos = hgap; // vertical offset
+
+ // iterate down the wrapped panels
+ while ((ypos <= canvasHeight) && (endx < cursorX))
+ {
+ // update vertical offset
+ ypos += cHeight + getAnnotationHeight() + hgap;
+
+ // update horizontal offset
+ startx += cWidth;
+ endx = startx + cWidth - 1;
+ }
+ yoffset = ypos;
+ xoffset = labelWidthWest;
+ }
+
if (av.cursorMode && cursorY >= startSeq && cursorY <= endSeq
- && cursorX >= startRes && cursorX <= endRes)
+ && cursorX >= startx && cursorX <= endx)
{
// get a new image of the correct size
cursorImage = setupImage();
SequenceI seq = av.getAlignment().getSequenceAt(cursorY);
char s = seq.getCharAt(cursorX);
- int offset = 0;
- if (av.getWrapAlignment())
- {
- // work out the correct offset for the cursor
- offset = wrappedSpaceAboveAlignment;
- int currentWidth = 0;
- while ((currentWidth < wrappedVisibleWidths)
- && (currentWidth < cursorX))
- {
- offset += wrappedRepeatHeightPx;
- currentWidth++;
- }
- }
-
seqRdr.drawCursor(g, s,
- (cursorX - startRes) * av.getCharWidth(),
- offset + ((cursorY - startSeq) * av.getCharHeight()));
+ xoffset + (cursorX - startx) * av.getCharWidth(),
+ yoffset + (cursorY - startSeq) * av.getCharHeight());
g.dispose();
}
return cursorImage;
}
+
/*
* Set up graphics for selection group
*/