提交 60056926 编写于 作者: M Mathieu Bastian

Fix issue with SVG lines

上级 7ba383e6
...@@ -534,14 +534,15 @@ public class EdgeRenderer implements Renderer { ...@@ -534,14 +534,15 @@ public class EdgeRenderer implements Renderer {
String path = String.format( String path = String.format(
Locale.ENGLISH, Locale.ENGLISH,
"M %f,%f A %f,%f %d,%d %d,%f,%f", "M %f,%f A %f,%f %d,%d %d,%f,%f",
h.x1, h.y1, h.x1WithRadius, h.y1WithRadius,
h.r, h.r, 0, 0, 1, h.x2, h.y2); h.r, h.r, 0, 0, 1, h.x2WithRadius, h.y2WithRadius);
edgeElem.setAttribute("d", path); edgeElem.setAttribute("d", path);
edgeElem.setAttribute("stroke", svgTarget.toHexString(color)); edgeElem.setAttribute("stroke", svgTarget.toHexString(color));
edgeElem.setAttribute( edgeElem.setAttribute(
"stroke-width", "stroke-width",
Float.toString(getThickness(item) Float.toString(getThickness(item)
* svgTarget.getScaleRatio())); * svgTarget.getScaleRatio()));
edgeElem.setAttribute("stroke-linecap", "round");
edgeElem.setAttribute( edgeElem.setAttribute(
"stroke-opacity", "stroke-opacity",
(color.getAlpha() / 255f) + ""); (color.getAlpha() / 255f) + "");
...@@ -604,6 +605,10 @@ public class EdgeRenderer implements Renderer { ...@@ -604,6 +605,10 @@ public class EdgeRenderer implements Renderer {
public final double bbh; public final double bbh;
public final double astart; public final double astart;
public final double asweep; public final double asweep;
public final Float x1WithRadius;
public final Float x2WithRadius;
public final Float y1WithRadius;
public final Float y2WithRadius;
public Helper( public Helper(
final Item item, final Item item,
...@@ -664,6 +669,12 @@ public class EdgeRenderer implements Renderer { ...@@ -664,6 +669,12 @@ public class EdgeRenderer implements Renderer {
if (targetRadius != null && targetRadius < 0) { if (targetRadius != null && targetRadius < 0) {
Double targetOffset = this.computeTheThing(r, (double) targetRadius); Double targetOffset = this.computeTheThing(r, (double) targetRadius);
angle2 += targetOffset; angle2 += targetOffset;
x2WithRadius = (float)(r*Math.cos(angle2) + xc);
y2WithRadius = (float)(r*Math.sin(angle2) + yc);
} else {
x2WithRadius = x2;
y2WithRadius = y2;
} }
// Source radius // Source radius
...@@ -672,6 +683,12 @@ public class EdgeRenderer implements Renderer { ...@@ -672,6 +683,12 @@ public class EdgeRenderer implements Renderer {
if (sourceRadius != null && sourceRadius < 0) { if (sourceRadius != null && sourceRadius < 0) {
Double sourceOffset = this.computeTheThing(r, (double) sourceRadius); Double sourceOffset = this.computeTheThing(r, (double) sourceRadius);
angle1 -= sourceOffset; angle1 -= sourceOffset;
x1WithRadius = (float)(r*Math.cos(angle1) + xc);
y1WithRadius = (float)(r*Math.sin(angle1) + yc);
} else {
x1WithRadius = x1;
y1WithRadius = y1;
} }
bbx = xc - r; bbx = xc - r;
...@@ -706,19 +723,6 @@ public class EdgeRenderer implements Renderer { ...@@ -706,19 +723,6 @@ public class EdgeRenderer implements Renderer {
} }
return 2 * Math.atan2(rt / 2, x); return 2 * Math.atan2(rt / 2, x);
} }
private Vector computeCtrlPoint(
final Float x,
final Float y,
final Vector direction,
final float factor,
final Vector normalVector) {
final Vector v = new Vector(direction.x, direction.y);
v.mult(factor);
v.add(new Vector(x, y));
v.add(normalVector);
return v;
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册