浏览代码

Merge pull request #114 from UnityTech/kgdev

fix strokeCap.
/main
GitHub 6 年前
当前提交
baf7dd08
共有 1 个文件被更改,包括 12 次插入12 次删除
  1. 24
      Runtime/ui/painting/path.cs

24
Runtime/ui/painting/path.cs


float dlx = dy;
float dly = -dx;
dst.Add(new Vector2(px + dlx * w, py + dly * w));
dst.Add(new Vector2(px - dlx * w, py - dly * w));
float a = i / (ncap - 1) * Mathf.PI;
float a = (float) i / (ncap - 1) * Mathf.PI;
dst.Add(new Vector2(px - dlx * ax - dx * ay, py - dly * ax - dy * ay));
dst.Add(new Vector2(px - dlx * ax + dx * ay, py - dly * ax + dy * ay));
dst.Add(new Vector2(px + dlx * w, py + dly * w));
dst.Add(new Vector2(px - dlx * w, py - dly * w));
}
public static void roundCapEnd(this List<Vector3> dst, PathPoint p,

float dlx = dy;
float dly = -dx;
dst.Add(new Vector2(px + dlx * w, py + dly * w));
dst.Add(new Vector2(px - dlx * w, py - dly * w));
float a = i / (ncap - 1) * Mathf.PI;
float a = (float) i / (ncap - 1) * Mathf.PI;
dst.Add(new Vector2(px - dlx * ax - dx * ay, py - dly * ax - dy * ay));
dst.Add(new Vector2(px - dlx * ax + dx * ay, py - dly * ax + dy * ay));
dst.Add(new Vector2(px + dlx * w, py + dly * w));
dst.Add(new Vector2(px - dlx * w, py - dly * w));
}
public static void chooseBevel(bool bevel, PathPoint p0, PathPoint p1, float w,

var n = Mathf.CeilToInt((a0 - a1) / Mathf.PI * ncap).clamp(2, ncap);
for (var i = 0; i < n; i++) {
float u = i / (n - 1);
float u = (float) i / (n - 1);
float a = a0 + u * (a1 - a0);
float rx = p1.x + Mathf.Cos(a) * rw;
float ry = p1.y + Mathf.Sin(a) * rw;

var n = Mathf.CeilToInt((a1 - a0) / Mathf.PI * ncap).clamp(2, ncap);
for (var i = 0; i < n; i++) {
float u = i / (n - 1);
float u = (float) i / (n - 1);
float a = a0 + u * (a1 - a0);
float lx = p1.x + Mathf.Cos(a) * lw;
float ly = p1.y + Mathf.Sin(a) * lw;

正在加载...
取消
保存