BasicStroke oldStroke = (BasicStroke) g2d.getStroke();
BasicStroke bs = null;
+ double scale = 1.0;
if (scaleStroke) {
- double scale = GeometryUtils.getScale(g2d.getTransform());
+ scale = GeometryUtils.getScale(g2d.getTransform());
scale = Math.max(10000, Math.min(scale, 50000));
double str = stroke != null ? Math.abs(stroke) : 1.0;
bs = GeometryUtils.scaleStroke(STROKE, (float) (str / scale));
// Draw arrow
if (arrowLength != null) {
g2d.setColor(Color.BLACK);
- g2d.setStroke(new BasicStroke(bs.getLineWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
+ float lw = STROKE.getLineWidth() / (float)scale;
+ g2d.setStroke(new BasicStroke(lw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
double l = arrowLength;
- double w = 2 * (double) bs.getLineWidth() * Math.signum(l);
+ double w = 2 * (double) lw * Math.signum(l);
if (Math.abs(w) > Math.abs(l)) w = l;
- double offset = 2 * (double) bs.getLineWidth();
+ double offset = 2 * (double) lw;
double centerX = (startX + endX) / 2, centerY = (startY + endY) / 2;
double deltaX = endX - startX, deltaY = endY - startY;
// Render SVG symbol
double viewScaleRecip = 10;
if (scaleStroke) {
- double scale = GeometryUtils.getScale(g2d.getTransform());
- scale = Math.max(10000, Math.min(scale, 50000));
viewScaleRecip /= scale;
}