@wcardinal/wcardinal-ui 0.390.2 → 0.392.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/util/dynamic-sdf-font-generator.js +7 -7
- 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 +86 -73
- package/dist/wcardinal-ui.js +86 -73
- 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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.392.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -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,17 +20755,17 @@
|
|
|
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 normY(vec2 p, float dx) {\n\tfloat result = 100.0;\n\tfor (float dy=-6.0; dy < 6.5; dy += 1.0) {\n\t\tresult = min(result, norm(p, vec2(dx, dy)));\n\t}\n\treturn result;\n}\n\nfloat normX(vec2 p) {\n\tfloat result = 100.0;\n\tfor (float dx=-6.0; dx < 6.5; dx += 1.0) {\n\t\tresult = min(result, normY(p, dx));\n\t}\n\treturn result;\n}\n\nvoid main(void) {\n\tfloat t = texture2D(uSampler, vTextureCoord).a;\n\tfloat d = min( 6.0, sqrt(normX( 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;
|
|
20751
20762
|
this._gl = null;
|
|
20752
20763
|
this._texture = null;
|
|
20753
20764
|
this._shaderProgram = null;
|
|
20754
|
-
this._vertexPositionAttribute =
|
|
20755
|
-
this._textureCoordAttribute =
|
|
20756
|
-
this._samplerUniform =
|
|
20757
|
-
this._sizeUniform =
|
|
20765
|
+
this._vertexPositionAttribute = 0;
|
|
20766
|
+
this._textureCoordAttribute = 1;
|
|
20767
|
+
this._samplerUniform = null;
|
|
20768
|
+
this._sizeUniform = null;
|
|
20758
20769
|
this._vb = null;
|
|
20759
20770
|
this._uvb = null;
|
|
20760
20771
|
var canvas = (this._canvas = document.createElement("canvas"));
|
|
@@ -20828,6 +20839,8 @@
|
|
|
20828
20839
|
if (shaderProgram != null) {
|
|
20829
20840
|
gl.attachShader(shaderProgram, vertexShader);
|
|
20830
20841
|
gl.attachShader(shaderProgram, fragmentShader);
|
|
20842
|
+
gl.bindAttribLocation(shaderProgram, 0, "aVertexPosition");
|
|
20843
|
+
gl.bindAttribLocation(shaderProgram, 1, "aTextureCoord");
|
|
20831
20844
|
gl.linkProgram(shaderProgram);
|
|
20832
20845
|
if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) {
|
|
20833
20846
|
console &&
|
|
@@ -20840,8 +20853,6 @@
|
|
|
20840
20853
|
gl.deleteShader(vertexShader);
|
|
20841
20854
|
gl.deleteShader(fragmentShader);
|
|
20842
20855
|
gl.useProgram(shaderProgram);
|
|
20843
|
-
this._vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition");
|
|
20844
|
-
this._textureCoordAttribute = gl.getAttribLocation(shaderProgram, "aTextureCoord");
|
|
20845
20856
|
this._samplerUniform = gl.getUniformLocation(shaderProgram, "uSampler");
|
|
20846
20857
|
this._sizeUniform = gl.getUniformLocation(shaderProgram, "uSize");
|
|
20847
20858
|
gl.useProgram(null);
|
|
@@ -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,
|