@wcardinal/wcardinal-ui 0.469.0-beta.0 → 0.469.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Winter Cardinal UI v0.469.0-beta.0
2
+ Winter Cardinal UI v0.469.0-beta.2
3
3
  Copyright (C) 2019-2026 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -16842,7 +16842,7 @@ var EShapeRendererIterator = /** @class */ (function () {
16842
16842
  * SPDX-License-Identifier: Apache-2.0
16843
16843
  */
16844
16844
  var VERTEX_SHADER$1 = "\nattribute highp vec2 aPosition;\nattribute highp vec2 aStepA;\nattribute highp vec4 aStepB;\nattribute highp vec3 aColor;\nattribute highp vec2 aUv;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mediump float shapeScale;\nuniform mediump float antialiasWeight;\n\nvarying mediump float vType;\nvarying mediump vec2 vStepA;\nvarying mediump vec4 vStepB;\nvarying mediump vec4 vLength;\nvarying mediump vec4 vColorFill;\nvarying mediump vec4 vColorStroke;\nvarying mediump vec2 vUv;\n\nvec2 toInverse(in vec2 v) {\n\treturn vec2(-v.y, v.x);\n}\n\nvec4 toGeneral(in float v) {\n\tvec4 c = vec4(1.0, 1.0/64.0, 1.0/64.0/64.0, 1.0/64.0/64.0/64.0) * v;\n\tc -= fract(c);\n\tc -= c.yzwx * vec4(64.0, 64.0, 64.0, 0.0);\n\treturn c;\n}\n\nfloat toStrokeWidthScale(in float scale) {\n\treturn (\n\t\tscale == 3.0 || scale == 7.0 ?\n\t\tshapeScale : (\n\t\t\tscale == 1.0 || scale == 5.0 ?\n\t\t\tmin(1.0, shapeScale) : (\n\t\t\t\tscale == 2.0 || scale == 6.0 ?\n\t\t\t\tmax(1.0, shapeScale) : 1.0\n\t\t\t)\n\t\t)\n\t);\n}\n\nvec2 toUnpackedClippings(in float v) {\n\tvec2 c = vec2(1.0, 1.0/1024.0) * v;\n\tc -= fract(c);\n\tc -= c.yx * vec2(1024.0, 0.0);\n\tc /= vec2(852.5, 852.5);\n\tc -= vec2(0.1, 0.1);\n\treturn c;\n}\n\nvec2 toUnpackedAlphas(in float v) {\n\tvec2 c = vec2(1.0, 1.0/1024.0) * v;\n\tc -= fract(c);\n\tc -= c.yx * vec2(1024.0, 0.0);\n\tc /= vec2(1023.0, 1023.0);\n\treturn c;\n}\n\nvec3 toUnpackedF3x256(in float v) {\n\tvec3 c = vec3(1.0, 1.0/256.0, 1.0/256.0/256.0) * v;\n\tc -= fract(c);\n\tc -= c.yzx * vec3(256.0, 256.0, 0.0);\n\tc /= 255.0;\n\treturn c;\n}\n\nvec2 toPosition012(in vec2 v) {\n\treturn (projectionMatrix * translationMatrix * vec3(v, 1.0)).xy;\n}\n\nvec4 toStepB01(in vec4 sb) {\n\treturn vec4(sb.xy, toUnpackedClippings(sb.z));\n}\n\nvec4 toStepB2(in vec4 sb, in float strokeWidth) {\n\tfloat x = min(0.4, 0.4 / 12.0 * sb.x * antialiasWeight);\n\tfloat w = clamp(strokeWidth, 0.0, 1.0) * 0.4;\n\tfloat p = w * sb.y + sb.z;\n\tfloat y = 0.5 - p;\n\tfloat z = 0.5 - p - w;\n\treturn vec4(y, z, y - max(0.01, y - x), z - max(0.01, z - x));\n}\n\nvec2 toPosition3(in float type, in vec2 p, in float npacked, in float length, in float strokeWidth, out float shift) {\n\tvec3 t = vec3(1.0, 1.0/1024.0, 1.0/1024.0/1024.0) * npacked;\n\tt -= fract(t);\n\tt -= t.yzx * vec3(1024.0, 1024.0, 0.0);\n\tt *= vec3(1.0/511.5, 1.0/511.5, 1.0);\n\tt -= vec3(1.0, 1.0, 0.0);\n\tvec2 n0 = vec2(t.x, ((0.5 < t.z && t.z < 1.5) || 2.5 < t.z ? +1.0 : -1.0) * sqrt(max(0.0, 1.0 - t.x * t.x)));\n\tvec2 n1 = vec2(t.y, (1.5 < t.z ? +1.0 : -1.0) * sqrt(max(0.0, 1.0 - t.y * t.y)));\n\n\tvec2 n0i = toInverse(n0);\n\tvec2 n1i = toInverse(n1);\n\tfloat direction = sign(4.5 - type);\n\n\t// Offset\n\tfloat cross = dot(n0i, n1);\n\tbool bcross = 0.00001 < abs(cross);\n\tfloat crossi = (bcross ? 1.0 / cross : 0.0);\n\tfloat b = dot(n1 - n0, n0) * crossi;\n\tfloat offsetSize = direction * strokeWidth * 0.5;\n\tvec2 offset = n1 + n1i * b;\n\n\t// Miter\n\tvec2 pmiter = p + offsetSize * offset;\n\tfloat miterAngle0 = dot( n0i, offsetSize * offset - length * n0i );\n\tfloat miterAngle1 = dot( n1i, offsetSize * offset + length * n1i );\n\tfloat miterLength = dot( offset, offset );\n\tfloat miterSide = direction * cross;\n\n\t// Bevel\n\tvec2 n = (type == 4.0 || type == 6.0 ? n1 : n0);\n\tvec2 pbevel = p + offsetSize * n;\n\n\t//\n\tvec2 presult = (\n\t\t0.0 <= miterSide ?\n\t\t(miterAngle0 < 0.0 && 0.0 <= miterAngle1 && bcross ? pmiter : pbevel) :\n\t\t(miterLength < 6.0 && bcross ? pmiter : pbevel)\n\t);\n\tvec2 ni = (type == 4.0 || type == 6.0 ? n1i : n0i);\n\tshift = dot(ni, p - presult);\n\treturn toPosition012(presult);\n}\n\nvec2 toStepA3(in float type, in float strokeWidth) {\n\treturn vec2(type < 4.5 ? 1.0 : 0.0, strokeWidth);\n}\n\nfloat toDotWidth(in float strokeScaling, in float strokeWidthScale) {\n\treturn aStepA.x * (\n\t\tstrokeScaling == 4.0 || strokeScaling == 5.0 ||\n\t\tstrokeScaling == 6.0 || strokeScaling == 7.0 ?\n\t\tstrokeWidthScale : 1.0\n\t);\n}\n\nvec2 toDotPattern(in float dash) {\n\treturn (dash < 0.5 ?\n\t\tvec2(1.0, 0.0) :\n\t\t(dash < 3.5 ?\n\t\t\t(dash < 1.5 ?\n\t\t\t\tvec2(1.0, 1.0) :\n\t\t\t\t(2.5 < dash ?\n\t\t\t\t\tvec2(1.0, 2.0) :\n\t\t\t\t\tvec2(1.0, 0.5)\n\t\t\t\t)\n\t\t\t) :\n\t\t\t(dash < 4.5 ?\n\t\t\t\tvec2(2.0, 1.0) :\n\t\t\t\t(5.5 < dash ?\n\t\t\t\t\tvec2(2.0, 2.0) :\n\t\t\t\t\tvec2(2.0, 0.5)\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t);\n}\n\nvec4 toLength3(in float shift, in float dash, in float strokeScaling, in float strokeWidthScale) {\n\tfloat width = toDotWidth(strokeScaling, strokeWidthScale);\n\tvec2 pattern = toDotPattern(dash);\n\treturn vec4(aStepB.y + shift, pattern.x * width, pattern.y * width, aStepB.z);\n}\n\nvec4 toLength7(in float type, in float strokeScaling, in float strokeWidthScale) {\n\tfloat width = toDotWidth(strokeScaling, strokeWidthScale);\n\tvec2 pattern = toDotPattern(type - 7.0);\n\treturn vec4(aStepB.w, pattern.x * width, pattern.y * width, -1.0);\n}\n\nvoid toColors(in vec3 source, out vec4 fillColor, out vec4 strokeColor) {\n\tvec2 a = toUnpackedAlphas(source.z);\n\tfillColor.xyz = toUnpackedF3x256(source.x).zyx * a.x;\n\tfillColor.w = a.x;\n\tstrokeColor.xyz = toUnpackedF3x256(source.y).zyx * a.y;\n\tstrokeColor.w = a.y;\n}\n\nvoid main(void) {\n\tvec4 general = toGeneral(aStepA.y);\n\tfloat type = general.x;\n\tfloat strokeScaling = general.y;\n\tfloat strokeWidthScale = toStrokeWidthScale(strokeScaling);\n\tfloat strokeWidth = strokeWidthScale * aStepA.x;\n\n\tvType = type;\n\tif (type < 2.5 || 6.5 < type) {\n\t\tgl_Position = vec4(toPosition012(aPosition), 0.0, 1.0);\n\t\tvStepA = strokeWidth * general.zw;\n\t\tif (type < 1.5) {\n\t\t\tvStepB = toStepB01(aStepB);\n\t\t\tvLength = vec4(-1.0, 0.0, 0.0, -1.0);\n\t\t} else if (type < 2.5) {\n\t\t\tvStepB = toStepB2(aStepB, strokeWidth);\n\t\t\tvLength = vec4(-1.0, 0.0, 0.0, -1.0);\n\t\t} else {\n\t\t\tvStepB = toStepB01(aStepB);\n\t\t\tvLength = toLength7(type, strokeScaling, strokeWidthScale);\n\t\t}\n\t} else {\n\t\tfloat shift3 = 0.0;\n\t\tgl_Position = vec4(toPosition3(type, aPosition, aStepB.x, aStepB.w, strokeWidth, shift3), 0.0, 1.0);\n\t\tvStepA = toStepA3(type, strokeWidth);\n\t\tvStepB = vec4(0.0);\n\t\tvLength = toLength3(shift3, general.z, strokeScaling, strokeWidthScale);\n\t}\n\ttoColors(aColor, vColorFill, vColorStroke);\n\tvUv = aUv;\n}";
16845
- var FRAGMENT_SHADER$1 = "\nvarying mediump float vType;\nvarying mediump vec2 vStepA;\nvarying mediump vec4 vStepB;\nvarying mediump vec4 vLength;\nvarying mediump vec4 vColorFill;\nvarying mediump vec4 vColorStroke;\nvarying mediump vec2 vUv;\n\nuniform sampler2D sampler;\nuniform mediump float antialiasWeight;\n\nvec4 toColor0(in vec4 texture) {\n\tvec2 f = vec2(1.0) / vStepB.xy;\n\tvec2 c = vStepB.zw;\n\tvec2 awd = 0.5 * antialiasWeight * f;\n\tvec2 swd = vStepA * f;\n\tvec2 one = vec2(1.0);\n\tvec2 s0 = smoothstep(one - awd, one + awd, c);\n\tvec2 s1 = smoothstep(one - swd - awd, one - swd + awd, c);\n\tfloat s2 = max(s0.x, s0.y);\n\tfloat s3 = max(s1.x, s1.y);\n\n\treturn texture * (\n\t\tvColorStroke * (s3 - s2) +\n\t\tvColorFill * (1.0 - s3)\n\t);\n}\n\nvec4 toColor1(in vec4 texture) {\n\tvec2 d = vStepB.xy;\n\tvec2 c = vStepB.zw;\n\tvec2 awd = 0.5 * antialiasWeight / d;\n\tvec2 swd = vStepA / d;\n\tvec2 one = vec2(1.0);\n\tvec2 zero = vec2(0.0);\n\tfloat s0 = smoothstep(length(c/clamp(one + awd, zero, one)), length(c/clamp(one - awd, zero, one)), 1.0);\n\tfloat s1 = smoothstep(length(c/clamp(one - swd + awd, zero, one)), length(c/clamp(one - swd - awd, zero, one)), 1.0);\n\treturn texture * (\n\t\tvColorStroke * (s0 - s1) +\n\t\tvColorFill * s1\n\t);\n}\n\nvec4 toColor2(in vec4 texture) {\n\tvec2 p0 = vStepB.xy;\n\tvec2 p1 = vStepB.zw;\n\tvec2 d = vec2(dot(texture, vec4(1.0, 1.0/255.0, 1.0/255.0/255.0, 0.0)));\n\tvec2 s = smoothstep(p0 - p1, p0 + p1, d);\n\treturn vColorStroke * (s.y - s.x) + vColorFill * s.x;\n}\n\nfloat toLineStep(in vec4 parameters) {\n\tfloat l = parameters.x;\n\tfloat lp0 = parameters.y;\n\tfloat lp1 = parameters.z;\n\tfloat lt = parameters.w;\n\tfloat ld = 0.5 * antialiasWeight;\n\tfloat lm = mod(l, lp0 + lp1);\n\tfloat s0 = (0.0 < lp1 ? smoothstep(-ld, ld, lm) - smoothstep(lp0 - ld, lp0 + ld, lm) : 1.0);\n\tfloat s1 = (0.0 <= lt ? smoothstep(-ld, ld, l) - smoothstep(lt - ld, lt + ld, l) : 1.0);\n\treturn s0 * s1;\n}\n\nvec4 toColor3(in vec4 texture) {\n\tfloat c = vStepA.x;\n\tfloat awd = 0.5 * antialiasWeight / vStepA.y;\n\tfloat s0 = smoothstep(-awd, awd, c);\n\tfloat s1 = smoothstep(1.0 - awd, 1.0 + awd, c);\n\treturn texture * vColorStroke * (s0 - s1) * toLineStep(vLength);\n}\n\nvec4 toColor7(in vec4 texture) {\n\tfloat aw = 0.5 * antialiasWeight;\n\tfloat awd = aw * vStepB.x;\n\tfloat swd = vStepA.x * vStepB.x;\n\tfloat s0 = smoothstep(1.0 - awd, 1.0 + awd, vStepB.z);\n\tfloat s1 = smoothstep(1.0 - swd - awd, 1.0 - swd + awd, vStepB.z) * toLineStep(vLength);\n\tfloat s2 = smoothstep(-aw, +aw, vStepB.y);\n\tfloat s3 = smoothstep(-awd, 0.0, vStepB.z);\n\treturn texture * (\n\t\tvColorStroke * (s1 - s0) +\n\t\tvColorFill * (1.0 - s1) * s2 * s3\n\t);\n}\n\nvoid main(void) {\n\tvec4 texture = texture2D(sampler, vUv);\n\tif (vType < 0.5) {\n\t\tgl_FragColor = toColor0(texture);\n\t} else if (vType < 1.5) {\n\t\tgl_FragColor = toColor1(texture);\n\t} else if (vType < 2.5) {\n\t\tgl_FragColor = toColor2(texture);\n\t} else if (vType < 6.5) {\n\t\tgl_FragColor = toColor3(texture);\n\t} else {\n\t\tgl_FragColor = toColor7(texture);\n\t}\n}";
16845
+ var FRAGMENT_SHADER$1 = "\nvarying mediump float vType;\nvarying mediump vec2 vStepA;\nvarying mediump vec4 vStepB;\nvarying mediump vec4 vLength;\nvarying mediump vec4 vColorFill;\nvarying mediump vec4 vColorStroke;\nvarying mediump vec2 vUv;\n\nuniform sampler2D sampler;\nuniform mediump float antialiasWeight;\n\nvec4 toColor0(in vec4 texture) {\n\tvec2 f = vec2(1.0) / vStepB.xy;\n\tvec2 c = vStepB.zw;\n\tvec2 awd = 0.5 * antialiasWeight * f;\n\tvec2 swd = vStepA * f;\n\tvec2 one = vec2(1.0);\n\tvec2 s0 = smoothstep(one - awd, one + awd, c);\n\tvec2 s1 = smoothstep(one - swd - awd, one - swd + awd, c);\n\tfloat s2 = max(s0.x, s0.y);\n\tfloat s3 = max(s1.x, s1.y);\n\n\treturn texture * (\n\t\tvColorStroke * (s3 - s2) +\n\t\tvColorFill * (1.0 - s3)\n\t);\n}\n\nvec4 toColor1(in vec4 texture) {\n\tvec2 d = vStepB.xy;\n\tvec2 c = vStepB.zw;\n\tvec2 awd = 0.5 * antialiasWeight / d;\n\tvec2 swd = vStepA / d;\n\tvec2 one = vec2(1.0);\n\tvec2 zero = vec2(0.0);\n\tfloat s0 = smoothstep(length(c/clamp(one + awd, zero, one)), length(c/clamp(one - awd, zero, one)), 1.0);\n\tfloat s1 = smoothstep(length(c/clamp(one - swd + awd, zero, one)), length(c/clamp(one - swd - awd, zero, one)), 1.0);\n\treturn texture * (\n\t\tvColorStroke * (s0 - s1) +\n\t\tvColorFill * s1\n\t);\n}\n\nvec4 toColor2(in vec4 texture) {\n\tvec2 p0 = vStepB.xy;\n\tvec2 p1 = vStepB.zw;\n\tvec2 d = vec2(dot(texture, vec4(1.0, 1.0/255.0, 1.0/255.0/255.0, 0.0)));\n\tvec2 s = smoothstep(p0 - p1, p0 + p1, d);\n\treturn vColorStroke * (s.y - s.x) + vColorFill * s.x;\n}\n\nfloat toLineStep(in vec4 parameters) {\n\tfloat l = parameters.x;\n\tfloat lp0 = parameters.y;\n\tfloat lp1 = parameters.z;\n\tfloat lt = parameters.w;\n\tfloat ld = 0.5 * antialiasWeight;\n\tfloat lm = mod(l, lp0 + lp1);\n\tfloat s0 = (0.0 < lp1 ? smoothstep(-ld, ld, lm) - smoothstep(lp0 - ld, lp0 + ld, lm) : 1.0);\n\tfloat s1 = (0.0 <= lt ? smoothstep(-ld, ld, l) - smoothstep(lt - ld, lt + ld, l) : 1.0);\n\treturn s0 * s1;\n}\n\nvec4 toColor3(in vec4 texture) {\n\tfloat c = vStepA.x;\n\tfloat awd = 0.5 * antialiasWeight / vStepA.y;\n\tfloat s0 = smoothstep(-awd, awd, c);\n\tfloat s1 = smoothstep(1.0 - awd, 1.0 + awd, c);\n\treturn texture * vColorStroke * (s0 - s1) * toLineStep(vLength);\n}\n\nvec4 toColor7(in vec4 texture) {\n\tfloat aw = 0.5 * antialiasWeight;\n\tfloat awd = aw * vStepB.x;\n\tfloat swd = vStepA.x * vStepB.x;\n\tfloat s0 = smoothstep(1.0 - awd, 1.0 + awd, vStepB.z);\n\tfloat s1 = smoothstep(1.0 - swd - awd, 1.0 - swd + awd, vStepB.z) * toLineStep(vLength);\n\tfloat s2 = smoothstep(-aw, +aw, vStepB.y);\n\tfloat s3 = smoothstep(-awd, 0.0, vStepB.z);\n\treturn texture * (\n\t\tvColorStroke * (s1 - s0) +\n\t\tvColorFill * (1.0 - s1) * (1.0 - s0) * s2 * s3\n\t);\n}\n\nvoid main(void) {\n\tvec4 texture = texture2D(sampler, vUv);\n\tif (vType < 0.5) {\n\t\tgl_FragColor = toColor0(texture);\n\t} else if (vType < 1.5) {\n\t\tgl_FragColor = toColor1(texture);\n\t} else if (vType < 2.5) {\n\t\tgl_FragColor = toColor2(texture);\n\t} else if (vType < 6.5) {\n\t\tgl_FragColor = toColor3(texture);\n\t} else {\n\t\tgl_FragColor = toColor7(texture);\n\t}\n}";
16846
16846
  var EShapeRenderer = /** @class */ (function (_super) {
16847
16847
  __extends(EShapeRenderer, _super);
16848
16848
  function EShapeRenderer(renderer) {
@@ -70274,8 +70274,8 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
70274
70274
  // The number of the arc segments is 2n and the number of the points on the arc is m.
70275
70275
  var n = EShapeDefaults.CIRCLE_SEGMENT_COUNT >> 2;
70276
70276
  var m = 2 * n + 1;
70277
- var nv = 2 * m + 2 * (n + 3);
70278
- var ni = 4 * n + 2 * (n + 1);
70277
+ var nv = 4 * (m - 1) + 2 * (n + 4);
70278
+ var ni = 4 * n + 2 * (n + 2);
70279
70279
  this._nvertices = nv;
70280
70280
  this._nindices = ni;
70281
70281
  this._id += 1;
@@ -70335,7 +70335,7 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
70335
70335
  var capped = !sided && !isExact;
70336
70336
  var chained = sided || capped;
70337
70337
  this.computeArcPoints(w, h, n, ea, sea, cea);
70338
- this.computeArcNormals(w, h, n, ea);
70338
+ this.computeArcNormals(w, h, n);
70339
70339
  var dmax = this.computeMedialPoints(w, h, n, st, ct, chained);
70340
70340
  if (capped) {
70341
70341
  // The distance field of the arc must cover O, which is the farthest point from the arc,
@@ -70353,10 +70353,10 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
70353
70353
  boundary[3] = 0;
70354
70354
  var fd = 1 / dmax;
70355
70355
  var fs = (EShapeFanTriangulatedImpl.SCALE - 1) * dmax;
70356
- this.computeRimPoints(w, h, n, fs, st, ct, sea, cea, sided);
70357
- // Strip: 2m vertices and 2 * 3 * (m - 1) indices
70356
+ this.computeRimPoints(n, fs, st, ct, sided);
70357
+ // Strip: 4 * (m - 1) vertices and 2 * 3 * (m - 1) indices
70358
70358
  this.writeStrip(m, fd, fx, fy, gx, gy);
70359
- var iv = 2 * m;
70359
+ var iv = 4 * (m - 1);
70360
70360
  var ii = 6 * (m - 1);
70361
70361
  // Polygons at the bottom: left (sign = -1) and right (sign = +1)
70362
70362
  if (sided) {
@@ -70411,12 +70411,12 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
70411
70411
  }
70412
70412
  };
70413
70413
  /**
70414
- * Computes the unit inward normals of the arc, the speeds of the arc, and the arc lengths at P[k].
70414
+ * Computes the unit inward normals of the arc, the speeds of the arc, and the lengths of the polyline at P[k].
70415
70415
  *
70416
70416
  * The normal at P is Np = (-h x / w, -w y / h), whose magnitude is the speed of the arc.
70417
- * The speed is used to approximate the arc length without extra square roots.
70417
+ * The lengths are the ones of the polyline, which is the actual outline, so that they are exact at clipping = 1.
70418
70418
  */
70419
- EShapeFanTriangulatedImpl.prototype.computeArcNormals = function (w, h, n, ea) {
70419
+ EShapeFanTriangulatedImpl.prototype.computeArcNormals = function (w, h, n) {
70420
70420
  var m = 2 * n + 1;
70421
70421
  var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
70422
70422
  var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
@@ -70424,11 +70424,9 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
70424
70424
  var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
70425
70425
  var speeds = EShapeFanTriangulatedImpl.WORK_SPEED;
70426
70426
  var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
70427
- var da = ea / n;
70428
70427
  var hw = h / w;
70429
70428
  var wh = w / h;
70430
70429
  var l = 0;
70431
- var previous = 0;
70432
70430
  for (var k = 0; k <= n; ++k) {
70433
70431
  var dx = -hw * px[k];
70434
70432
  var dy = -wh * py[k];
@@ -70437,9 +70435,10 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
70437
70435
  ny[k] = dy / speed;
70438
70436
  speeds[k] = speed;
70439
70437
  if (0 < k) {
70440
- l += 0.5 * da * (previous + speed);
70438
+ var ex = px[k] - px[k - 1];
70439
+ var ey = py[k] - py[k - 1];
70440
+ l += Math.sqrt(ex * ex + ey * ey);
70441
70441
  }
70442
- previous = speed;
70443
70442
  ls[k] = l;
70444
70443
  }
70445
70444
  for (var k = 0; k < n; ++k) {
@@ -70516,24 +70515,21 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
70516
70515
  return dmax;
70517
70516
  };
70518
70517
  /**
70519
- * Computes R[k], the points on the arc shifted outward by fs, and their lengths.
70518
+ * Computes R[k], the points on the arc shifted outward by fs.
70520
70519
  * If the straight sides are the outline, the end points are shifted
70521
70520
  * to the intersections of the shifted arc and the shifted straight sides.
70522
70521
  */
70523
- EShapeFanTriangulatedImpl.prototype.computeRimPoints = function (w, h, n, fs, st, ct, sea, cea, sided) {
70522
+ EShapeFanTriangulatedImpl.prototype.computeRimPoints = function (n, fs, st, ct, sided) {
70524
70523
  var m = 2 * n + 1;
70525
70524
  var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
70526
70525
  var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
70527
70526
  var nx = EShapeFanTriangulatedImpl.WORK_NORMAL_X;
70528
70527
  var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
70529
- var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
70530
70528
  var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
70531
70529
  var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
70532
- var rl = EShapeFanTriangulatedImpl.WORK_RIM_L;
70533
70530
  for (var k = 0; k < m; ++k) {
70534
70531
  var x = px[k] - fs * nx[k];
70535
70532
  var y = py[k] - fs * ny[k];
70536
- var l = ls[k];
70537
70533
  if (sided && (k === 0 || k === m - 1)) {
70538
70534
  var sign = k === 0 ? -1 : +1;
70539
70535
  // The miter of the outward normal of the arc (n1) and that of the straight side (n2)
@@ -70544,44 +70540,63 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
70544
70540
  var miter = fs / Math.max(1 + n1x * n2x + n1y * n2y, 0.05);
70545
70541
  x = px[k] + miter * (n1x + n2x);
70546
70542
  y = py[k] + miter * (n1y + n2y);
70547
- // The length is shifted along the tangent (tx, ty) / speed
70548
- var tx = w * cea;
70549
- var ty = sign * h * sea;
70550
- l +=
70551
- ((x - px[k]) * tx + (y - py[k]) * ty) / EShapeFanTriangulatedImpl.WORK_SPEED[0];
70552
70543
  }
70553
70544
  rx[k] = x;
70554
70545
  ry[k] = y;
70555
- rl[k] = l;
70556
70546
  }
70557
70547
  };
70558
70548
  /**
70559
- * Writes the strip P[k], P[k + 1], Q[k + 1], Q[k] with the vertices R[k] and Q[k].
70549
+ * Writes the strip P[k], P[k + 1], Q[k + 1], Q[k] with the vertices R[k], Q[k], R[k + 1] and Q[k + 1].
70550
+ *
70551
+ * Each quad owns its vertices. The length in a quad is the length at P[k] plus the projection
70552
+ * to the chord P[k]P[k + 1], which is exact at clipping = 1 where the chord is the outline.
70560
70553
  */
70561
70554
  EShapeFanTriangulatedImpl.prototype.writeStrip = function (m, fd, fx, fy, gx, gy) {
70555
+ var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
70556
+ var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
70562
70557
  var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
70563
70558
  var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
70564
70559
  var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
70565
70560
  var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
70566
70561
  var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
70567
70562
  var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
70568
- var rl = EShapeFanTriangulatedImpl.WORK_RIM_L;
70569
70563
  var scale = EShapeFanTriangulatedImpl.SCALE;
70570
70564
  var indices = this._indices;
70571
70565
  var iv = 0;
70572
70566
  var ii = 0;
70573
- for (var k = 0; k < m; ++k) {
70574
- this.writeVertex(iv++, rx[k], ry[k], rl[k], scale, fd, fx, fy, gx, gy);
70575
- this.writeVertex(iv++, qx[k], qy[k], ls[k], 1 - qd[k] * fd, fd, fx, fy, gx, gy);
70576
- if (k < m - 1) {
70577
- var a = 2 * k;
70578
- indices[ii++] = a;
70579
- indices[ii++] = a + 2;
70580
- indices[ii++] = a + 3;
70581
- indices[ii++] = a;
70582
- indices[ii++] = a + 3;
70583
- indices[ii++] = a + 1;
70584
- }
70567
+ for (var k = 0; k < m - 1; ++k) {
70568
+ var x0 = px[k];
70569
+ var y0 = py[k];
70570
+ var l0 = ls[k];
70571
+ var dl = ls[k + 1] - l0;
70572
+ var fl = 0 < dl ? 1 / dl : 0;
70573
+ var ex = (px[k + 1] - x0) * fl;
70574
+ var ey = (py[k + 1] - y0) * fl;
70575
+ var r0x = rx[k];
70576
+ var r0y = ry[k];
70577
+ var q0x = qx[k];
70578
+ var q0y = qy[k];
70579
+ var r1x = rx[k + 1];
70580
+ var r1y = ry[k + 1];
70581
+ var q1x = qx[k + 1];
70582
+ var q1y = qy[k + 1];
70583
+ var lr0 = l0 + (r0x - x0) * ex + (r0y - y0) * ey;
70584
+ var lq0 = l0 + (q0x - x0) * ex + (q0y - y0) * ey;
70585
+ var lr1 = l0 + (r1x - x0) * ex + (r1y - y0) * ey;
70586
+ var lq1 = l0 + (q1x - x0) * ex + (q1y - y0) * ey;
70587
+ var cq0 = 1 - qd[k] * fd;
70588
+ var cq1 = 1 - qd[k + 1] * fd;
70589
+ this.writeVertex(iv, r0x, r0y, lr0, scale, fd, fx, fy, gx, gy);
70590
+ this.writeVertex(iv + 1, q0x, q0y, lq0, cq0, fd, fx, fy, gx, gy);
70591
+ this.writeVertex(iv + 2, r1x, r1y, lr1, scale, fd, fx, fy, gx, gy);
70592
+ this.writeVertex(iv + 3, q1x, q1y, lq1, cq1, fd, fx, fy, gx, gy);
70593
+ indices[ii++] = iv;
70594
+ indices[ii++] = iv + 2;
70595
+ indices[ii++] = iv + 3;
70596
+ indices[ii++] = iv;
70597
+ indices[ii++] = iv + 3;
70598
+ indices[ii++] = iv + 1;
70599
+ iv += 4;
70585
70600
  }
70586
70601
  };
70587
70602
  /**
@@ -70614,8 +70629,23 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
70614
70629
  for (var j = 0; j <= n; ++j) {
70615
70630
  var k = sign < 0 ? j : m - 1 - j;
70616
70631
  var floor = 1 - qd[k] * fd;
70632
+ var isOnAxis = Math.abs(qx[k]) <= eps;
70633
+ // Where Q is clamped, the clipping of the side reaches the floor at T on the axis before Q.
70634
+ // Without T, the clipping on the axis is not linear and a dent appears at O.
70635
+ var ty = -qd[k] / st;
70636
+ if (isOnAxis && qy[k] < ty - eps) {
70637
+ this.writeSideVertex(iv + count++, 0, ty, floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
70638
+ this.writeFan(ii, iv, count);
70639
+ this.writeSideVertex(iv + count, qx[k], qy[k], floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
70640
+ var indices = this._indices;
70641
+ var i = ii + 3 * (count - 2);
70642
+ indices[i] = iv + count - 2;
70643
+ indices[i + 1] = iv + count;
70644
+ indices[i + 2] = iv + count - 1;
70645
+ return count + 1;
70646
+ }
70617
70647
  this.writeSideVertex(iv + count++, qx[k], qy[k], floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
70618
- if (Math.abs(qx[k]) <= eps) {
70648
+ if (isOnAxis) {
70619
70649
  break;
70620
70650
  }
70621
70651
  }
@@ -70794,7 +70824,7 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
70794
70824
  /** P: the points on the arc */
70795
70825
  EShapeFanTriangulatedImpl.WORK_ARC_X = [];
70796
70826
  EShapeFanTriangulatedImpl.WORK_ARC_Y = [];
70797
- /** The arc lengths measured from P[0] */
70827
+ /** The lengths of the polyline P[0], ..., P[k] */
70798
70828
  EShapeFanTriangulatedImpl.WORK_ARC_L = [];
70799
70829
  /** The unit inward normals of the arc */
70800
70830
  EShapeFanTriangulatedImpl.WORK_NORMAL_X = [];
@@ -70806,10 +70836,9 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
70806
70836
  EShapeFanTriangulatedImpl.WORK_MEDIAL_Y = [];
70807
70837
  /** The distances from P to Q */
70808
70838
  EShapeFanTriangulatedImpl.WORK_MEDIAL_D = [];
70809
- /** R: the points on the arc shifted outward, and their lengths */
70839
+ /** R: the points on the arc shifted outward */
70810
70840
  EShapeFanTriangulatedImpl.WORK_RIM_X = [];
70811
70841
  EShapeFanTriangulatedImpl.WORK_RIM_Y = [];
70812
- EShapeFanTriangulatedImpl.WORK_RIM_L = [];
70813
70842
  return EShapeFanTriangulatedImpl;
70814
70843
  }());
70815
70844
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Winter Cardinal UI v0.469.0-beta.0
2
+ Winter Cardinal UI v0.469.0-beta.2
3
3
  Copyright (C) 2019-2026 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -16839,7 +16839,7 @@
16839
16839
  * SPDX-License-Identifier: Apache-2.0
16840
16840
  */
16841
16841
  var VERTEX_SHADER$1 = "\nattribute highp vec2 aPosition;\nattribute highp vec2 aStepA;\nattribute highp vec4 aStepB;\nattribute highp vec3 aColor;\nattribute highp vec2 aUv;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mediump float shapeScale;\nuniform mediump float antialiasWeight;\n\nvarying mediump float vType;\nvarying mediump vec2 vStepA;\nvarying mediump vec4 vStepB;\nvarying mediump vec4 vLength;\nvarying mediump vec4 vColorFill;\nvarying mediump vec4 vColorStroke;\nvarying mediump vec2 vUv;\n\nvec2 toInverse(in vec2 v) {\n\treturn vec2(-v.y, v.x);\n}\n\nvec4 toGeneral(in float v) {\n\tvec4 c = vec4(1.0, 1.0/64.0, 1.0/64.0/64.0, 1.0/64.0/64.0/64.0) * v;\n\tc -= fract(c);\n\tc -= c.yzwx * vec4(64.0, 64.0, 64.0, 0.0);\n\treturn c;\n}\n\nfloat toStrokeWidthScale(in float scale) {\n\treturn (\n\t\tscale == 3.0 || scale == 7.0 ?\n\t\tshapeScale : (\n\t\t\tscale == 1.0 || scale == 5.0 ?\n\t\t\tmin(1.0, shapeScale) : (\n\t\t\t\tscale == 2.0 || scale == 6.0 ?\n\t\t\t\tmax(1.0, shapeScale) : 1.0\n\t\t\t)\n\t\t)\n\t);\n}\n\nvec2 toUnpackedClippings(in float v) {\n\tvec2 c = vec2(1.0, 1.0/1024.0) * v;\n\tc -= fract(c);\n\tc -= c.yx * vec2(1024.0, 0.0);\n\tc /= vec2(852.5, 852.5);\n\tc -= vec2(0.1, 0.1);\n\treturn c;\n}\n\nvec2 toUnpackedAlphas(in float v) {\n\tvec2 c = vec2(1.0, 1.0/1024.0) * v;\n\tc -= fract(c);\n\tc -= c.yx * vec2(1024.0, 0.0);\n\tc /= vec2(1023.0, 1023.0);\n\treturn c;\n}\n\nvec3 toUnpackedF3x256(in float v) {\n\tvec3 c = vec3(1.0, 1.0/256.0, 1.0/256.0/256.0) * v;\n\tc -= fract(c);\n\tc -= c.yzx * vec3(256.0, 256.0, 0.0);\n\tc /= 255.0;\n\treturn c;\n}\n\nvec2 toPosition012(in vec2 v) {\n\treturn (projectionMatrix * translationMatrix * vec3(v, 1.0)).xy;\n}\n\nvec4 toStepB01(in vec4 sb) {\n\treturn vec4(sb.xy, toUnpackedClippings(sb.z));\n}\n\nvec4 toStepB2(in vec4 sb, in float strokeWidth) {\n\tfloat x = min(0.4, 0.4 / 12.0 * sb.x * antialiasWeight);\n\tfloat w = clamp(strokeWidth, 0.0, 1.0) * 0.4;\n\tfloat p = w * sb.y + sb.z;\n\tfloat y = 0.5 - p;\n\tfloat z = 0.5 - p - w;\n\treturn vec4(y, z, y - max(0.01, y - x), z - max(0.01, z - x));\n}\n\nvec2 toPosition3(in float type, in vec2 p, in float npacked, in float length, in float strokeWidth, out float shift) {\n\tvec3 t = vec3(1.0, 1.0/1024.0, 1.0/1024.0/1024.0) * npacked;\n\tt -= fract(t);\n\tt -= t.yzx * vec3(1024.0, 1024.0, 0.0);\n\tt *= vec3(1.0/511.5, 1.0/511.5, 1.0);\n\tt -= vec3(1.0, 1.0, 0.0);\n\tvec2 n0 = vec2(t.x, ((0.5 < t.z && t.z < 1.5) || 2.5 < t.z ? +1.0 : -1.0) * sqrt(max(0.0, 1.0 - t.x * t.x)));\n\tvec2 n1 = vec2(t.y, (1.5 < t.z ? +1.0 : -1.0) * sqrt(max(0.0, 1.0 - t.y * t.y)));\n\n\tvec2 n0i = toInverse(n0);\n\tvec2 n1i = toInverse(n1);\n\tfloat direction = sign(4.5 - type);\n\n\t// Offset\n\tfloat cross = dot(n0i, n1);\n\tbool bcross = 0.00001 < abs(cross);\n\tfloat crossi = (bcross ? 1.0 / cross : 0.0);\n\tfloat b = dot(n1 - n0, n0) * crossi;\n\tfloat offsetSize = direction * strokeWidth * 0.5;\n\tvec2 offset = n1 + n1i * b;\n\n\t// Miter\n\tvec2 pmiter = p + offsetSize * offset;\n\tfloat miterAngle0 = dot( n0i, offsetSize * offset - length * n0i );\n\tfloat miterAngle1 = dot( n1i, offsetSize * offset + length * n1i );\n\tfloat miterLength = dot( offset, offset );\n\tfloat miterSide = direction * cross;\n\n\t// Bevel\n\tvec2 n = (type == 4.0 || type == 6.0 ? n1 : n0);\n\tvec2 pbevel = p + offsetSize * n;\n\n\t//\n\tvec2 presult = (\n\t\t0.0 <= miterSide ?\n\t\t(miterAngle0 < 0.0 && 0.0 <= miterAngle1 && bcross ? pmiter : pbevel) :\n\t\t(miterLength < 6.0 && bcross ? pmiter : pbevel)\n\t);\n\tvec2 ni = (type == 4.0 || type == 6.0 ? n1i : n0i);\n\tshift = dot(ni, p - presult);\n\treturn toPosition012(presult);\n}\n\nvec2 toStepA3(in float type, in float strokeWidth) {\n\treturn vec2(type < 4.5 ? 1.0 : 0.0, strokeWidth);\n}\n\nfloat toDotWidth(in float strokeScaling, in float strokeWidthScale) {\n\treturn aStepA.x * (\n\t\tstrokeScaling == 4.0 || strokeScaling == 5.0 ||\n\t\tstrokeScaling == 6.0 || strokeScaling == 7.0 ?\n\t\tstrokeWidthScale : 1.0\n\t);\n}\n\nvec2 toDotPattern(in float dash) {\n\treturn (dash < 0.5 ?\n\t\tvec2(1.0, 0.0) :\n\t\t(dash < 3.5 ?\n\t\t\t(dash < 1.5 ?\n\t\t\t\tvec2(1.0, 1.0) :\n\t\t\t\t(2.5 < dash ?\n\t\t\t\t\tvec2(1.0, 2.0) :\n\t\t\t\t\tvec2(1.0, 0.5)\n\t\t\t\t)\n\t\t\t) :\n\t\t\t(dash < 4.5 ?\n\t\t\t\tvec2(2.0, 1.0) :\n\t\t\t\t(5.5 < dash ?\n\t\t\t\t\tvec2(2.0, 2.0) :\n\t\t\t\t\tvec2(2.0, 0.5)\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t);\n}\n\nvec4 toLength3(in float shift, in float dash, in float strokeScaling, in float strokeWidthScale) {\n\tfloat width = toDotWidth(strokeScaling, strokeWidthScale);\n\tvec2 pattern = toDotPattern(dash);\n\treturn vec4(aStepB.y + shift, pattern.x * width, pattern.y * width, aStepB.z);\n}\n\nvec4 toLength7(in float type, in float strokeScaling, in float strokeWidthScale) {\n\tfloat width = toDotWidth(strokeScaling, strokeWidthScale);\n\tvec2 pattern = toDotPattern(type - 7.0);\n\treturn vec4(aStepB.w, pattern.x * width, pattern.y * width, -1.0);\n}\n\nvoid toColors(in vec3 source, out vec4 fillColor, out vec4 strokeColor) {\n\tvec2 a = toUnpackedAlphas(source.z);\n\tfillColor.xyz = toUnpackedF3x256(source.x).zyx * a.x;\n\tfillColor.w = a.x;\n\tstrokeColor.xyz = toUnpackedF3x256(source.y).zyx * a.y;\n\tstrokeColor.w = a.y;\n}\n\nvoid main(void) {\n\tvec4 general = toGeneral(aStepA.y);\n\tfloat type = general.x;\n\tfloat strokeScaling = general.y;\n\tfloat strokeWidthScale = toStrokeWidthScale(strokeScaling);\n\tfloat strokeWidth = strokeWidthScale * aStepA.x;\n\n\tvType = type;\n\tif (type < 2.5 || 6.5 < type) {\n\t\tgl_Position = vec4(toPosition012(aPosition), 0.0, 1.0);\n\t\tvStepA = strokeWidth * general.zw;\n\t\tif (type < 1.5) {\n\t\t\tvStepB = toStepB01(aStepB);\n\t\t\tvLength = vec4(-1.0, 0.0, 0.0, -1.0);\n\t\t} else if (type < 2.5) {\n\t\t\tvStepB = toStepB2(aStepB, strokeWidth);\n\t\t\tvLength = vec4(-1.0, 0.0, 0.0, -1.0);\n\t\t} else {\n\t\t\tvStepB = toStepB01(aStepB);\n\t\t\tvLength = toLength7(type, strokeScaling, strokeWidthScale);\n\t\t}\n\t} else {\n\t\tfloat shift3 = 0.0;\n\t\tgl_Position = vec4(toPosition3(type, aPosition, aStepB.x, aStepB.w, strokeWidth, shift3), 0.0, 1.0);\n\t\tvStepA = toStepA3(type, strokeWidth);\n\t\tvStepB = vec4(0.0);\n\t\tvLength = toLength3(shift3, general.z, strokeScaling, strokeWidthScale);\n\t}\n\ttoColors(aColor, vColorFill, vColorStroke);\n\tvUv = aUv;\n}";
16842
- var FRAGMENT_SHADER$1 = "\nvarying mediump float vType;\nvarying mediump vec2 vStepA;\nvarying mediump vec4 vStepB;\nvarying mediump vec4 vLength;\nvarying mediump vec4 vColorFill;\nvarying mediump vec4 vColorStroke;\nvarying mediump vec2 vUv;\n\nuniform sampler2D sampler;\nuniform mediump float antialiasWeight;\n\nvec4 toColor0(in vec4 texture) {\n\tvec2 f = vec2(1.0) / vStepB.xy;\n\tvec2 c = vStepB.zw;\n\tvec2 awd = 0.5 * antialiasWeight * f;\n\tvec2 swd = vStepA * f;\n\tvec2 one = vec2(1.0);\n\tvec2 s0 = smoothstep(one - awd, one + awd, c);\n\tvec2 s1 = smoothstep(one - swd - awd, one - swd + awd, c);\n\tfloat s2 = max(s0.x, s0.y);\n\tfloat s3 = max(s1.x, s1.y);\n\n\treturn texture * (\n\t\tvColorStroke * (s3 - s2) +\n\t\tvColorFill * (1.0 - s3)\n\t);\n}\n\nvec4 toColor1(in vec4 texture) {\n\tvec2 d = vStepB.xy;\n\tvec2 c = vStepB.zw;\n\tvec2 awd = 0.5 * antialiasWeight / d;\n\tvec2 swd = vStepA / d;\n\tvec2 one = vec2(1.0);\n\tvec2 zero = vec2(0.0);\n\tfloat s0 = smoothstep(length(c/clamp(one + awd, zero, one)), length(c/clamp(one - awd, zero, one)), 1.0);\n\tfloat s1 = smoothstep(length(c/clamp(one - swd + awd, zero, one)), length(c/clamp(one - swd - awd, zero, one)), 1.0);\n\treturn texture * (\n\t\tvColorStroke * (s0 - s1) +\n\t\tvColorFill * s1\n\t);\n}\n\nvec4 toColor2(in vec4 texture) {\n\tvec2 p0 = vStepB.xy;\n\tvec2 p1 = vStepB.zw;\n\tvec2 d = vec2(dot(texture, vec4(1.0, 1.0/255.0, 1.0/255.0/255.0, 0.0)));\n\tvec2 s = smoothstep(p0 - p1, p0 + p1, d);\n\treturn vColorStroke * (s.y - s.x) + vColorFill * s.x;\n}\n\nfloat toLineStep(in vec4 parameters) {\n\tfloat l = parameters.x;\n\tfloat lp0 = parameters.y;\n\tfloat lp1 = parameters.z;\n\tfloat lt = parameters.w;\n\tfloat ld = 0.5 * antialiasWeight;\n\tfloat lm = mod(l, lp0 + lp1);\n\tfloat s0 = (0.0 < lp1 ? smoothstep(-ld, ld, lm) - smoothstep(lp0 - ld, lp0 + ld, lm) : 1.0);\n\tfloat s1 = (0.0 <= lt ? smoothstep(-ld, ld, l) - smoothstep(lt - ld, lt + ld, l) : 1.0);\n\treturn s0 * s1;\n}\n\nvec4 toColor3(in vec4 texture) {\n\tfloat c = vStepA.x;\n\tfloat awd = 0.5 * antialiasWeight / vStepA.y;\n\tfloat s0 = smoothstep(-awd, awd, c);\n\tfloat s1 = smoothstep(1.0 - awd, 1.0 + awd, c);\n\treturn texture * vColorStroke * (s0 - s1) * toLineStep(vLength);\n}\n\nvec4 toColor7(in vec4 texture) {\n\tfloat aw = 0.5 * antialiasWeight;\n\tfloat awd = aw * vStepB.x;\n\tfloat swd = vStepA.x * vStepB.x;\n\tfloat s0 = smoothstep(1.0 - awd, 1.0 + awd, vStepB.z);\n\tfloat s1 = smoothstep(1.0 - swd - awd, 1.0 - swd + awd, vStepB.z) * toLineStep(vLength);\n\tfloat s2 = smoothstep(-aw, +aw, vStepB.y);\n\tfloat s3 = smoothstep(-awd, 0.0, vStepB.z);\n\treturn texture * (\n\t\tvColorStroke * (s1 - s0) +\n\t\tvColorFill * (1.0 - s1) * s2 * s3\n\t);\n}\n\nvoid main(void) {\n\tvec4 texture = texture2D(sampler, vUv);\n\tif (vType < 0.5) {\n\t\tgl_FragColor = toColor0(texture);\n\t} else if (vType < 1.5) {\n\t\tgl_FragColor = toColor1(texture);\n\t} else if (vType < 2.5) {\n\t\tgl_FragColor = toColor2(texture);\n\t} else if (vType < 6.5) {\n\t\tgl_FragColor = toColor3(texture);\n\t} else {\n\t\tgl_FragColor = toColor7(texture);\n\t}\n}";
16842
+ var FRAGMENT_SHADER$1 = "\nvarying mediump float vType;\nvarying mediump vec2 vStepA;\nvarying mediump vec4 vStepB;\nvarying mediump vec4 vLength;\nvarying mediump vec4 vColorFill;\nvarying mediump vec4 vColorStroke;\nvarying mediump vec2 vUv;\n\nuniform sampler2D sampler;\nuniform mediump float antialiasWeight;\n\nvec4 toColor0(in vec4 texture) {\n\tvec2 f = vec2(1.0) / vStepB.xy;\n\tvec2 c = vStepB.zw;\n\tvec2 awd = 0.5 * antialiasWeight * f;\n\tvec2 swd = vStepA * f;\n\tvec2 one = vec2(1.0);\n\tvec2 s0 = smoothstep(one - awd, one + awd, c);\n\tvec2 s1 = smoothstep(one - swd - awd, one - swd + awd, c);\n\tfloat s2 = max(s0.x, s0.y);\n\tfloat s3 = max(s1.x, s1.y);\n\n\treturn texture * (\n\t\tvColorStroke * (s3 - s2) +\n\t\tvColorFill * (1.0 - s3)\n\t);\n}\n\nvec4 toColor1(in vec4 texture) {\n\tvec2 d = vStepB.xy;\n\tvec2 c = vStepB.zw;\n\tvec2 awd = 0.5 * antialiasWeight / d;\n\tvec2 swd = vStepA / d;\n\tvec2 one = vec2(1.0);\n\tvec2 zero = vec2(0.0);\n\tfloat s0 = smoothstep(length(c/clamp(one + awd, zero, one)), length(c/clamp(one - awd, zero, one)), 1.0);\n\tfloat s1 = smoothstep(length(c/clamp(one - swd + awd, zero, one)), length(c/clamp(one - swd - awd, zero, one)), 1.0);\n\treturn texture * (\n\t\tvColorStroke * (s0 - s1) +\n\t\tvColorFill * s1\n\t);\n}\n\nvec4 toColor2(in vec4 texture) {\n\tvec2 p0 = vStepB.xy;\n\tvec2 p1 = vStepB.zw;\n\tvec2 d = vec2(dot(texture, vec4(1.0, 1.0/255.0, 1.0/255.0/255.0, 0.0)));\n\tvec2 s = smoothstep(p0 - p1, p0 + p1, d);\n\treturn vColorStroke * (s.y - s.x) + vColorFill * s.x;\n}\n\nfloat toLineStep(in vec4 parameters) {\n\tfloat l = parameters.x;\n\tfloat lp0 = parameters.y;\n\tfloat lp1 = parameters.z;\n\tfloat lt = parameters.w;\n\tfloat ld = 0.5 * antialiasWeight;\n\tfloat lm = mod(l, lp0 + lp1);\n\tfloat s0 = (0.0 < lp1 ? smoothstep(-ld, ld, lm) - smoothstep(lp0 - ld, lp0 + ld, lm) : 1.0);\n\tfloat s1 = (0.0 <= lt ? smoothstep(-ld, ld, l) - smoothstep(lt - ld, lt + ld, l) : 1.0);\n\treturn s0 * s1;\n}\n\nvec4 toColor3(in vec4 texture) {\n\tfloat c = vStepA.x;\n\tfloat awd = 0.5 * antialiasWeight / vStepA.y;\n\tfloat s0 = smoothstep(-awd, awd, c);\n\tfloat s1 = smoothstep(1.0 - awd, 1.0 + awd, c);\n\treturn texture * vColorStroke * (s0 - s1) * toLineStep(vLength);\n}\n\nvec4 toColor7(in vec4 texture) {\n\tfloat aw = 0.5 * antialiasWeight;\n\tfloat awd = aw * vStepB.x;\n\tfloat swd = vStepA.x * vStepB.x;\n\tfloat s0 = smoothstep(1.0 - awd, 1.0 + awd, vStepB.z);\n\tfloat s1 = smoothstep(1.0 - swd - awd, 1.0 - swd + awd, vStepB.z) * toLineStep(vLength);\n\tfloat s2 = smoothstep(-aw, +aw, vStepB.y);\n\tfloat s3 = smoothstep(-awd, 0.0, vStepB.z);\n\treturn texture * (\n\t\tvColorStroke * (s1 - s0) +\n\t\tvColorFill * (1.0 - s1) * (1.0 - s0) * s2 * s3\n\t);\n}\n\nvoid main(void) {\n\tvec4 texture = texture2D(sampler, vUv);\n\tif (vType < 0.5) {\n\t\tgl_FragColor = toColor0(texture);\n\t} else if (vType < 1.5) {\n\t\tgl_FragColor = toColor1(texture);\n\t} else if (vType < 2.5) {\n\t\tgl_FragColor = toColor2(texture);\n\t} else if (vType < 6.5) {\n\t\tgl_FragColor = toColor3(texture);\n\t} else {\n\t\tgl_FragColor = toColor7(texture);\n\t}\n}";
16843
16843
  var EShapeRenderer = /** @class */ (function (_super) {
16844
16844
  __extends(EShapeRenderer, _super);
16845
16845
  function EShapeRenderer(renderer) {
@@ -48165,8 +48165,8 @@
48165
48165
  // The number of the arc segments is 2n and the number of the points on the arc is m.
48166
48166
  var n = EShapeDefaults.CIRCLE_SEGMENT_COUNT >> 2;
48167
48167
  var m = 2 * n + 1;
48168
- var nv = 2 * m + 2 * (n + 3);
48169
- var ni = 4 * n + 2 * (n + 1);
48168
+ var nv = 4 * (m - 1) + 2 * (n + 4);
48169
+ var ni = 4 * n + 2 * (n + 2);
48170
48170
  this._nvertices = nv;
48171
48171
  this._nindices = ni;
48172
48172
  this._id += 1;
@@ -48226,7 +48226,7 @@
48226
48226
  var capped = !sided && !isExact;
48227
48227
  var chained = sided || capped;
48228
48228
  this.computeArcPoints(w, h, n, ea, sea, cea);
48229
- this.computeArcNormals(w, h, n, ea);
48229
+ this.computeArcNormals(w, h, n);
48230
48230
  var dmax = this.computeMedialPoints(w, h, n, st, ct, chained);
48231
48231
  if (capped) {
48232
48232
  // The distance field of the arc must cover O, which is the farthest point from the arc,
@@ -48244,10 +48244,10 @@
48244
48244
  boundary[3] = 0;
48245
48245
  var fd = 1 / dmax;
48246
48246
  var fs = (EShapeFanTriangulatedImpl.SCALE - 1) * dmax;
48247
- this.computeRimPoints(w, h, n, fs, st, ct, sea, cea, sided);
48248
- // Strip: 2m vertices and 2 * 3 * (m - 1) indices
48247
+ this.computeRimPoints(n, fs, st, ct, sided);
48248
+ // Strip: 4 * (m - 1) vertices and 2 * 3 * (m - 1) indices
48249
48249
  this.writeStrip(m, fd, fx, fy, gx, gy);
48250
- var iv = 2 * m;
48250
+ var iv = 4 * (m - 1);
48251
48251
  var ii = 6 * (m - 1);
48252
48252
  // Polygons at the bottom: left (sign = -1) and right (sign = +1)
48253
48253
  if (sided) {
@@ -48302,12 +48302,12 @@
48302
48302
  }
48303
48303
  };
48304
48304
  /**
48305
- * Computes the unit inward normals of the arc, the speeds of the arc, and the arc lengths at P[k].
48305
+ * Computes the unit inward normals of the arc, the speeds of the arc, and the lengths of the polyline at P[k].
48306
48306
  *
48307
48307
  * The normal at P is Np = (-h x / w, -w y / h), whose magnitude is the speed of the arc.
48308
- * The speed is used to approximate the arc length without extra square roots.
48308
+ * The lengths are the ones of the polyline, which is the actual outline, so that they are exact at clipping = 1.
48309
48309
  */
48310
- EShapeFanTriangulatedImpl.prototype.computeArcNormals = function (w, h, n, ea) {
48310
+ EShapeFanTriangulatedImpl.prototype.computeArcNormals = function (w, h, n) {
48311
48311
  var m = 2 * n + 1;
48312
48312
  var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
48313
48313
  var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
@@ -48315,11 +48315,9 @@
48315
48315
  var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
48316
48316
  var speeds = EShapeFanTriangulatedImpl.WORK_SPEED;
48317
48317
  var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
48318
- var da = ea / n;
48319
48318
  var hw = h / w;
48320
48319
  var wh = w / h;
48321
48320
  var l = 0;
48322
- var previous = 0;
48323
48321
  for (var k = 0; k <= n; ++k) {
48324
48322
  var dx = -hw * px[k];
48325
48323
  var dy = -wh * py[k];
@@ -48328,9 +48326,10 @@
48328
48326
  ny[k] = dy / speed;
48329
48327
  speeds[k] = speed;
48330
48328
  if (0 < k) {
48331
- l += 0.5 * da * (previous + speed);
48329
+ var ex = px[k] - px[k - 1];
48330
+ var ey = py[k] - py[k - 1];
48331
+ l += Math.sqrt(ex * ex + ey * ey);
48332
48332
  }
48333
- previous = speed;
48334
48333
  ls[k] = l;
48335
48334
  }
48336
48335
  for (var k = 0; k < n; ++k) {
@@ -48407,24 +48406,21 @@
48407
48406
  return dmax;
48408
48407
  };
48409
48408
  /**
48410
- * Computes R[k], the points on the arc shifted outward by fs, and their lengths.
48409
+ * Computes R[k], the points on the arc shifted outward by fs.
48411
48410
  * If the straight sides are the outline, the end points are shifted
48412
48411
  * to the intersections of the shifted arc and the shifted straight sides.
48413
48412
  */
48414
- EShapeFanTriangulatedImpl.prototype.computeRimPoints = function (w, h, n, fs, st, ct, sea, cea, sided) {
48413
+ EShapeFanTriangulatedImpl.prototype.computeRimPoints = function (n, fs, st, ct, sided) {
48415
48414
  var m = 2 * n + 1;
48416
48415
  var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
48417
48416
  var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
48418
48417
  var nx = EShapeFanTriangulatedImpl.WORK_NORMAL_X;
48419
48418
  var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
48420
- var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
48421
48419
  var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
48422
48420
  var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
48423
- var rl = EShapeFanTriangulatedImpl.WORK_RIM_L;
48424
48421
  for (var k = 0; k < m; ++k) {
48425
48422
  var x = px[k] - fs * nx[k];
48426
48423
  var y = py[k] - fs * ny[k];
48427
- var l = ls[k];
48428
48424
  if (sided && (k === 0 || k === m - 1)) {
48429
48425
  var sign = k === 0 ? -1 : +1;
48430
48426
  // The miter of the outward normal of the arc (n1) and that of the straight side (n2)
@@ -48435,44 +48431,63 @@
48435
48431
  var miter = fs / Math.max(1 + n1x * n2x + n1y * n2y, 0.05);
48436
48432
  x = px[k] + miter * (n1x + n2x);
48437
48433
  y = py[k] + miter * (n1y + n2y);
48438
- // The length is shifted along the tangent (tx, ty) / speed
48439
- var tx = w * cea;
48440
- var ty = sign * h * sea;
48441
- l +=
48442
- ((x - px[k]) * tx + (y - py[k]) * ty) / EShapeFanTriangulatedImpl.WORK_SPEED[0];
48443
48434
  }
48444
48435
  rx[k] = x;
48445
48436
  ry[k] = y;
48446
- rl[k] = l;
48447
48437
  }
48448
48438
  };
48449
48439
  /**
48450
- * Writes the strip P[k], P[k + 1], Q[k + 1], Q[k] with the vertices R[k] and Q[k].
48440
+ * Writes the strip P[k], P[k + 1], Q[k + 1], Q[k] with the vertices R[k], Q[k], R[k + 1] and Q[k + 1].
48441
+ *
48442
+ * Each quad owns its vertices. The length in a quad is the length at P[k] plus the projection
48443
+ * to the chord P[k]P[k + 1], which is exact at clipping = 1 where the chord is the outline.
48451
48444
  */
48452
48445
  EShapeFanTriangulatedImpl.prototype.writeStrip = function (m, fd, fx, fy, gx, gy) {
48446
+ var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
48447
+ var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
48453
48448
  var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
48454
48449
  var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
48455
48450
  var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
48456
48451
  var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
48457
48452
  var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
48458
48453
  var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
48459
- var rl = EShapeFanTriangulatedImpl.WORK_RIM_L;
48460
48454
  var scale = EShapeFanTriangulatedImpl.SCALE;
48461
48455
  var indices = this._indices;
48462
48456
  var iv = 0;
48463
48457
  var ii = 0;
48464
- for (var k = 0; k < m; ++k) {
48465
- this.writeVertex(iv++, rx[k], ry[k], rl[k], scale, fd, fx, fy, gx, gy);
48466
- this.writeVertex(iv++, qx[k], qy[k], ls[k], 1 - qd[k] * fd, fd, fx, fy, gx, gy);
48467
- if (k < m - 1) {
48468
- var a = 2 * k;
48469
- indices[ii++] = a;
48470
- indices[ii++] = a + 2;
48471
- indices[ii++] = a + 3;
48472
- indices[ii++] = a;
48473
- indices[ii++] = a + 3;
48474
- indices[ii++] = a + 1;
48475
- }
48458
+ for (var k = 0; k < m - 1; ++k) {
48459
+ var x0 = px[k];
48460
+ var y0 = py[k];
48461
+ var l0 = ls[k];
48462
+ var dl = ls[k + 1] - l0;
48463
+ var fl = 0 < dl ? 1 / dl : 0;
48464
+ var ex = (px[k + 1] - x0) * fl;
48465
+ var ey = (py[k + 1] - y0) * fl;
48466
+ var r0x = rx[k];
48467
+ var r0y = ry[k];
48468
+ var q0x = qx[k];
48469
+ var q0y = qy[k];
48470
+ var r1x = rx[k + 1];
48471
+ var r1y = ry[k + 1];
48472
+ var q1x = qx[k + 1];
48473
+ var q1y = qy[k + 1];
48474
+ var lr0 = l0 + (r0x - x0) * ex + (r0y - y0) * ey;
48475
+ var lq0 = l0 + (q0x - x0) * ex + (q0y - y0) * ey;
48476
+ var lr1 = l0 + (r1x - x0) * ex + (r1y - y0) * ey;
48477
+ var lq1 = l0 + (q1x - x0) * ex + (q1y - y0) * ey;
48478
+ var cq0 = 1 - qd[k] * fd;
48479
+ var cq1 = 1 - qd[k + 1] * fd;
48480
+ this.writeVertex(iv, r0x, r0y, lr0, scale, fd, fx, fy, gx, gy);
48481
+ this.writeVertex(iv + 1, q0x, q0y, lq0, cq0, fd, fx, fy, gx, gy);
48482
+ this.writeVertex(iv + 2, r1x, r1y, lr1, scale, fd, fx, fy, gx, gy);
48483
+ this.writeVertex(iv + 3, q1x, q1y, lq1, cq1, fd, fx, fy, gx, gy);
48484
+ indices[ii++] = iv;
48485
+ indices[ii++] = iv + 2;
48486
+ indices[ii++] = iv + 3;
48487
+ indices[ii++] = iv;
48488
+ indices[ii++] = iv + 3;
48489
+ indices[ii++] = iv + 1;
48490
+ iv += 4;
48476
48491
  }
48477
48492
  };
48478
48493
  /**
@@ -48505,8 +48520,23 @@
48505
48520
  for (var j = 0; j <= n; ++j) {
48506
48521
  var k = sign < 0 ? j : m - 1 - j;
48507
48522
  var floor = 1 - qd[k] * fd;
48523
+ var isOnAxis = Math.abs(qx[k]) <= eps;
48524
+ // Where Q is clamped, the clipping of the side reaches the floor at T on the axis before Q.
48525
+ // Without T, the clipping on the axis is not linear and a dent appears at O.
48526
+ var ty = -qd[k] / st;
48527
+ if (isOnAxis && qy[k] < ty - eps) {
48528
+ this.writeSideVertex(iv + count++, 0, ty, floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
48529
+ this.writeFan(ii, iv, count);
48530
+ this.writeSideVertex(iv + count, qx[k], qy[k], floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
48531
+ var indices = this._indices;
48532
+ var i = ii + 3 * (count - 2);
48533
+ indices[i] = iv + count - 2;
48534
+ indices[i + 1] = iv + count;
48535
+ indices[i + 2] = iv + count - 1;
48536
+ return count + 1;
48537
+ }
48508
48538
  this.writeSideVertex(iv + count++, qx[k], qy[k], floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
48509
- if (Math.abs(qx[k]) <= eps) {
48539
+ if (isOnAxis) {
48510
48540
  break;
48511
48541
  }
48512
48542
  }
@@ -48685,7 +48715,7 @@
48685
48715
  /** P: the points on the arc */
48686
48716
  EShapeFanTriangulatedImpl.WORK_ARC_X = [];
48687
48717
  EShapeFanTriangulatedImpl.WORK_ARC_Y = [];
48688
- /** The arc lengths measured from P[0] */
48718
+ /** The lengths of the polyline P[0], ..., P[k] */
48689
48719
  EShapeFanTriangulatedImpl.WORK_ARC_L = [];
48690
48720
  /** The unit inward normals of the arc */
48691
48721
  EShapeFanTriangulatedImpl.WORK_NORMAL_X = [];
@@ -48697,10 +48727,9 @@
48697
48727
  EShapeFanTriangulatedImpl.WORK_MEDIAL_Y = [];
48698
48728
  /** The distances from P to Q */
48699
48729
  EShapeFanTriangulatedImpl.WORK_MEDIAL_D = [];
48700
- /** R: the points on the arc shifted outward, and their lengths */
48730
+ /** R: the points on the arc shifted outward */
48701
48731
  EShapeFanTriangulatedImpl.WORK_RIM_X = [];
48702
48732
  EShapeFanTriangulatedImpl.WORK_RIM_Y = [];
48703
- EShapeFanTriangulatedImpl.WORK_RIM_L = [];
48704
48733
  return EShapeFanTriangulatedImpl;
48705
48734
  }());
48706
48735