+ /**
+ * draw full height alignment in the second last row, last columns, if the
+ * last row was not full height
+ */
+ if (lastWidthPartHeight)
+ {
+ int widthsAbove = visibleWidths - 2;
+ int ypos = repeatHeight * widthsAbove + hgap;
+ int endRes = ranges.getEndRes();
+ endRes += widthsAbove * viewportWidth;
+ int startRes = endRes - columns;
+ int xOffset = ((startRes - ranges.getStartRes()) % viewportWidth)
+ * charWidth;
+ gg.translate(xOffset, 0);
+
+ /*
+ * white fill first to erase annotations
+ */
+ gg.setColor(Color.white);
+ gg.fillRect(labelWidthWest, ypos,
+ (endRes - startRes + 1) * charWidth, repeatHeight);
+
+ drawWrappedRegion(gg, startRes, endRes, canvasHeight, widthInColumns,
+ ypos);
+ gg.translate(-xOffset, 0);
+ }
+
+ /*
+ * y-offset for drawing is height of widths above,
+ * plus one gap row
+ */
+ int widthsAbove = visibleWidths - 1;
+ int ypos = repeatHeight * widthsAbove + hgap;
+ int endRes = ranges.getEndRes();
+ endRes += widthsAbove * viewportWidth;
+ endRes = Math.min(endRes, ranges.getVisibleAlignmentWidth());
+
+ /*
+ * draw one extra column than strictly needed - this is a (harmless)
+ * fudge to ensure scale marks get drawn (JAL-2636)
+ */
+ int startRes = endRes - columns;
+
+ /*
+ * x-offset is x-start modulo viewport start residue;
+ * doesn't include label West (offset is applied in drawWrappedRegion)
+ */
+
+ int leftEndColumn = ranges.getStartRes() + widthsAbove
+ * ranges.getViewportWidth();
+ // startRes = Math.max(startRes - 0, leftEndColumn);
+ int xOffset = ((startRes - ranges.getStartRes()) % viewportWidth)
+ * charWidth;
+ gg.translate(xOffset, 0);
+
+ /*
+ * white fill the region to be drawn including scale left or above;
+ * extend to right hand margin so as to erase scale above when
+ * scrolling right beyond end of alignment
+ */
+ gg.setColor(Color.white);
+ int width = getWidth() - labelWidthWest - xOffset;
+ gg.fillRect(labelWidthWest, ypos - hgap, width, repeatHeight);