@wcardinal/wcardinal-ui 0.390.1 → 0.391.0
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.
- package/dist/types/wcardinal/ui/d-base-mesh-geometry.d.ts +1 -0
- package/dist/wcardinal/ui/d-base-background-mesh-geometry.js +3 -16
- package/dist/wcardinal/ui/d-base-background-mesh-geometry.js.map +1 -1
- package/dist/wcardinal/ui/d-base-border-mesh-geometry.js +68 -45
- package/dist/wcardinal/ui/d-base-border-mesh-geometry.js.map +1 -1
- package/dist/wcardinal/ui/d-base-mesh-geometry.js +2 -1
- package/dist/wcardinal/ui/d-base-mesh-geometry.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-renderer.js +1 -1
- package/dist/wcardinal/ui/shape/e-shape-renderer.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-base.js +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-base.js.map +1 -1
- package/dist/wcardinal/ui/util/dynamic-sdf-font-generator.js +1 -1
- package/dist/wcardinal/ui/util/dynamic-sdf-font-generator.js.map +1 -1
- package/dist/wcardinal/ui/util/util-extractor.js +2 -0
- package/dist/wcardinal/ui/util/util-extractor.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +81 -68
- package/dist/wcardinal-ui.js +81 -68
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
package/dist/wcardinal-ui.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.391.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -4831,7 +4831,7 @@ var EShapeBase = /** @class */ (function (_super) {
|
|
|
4831
4831
|
//
|
|
4832
4832
|
};
|
|
4833
4833
|
EShapeBase.prototype.updateUploaded = function (recursively) {
|
|
4834
|
-
if (this._lockUploaded.isLocked()) {
|
|
4834
|
+
if (this._lockUploaded.isLocked(recursively)) {
|
|
4835
4835
|
return;
|
|
4836
4836
|
}
|
|
4837
4837
|
var uploaded = this.uploaded;
|
|
@@ -11784,7 +11784,8 @@ var DBaseMeshGeometry = /** @class */ (function (_super) {
|
|
|
11784
11784
|
sin: sin
|
|
11785
11785
|
};
|
|
11786
11786
|
};
|
|
11787
|
-
|
|
11787
|
+
/** Note that this must be an odd number. */
|
|
11788
|
+
DBaseMeshGeometry.N = 5;
|
|
11788
11789
|
return DBaseMeshGeometry;
|
|
11789
11790
|
}(pixi_js.MeshGeometry));
|
|
11790
11791
|
|
|
@@ -11800,27 +11801,14 @@ var DBaseBackgroundMeshGeometry = /** @class */ (function (_super) {
|
|
|
11800
11801
|
DBaseBackgroundMeshGeometry.prototype.fillVertices = function (vertices, uvs, iv, iuv, n, x, y, r, dr, table) {
|
|
11801
11802
|
var cos = table.cos;
|
|
11802
11803
|
var sin = table.sin;
|
|
11803
|
-
var
|
|
11804
|
-
var sin0 = sin[0];
|
|
11805
|
-
var cos1 = cos[n - 1];
|
|
11806
|
-
var sin1 = sin[n - 1];
|
|
11804
|
+
var r1 = r + 0.25;
|
|
11807
11805
|
for (var i = 0; i < n; ++i) {
|
|
11808
11806
|
var c = cos[i];
|
|
11809
11807
|
var s = sin[i];
|
|
11810
|
-
var dro = dr;
|
|
11811
|
-
var d0 = c * cos0 + s * sin0;
|
|
11812
|
-
if (0.0001 < d0) {
|
|
11813
|
-
dro = Math.min(dro, (1 / d0 - 1) * r);
|
|
11814
|
-
}
|
|
11815
|
-
var d1 = c * cos1 + s * sin1;
|
|
11816
|
-
if (0.0001 < d1) {
|
|
11817
|
-
dro = Math.min(dro, (1 / d1 - 1) * r);
|
|
11818
|
-
}
|
|
11819
|
-
var ro = r + dro;
|
|
11820
11808
|
vertices[++iv] = x + c * r;
|
|
11821
11809
|
vertices[++iv] = y + s * r;
|
|
11822
|
-
vertices[++iv] = x + c *
|
|
11823
|
-
vertices[++iv] = y + s *
|
|
11810
|
+
vertices[++iv] = x + c * r1;
|
|
11811
|
+
vertices[++iv] = y + s * r1;
|
|
11824
11812
|
uvs[++iuv] = 0.5;
|
|
11825
11813
|
uvs[++iuv] = 0.5;
|
|
11826
11814
|
uvs[++iuv] = 0.5 * (1 + c);
|
|
@@ -12115,60 +12103,83 @@ var DBaseBorderMeshGeometry = /** @class */ (function (_super) {
|
|
|
12115
12103
|
configurable: true
|
|
12116
12104
|
});
|
|
12117
12105
|
DBaseBorderMeshGeometry.prototype.fillVertices = function (vertices, uvs, iv, iuv, n, x, y, r, dr, borderWidth, table) {
|
|
12118
|
-
var
|
|
12119
|
-
var
|
|
12120
|
-
var r2 = r +
|
|
12106
|
+
var hw = 0.5 * borderWidth;
|
|
12107
|
+
var r1 = r - hw;
|
|
12108
|
+
var r2 = r + hw;
|
|
12109
|
+
var r0 = r1 - 0.25;
|
|
12110
|
+
var r3 = r2 + 0.25;
|
|
12121
12111
|
var cos = table.cos;
|
|
12122
12112
|
var sin = table.sin;
|
|
12123
|
-
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
12137
|
-
|
|
12138
|
-
|
|
12139
|
-
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
|
-
|
|
12143
|
-
|
|
12144
|
-
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
|
|
12113
|
+
if (r0 < 0) {
|
|
12114
|
+
var m = n >> 1;
|
|
12115
|
+
var c0 = cos[m];
|
|
12116
|
+
var s0 = sin[m];
|
|
12117
|
+
if (r1 < 0) {
|
|
12118
|
+
for (var i = 0; i < n; ++i) {
|
|
12119
|
+
var c = cos[i];
|
|
12120
|
+
var s = sin[i];
|
|
12121
|
+
vertices[++iv] = x + c0 * r0;
|
|
12122
|
+
vertices[++iv] = y + s0 * r0;
|
|
12123
|
+
vertices[++iv] = x + c0 * r1;
|
|
12124
|
+
vertices[++iv] = y + s0 * r1;
|
|
12125
|
+
vertices[++iv] = x + c * r2;
|
|
12126
|
+
vertices[++iv] = y + s * r2;
|
|
12127
|
+
vertices[++iv] = x + c * r3;
|
|
12128
|
+
vertices[++iv] = y + s * r3;
|
|
12129
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12130
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12131
|
+
uvs[++iuv] = 0.5;
|
|
12132
|
+
uvs[++iuv] = 0.5;
|
|
12133
|
+
uvs[++iuv] = 0.5;
|
|
12134
|
+
uvs[++iuv] = 0.5;
|
|
12135
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12136
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12137
|
+
}
|
|
12138
|
+
}
|
|
12139
|
+
else {
|
|
12140
|
+
for (var i = 0; i < n; ++i) {
|
|
12141
|
+
var c = cos[i];
|
|
12142
|
+
var s = sin[i];
|
|
12143
|
+
vertices[++iv] = x + c0 * r0;
|
|
12144
|
+
vertices[++iv] = y + s0 * r0;
|
|
12145
|
+
vertices[++iv] = x + c * r1;
|
|
12146
|
+
vertices[++iv] = y + s * r1;
|
|
12147
|
+
vertices[++iv] = x + c * r2;
|
|
12148
|
+
vertices[++iv] = y + s * r2;
|
|
12149
|
+
vertices[++iv] = x + c * r3;
|
|
12150
|
+
vertices[++iv] = y + s * r3;
|
|
12151
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12152
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12153
|
+
uvs[++iuv] = 0.5;
|
|
12154
|
+
uvs[++iuv] = 0.5;
|
|
12155
|
+
uvs[++iuv] = 0.5;
|
|
12156
|
+
uvs[++iuv] = 0.5;
|
|
12157
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12158
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12159
|
+
}
|
|
12160
|
+
}
|
|
12161
|
+
}
|
|
12162
|
+
else {
|
|
12163
|
+
for (var i = 0; i < n; ++i) {
|
|
12164
|
+
var c = cos[i];
|
|
12165
|
+
var s = sin[i];
|
|
12149
12166
|
vertices[++iv] = x + c * r0;
|
|
12150
12167
|
vertices[++iv] = y + s * r0;
|
|
12151
12168
|
vertices[++iv] = x + c * r1;
|
|
12152
12169
|
vertices[++iv] = y + s * r1;
|
|
12170
|
+
vertices[++iv] = x + c * r2;
|
|
12171
|
+
vertices[++iv] = y + s * r2;
|
|
12172
|
+
vertices[++iv] = x + c * r3;
|
|
12173
|
+
vertices[++iv] = y + s * r3;
|
|
12174
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12175
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12176
|
+
uvs[++iuv] = 0.5;
|
|
12177
|
+
uvs[++iuv] = 0.5;
|
|
12178
|
+
uvs[++iuv] = 0.5;
|
|
12179
|
+
uvs[++iuv] = 0.5;
|
|
12180
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12181
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12153
12182
|
}
|
|
12154
|
-
else {
|
|
12155
|
-
vertices[++iv] = x1;
|
|
12156
|
-
vertices[++iv] = y1;
|
|
12157
|
-
vertices[++iv] = x1;
|
|
12158
|
-
vertices[++iv] = y1;
|
|
12159
|
-
}
|
|
12160
|
-
vertices[++iv] = x + c * r2;
|
|
12161
|
-
vertices[++iv] = y + s * r2;
|
|
12162
|
-
vertices[++iv] = x + c * r3;
|
|
12163
|
-
vertices[++iv] = y + s * r3;
|
|
12164
|
-
uvs[++iuv] = 0.5 * (1 + c);
|
|
12165
|
-
uvs[++iuv] = 0.5 * (1 + s);
|
|
12166
|
-
uvs[++iuv] = 0.5;
|
|
12167
|
-
uvs[++iuv] = 0.5;
|
|
12168
|
-
uvs[++iuv] = 0.5;
|
|
12169
|
-
uvs[++iuv] = 0.5;
|
|
12170
|
-
uvs[++iuv] = 0.5 * (1 + c);
|
|
12171
|
-
uvs[++iuv] = 0.5 * (1 + s);
|
|
12172
12183
|
}
|
|
12173
12184
|
};
|
|
12174
12185
|
DBaseBorderMeshGeometry.prototype.fillIndices = function (indices, ia, ii, n, end, loop) {
|
|
@@ -20747,7 +20758,7 @@ var DynamicFontAtlasCharacterType = {
|
|
|
20747
20758
|
* SPDX-License-Identifier: Apache-2.0
|
|
20748
20759
|
*/
|
|
20749
20760
|
var VERTEX_SHADER$2 = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nvarying mediump vec2 vTextureCoord;\nvoid main(void) {\n\tgl_Position = vec4(aVertexPosition, 0.0, 1.0);\n\tvTextureCoord = aTextureCoord;\n}\n";
|
|
20750
|
-
var FRAGMENT_SHADER$2 = "\nprecision mediump float;\n\nvarying mediump vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec2 uSize;\n\nfloat
|
|
20761
|
+
var FRAGMENT_SHADER$2 = "\nprecision mediump float;\n\nvarying mediump vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec2 uSize;\n\nfloat norm(vec2 v) {\n\treturn dot(v, v);\n}\n\nfloat norm(vec2 p, vec2 dp) {\n\tvec2 xy = p + dp;\n\tvec2 uvi = vec2(1.0) / uSize;\n\tvec2 uv = xy * uvi;\n\tvec4 t0 = vec4(texture2D(uSampler, uv).a);\n\tvec4 t1 = vec4(\n\t\ttexture2D(uSampler, uv + vec2(-uvi.x, 0.0 )).a,\n\t\ttexture2D(uSampler, uv + vec2(0.0 , -uvi.y)).a,\n\t\ttexture2D(uSampler, uv + vec2(+uvi.x, 0.0 )).a,\n\t\ttexture2D(uSampler, uv + vec2(0.0 , +uvi.y)).a\n\t);\n\tvec4 t2 = vec4(0.5);\n\tvec4 t3 = min(t1,t0);\n\tvec4 t4 = max(t1,t0);\n\n\tvec4 w0 = (t2 - t0) / (t1 - t0);\n\tvec4 s0 = vec4(\n\t\tt3.x < 0.5 && 0.5 <= t4.x,\n\t\tt3.y < 0.5 && 0.5 <= t4.y,\n\t\tt3.z < 0.5 && 0.5 <= t4.z,\n\t\tt3.w < 0.5 && 0.5 <= t4.w\n\t);\n\tvec4 l0 = vec4(\n\t\tnorm(dp + vec2(-w0.x, 0.0 )),\n\t\tnorm(dp + vec2(0.0 , -w0.y)),\n\t\tnorm(dp + vec2(+w0.z, 0.0 )),\n\t\tnorm(dp + vec2(0.0 , +w0.w))\n\t);\n\tvec4 c0 = vec4(100.0);\n\tvec4 r0 = mix(c0, l0, s0);\n\n\tvec4 w1 = w0 * vec4(0.5);\n\tvec4 s1 = vec4(\n\t\t0.5 < s0.x && 0.5 < s0.y,\n\t\t0.5 < s0.y && 0.5 < s0.z,\n\t\t0.5 < s0.z && 0.5 < s0.w,\n\t\t0.5 < s0.w && 0.5 < s0.x\n\t);\n\tvec4 l1 = vec4(\n\t\tnorm(dp + vec2(-w1.x, -w1.y)),\n\t\tnorm(dp + vec2(+w1.z, -w1.y)),\n\t\tnorm(dp + vec2(+w1.z, +w1.w)),\n\t\tnorm(dp + vec2(-w1.x, +w1.w))\n\t);\n\tvec4 r1 = mix(c0, l1, s1);\n\tvec4 r2 = min(r0, r1);\n\tvec2 r3 = min(r2.xy, r2.zw);\n\treturn min(r3.x, r3.y);\n}\n\nfloat distY(vec2 p, float dx) {\n\treturn min(\n\t\tnorm(p, vec2(dx, 0.0)),\n\t\tmin(\n\t\t\tmin(\n\t\t\t\tmin(\n\t\t\t\t\tmin(\n\t\t\t\t\t\tnorm(p, vec2(dx, -6.0)),\n\t\t\t\t\t\tnorm(p, vec2(dx, -5.0))\n\t\t\t\t\t),\n\t\t\t\t\tmin(\n\t\t\t\t\t\tnorm(p, vec2(dx, -4.0)),\n\t\t\t\t\t\tnorm(p, vec2(dx, -3.0))\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tmin(\n\t\t\t\t\tnorm(p, vec2(dx, -2.0)),\n\t\t\t\t\tnorm(p, vec2(dx, -1.0))\n\t\t\t\t)\n\t\t\t),\n\t\t\tmin(\n\t\t\t\tmin(\n\t\t\t\t\tmin(\n\t\t\t\t\t\tnorm(p, vec2(dx, +1.0)),\n\t\t\t\t\t\tnorm(p, vec2(dx, +2.0))\n\t\t\t\t\t),\n\t\t\t\t\tmin(\n\t\t\t\t\t\tnorm(p, vec2(dx, +3.0)),\n\t\t\t\t\t\tnorm(p, vec2(dx, +4.0))\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tmin(\n\t\t\t\t\tnorm(p, vec2(dx, +5.0)),\n\t\t\t\t\tnorm(p, vec2(dx, +6.0))\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t);\n}\n\nfloat distX(vec2 p) {\n\treturn min(\n\t\tdistY(p, 0.0),\n\t\tmin(\n\t\t\tmin(\n\t\t\t\tmin(\n\t\t\t\t\tmin(\n\t\t\t\t\t\tdistY(p, -6.0),\n\t\t\t\t\t\tdistY(p, -5.0)\n\t\t\t\t\t),\n\t\t\t\t\tmin(\n\t\t\t\t\t\tdistY(p, -4.0),\n\t\t\t\t\t\tdistY(p, -3.0)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tmin(\n\t\t\t\t\tdistY(p, -2.0),\n\t\t\t\t\tdistY(p, -1.0)\n\t\t\t\t)\n\t\t\t),\n\t\t\tmin(\n\t\t\t\tmin(\n\t\t\t\t\tmin(\n\t\t\t\t\t\tdistY(p, +1.0),\n\t\t\t\t\t\tdistY(p, +2.0)\n\t\t\t\t\t),\n\t\t\t\t\tmin(\n\t\t\t\t\t\tdistY(p, +3.0),\n\t\t\t\t\t\tdistY(p, +4.0)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tmin(\n\t\t\t\t\tdistY(p, +5.0),\n\t\t\t\t\tdistY(p, +6.0)\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t);\n}\n\nfloat dist(vec2 p) {\n\treturn sqrt(distX(p));\n}\n\nvoid main(void) {\n\tfloat t = texture2D(uSampler, vTextureCoord).a;\n\tfloat d = min( 6.0, dist( vTextureCoord * uSize ) ) / 12.0;\n\td = clamp( mix( 0.5 - d, 0.5 + d, step( 0.5, t ) ), 0.0, 1.0 ) * 255.0;\n\tfloat r = floor(d);\n\td = (d - r) * 255.0;\n\tfloat g = floor(d);\n\tgl_FragColor = vec4(r * 0.00392156862745098, g * 0.00392156862745098, d - g, 1.0);\n}\n";
|
|
20751
20762
|
var DynamicSDFFontGenerator = /** @class */ (function () {
|
|
20752
20763
|
function DynamicSDFFontGenerator() {
|
|
20753
20764
|
var _this = this;
|
|
@@ -21756,7 +21767,7 @@ var EShapeRendererIterator = /** @class */ (function () {
|
|
|
21756
21767
|
* SPDX-License-Identifier: Apache-2.0
|
|
21757
21768
|
*/
|
|
21758
21769
|
var VERTEX_SHADER$1 = "\nattribute vec2 aPosition;\nattribute vec3 aClipping;\nattribute vec2 aStep;\nattribute vec4 aAntialias;\nattribute vec4 aColorFill;\nattribute vec4 aColorStroke;\nattribute vec2 aUv;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mediump float shapeScale;\nuniform mediump float pixelScale;\nuniform mediump float antialiasWeight;\n\nvarying mediump vec3 vClipping;\nvarying mediump vec2 vStep;\nvarying mediump vec4 vAntialias;\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\nvec2 toTransformedPosition( in vec2 v ) {\n\treturn (projectionMatrix * translationMatrix * vec3(v, 1.0)).xy;\n}\n\nvec4 toAntialias01( in vec4 antialias ) {\n\t// Taylor series of 1 / ( 1 - a ) = 1 + a + a^2 + ....\n\treturn 1.0 + min( vec4( 1.0 ), antialias * pixelScale );\n}\n\nvec4 toAntialias2( in vec4 antialias, in float strokeWidth ) {\n\tfloat x = min( 0.4, 0.4 / 12.0 * antialias.x * pixelScale * antialiasWeight );\n\tfloat w = clamp( strokeWidth / antialias.y, 0.0, 1.0 ) * 0.4;\n\tfloat p = w * antialias.z + antialias.w;\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 toPosition3456( in float type, in vec2 p, in vec2 pprev, in vec2 pnext, in float strokeWidth, out float shift ) {\n\tvec2 d0 = p - pprev;\n\tvec2 d1 = pnext - p;\n\tfloat l0 = dot( d0, d0 );\n\tfloat l1 = dot( d1, d1 );\n\tvec2 nd0 = normalize( toInverse( d0 ) );\n\tvec2 nd1 = normalize( toInverse( d1 ) );\n\tvec2 nd2 = 0.00001 < l1 ? nd1 : vec2(0.0, 0.0);\n\tvec2 n0 = 0.00001 < l0 ? nd0 : nd2;\n\tvec2 n1 = 0.00001 < l1 ? nd1 : n0;\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\tfloat crossInverse = ( 0.00001 < abs( cross ) ? 1.0 / cross : 0.0 );\n\tfloat b = dot(n1 - n0, n0) * crossInverse;\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, pmiter - pprev );\n\tfloat miterAngle1 = dot( n1i, pmiter - pnext );\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 ? pmiter : pbevel ) :\n\t\t( miterLength < 6.0 ? pmiter : pbevel )\n\t);\n\tvec2 ni = ( type == 4.0 || type == 6.0 ? n1i : n0i );\n\tshift = dot( ni, p - presult );\n\treturn toTransformedPosition( presult );\n}\n\nvec2 toStep3456( in float type ) {\n\treturn ( type < 4.5 ? vec2( 1.0, 0.0 ) : vec2( 0.0, 1.0 ) );\n}\n\nvec4 toAntialias3456( in float strokeWidth ) {\n\tfloat a = antialiasWeight / max( 0.0001, strokeWidth );\n\treturn toAntialias01( vec4( a, a, a, a ) );\n}\n\nfloat toDotAndDashScale( in float scale, in float strokeWidthScale ) {\n\treturn (\n\t\tscale == 4.0 || scale == 5.0 || scale == 6.0 || scale == 7.0 ?\n\t\tstrokeWidthScale : 1.0\n\t);\n}\n\nvec4 toColorStroke3456( in float shift, in float scale ) {\n\tfloat x = aColorFill.x + shift;\n\tfloat y = scale * aColorFill.y;\n\tfloat z = scale * aColorFill.z;\n\tfloat w = aColorFill.w;\n\treturn vec4( x, y, z, w );\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 toStep01(in vec2 size, in vec2 weight, in vec2 strokeWidth) {\n\treturn weight / max(vec2(0.00001), vec2(1.0) - strokeWidth / size);\n}\n\nvec4 toAntialias01b(in vec2 size, in vec2 strokeWidth) {\n\treturn antialiasWeight / max(vec4(0.00001), vec4(size - strokeWidth, size));\n}\n\nvoid main(void) {\n\tvec2 p012 = toTransformedPosition( aPosition );\n\n\tfloat type = aClipping.z;\n\tfloat strokeWidthScale = toStrokeWidthScale( aStep.y );\n\tfloat strokeWidth = strokeWidthScale * aStep.x;\n\n\t// type === 0 or 1\n\tvec2 size01 = aAntialias.xy;\n\tvec2 weight01 = abs(aAntialias.zw - sign(aAntialias.zw));\n\tvec2 strokeWidth01 = step(vec2(0.0), aAntialias.zw) * strokeWidth;\n\tvec2 step01 = toStep01( size01, weight01, strokeWidth01 );\n\tvec4 a01 = toAntialias01( toAntialias01b( size01, strokeWidth01 ) );\n\n\t// type === 2\n\tvec4 a2 = toAntialias2( aAntialias, strokeWidth );\n\n\t// type === 3, 4, 5 or 6\n\tfloat shift3456 = 0.0;\n\tvec2 p3456 = toPosition3456( type, aPosition, aAntialias.xy, aAntialias.zw, strokeWidth, shift3456 );\n\tvec2 step3456 = toStep3456( type );\n\tvec4 a3456 = toAntialias3456( strokeWidth );\n\tvec4 colorStroke3456 = toColorStroke3456( shift3456, toDotAndDashScale( aStep.y, strokeWidthScale ) );\n\n\t//\n\tgl_Position = vec4( ( 2.5 < type ? p3456 : p012 ), 0.0, 1.0 );\n\tvAntialias = ( 1.5 < type ? ( 2.5 < type ? a3456 : a2 ) : a01 );\n\tvClipping = aClipping;\n\tvStep = ( 2.5 < type ? step3456 : step01 );\n\tvColorFill = ( 2.5 < type ? aColorStroke : aColorFill );\n\tvColorStroke = ( 2.5 < type ? colorStroke3456 : aColorStroke );\n\tvUv = aUv;\n}";
|
|
21759
|
-
var FRAGMENT_SHADER$1 = "\nvarying mediump vec3 vClipping;\nvarying mediump vec2 vStep;\nvarying mediump vec4 vAntialias;\nvarying mediump vec4 vColorFill;\nvarying mediump vec4 vColorStroke;\nvarying mediump vec2 vUv;\n\nuniform sampler2D sampler;\nuniform mediump float pixelScale;\n\
|
|
21770
|
+
var FRAGMENT_SHADER$1 = "\nvarying mediump vec3 vClipping;\nvarying mediump vec2 vStep;\nvarying mediump vec4 vAntialias;\nvarying mediump vec4 vColorFill;\nvarying mediump vec4 vColorStroke;\nvarying mediump vec2 vUv;\n\nuniform sampler2D sampler;\nuniform mediump float pixelScale;\n\nvec4 color1(float type, vec4 texture) {\n\tvec2 v0 = vStep;\n\tvec2 v1 = vClipping.xy;\n\tvec2 v2 = v0 * vAntialias.xy;\n\tvec2 v3 = v1 * vAntialias.zw;\n\tvec2 d01 = ( v0.x < v0.y ? vec2( v0.y, v2.y ) : vec2( v0.x, v2.x ) );\n\tvec2 d02 = ( v1.x < v1.y ? vec2( v1.y, v3.y ) : vec2( v1.x, v3.x ) );\n\tvec4 d0 = vec4( d01.x, d02.x, d01.y, d02.y );\n\tvec4 d1 = vec4( dot( v0, v0 ), dot( v1, v1 ), dot( v2, v2 ), dot( v3, v3 ) );\n\tvec4 d = (type == 1.0 ? d1 : d0);\n\tvec2 s = smoothstep( 1.0 - (d.zw - d.xy), vec2( 1.0 ), d.xy );\n\treturn texture * (vColorStroke * (s.x - s.y) + vColorFill * (1.0 - s.x));\n}\n\nvec4 color2(float type, vec4 texture) {\n\tvec2 a0 = vAntialias.xy;\n\tvec2 a1 = vAntialias.zw;\n\tvec2 a2 = vec2( (texture.b * 0.00392156862745098 + texture.g) * 0.00392156862745098 + texture.r );\n\tvec2 a = smoothstep( a0 - a1, a0 + a1, a2 );\n\treturn a.x * vColorFill + ( a.y - a.x ) * vColorStroke;\n}\n\nfloat color3456(float type, vec4 texture) {\n\tfloat l = vColorStroke.x;\n\tfloat lp0 = vColorStroke.y;\n\tfloat lp1 = vColorStroke.z;\n\tfloat lt = vColorStroke.w;\n\tfloat ld = 0.5 * pixelScale;\n\tfloat lm = mod( l, lp0 + lp1 );\n\tfloat ls0 = ( 0.0 < lp1 ? smoothstep( 0.0, ld, lm ) - smoothstep( lp0, lp0 + ld, lm ) : 1.0 );\n\tfloat ls1 = ( 0.0 <= lt ? smoothstep( 0.0, ld, l ) - smoothstep( lt - ld, lt, l ) : 1.0 );\n\treturn ls0 * ls1;\n}\n\nvoid main(void) {\n\tfloat type = vClipping.z;\n\tvec4 texture = texture2D(sampler, vUv);\n\tgl_FragColor = (type == 2.0 ?\n\t\tcolor2(type, texture) :\n\t\tcolor1(type, texture) * (2.5 < type ? color3456(type, texture) : 1.0)\n\t);\n}";
|
|
21760
21771
|
var EShapeRenderer = /** @class */ (function (_super) {
|
|
21761
21772
|
__extends(EShapeRenderer, _super);
|
|
21762
21773
|
function EShapeRenderer(renderer) {
|
|
@@ -68674,9 +68685,11 @@ var UtilExtractor = /** @class */ (function () {
|
|
|
68674
68685
|
var width = Math.floor(frame.width * resolution);
|
|
68675
68686
|
var height = Math.floor(frame.height * resolution);
|
|
68676
68687
|
var pixels = new Uint8Array(4 * width * height);
|
|
68688
|
+
var oldRenderTexture = renderer.renderTexture.current;
|
|
68677
68689
|
renderer.renderTexture.bind(renderTexture);
|
|
68678
68690
|
var gl = renderer.gl;
|
|
68679
68691
|
gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
|
|
68692
|
+
renderer.renderTexture.bind(oldRenderTexture);
|
|
68680
68693
|
return {
|
|
68681
68694
|
width: width,
|
|
68682
68695
|
height: height,
|
package/dist/wcardinal-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.391.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -4828,7 +4828,7 @@
|
|
|
4828
4828
|
//
|
|
4829
4829
|
};
|
|
4830
4830
|
EShapeBase.prototype.updateUploaded = function (recursively) {
|
|
4831
|
-
if (this._lockUploaded.isLocked()) {
|
|
4831
|
+
if (this._lockUploaded.isLocked(recursively)) {
|
|
4832
4832
|
return;
|
|
4833
4833
|
}
|
|
4834
4834
|
var uploaded = this.uploaded;
|
|
@@ -11781,7 +11781,8 @@
|
|
|
11781
11781
|
sin: sin
|
|
11782
11782
|
};
|
|
11783
11783
|
};
|
|
11784
|
-
|
|
11784
|
+
/** Note that this must be an odd number. */
|
|
11785
|
+
DBaseMeshGeometry.N = 5;
|
|
11785
11786
|
return DBaseMeshGeometry;
|
|
11786
11787
|
}(pixi_js.MeshGeometry));
|
|
11787
11788
|
|
|
@@ -11797,27 +11798,14 @@
|
|
|
11797
11798
|
DBaseBackgroundMeshGeometry.prototype.fillVertices = function (vertices, uvs, iv, iuv, n, x, y, r, dr, table) {
|
|
11798
11799
|
var cos = table.cos;
|
|
11799
11800
|
var sin = table.sin;
|
|
11800
|
-
var
|
|
11801
|
-
var sin0 = sin[0];
|
|
11802
|
-
var cos1 = cos[n - 1];
|
|
11803
|
-
var sin1 = sin[n - 1];
|
|
11801
|
+
var r1 = r + 0.25;
|
|
11804
11802
|
for (var i = 0; i < n; ++i) {
|
|
11805
11803
|
var c = cos[i];
|
|
11806
11804
|
var s = sin[i];
|
|
11807
|
-
var dro = dr;
|
|
11808
|
-
var d0 = c * cos0 + s * sin0;
|
|
11809
|
-
if (0.0001 < d0) {
|
|
11810
|
-
dro = Math.min(dro, (1 / d0 - 1) * r);
|
|
11811
|
-
}
|
|
11812
|
-
var d1 = c * cos1 + s * sin1;
|
|
11813
|
-
if (0.0001 < d1) {
|
|
11814
|
-
dro = Math.min(dro, (1 / d1 - 1) * r);
|
|
11815
|
-
}
|
|
11816
|
-
var ro = r + dro;
|
|
11817
11805
|
vertices[++iv] = x + c * r;
|
|
11818
11806
|
vertices[++iv] = y + s * r;
|
|
11819
|
-
vertices[++iv] = x + c *
|
|
11820
|
-
vertices[++iv] = y + s *
|
|
11807
|
+
vertices[++iv] = x + c * r1;
|
|
11808
|
+
vertices[++iv] = y + s * r1;
|
|
11821
11809
|
uvs[++iuv] = 0.5;
|
|
11822
11810
|
uvs[++iuv] = 0.5;
|
|
11823
11811
|
uvs[++iuv] = 0.5 * (1 + c);
|
|
@@ -12112,60 +12100,83 @@
|
|
|
12112
12100
|
configurable: true
|
|
12113
12101
|
});
|
|
12114
12102
|
DBaseBorderMeshGeometry.prototype.fillVertices = function (vertices, uvs, iv, iuv, n, x, y, r, dr, borderWidth, table) {
|
|
12115
|
-
var
|
|
12116
|
-
var
|
|
12117
|
-
var r2 = r +
|
|
12103
|
+
var hw = 0.5 * borderWidth;
|
|
12104
|
+
var r1 = r - hw;
|
|
12105
|
+
var r2 = r + hw;
|
|
12106
|
+
var r0 = r1 - 0.25;
|
|
12107
|
+
var r3 = r2 + 0.25;
|
|
12118
12108
|
var cos = table.cos;
|
|
12119
12109
|
var sin = table.sin;
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
12137
|
-
|
|
12138
|
-
|
|
12139
|
-
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
|
-
|
|
12143
|
-
|
|
12144
|
-
|
|
12145
|
-
|
|
12110
|
+
if (r0 < 0) {
|
|
12111
|
+
var m = n >> 1;
|
|
12112
|
+
var c0 = cos[m];
|
|
12113
|
+
var s0 = sin[m];
|
|
12114
|
+
if (r1 < 0) {
|
|
12115
|
+
for (var i = 0; i < n; ++i) {
|
|
12116
|
+
var c = cos[i];
|
|
12117
|
+
var s = sin[i];
|
|
12118
|
+
vertices[++iv] = x + c0 * r0;
|
|
12119
|
+
vertices[++iv] = y + s0 * r0;
|
|
12120
|
+
vertices[++iv] = x + c0 * r1;
|
|
12121
|
+
vertices[++iv] = y + s0 * r1;
|
|
12122
|
+
vertices[++iv] = x + c * r2;
|
|
12123
|
+
vertices[++iv] = y + s * r2;
|
|
12124
|
+
vertices[++iv] = x + c * r3;
|
|
12125
|
+
vertices[++iv] = y + s * r3;
|
|
12126
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12127
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12128
|
+
uvs[++iuv] = 0.5;
|
|
12129
|
+
uvs[++iuv] = 0.5;
|
|
12130
|
+
uvs[++iuv] = 0.5;
|
|
12131
|
+
uvs[++iuv] = 0.5;
|
|
12132
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12133
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12134
|
+
}
|
|
12135
|
+
}
|
|
12136
|
+
else {
|
|
12137
|
+
for (var i = 0; i < n; ++i) {
|
|
12138
|
+
var c = cos[i];
|
|
12139
|
+
var s = sin[i];
|
|
12140
|
+
vertices[++iv] = x + c0 * r0;
|
|
12141
|
+
vertices[++iv] = y + s0 * r0;
|
|
12142
|
+
vertices[++iv] = x + c * r1;
|
|
12143
|
+
vertices[++iv] = y + s * r1;
|
|
12144
|
+
vertices[++iv] = x + c * r2;
|
|
12145
|
+
vertices[++iv] = y + s * r2;
|
|
12146
|
+
vertices[++iv] = x + c * r3;
|
|
12147
|
+
vertices[++iv] = y + s * r3;
|
|
12148
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12149
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12150
|
+
uvs[++iuv] = 0.5;
|
|
12151
|
+
uvs[++iuv] = 0.5;
|
|
12152
|
+
uvs[++iuv] = 0.5;
|
|
12153
|
+
uvs[++iuv] = 0.5;
|
|
12154
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12155
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12156
|
+
}
|
|
12157
|
+
}
|
|
12158
|
+
}
|
|
12159
|
+
else {
|
|
12160
|
+
for (var i = 0; i < n; ++i) {
|
|
12161
|
+
var c = cos[i];
|
|
12162
|
+
var s = sin[i];
|
|
12146
12163
|
vertices[++iv] = x + c * r0;
|
|
12147
12164
|
vertices[++iv] = y + s * r0;
|
|
12148
12165
|
vertices[++iv] = x + c * r1;
|
|
12149
12166
|
vertices[++iv] = y + s * r1;
|
|
12167
|
+
vertices[++iv] = x + c * r2;
|
|
12168
|
+
vertices[++iv] = y + s * r2;
|
|
12169
|
+
vertices[++iv] = x + c * r3;
|
|
12170
|
+
vertices[++iv] = y + s * r3;
|
|
12171
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12172
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12173
|
+
uvs[++iuv] = 0.5;
|
|
12174
|
+
uvs[++iuv] = 0.5;
|
|
12175
|
+
uvs[++iuv] = 0.5;
|
|
12176
|
+
uvs[++iuv] = 0.5;
|
|
12177
|
+
uvs[++iuv] = 0.5 * (1 + c);
|
|
12178
|
+
uvs[++iuv] = 0.5 * (1 + s);
|
|
12150
12179
|
}
|
|
12151
|
-
else {
|
|
12152
|
-
vertices[++iv] = x1;
|
|
12153
|
-
vertices[++iv] = y1;
|
|
12154
|
-
vertices[++iv] = x1;
|
|
12155
|
-
vertices[++iv] = y1;
|
|
12156
|
-
}
|
|
12157
|
-
vertices[++iv] = x + c * r2;
|
|
12158
|
-
vertices[++iv] = y + s * r2;
|
|
12159
|
-
vertices[++iv] = x + c * r3;
|
|
12160
|
-
vertices[++iv] = y + s * r3;
|
|
12161
|
-
uvs[++iuv] = 0.5 * (1 + c);
|
|
12162
|
-
uvs[++iuv] = 0.5 * (1 + s);
|
|
12163
|
-
uvs[++iuv] = 0.5;
|
|
12164
|
-
uvs[++iuv] = 0.5;
|
|
12165
|
-
uvs[++iuv] = 0.5;
|
|
12166
|
-
uvs[++iuv] = 0.5;
|
|
12167
|
-
uvs[++iuv] = 0.5 * (1 + c);
|
|
12168
|
-
uvs[++iuv] = 0.5 * (1 + s);
|
|
12169
12180
|
}
|
|
12170
12181
|
};
|
|
12171
12182
|
DBaseBorderMeshGeometry.prototype.fillIndices = function (indices, ia, ii, n, end, loop) {
|
|
@@ -20744,7 +20755,7 @@
|
|
|
20744
20755
|
* SPDX-License-Identifier: Apache-2.0
|
|
20745
20756
|
*/
|
|
20746
20757
|
var VERTEX_SHADER$2 = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nvarying mediump vec2 vTextureCoord;\nvoid main(void) {\n\tgl_Position = vec4(aVertexPosition, 0.0, 1.0);\n\tvTextureCoord = aTextureCoord;\n}\n";
|
|
20747
|
-
var FRAGMENT_SHADER$2 = "\nprecision mediump float;\n\nvarying mediump vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec2 uSize;\n\nfloat
|
|
20758
|
+
var FRAGMENT_SHADER$2 = "\nprecision mediump float;\n\nvarying mediump vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec2 uSize;\n\nfloat norm(vec2 v) {\n\treturn dot(v, v);\n}\n\nfloat norm(vec2 p, vec2 dp) {\n\tvec2 xy = p + dp;\n\tvec2 uvi = vec2(1.0) / uSize;\n\tvec2 uv = xy * uvi;\n\tvec4 t0 = vec4(texture2D(uSampler, uv).a);\n\tvec4 t1 = vec4(\n\t\ttexture2D(uSampler, uv + vec2(-uvi.x, 0.0 )).a,\n\t\ttexture2D(uSampler, uv + vec2(0.0 , -uvi.y)).a,\n\t\ttexture2D(uSampler, uv + vec2(+uvi.x, 0.0 )).a,\n\t\ttexture2D(uSampler, uv + vec2(0.0 , +uvi.y)).a\n\t);\n\tvec4 t2 = vec4(0.5);\n\tvec4 t3 = min(t1,t0);\n\tvec4 t4 = max(t1,t0);\n\n\tvec4 w0 = (t2 - t0) / (t1 - t0);\n\tvec4 s0 = vec4(\n\t\tt3.x < 0.5 && 0.5 <= t4.x,\n\t\tt3.y < 0.5 && 0.5 <= t4.y,\n\t\tt3.z < 0.5 && 0.5 <= t4.z,\n\t\tt3.w < 0.5 && 0.5 <= t4.w\n\t);\n\tvec4 l0 = vec4(\n\t\tnorm(dp + vec2(-w0.x, 0.0 )),\n\t\tnorm(dp + vec2(0.0 , -w0.y)),\n\t\tnorm(dp + vec2(+w0.z, 0.0 )),\n\t\tnorm(dp + vec2(0.0 , +w0.w))\n\t);\n\tvec4 c0 = vec4(100.0);\n\tvec4 r0 = mix(c0, l0, s0);\n\n\tvec4 w1 = w0 * vec4(0.5);\n\tvec4 s1 = vec4(\n\t\t0.5 < s0.x && 0.5 < s0.y,\n\t\t0.5 < s0.y && 0.5 < s0.z,\n\t\t0.5 < s0.z && 0.5 < s0.w,\n\t\t0.5 < s0.w && 0.5 < s0.x\n\t);\n\tvec4 l1 = vec4(\n\t\tnorm(dp + vec2(-w1.x, -w1.y)),\n\t\tnorm(dp + vec2(+w1.z, -w1.y)),\n\t\tnorm(dp + vec2(+w1.z, +w1.w)),\n\t\tnorm(dp + vec2(-w1.x, +w1.w))\n\t);\n\tvec4 r1 = mix(c0, l1, s1);\n\tvec4 r2 = min(r0, r1);\n\tvec2 r3 = min(r2.xy, r2.zw);\n\treturn min(r3.x, r3.y);\n}\n\nfloat distY(vec2 p, float dx) {\n\treturn min(\n\t\tnorm(p, vec2(dx, 0.0)),\n\t\tmin(\n\t\t\tmin(\n\t\t\t\tmin(\n\t\t\t\t\tmin(\n\t\t\t\t\t\tnorm(p, vec2(dx, -6.0)),\n\t\t\t\t\t\tnorm(p, vec2(dx, -5.0))\n\t\t\t\t\t),\n\t\t\t\t\tmin(\n\t\t\t\t\t\tnorm(p, vec2(dx, -4.0)),\n\t\t\t\t\t\tnorm(p, vec2(dx, -3.0))\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tmin(\n\t\t\t\t\tnorm(p, vec2(dx, -2.0)),\n\t\t\t\t\tnorm(p, vec2(dx, -1.0))\n\t\t\t\t)\n\t\t\t),\n\t\t\tmin(\n\t\t\t\tmin(\n\t\t\t\t\tmin(\n\t\t\t\t\t\tnorm(p, vec2(dx, +1.0)),\n\t\t\t\t\t\tnorm(p, vec2(dx, +2.0))\n\t\t\t\t\t),\n\t\t\t\t\tmin(\n\t\t\t\t\t\tnorm(p, vec2(dx, +3.0)),\n\t\t\t\t\t\tnorm(p, vec2(dx, +4.0))\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tmin(\n\t\t\t\t\tnorm(p, vec2(dx, +5.0)),\n\t\t\t\t\tnorm(p, vec2(dx, +6.0))\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t);\n}\n\nfloat distX(vec2 p) {\n\treturn min(\n\t\tdistY(p, 0.0),\n\t\tmin(\n\t\t\tmin(\n\t\t\t\tmin(\n\t\t\t\t\tmin(\n\t\t\t\t\t\tdistY(p, -6.0),\n\t\t\t\t\t\tdistY(p, -5.0)\n\t\t\t\t\t),\n\t\t\t\t\tmin(\n\t\t\t\t\t\tdistY(p, -4.0),\n\t\t\t\t\t\tdistY(p, -3.0)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tmin(\n\t\t\t\t\tdistY(p, -2.0),\n\t\t\t\t\tdistY(p, -1.0)\n\t\t\t\t)\n\t\t\t),\n\t\t\tmin(\n\t\t\t\tmin(\n\t\t\t\t\tmin(\n\t\t\t\t\t\tdistY(p, +1.0),\n\t\t\t\t\t\tdistY(p, +2.0)\n\t\t\t\t\t),\n\t\t\t\t\tmin(\n\t\t\t\t\t\tdistY(p, +3.0),\n\t\t\t\t\t\tdistY(p, +4.0)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tmin(\n\t\t\t\t\tdistY(p, +5.0),\n\t\t\t\t\tdistY(p, +6.0)\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t);\n}\n\nfloat dist(vec2 p) {\n\treturn sqrt(distX(p));\n}\n\nvoid main(void) {\n\tfloat t = texture2D(uSampler, vTextureCoord).a;\n\tfloat d = min( 6.0, dist( vTextureCoord * uSize ) ) / 12.0;\n\td = clamp( mix( 0.5 - d, 0.5 + d, step( 0.5, t ) ), 0.0, 1.0 ) * 255.0;\n\tfloat r = floor(d);\n\td = (d - r) * 255.0;\n\tfloat g = floor(d);\n\tgl_FragColor = vec4(r * 0.00392156862745098, g * 0.00392156862745098, d - g, 1.0);\n}\n";
|
|
20748
20759
|
var DynamicSDFFontGenerator = /** @class */ (function () {
|
|
20749
20760
|
function DynamicSDFFontGenerator() {
|
|
20750
20761
|
var _this = this;
|
|
@@ -21753,7 +21764,7 @@
|
|
|
21753
21764
|
* SPDX-License-Identifier: Apache-2.0
|
|
21754
21765
|
*/
|
|
21755
21766
|
var VERTEX_SHADER$1 = "\nattribute vec2 aPosition;\nattribute vec3 aClipping;\nattribute vec2 aStep;\nattribute vec4 aAntialias;\nattribute vec4 aColorFill;\nattribute vec4 aColorStroke;\nattribute vec2 aUv;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mediump float shapeScale;\nuniform mediump float pixelScale;\nuniform mediump float antialiasWeight;\n\nvarying mediump vec3 vClipping;\nvarying mediump vec2 vStep;\nvarying mediump vec4 vAntialias;\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\nvec2 toTransformedPosition( in vec2 v ) {\n\treturn (projectionMatrix * translationMatrix * vec3(v, 1.0)).xy;\n}\n\nvec4 toAntialias01( in vec4 antialias ) {\n\t// Taylor series of 1 / ( 1 - a ) = 1 + a + a^2 + ....\n\treturn 1.0 + min( vec4( 1.0 ), antialias * pixelScale );\n}\n\nvec4 toAntialias2( in vec4 antialias, in float strokeWidth ) {\n\tfloat x = min( 0.4, 0.4 / 12.0 * antialias.x * pixelScale * antialiasWeight );\n\tfloat w = clamp( strokeWidth / antialias.y, 0.0, 1.0 ) * 0.4;\n\tfloat p = w * antialias.z + antialias.w;\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 toPosition3456( in float type, in vec2 p, in vec2 pprev, in vec2 pnext, in float strokeWidth, out float shift ) {\n\tvec2 d0 = p - pprev;\n\tvec2 d1 = pnext - p;\n\tfloat l0 = dot( d0, d0 );\n\tfloat l1 = dot( d1, d1 );\n\tvec2 nd0 = normalize( toInverse( d0 ) );\n\tvec2 nd1 = normalize( toInverse( d1 ) );\n\tvec2 nd2 = 0.00001 < l1 ? nd1 : vec2(0.0, 0.0);\n\tvec2 n0 = 0.00001 < l0 ? nd0 : nd2;\n\tvec2 n1 = 0.00001 < l1 ? nd1 : n0;\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\tfloat crossInverse = ( 0.00001 < abs( cross ) ? 1.0 / cross : 0.0 );\n\tfloat b = dot(n1 - n0, n0) * crossInverse;\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, pmiter - pprev );\n\tfloat miterAngle1 = dot( n1i, pmiter - pnext );\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 ? pmiter : pbevel ) :\n\t\t( miterLength < 6.0 ? pmiter : pbevel )\n\t);\n\tvec2 ni = ( type == 4.0 || type == 6.0 ? n1i : n0i );\n\tshift = dot( ni, p - presult );\n\treturn toTransformedPosition( presult );\n}\n\nvec2 toStep3456( in float type ) {\n\treturn ( type < 4.5 ? vec2( 1.0, 0.0 ) : vec2( 0.0, 1.0 ) );\n}\n\nvec4 toAntialias3456( in float strokeWidth ) {\n\tfloat a = antialiasWeight / max( 0.0001, strokeWidth );\n\treturn toAntialias01( vec4( a, a, a, a ) );\n}\n\nfloat toDotAndDashScale( in float scale, in float strokeWidthScale ) {\n\treturn (\n\t\tscale == 4.0 || scale == 5.0 || scale == 6.0 || scale == 7.0 ?\n\t\tstrokeWidthScale : 1.0\n\t);\n}\n\nvec4 toColorStroke3456( in float shift, in float scale ) {\n\tfloat x = aColorFill.x + shift;\n\tfloat y = scale * aColorFill.y;\n\tfloat z = scale * aColorFill.z;\n\tfloat w = aColorFill.w;\n\treturn vec4( x, y, z, w );\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 toStep01(in vec2 size, in vec2 weight, in vec2 strokeWidth) {\n\treturn weight / max(vec2(0.00001), vec2(1.0) - strokeWidth / size);\n}\n\nvec4 toAntialias01b(in vec2 size, in vec2 strokeWidth) {\n\treturn antialiasWeight / max(vec4(0.00001), vec4(size - strokeWidth, size));\n}\n\nvoid main(void) {\n\tvec2 p012 = toTransformedPosition( aPosition );\n\n\tfloat type = aClipping.z;\n\tfloat strokeWidthScale = toStrokeWidthScale( aStep.y );\n\tfloat strokeWidth = strokeWidthScale * aStep.x;\n\n\t// type === 0 or 1\n\tvec2 size01 = aAntialias.xy;\n\tvec2 weight01 = abs(aAntialias.zw - sign(aAntialias.zw));\n\tvec2 strokeWidth01 = step(vec2(0.0), aAntialias.zw) * strokeWidth;\n\tvec2 step01 = toStep01( size01, weight01, strokeWidth01 );\n\tvec4 a01 = toAntialias01( toAntialias01b( size01, strokeWidth01 ) );\n\n\t// type === 2\n\tvec4 a2 = toAntialias2( aAntialias, strokeWidth );\n\n\t// type === 3, 4, 5 or 6\n\tfloat shift3456 = 0.0;\n\tvec2 p3456 = toPosition3456( type, aPosition, aAntialias.xy, aAntialias.zw, strokeWidth, shift3456 );\n\tvec2 step3456 = toStep3456( type );\n\tvec4 a3456 = toAntialias3456( strokeWidth );\n\tvec4 colorStroke3456 = toColorStroke3456( shift3456, toDotAndDashScale( aStep.y, strokeWidthScale ) );\n\n\t//\n\tgl_Position = vec4( ( 2.5 < type ? p3456 : p012 ), 0.0, 1.0 );\n\tvAntialias = ( 1.5 < type ? ( 2.5 < type ? a3456 : a2 ) : a01 );\n\tvClipping = aClipping;\n\tvStep = ( 2.5 < type ? step3456 : step01 );\n\tvColorFill = ( 2.5 < type ? aColorStroke : aColorFill );\n\tvColorStroke = ( 2.5 < type ? colorStroke3456 : aColorStroke );\n\tvUv = aUv;\n}";
|
|
21756
|
-
var FRAGMENT_SHADER$1 = "\nvarying mediump vec3 vClipping;\nvarying mediump vec2 vStep;\nvarying mediump vec4 vAntialias;\nvarying mediump vec4 vColorFill;\nvarying mediump vec4 vColorStroke;\nvarying mediump vec2 vUv;\n\nuniform sampler2D sampler;\nuniform mediump float pixelScale;\n\
|
|
21767
|
+
var FRAGMENT_SHADER$1 = "\nvarying mediump vec3 vClipping;\nvarying mediump vec2 vStep;\nvarying mediump vec4 vAntialias;\nvarying mediump vec4 vColorFill;\nvarying mediump vec4 vColorStroke;\nvarying mediump vec2 vUv;\n\nuniform sampler2D sampler;\nuniform mediump float pixelScale;\n\nvec4 color1(float type, vec4 texture) {\n\tvec2 v0 = vStep;\n\tvec2 v1 = vClipping.xy;\n\tvec2 v2 = v0 * vAntialias.xy;\n\tvec2 v3 = v1 * vAntialias.zw;\n\tvec2 d01 = ( v0.x < v0.y ? vec2( v0.y, v2.y ) : vec2( v0.x, v2.x ) );\n\tvec2 d02 = ( v1.x < v1.y ? vec2( v1.y, v3.y ) : vec2( v1.x, v3.x ) );\n\tvec4 d0 = vec4( d01.x, d02.x, d01.y, d02.y );\n\tvec4 d1 = vec4( dot( v0, v0 ), dot( v1, v1 ), dot( v2, v2 ), dot( v3, v3 ) );\n\tvec4 d = (type == 1.0 ? d1 : d0);\n\tvec2 s = smoothstep( 1.0 - (d.zw - d.xy), vec2( 1.0 ), d.xy );\n\treturn texture * (vColorStroke * (s.x - s.y) + vColorFill * (1.0 - s.x));\n}\n\nvec4 color2(float type, vec4 texture) {\n\tvec2 a0 = vAntialias.xy;\n\tvec2 a1 = vAntialias.zw;\n\tvec2 a2 = vec2( (texture.b * 0.00392156862745098 + texture.g) * 0.00392156862745098 + texture.r );\n\tvec2 a = smoothstep( a0 - a1, a0 + a1, a2 );\n\treturn a.x * vColorFill + ( a.y - a.x ) * vColorStroke;\n}\n\nfloat color3456(float type, vec4 texture) {\n\tfloat l = vColorStroke.x;\n\tfloat lp0 = vColorStroke.y;\n\tfloat lp1 = vColorStroke.z;\n\tfloat lt = vColorStroke.w;\n\tfloat ld = 0.5 * pixelScale;\n\tfloat lm = mod( l, lp0 + lp1 );\n\tfloat ls0 = ( 0.0 < lp1 ? smoothstep( 0.0, ld, lm ) - smoothstep( lp0, lp0 + ld, lm ) : 1.0 );\n\tfloat ls1 = ( 0.0 <= lt ? smoothstep( 0.0, ld, l ) - smoothstep( lt - ld, lt, l ) : 1.0 );\n\treturn ls0 * ls1;\n}\n\nvoid main(void) {\n\tfloat type = vClipping.z;\n\tvec4 texture = texture2D(sampler, vUv);\n\tgl_FragColor = (type == 2.0 ?\n\t\tcolor2(type, texture) :\n\t\tcolor1(type, texture) * (2.5 < type ? color3456(type, texture) : 1.0)\n\t);\n}";
|
|
21757
21768
|
var EShapeRenderer = /** @class */ (function (_super) {
|
|
21758
21769
|
__extends(EShapeRenderer, _super);
|
|
21759
21770
|
function EShapeRenderer(renderer) {
|
|
@@ -47283,9 +47294,11 @@
|
|
|
47283
47294
|
var width = Math.floor(frame.width * resolution);
|
|
47284
47295
|
var height = Math.floor(frame.height * resolution);
|
|
47285
47296
|
var pixels = new Uint8Array(4 * width * height);
|
|
47297
|
+
var oldRenderTexture = renderer.renderTexture.current;
|
|
47286
47298
|
renderer.renderTexture.bind(renderTexture);
|
|
47287
47299
|
var gl = renderer.gl;
|
|
47288
47300
|
gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
|
|
47301
|
+
renderer.renderTexture.bind(oldRenderTexture);
|
|
47289
47302
|
return {
|
|
47290
47303
|
width: width,
|
|
47291
47304
|
height: height,
|