for (ScaleMark mark : marks)
{
int mpos = mark.column; // (i - startx - 1)
-// System.out.println("n " + mpos + " " + ypos);
if (mpos < 0)
{
continue;
int startX = startx;
int endX = endx;
- //System.out.println("v " + startx + " " + endx + " " + ypos);
-
-
if (av.hasHiddenColumns())
{
HiddenColumns hiddenColumns = av.getAlignment().getHiddenColumns();
}
}
+
/*
* white fill the space for the scale
*/
// fillRect origin is top left of rectangle
g.fillRect(0, y - charHeight, left ? labelWidthWest : labelWidthEast,
charHeight + 1);
-
+
if (value != -1)
{
/*
int xOffset = labelSpace - labelLength;
g.setColor(Color.black);
g.drawString(valueAsString, xOffset, y);
-
- //System.out.println("v " + valueAsString + " " + xOffset + " " + y);
-
}
}
+
}
/**
* @param endColumn
* @param canvasHeight
*/
- protected void drawWrappedWidth(Graphics g, int ypos, int startColumn,
+ protected void drawWrappedWidth(Graphics gg, int ypos, int startColumn,
int endColumn, int canvasHeight)
{
ViewportRanges ranges = av.getRanges();
int xOffset = labelWidthWest
+ ((startColumn - ranges.getStartRes()) % viewportWidth)
* charWidth;
+
+ // BH 2018 note: I have switched to using Graphics.create() here because it is
+ // more reliable (and simpler) to reset. The difference seems to be that SwingJS
+ // automatically sets a clipping region on an image to be the image dimensions, whereas
+ // Java sets no clip for an image. (A bug? Go figure!)
+ // Since we are using an off-screen BufferedImage here, the result is that g.getClip()
+ // returns non-null in JavaScript but not Java.
+ //
+ // Anyway, this works and, I suggest, is better design anyway.
+ //
+ Graphics g = gg.create();
+
g.translate(xOffset, 0);
// When printing we have an extra clipped region,
// the Printable page which we need to account for here
Shape clip = g.getClip();
-
if (clip == null)
{
g.setClip(0, 0, viewportWidth * charWidth, canvasHeight);
viewportWidth * charWidth, (int) clip.getBounds().getHeight());
}
+
/*
* white fill the region to be drawn (so incremental fast paint doesn't
* scribble over an existing image)
startColumn, endx + 1);
g.translate(0, -cHeight - ypos - 3);
}
- g.setClip(clip);
- g.translate(-xOffset, 0);
+ g.dispose();
+// g.translate(-xOffset, 0);
+// g.setClip(clip);
}
/**
int charWidth = av.getCharWidth();
g.setFont(av.getFont());
+
g.setColor(Color.black);
int ypos = wrappedSpaceAboveAlignment;
{
int x = labelWidthWest + viewportWidth * charWidth;
- //System.out.println("shifting " + x);
g.translate(x, 0);
drawVerticalScale(g, startCol, endColumn, ypos, false);
g.translate(-x, 0);