- seq = av.getAlignment().getSequenceAt(i);
- if ((av.getSelectionGroup() != null)
- && av.getSelectionGroup().getSequences(null).contains(seq))
- {
- currentColor = Color.gray;
- currentTextColor = Color.black;
- }
- else
- {
- currentColor = av.getSequenceColour(seq);
- currentTextColor = Color.black;
- }
-
- pg.setColor(currentColor);
- pg.fillRect(0, (i - startSeq) * av.charHeight, idWidth,
- av.getCharHeight());
-
- pg.setColor(currentTextColor);
-
- int xPos = 0;
- if (av.rightAlignIds)
- {
- fm = pg.getFontMetrics();
- xPos = idWidth
- - fm.stringWidth(seq.getDisplayId(av.getShowJVSuffix()))
- - 4;
- }
-
- pg.drawString(
- seq.getDisplayId(av.getShowJVSuffix()),
- xPos,
- (((i - startSeq) * av.charHeight) + av.getCharHeight())
- - (av.getCharHeight() / 5));
- }
-
- pg.setFont(av.getFont());
-
- // draw main sequence panel
- pg.translate(idWidth, 0);
- seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq, 0);
-
- if (av.showAnnotation && (endSeq == av.getAlignment().getHeight()))
- {
- // draw annotation - need to offset for current scroll position
- int offset = -alabels.scrollOffset;
- pg.translate(0, offset);
- pg.translate(-idWidth - 3, (endSeq - startSeq) * av.charHeight + 3);
- alabels.drawComponent(pg, idWidth);
- pg.translate(idWidth + 3, 0);
- annotationPanel.renderer.drawComponent(annotationPanel, av,
- pg, -1, startRes, endRes + 1);
- pg.translate(0, -offset);
+ /*
+ * draw annotation labels; drawComponent() translates by
+ * getScrollOffset(), so compensate for that first;
+ * then reset to (0, scale height)
+ */
+ int offset = getAlabels().getScrollOffset();
+ idGraphics.translate(0, -offset);
+ idGraphics.translate(0, alignmentDrawnHeight);
+ getAlabels().drawComponent(idGraphics, idWidth);
+ idGraphics.translate(0, -alignmentDrawnHeight);
+
+ /*
+ * draw the annotations starting at
+ * (idOffset, alignmentHeight) from (0, scaleHeight)
+ */
+ alignmentGraphics.translate(alignmentGraphicsOffset,
+ alignmentDrawnHeight);
+ getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av,
+ alignmentGraphics, -1, startRes, endRes + 1);