textmode.js 0.2.1-beta.7 → 0.2.1-beta.8
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/textmode.esm.js +461 -461
- package/dist/textmode.esm.min.js +148 -148
- package/dist/textmode.umd.js +4 -4
- package/dist/textmode.umd.min.js +5 -5
- package/package.json +1 -1
package/dist/textmode.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var ct = Object.defineProperty;
|
|
2
|
-
var lt = (
|
|
3
|
-
var
|
|
2
|
+
var lt = (h, t, e) => t in h ? ct(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
|
|
3
|
+
var a = (h, t, e) => lt(h, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
class U extends Error {
|
|
5
5
|
constructor(t, e = {}) {
|
|
6
6
|
super(U.i(t, e)), this.name = "TextmodeError";
|
|
@@ -27,10 +27,10 @@ ${"↓".repeat(24)}
|
|
|
27
27
|
return t + "";
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
var ut = ((
|
|
30
|
+
var ut = ((h) => (h[h.SILENT = 0] = "SILENT", h[h.WARNING = 1] = "WARNING", h[h.ERROR = 2] = "ERROR", h[h.THROW = 3] = "THROW", h))(ut || {});
|
|
31
31
|
const D = class D {
|
|
32
32
|
constructor() {
|
|
33
|
-
|
|
33
|
+
a(this, "u", { globalLevel: 3 });
|
|
34
34
|
}
|
|
35
35
|
static m() {
|
|
36
36
|
return D.l || (D.l = new D()), D.l;
|
|
@@ -55,40 +55,40 @@ const D = class D {
|
|
|
55
55
|
this.u.globalLevel = t;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
a(D, "l", null);
|
|
59
59
|
let K = D;
|
|
60
60
|
const G = K.m(), ot = /* @__PURE__ */ new WeakMap();
|
|
61
|
-
function H(
|
|
62
|
-
ot.set(
|
|
61
|
+
function H(h, t) {
|
|
62
|
+
ot.set(h, t);
|
|
63
63
|
}
|
|
64
|
-
function k(
|
|
65
|
-
return ot.get(
|
|
64
|
+
function k(h) {
|
|
65
|
+
return ot.get(h);
|
|
66
66
|
}
|
|
67
|
-
class
|
|
67
|
+
class ht {
|
|
68
68
|
constructor() {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
69
|
+
a(this, "C", 1);
|
|
70
|
+
a(this, "$", 0);
|
|
71
|
+
a(this, "U", 0);
|
|
72
|
+
a(this, "M", 0);
|
|
73
|
+
a(this, "F", [0, 0, 0]);
|
|
74
|
+
a(this, "R", [1, 1, 1, 1]);
|
|
75
|
+
a(this, "P", [0, 0, 0, 1]);
|
|
76
|
+
a(this, "S", !1);
|
|
77
|
+
a(this, "G", !1);
|
|
78
|
+
a(this, "D", !1);
|
|
79
|
+
a(this, "L", [0, 0]);
|
|
80
|
+
a(this, "O", [0, 0, 0, 1]);
|
|
81
|
+
a(this, "k", []);
|
|
82
82
|
}
|
|
83
83
|
H() {
|
|
84
|
-
this.k.push({ I: this.C, N: this
|
|
84
|
+
this.k.push({ I: this.C, N: this.$, X: this.U, W: this.M, L: [...this.L], V: this.S, K: this.G, D: this.D, j: [...this.F], Y: [...this.R], q: [...this.P] });
|
|
85
85
|
}
|
|
86
86
|
Z() {
|
|
87
87
|
const t = this.k.pop();
|
|
88
|
-
t ? (this.C = t.I, this
|
|
88
|
+
t ? (this.C = t.I, this.$ = t.N, this.U = t.X, this.M = t.W, this.L = t.L, this.S = t.V, this.G = t.K, this.D = t.D, this.F = t.j, this.R = t.Y, this.P = t.q) : console.warn("pop() called without matching push()");
|
|
89
89
|
}
|
|
90
90
|
J(t) {
|
|
91
|
-
t.I = this.C, t.N = this
|
|
91
|
+
t.I = this.C, t.N = this.$, t.X = this.U, t.W = this.M, t.j[0] = this.F[0], t.j[1] = this.F[1], t.j[2] = this.F[2], t.Y[0] = this.R[0], t.Y[1] = this.R[1], t.Y[2] = this.R[2], t.Y[3] = this.R[3], t.q[0] = this.P[0], t.q[1] = this.P[1], t.q[2] = this.P[2], t.q[3] = this.P[3], t.V = this.S, t.K = this.G, t.D = this.D, t.L[0] = this.L[0], t.L[1] = this.L[1];
|
|
92
92
|
}
|
|
93
93
|
get lineWeight() {
|
|
94
94
|
return this.C;
|
|
@@ -100,10 +100,10 @@ class at {
|
|
|
100
100
|
this.C = Math.abs(t);
|
|
101
101
|
}
|
|
102
102
|
et(t) {
|
|
103
|
-
this
|
|
103
|
+
this.$ = t;
|
|
104
104
|
}
|
|
105
105
|
st(t) {
|
|
106
|
-
this
|
|
106
|
+
this.U = t;
|
|
107
107
|
}
|
|
108
108
|
it(t) {
|
|
109
109
|
this.M = t;
|
|
@@ -121,10 +121,10 @@ class at {
|
|
|
121
121
|
this.S = t;
|
|
122
122
|
}
|
|
123
123
|
ct(t) {
|
|
124
|
-
this.
|
|
124
|
+
this.G = t;
|
|
125
125
|
}
|
|
126
126
|
lt(t) {
|
|
127
|
-
this.
|
|
127
|
+
this.D = t;
|
|
128
128
|
}
|
|
129
129
|
ut(t) {
|
|
130
130
|
const e = 255 * t / 360, i = Math.floor(e) / 255, s = Math.round(e - Math.floor(e));
|
|
@@ -136,39 +136,39 @@ class at {
|
|
|
136
136
|
}
|
|
137
137
|
class q {
|
|
138
138
|
constructor(t, e, i = e, s = 1, r = {}, n = null, o = !1) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
this.dt = e, this.gt = i, this.u = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", ...r }, this.vt = t, this.
|
|
139
|
+
a(this, "dt");
|
|
140
|
+
a(this, "gt");
|
|
141
|
+
a(this, "u");
|
|
142
|
+
a(this, "_t", null);
|
|
143
|
+
a(this, "vt");
|
|
144
|
+
a(this, "wt");
|
|
145
|
+
a(this, "yt", []);
|
|
146
|
+
a(this, "At");
|
|
147
|
+
a(this, "Ct", null);
|
|
148
|
+
a(this, "bt", []);
|
|
149
|
+
a(this, "xt", null);
|
|
150
|
+
a(this, "$t", !1);
|
|
151
|
+
a(this, "Mt", null);
|
|
152
|
+
this.dt = e, this.gt = i, this.u = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", ...r }, this.vt = t, this.At = Math.min(Math.max(1, s), 8), this.xt = n, this.$t = !!o, this.Mt = this.$t ? new ht() : null;
|
|
153
153
|
const c = t.getParameter(t.MAX_DRAW_BUFFERS), l = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
|
|
154
|
-
this.
|
|
154
|
+
this.At = Math.min(this.At, c, l), this.wt = t.createFramebuffer(), this.Ft(), this.Rt(), this.bt = Array(this.At).fill(null);
|
|
155
155
|
}
|
|
156
156
|
Ft() {
|
|
157
157
|
const t = this.vt, e = this.u.filter === "linear" ? t.LINEAR : t.NEAREST, i = this.u.wrap === "repeat" ? t.REPEAT : t.CLAMP_TO_EDGE, s = this.u.type === "float" ? t.FLOAT : t.UNSIGNED_BYTE;
|
|
158
|
-
for (let r = 0; r < this.
|
|
158
|
+
for (let r = 0; r < this.At; r++) {
|
|
159
159
|
const n = t.createTexture();
|
|
160
|
-
t.bindTexture(t.TEXTURE_2D, n), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, i), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, i), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, this.dt, this.gt, 0, t.RGBA, s, null), this.
|
|
160
|
+
t.bindTexture(t.TEXTURE_2D, n), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, e), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, i), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, i), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, this.dt, this.gt, 0, t.RGBA, s, null), this.yt.push(n);
|
|
161
161
|
}
|
|
162
162
|
t.bindTexture(t.TEXTURE_2D, null);
|
|
163
163
|
}
|
|
164
164
|
Rt() {
|
|
165
165
|
const t = this.vt;
|
|
166
|
-
if (t.bindFramebuffer(t.FRAMEBUFFER, this.
|
|
166
|
+
if (t.bindFramebuffer(t.FRAMEBUFFER, this.wt), this.At === 1) t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, this.yt[0], 0);
|
|
167
167
|
else {
|
|
168
168
|
const i = [];
|
|
169
|
-
for (let s = 0; s < this.
|
|
169
|
+
for (let s = 0; s < this.At; s++) {
|
|
170
170
|
const r = t.COLOR_ATTACHMENT0 + s;
|
|
171
|
-
t.framebufferTexture2D(t.FRAMEBUFFER, r, t.TEXTURE_2D, this.
|
|
171
|
+
t.framebufferTexture2D(t.FRAMEBUFFER, r, t.TEXTURE_2D, this.yt[s], 0), i.push(r);
|
|
172
172
|
}
|
|
173
173
|
t.drawBuffers(i);
|
|
174
174
|
}
|
|
@@ -177,19 +177,19 @@ class q {
|
|
|
177
177
|
}
|
|
178
178
|
zt(t) {
|
|
179
179
|
const e = this.vt;
|
|
180
|
-
e.bindTexture(e.TEXTURE_2D, this.
|
|
180
|
+
e.bindTexture(e.TEXTURE_2D, this.yt[0]), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, 1), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, t), e.bindTexture(e.TEXTURE_2D, null);
|
|
181
181
|
}
|
|
182
182
|
resize(t, e) {
|
|
183
|
-
this.dt = t, this.gt = e, this._t = null, this.bt = Array(this.
|
|
183
|
+
this.dt = t, this.gt = e, this._t = null, this.bt = Array(this.At).fill(null);
|
|
184
184
|
const i = this.vt, s = this.u.type === "float" ? i.FLOAT : i.UNSIGNED_BYTE;
|
|
185
|
-
for (const r of this.
|
|
185
|
+
for (const r of this.yt) i.bindTexture(i.TEXTURE_2D, r), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, this.dt, this.gt, 0, i.RGBA, s, null);
|
|
186
186
|
i.bindTexture(i.TEXTURE_2D, null);
|
|
187
187
|
}
|
|
188
188
|
Pt(t) {
|
|
189
189
|
const e = this.vt, i = this.bt[t];
|
|
190
190
|
if (i) return i;
|
|
191
191
|
const s = this.dt, r = this.gt, n = new Uint8Array(s * r * 4), o = e.getParameter(e.READ_FRAMEBUFFER_BINDING);
|
|
192
|
-
e.bindFramebuffer(e.READ_FRAMEBUFFER, this.
|
|
192
|
+
e.bindFramebuffer(e.READ_FRAMEBUFFER, this.wt), e.readBuffer(e.COLOR_ATTACHMENT0 + t), e.readPixels(0, 0, s, r, e.RGBA, e.UNSIGNED_BYTE, n), e.bindFramebuffer(e.READ_FRAMEBUFFER, o);
|
|
193
193
|
const c = 4 * s, l = new Uint8Array(n.length);
|
|
194
194
|
for (let u = 0; u < r; u++) {
|
|
195
195
|
const f = (r - 1 - u) * c, g = u * c;
|
|
@@ -204,8 +204,8 @@ class q {
|
|
|
204
204
|
const n = ((i = (e = this.xt).Tt) == null ? void 0 : i.call(e)) ?? null;
|
|
205
205
|
n && this.xt.St(n), this.$t && this.Mt && ((r = (s = this.xt).Et) == null || r.call(s, this.Mt));
|
|
206
206
|
}
|
|
207
|
-
this.Ct = { framebuffer: t.getParameter(t.FRAMEBUFFER_BINDING), viewport: t.getParameter(t.VIEWPORT) }, t.bindFramebuffer(t.FRAMEBUFFER, this.
|
|
208
|
-
for (let n = 0; n < this.
|
|
207
|
+
this.Ct = { framebuffer: t.getParameter(t.FRAMEBUFFER_BINDING), viewport: t.getParameter(t.VIEWPORT) }, t.bindFramebuffer(t.FRAMEBUFFER, this.wt), this.bt = Array(this.At).fill(null);
|
|
208
|
+
for (let n = 0; n < this.At; n++) t.clearBufferfv(t.COLOR, n, new Float32Array([0, 0, 0, 0]));
|
|
209
209
|
t.viewport(0, 0, this.dt, this.gt), H(t, [0, 0, this.dt, this.gt]);
|
|
210
210
|
}
|
|
211
211
|
end() {
|
|
@@ -218,10 +218,10 @@ class q {
|
|
|
218
218
|
}
|
|
219
219
|
t.bindFramebuffer(t.FRAMEBUFFER, this.Ct.framebuffer), t.viewport(...this.Ct.viewport), H(t, this.Ct.viewport), this.Ct = null, this.xt && this.$t && this.Mt && ((r = (s = this.xt).Bt) == null || r.call(s));
|
|
220
220
|
}
|
|
221
|
-
|
|
221
|
+
Gt() {
|
|
222
222
|
const t = this.vt;
|
|
223
|
-
t.deleteFramebuffer(this.
|
|
224
|
-
for (const e of this.
|
|
223
|
+
t.deleteFramebuffer(this.wt);
|
|
224
|
+
for (const e of this.yt) t.deleteTexture(e);
|
|
225
225
|
}
|
|
226
226
|
get width() {
|
|
227
227
|
return this.dt;
|
|
@@ -230,24 +230,24 @@ class q {
|
|
|
230
230
|
return this.gt;
|
|
231
231
|
}
|
|
232
232
|
get textures() {
|
|
233
|
-
return [...this.
|
|
233
|
+
return [...this.yt];
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
class I {
|
|
237
237
|
constructor(t, e, i) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
this.vt = t, this.
|
|
238
|
+
a(this, "vt");
|
|
239
|
+
a(this, "Dt");
|
|
240
|
+
a(this, "Lt", /* @__PURE__ */ new Map());
|
|
241
|
+
a(this, "Ot", /* @__PURE__ */ new Map());
|
|
242
|
+
a(this, "kt", 0);
|
|
243
|
+
this.vt = t, this.Dt = this.Ht(e, i), this.It();
|
|
244
244
|
}
|
|
245
245
|
It() {
|
|
246
|
-
const t = this.vt.getProgramParameter(this.
|
|
246
|
+
const t = this.vt.getProgramParameter(this.Dt, this.vt.ACTIVE_UNIFORMS);
|
|
247
247
|
for (let e = 0; e < t; e++) {
|
|
248
|
-
const i = this.vt.getActiveUniform(this.
|
|
248
|
+
const i = this.vt.getActiveUniform(this.Dt, e);
|
|
249
249
|
if (i) {
|
|
250
|
-
const s = this.vt.getUniformLocation(this.
|
|
250
|
+
const s = this.vt.getUniformLocation(this.Dt, i.name);
|
|
251
251
|
if (s && (this.Lt.set(i.name, s), this.Ot.set(i.name, { type: i.type, size: i.size }), i.size > 1)) {
|
|
252
252
|
const r = i.name.replace(/\[.*\]$/, "");
|
|
253
253
|
this.Lt.has(r) || (this.Lt.set(r, s), this.Ot.set(r, { type: i.type, size: i.size }));
|
|
@@ -272,7 +272,7 @@ class I {
|
|
|
272
272
|
return i;
|
|
273
273
|
}
|
|
274
274
|
Xt() {
|
|
275
|
-
this.vt.useProgram(this.
|
|
275
|
+
this.vt.useProgram(this.Dt), this.Wt();
|
|
276
276
|
}
|
|
277
277
|
Wt() {
|
|
278
278
|
this.kt = 0;
|
|
@@ -356,25 +356,25 @@ class I {
|
|
|
356
356
|
return this.kt++;
|
|
357
357
|
}
|
|
358
358
|
get Qt() {
|
|
359
|
-
return this.
|
|
359
|
+
return this.Dt;
|
|
360
360
|
}
|
|
361
|
-
|
|
362
|
-
this.vt.deleteProgram(this.
|
|
361
|
+
Gt() {
|
|
362
|
+
this.vt.deleteProgram(this.Dt);
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
const W = `#version 300 es
|
|
366
|
-
in vec2 a_position;in vec2 a_texCoord;in vec2 a_instancePosition;in vec2 a_instanceSize;in vec3 a_instanceCharacter;in vec4 a_instancePrimaryColor;in vec4 a_instanceSecondaryColor;in vec2 a_instanceRotation;in vec3 a_instanceTransform;in vec3 a_instanceGlobalRotation;in vec2 a_instanceRotationCenter;in vec2 a_instanceBezierCP1;in vec2 a_instanceBezierCP2;in vec2 a_instanceBezierStart;in vec2 a_instanceBezierEnd;in vec2 a_instanceArcAngles;uniform float U9;uniform vec2
|
|
366
|
+
in vec2 a_position;in vec2 a_texCoord;in vec2 a_instancePosition;in vec2 a_instanceSize;in vec3 a_instanceCharacter;in vec4 a_instancePrimaryColor;in vec4 a_instanceSecondaryColor;in vec2 a_instanceRotation;in vec3 a_instanceTransform;in vec3 a_instanceGlobalRotation;in vec2 a_instanceRotationCenter;in vec2 a_instanceBezierCP1;in vec2 a_instanceBezierCP2;in vec2 a_instanceBezierStart;in vec2 a_instanceBezierEnd;in vec2 a_instanceArcAngles;uniform float U9;uniform vec2 Uw;out vec2 v_uv;out vec3 v_character;out vec4 v_primaryColor;out vec4 v_secondaryColor;out vec2 v_rotation;out vec3 v_transform;mat3 A(float B){float C=sin(B),D=cos(B);return mat3(1,0,0,0,D,-C,0,C,D);}mat3 E(float B){float C=sin(B),D=cos(B);return mat3(D,0,C,0,1,0,-C,0,D);}mat3 F(float B){float C=sin(B),D=cos(B);return mat3(D,-C,0,C,D,0,0,0,1);}vec2 G(float H,vec2 I,vec2 J,vec2 K,vec2 L){float M=1.-H,N=M*M,O=H*H;return N*M*I+3.*N*H*J+3.*M*O*K+O*H*L;}vec2 P(float H,vec2 I,vec2 J,vec2 K,vec2 L){float M=1.-H,N=M*M,O=H*H;return-3.*N*I+3.*N*J-6.*M*H*J+6.*M*H*K-3.*O*K+3.*O*L;}void main(){v_uv=a_texCoord;v_character=a_instanceCharacter;v_primaryColor=a_instancePrimaryColor;v_secondaryColor=a_instanceSecondaryColor;v_rotation=a_instanceRotation;v_transform=a_instanceTransform;vec2 Q;bool R=length(a_instanceBezierCP1)+length(a_instanceBezierCP2)+length(a_instanceBezierStart)+length(a_instanceBezierEnd)>0.;bool S=a_instanceArcAngles.x!=0.||a_instanceArcAngles.y!=0.;if(R){float H=a_position.x;vec2 T=G(H,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);vec2 U=P(H,a_instanceBezierStart,a_instanceBezierCP1,a_instanceBezierCP2,a_instanceBezierEnd);float V=length(U);U=V>0.?U/V:vec2(1,0);Q=T+vec2(-U.y,U.x)*a_position.y*a_instanceSize.y;}else if(S){float C=a_instanceArcAngles.x,W=a_instanceArcAngles.y;C=mod(C,6.28318530718);if(C<0.)C+=6.28318530718;W=mod(W,6.28318530718);if(W<0.)W+=6.28318530718;float X=C-W;if(X<=0.)X+=6.28318530718;float Y=C-a_position.x*X;vec2 Z=vec2(cos(Y),sin(Y))*a_position.y;Q=Z*a_instanceSize*.5+a_instanceSize*.5+a_instancePosition;}else{Q=a_position*a_instanceSize+a_instancePosition;}vec2 a=(Q/Uw)*2.-1.;a.y=-a.y;if(length(a_instanceGlobalRotation)>0.){vec3 b=vec3(a-a_instanceRotationCenter,0);b.x*=U9;if(a_instanceGlobalRotation.x!=0.)b=A(-a_instanceGlobalRotation.x)*b;if(a_instanceGlobalRotation.y!=0.)b=E(-a_instanceGlobalRotation.y)*b;if(a_instanceGlobalRotation.z!=0.)b=F(-a_instanceGlobalRotation.z)*b;b.x/=U9;a=b.xy+a_instanceRotationCenter;}gl_Position=vec4(a,0,1);}`, at = "attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;void main(){v_uv=a_texCoord;gl_Position=vec4(a_position,0.,1.);}";
|
|
367
367
|
class ft {
|
|
368
368
|
constructor(t) {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
369
|
+
a(this, "vt");
|
|
370
|
+
a(this, "Jt");
|
|
371
|
+
a(this, "te");
|
|
372
|
+
a(this, "ee");
|
|
373
|
+
a(this, "se");
|
|
374
374
|
this.vt = t, this.te = new I(this.vt, W, `#version 300 es
|
|
375
375
|
precision highp float;in vec2 v_uv;in vec3 v_character;in vec4 v_primaryColor;in vec4 v_secondaryColor;in vec2 v_rotation;in vec3 v_transform;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;void main(){o_character=vec4(v_character,1.);o_primaryColor=v_primaryColor;o_secondaryColor=v_secondaryColor;o_rotation=vec4(v_rotation,0.,1.);o_transform=vec4(v_transform,1.);}`), this.Jt = new I(this.vt, W, `#version 300 es
|
|
376
|
-
precision highp float;in vec2 v_uv;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ug;uniform sampler2D Uh;uniform sampler2D Ui;uniform vec2 Uj;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;void main(){vec2 A=vec2(v_uv.x,1.-v_uv.y);vec2 B=A*Uj;vec2 C=(floor(B)+0.5f)/Uj;vec4 D=texture(Ue,C);vec4 E=texture(Uf,C);if(E.a==0.){discard;}vec4 F=texture(Ug,C);vec4 G=texture(Uh,C);vec4 H=texture(Ui,C);o_character=D;o_primaryColor=E;o_secondaryColor=F;o_rotation=G;o_transform=H;}`), this.ee = new I(this.vt,
|
|
377
|
-
precision highp float;in vec2 v_uv;uniform sampler2D Uk;uniform bool Ul;uniform bool Um;uniform bool Un;uniform vec2 Uo;uniform bool Up;uniform vec3 Uq;uniform bool Ur;uniform vec3 Us;uniform vec4 Ut;uniform int Uu;uniform vec3 Uv[64];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;float A(vec3 B){return dot(B,vec3(0.
|
|
376
|
+
precision highp float;in vec2 v_uv;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ug;uniform sampler2D Uh;uniform sampler2D Ui;uniform vec2 Uj;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;void main(){vec2 A=vec2(v_uv.x,1.-v_uv.y);vec2 B=A*Uj;vec2 C=(floor(B)+0.5f)/Uj;vec4 D=texture(Ue,C);vec4 E=texture(Uf,C);if(E.a==0.){discard;}vec4 F=texture(Ug,C);vec4 G=texture(Uh,C);vec4 H=texture(Ui,C);o_character=D;o_primaryColor=E;o_secondaryColor=F;o_rotation=G;o_transform=H;}`), this.ee = new I(this.vt, at, "precision mediump float;uniform sampler2D U0;uniform vec2 U1;uniform sampler2D U3;uniform sampler2D U4;uniform sampler2D U5;uniform sampler2D U2;uniform sampler2D U6;uniform vec2 U7;uniform vec2 U8;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/U8;vec2 F=E*U7;vec2 G=floor(F);vec2 H=(G+0.5)/U7;vec4 I=texture2D(U3,H);vec4 J=texture2D(U4,H);vec4 K=texture2D(U5,H);bool L=K.r>0.5;bool M=K.g>0.5;bool N=K.b>0.5;vec4 O=texture2D(U2,H);int P=int(O.r*255.+0.5)+int(O.g*255.+0.5)*256;int Q=int(mod(float(P),U1.x));int R=P/int(U1.x);float S=(U1.y-1.)-float(R);vec2 T=vec2(float(Q),S)/U1;vec4 U=texture2D(U6,H);float V=U.r*255.+U.g;float W=-(V*360./255.)*0.017453292;vec2 X=fract(F)-0.5;if(M)X.x=-X.x;if(N)X.y=-X.y;X=A(W)*X+0.5;vec2 Y=1./U1;vec2 Z=T+X*Y;vec2 a=T+Y;if(any(lessThan(Z,T))||any(greaterThan(Z,a))){gl_FragColor=L?I:J;return;}vec4 b=texture2D(U0,Z);if(L)b.rgb=1.-b.rgb;gl_FragColor=mix(J,I,b);}"), this.se = new I(this.vt, W, `#version 300 es
|
|
377
|
+
precision highp float;in vec2 v_uv;uniform sampler2D Uk;uniform bool Ul;uniform bool Um;uniform bool Un;uniform vec2 Uo;uniform bool Up;uniform vec3 Uq;uniform bool Ur;uniform vec3 Us;uniform vec4 Ut;uniform int Uu;uniform vec3 Uv[64];layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 o_rotation;layout(location=4)out vec4 o_transform;float A(vec3 B){return dot(B,vec3(0.299f,0.587f,0.114f));}void main(){vec2 C=vec2(v_uv.x,1.0f-v_uv.y);vec4 D=texture(Uk,C);float E=A(D.rgb);if(Uu>0){float F=float(Uu);float G=clamp(E*(F-1.0f),0.0f,F-1.0f);int H=int(floor(G+0.5f));vec3 I=Uv[H];o_character=vec4(I,1.0f);}else{o_character=vec4(E,0.0f,0.0f,1.0f);}vec3 J=D.rgb;vec3 K=Up?Uq:J;vec3 L=Ur?Us:J;float M=1.0f;float N=1.0f;if(D.a<0.01f){K=Ut.rgb;L=Ut.rgb;}o_primaryColor=vec4(K,M);o_secondaryColor=vec4(L,N);o_rotation=vec4(Uo.xy,0.0f,1.0f);o_transform=vec4(float(Ul),float(Um),float(Un),1.0f);}`);
|
|
378
378
|
}
|
|
379
379
|
ie() {
|
|
380
380
|
return this.Jt;
|
|
@@ -394,15 +394,15 @@ precision highp float;in vec2 v_uv;uniform sampler2D Uk;uniform bool Ul;uniform
|
|
|
394
394
|
ae(t, e) {
|
|
395
395
|
return new I(this.vt, t, e);
|
|
396
396
|
}
|
|
397
|
-
|
|
398
|
-
this.Jt.
|
|
397
|
+
Gt() {
|
|
398
|
+
this.Jt.Gt(), this.te.Gt(), this.ee.Gt(), this.se.Gt();
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
|
-
var y = ((
|
|
401
|
+
var y = ((h) => (h.RECTANGLE = "rectangle", h.LINE = "line", h.ELLIPSE = "ellipse", h.ARC = "arc", h.TRIANGLE = "triangle", h.BEZIER_CURVE = "bezier_curve", h.CUSTOM = "custom", h))(y || {});
|
|
402
402
|
class dt {
|
|
403
403
|
constructor(t) {
|
|
404
|
-
|
|
405
|
-
|
|
404
|
+
a(this, "vt");
|
|
405
|
+
a(this, "he", /* @__PURE__ */ new Map());
|
|
406
406
|
this.vt = t;
|
|
407
407
|
}
|
|
408
408
|
ce(t, e, i, s) {
|
|
@@ -422,27 +422,27 @@ class dt {
|
|
|
422
422
|
pe() {
|
|
423
423
|
this.vt.bindVertexArray(null);
|
|
424
424
|
}
|
|
425
|
-
|
|
425
|
+
Gt() {
|
|
426
426
|
for (const [, t] of this.he) for (const [, e] of t) e && this.vt.deleteVertexArray(e);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
class gt {
|
|
430
430
|
constructor(t, e) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
431
|
+
a(this, "me");
|
|
432
|
+
a(this, "vt");
|
|
433
|
+
a(this, "xt");
|
|
434
|
+
a(this, "ge", null);
|
|
435
|
+
a(this, "_e", null);
|
|
436
436
|
this.vt = t, this.me = new dt(t), this.xt = e;
|
|
437
437
|
}
|
|
438
438
|
ve(t, e, i) {
|
|
439
439
|
const { shader: s } = t, r = k(this.vt) || this.vt.getParameter(this.vt.VIEWPORT);
|
|
440
|
-
s.Vt({ U9: r[2] / r[3],
|
|
440
|
+
s.Vt({ U9: r[2] / r[3], Uw: [r[2], r[3]] });
|
|
441
441
|
const n = (l) => {
|
|
442
|
-
if (!l || !l.
|
|
442
|
+
if (!l || !l.we()) return;
|
|
443
443
|
const u = l.unitGeometry, f = l.unitBuffer;
|
|
444
444
|
try {
|
|
445
|
-
this.me.ce(s.Qt, l.type + "", u, f), l.batch.
|
|
445
|
+
this.me.ce(s.Qt, l.type + "", u, f), l.batch.ye(s), l.batch.Ae(u.Ce, u.be);
|
|
446
446
|
} finally {
|
|
447
447
|
l.batch.xe(s), this.me.pe(), l.$e();
|
|
448
448
|
}
|
|
@@ -468,10 +468,10 @@ class gt {
|
|
|
468
468
|
ze(t, e, i, s, r, n, o, c) {
|
|
469
469
|
e.Xt(), e.Vt(i);
|
|
470
470
|
const l = this.vt.getParameter(this.vt.VIEWPORT);
|
|
471
|
-
if (e.Vt({ U9: l[2] / l[3],
|
|
471
|
+
if (e.Vt({ U9: l[2] / l[3], Uw: [l[2], l[3]] }), t.$e(), t.Fe({ x: s, y: r, width: n, height: o }, c), t.we()) {
|
|
472
472
|
const u = t.unitGeometry, f = t.unitBuffer;
|
|
473
473
|
try {
|
|
474
|
-
this.me.ce(e.Qt, t.type + "", u, f), t.batch.
|
|
474
|
+
this.me.ce(e.Qt, t.type + "", u, f), t.batch.ye(e), t.batch.Ae(u.Ce, u.be);
|
|
475
475
|
} finally {
|
|
476
476
|
t.batch.xe(e), this.me.pe(), t.$e();
|
|
477
477
|
}
|
|
@@ -481,31 +481,31 @@ class gt {
|
|
|
481
481
|
return this.xt.ie();
|
|
482
482
|
}
|
|
483
483
|
Re(t, e) {
|
|
484
|
-
return this.ge && this._e && this._e.w === t && this._e.h === e || (this.ge && this.ge.
|
|
484
|
+
return this.ge && this._e && this._e.w === t && this._e.h === e || (this.ge && this.ge.Gt(), this.ge = new q(this.vt, t, e, 5), this._e = { w: t, h: e }), this.ge;
|
|
485
485
|
}
|
|
486
|
-
|
|
487
|
-
this.me.
|
|
486
|
+
Gt() {
|
|
487
|
+
this.me.Gt(), this.ge && this.ge.Gt();
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
class pt {
|
|
491
491
|
constructor() {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
492
|
+
a(this, "Te", []);
|
|
493
|
+
a(this, "Se", 1);
|
|
494
|
+
a(this, "Ee", 0);
|
|
495
495
|
}
|
|
496
496
|
Be(t) {
|
|
497
497
|
if (this.Ee >= this.Te.length) {
|
|
498
|
-
const i = { id: this.Se++, type: t, params: {}, state: { I: 1, N: 0, X: 0, W: 0, j: [0, 0, 0], Y: [1, 1, 1, 1], q: [0, 0, 0, 1], V: !1, K: !1,
|
|
498
|
+
const i = { id: this.Se++, type: t, params: {}, state: { I: 1, N: 0, X: 0, W: 0, j: [0, 0, 0], Y: [1, 1, 1, 1], q: [0, 0, 0, 1], V: !1, K: !1, D: !1, L: [0, 0] } };
|
|
499
499
|
this.Te.push(i);
|
|
500
500
|
}
|
|
501
501
|
const e = this.Te[this.Ee];
|
|
502
502
|
return e.id = this.Se++, e.type = t, this.Ee++, e;
|
|
503
503
|
}
|
|
504
|
-
|
|
504
|
+
Ge(t, e, i, s, r) {
|
|
505
505
|
const n = this.Be(y.RECTANGLE);
|
|
506
506
|
return n.params.x = t, n.params.y = e, n.params.width = i, n.params.height = s, r.J(n.state), n.id;
|
|
507
507
|
}
|
|
508
|
-
|
|
508
|
+
De(t, e, i, s, r, n, o) {
|
|
509
509
|
const c = this.Be(y.CUSTOM);
|
|
510
510
|
return c.params.x = t, c.params.y = e, c.params.width = i, c.params.height = s, c.params.shader = r, c.params.uniforms = n, o.J(c.state), c.id;
|
|
511
511
|
}
|
|
@@ -560,23 +560,23 @@ const P = class P {
|
|
|
560
560
|
return i;
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
|
-
|
|
563
|
+
a(P, "BYTES_PER_INSTANCE", 140), a(P, "FLOATS_PER_INSTANCE", 35);
|
|
564
564
|
let M = P;
|
|
565
565
|
const T = class T {
|
|
566
566
|
};
|
|
567
|
-
|
|
567
|
+
a(T, "STRIDE", M.BYTES_PER_INSTANCE), a(T, "ATTRIBUTES", { a_instancePosition: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 0, divisor: 1 }, a_instanceSize: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 8, divisor: 1 }, a_instanceCharacter: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 16, divisor: 1 }, a_instancePrimaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 28, divisor: 1 }, a_instanceSecondaryColor: { location: -1, size: 4, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 44, divisor: 1 }, a_instanceRotation: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 60, divisor: 1 }, a_instanceTransform: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 68, divisor: 1 }, a_instanceGlobalRotation: { location: -1, size: 3, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 80, divisor: 1 }, a_instanceRotationCenter: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 92, divisor: 1 }, a_instanceArcAngles: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 100, divisor: 1 }, a_instanceBezierCP1: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 108, divisor: 1 }, a_instanceBezierCP2: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 116, divisor: 1 }, a_instanceBezierStart: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 124, divisor: 1 }, a_instanceBezierEnd: { location: -1, size: 2, type: WebGL2RenderingContext.FLOAT, normalized: !1, stride: T.STRIDE, offset: 132, divisor: 1 } });
|
|
568
568
|
let Y = T;
|
|
569
569
|
class mt {
|
|
570
570
|
constructor(t, e = 1e3, i = 1.5) {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
571
|
+
a(this, "vt");
|
|
572
|
+
a(this, "Je", []);
|
|
573
|
+
a(this, "ts");
|
|
574
|
+
a(this, "es");
|
|
575
|
+
a(this, "ss", null);
|
|
576
|
+
a(this, "rs", !0);
|
|
577
|
+
a(this, "ns", 0);
|
|
578
|
+
a(this, "hs", /* @__PURE__ */ new Map());
|
|
579
|
+
a(this, "cs", null);
|
|
580
580
|
this.vt = t, this.ts = e, this.es = i, this.ls();
|
|
581
581
|
}
|
|
582
582
|
Fe(t) {
|
|
@@ -623,7 +623,7 @@ class mt {
|
|
|
623
623
|
}
|
|
624
624
|
return e;
|
|
625
625
|
}
|
|
626
|
-
|
|
626
|
+
ye(t) {
|
|
627
627
|
if (!this.ss || this.Je.length === 0) return;
|
|
628
628
|
const e = this.vt, i = t.Qt;
|
|
629
629
|
this.fs();
|
|
@@ -638,24 +638,24 @@ class mt {
|
|
|
638
638
|
const e = this.vt, i = this.ds(t.Qt);
|
|
639
639
|
for (const [, s] of i) e.disableVertexAttribArray(s), e.vertexAttribDivisor(s, 0);
|
|
640
640
|
}
|
|
641
|
-
|
|
641
|
+
Ae(t, e) {
|
|
642
642
|
this.Je.length !== 0 && this.vt.drawArraysInstanced(t, 0, e, this.Je.length);
|
|
643
643
|
}
|
|
644
|
-
|
|
644
|
+
Gt() {
|
|
645
645
|
this.ss && this.vt.deleteBuffer(this.ss);
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
648
|
class _ {
|
|
649
649
|
constructor(t, e, i, s) {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
650
|
+
a(this, "vt");
|
|
651
|
+
a(this, "ps");
|
|
652
|
+
a(this, "gs");
|
|
653
|
+
a(this, "_s");
|
|
654
|
+
a(this, "vs", null);
|
|
655
655
|
this.vt = t, this.ps = e, this.gs = i, this._s = s;
|
|
656
656
|
const r = this.vt.createBuffer();
|
|
657
657
|
if (!r) throw Error("Failed to create unit geometry buffer");
|
|
658
|
-
this.vt.bindBuffer(this.vt.ARRAY_BUFFER, r), this.vt.bufferData(this.vt.ARRAY_BUFFER, this._s.
|
|
658
|
+
this.vt.bindBuffer(this.vt.ARRAY_BUFFER, r), this.vt.bufferData(this.vt.ARRAY_BUFFER, this._s.ws, this.vt.STATIC_DRAW), this.vt.bindBuffer(this.vt.ARRAY_BUFFER, null), this.vs = r;
|
|
659
659
|
}
|
|
660
660
|
get type() {
|
|
661
661
|
return this.gs;
|
|
@@ -672,15 +672,15 @@ class _ {
|
|
|
672
672
|
$e() {
|
|
673
673
|
this.ps.clear();
|
|
674
674
|
}
|
|
675
|
-
|
|
675
|
+
we() {
|
|
676
676
|
return !this.ps.isEmpty;
|
|
677
677
|
}
|
|
678
|
-
|
|
679
|
-
this.ps.
|
|
678
|
+
Gt() {
|
|
679
|
+
this.ps.Gt(), this.vt.deleteBuffer(this.vs);
|
|
680
680
|
}
|
|
681
|
-
|
|
681
|
+
As(t, e, i, s, r) {
|
|
682
682
|
const n = this.Cs(t, e, i, s, r.N || 0, r.X || 0, r.W || 0);
|
|
683
|
-
return { le: [t, e], Ee: [i, s], j: r.j || [0, 0, 0], Y: r.Y || [1, 1, 1, 1], q: r.q || [0, 0, 0, 1], L: r.L || [0, 0], We: [r.
|
|
683
|
+
return { le: [t, e], Ee: [i, s], j: r.j || [0, 0, 0], Y: r.Y || [1, 1, 1, 1], q: r.q || [0, 0, 0, 1], L: r.L || [0, 0], We: [r.D ? 1 : 0, r.V ? 1 : 0, r.K ? 1 : 0], N: n.radiansX, X: n.radiansY, W: n.radiansZ, Ve: [n.centerX, n.centerY] };
|
|
684
684
|
}
|
|
685
685
|
bs(t, e) {
|
|
686
686
|
const i = k(this.vt) || [0, 0, this.vt.canvas.width, this.vt.canvas.height];
|
|
@@ -695,30 +695,30 @@ class _ {
|
|
|
695
695
|
return { centerX: (t + i / 2) / l * 2 - 1, centerY: 1 - (e + s / 2) / u * 2, radiansX: -r * Math.PI / 180, radiansY: -n * Math.PI / 180, radiansZ: -o * Math.PI / 180, aspectRatio: l / u };
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
const vt = {
|
|
698
|
+
const vt = { ws: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1]), be: 6, Ce: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
|
|
699
699
|
class At extends _ {
|
|
700
700
|
constructor(t, e) {
|
|
701
701
|
super(t, e, y.RECTANGLE, vt);
|
|
702
702
|
}
|
|
703
703
|
Fe(t, e) {
|
|
704
|
-
const i = this.
|
|
704
|
+
const i = this.As(t.x, t.y, t.width, t.height, e);
|
|
705
705
|
return this.ps.Fe(i);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
const xt = {
|
|
708
|
+
const xt = { ws: new Float32Array([0, -0.5, 0, 0, 1, -0.5, 1, 0, 0, 0.5, 0, 1, 0, 0.5, 0, 1, 1, -0.5, 1, 0, 1, 0.5, 1, 1]), be: 6, Ce: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
|
|
709
709
|
class Et extends _ {
|
|
710
710
|
constructor(t, e) {
|
|
711
711
|
super(t, e, y.LINE, xt);
|
|
712
712
|
}
|
|
713
713
|
Fe(t, e) {
|
|
714
|
-
const i = t.x2 - t.x1, s = t.y2 - t.y1, r = Math.hypot(i, s), n = t.thickness || e.I || 1, o = t.x1 + i / 2, c = t.y1 + s / 2, l = o - r / 2, u = c, f = this.
|
|
714
|
+
const i = t.x2 - t.x1, s = t.y2 - t.y1, r = Math.hypot(i, s), n = t.thickness || e.I || 1, o = t.x1 + i / 2, c = t.y1 + s / 2, l = o - r / 2, u = c, f = this.As(l, u, r, n, e);
|
|
715
715
|
return this.$s(f, o, c), this.ps.Fe(f);
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
|
-
const yt = {
|
|
719
|
-
const t = [], e = 2 * Math.PI /
|
|
720
|
-
for (let i = 0; i <
|
|
721
|
-
const s = i * e, r = (i + 1) %
|
|
718
|
+
const yt = { ws: function(h = 32) {
|
|
719
|
+
const t = [], e = 2 * Math.PI / h;
|
|
720
|
+
for (let i = 0; i < h; i++) {
|
|
721
|
+
const s = i * e, r = (i + 1) % h * e, n = Math.cos(s), o = Math.sin(s), c = 0.5 * (n + 1), l = 0.5 * (o + 1), u = Math.cos(r), f = Math.sin(r), g = 0.5 * (u + 1), v = 0.5 * (f + 1);
|
|
722
722
|
t.push(0, 0, 0.5, 0.5, n, o, c, l, u, f, g, v);
|
|
723
723
|
}
|
|
724
724
|
return new Float32Array(t);
|
|
@@ -728,14 +728,14 @@ class wt extends _ {
|
|
|
728
728
|
super(t, e, y.ELLIPSE, yt);
|
|
729
729
|
}
|
|
730
730
|
Fe(t, e) {
|
|
731
|
-
const i = this.
|
|
731
|
+
const i = this.As(t.x, t.y, t.width, t.height, e);
|
|
732
732
|
return this.$s(i, t.x, t.y), this.ps.Fe(i);
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
|
-
let bt = {
|
|
735
|
+
let bt = { ws: function(h) {
|
|
736
736
|
const t = [];
|
|
737
|
-
for (let e = 0; e <
|
|
738
|
-
const i = e /
|
|
737
|
+
for (let e = 0; e < h; e++) {
|
|
738
|
+
const i = e / h, s = (e + 1) / h;
|
|
739
739
|
t.push(i, 0, i, 0, i, 1, i, 1, s, 1, s, 1);
|
|
740
740
|
}
|
|
741
741
|
return new Float32Array(t);
|
|
@@ -745,28 +745,28 @@ class Rt extends _ {
|
|
|
745
745
|
super(t, e, y.ARC, bt);
|
|
746
746
|
}
|
|
747
747
|
Fe(t, e) {
|
|
748
|
-
const i = t.x - t.width / 2, s = t.y - t.height / 2, r = t.start * Math.PI / 180, n = t.stop * Math.PI / 180, o = this.
|
|
748
|
+
const i = t.x - t.width / 2, s = t.y - t.height / 2, r = t.start * Math.PI / 180, n = t.stop * Math.PI / 180, o = this.As(i, s, t.width, t.height, e);
|
|
749
749
|
return this.$s(o, t.x, t.y), o.Ke = [r, n], this.ps.Fe(o);
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
|
-
const Tt = {
|
|
752
|
+
const Tt = { ws: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), be: 3, Ce: WebGL2RenderingContext.TRIANGLES, fe: 16, ue: { le: { size: 2, offset: 0 }, de: { size: 2, offset: 8 } } };
|
|
753
753
|
class Ct extends _ {
|
|
754
754
|
constructor(t, e) {
|
|
755
755
|
super(t, e, y.TRIANGLE, Tt);
|
|
756
756
|
}
|
|
757
757
|
Fe(t, e) {
|
|
758
|
-
const i = Math.min(t.x1, t.x2, t.x3), s = Math.max(t.x1, t.x2, t.x3), r = Math.min(t.y1, t.y2, t.y3), n = s - i, o = Math.max(t.y1, t.y2, t.y3) - r, c = this.
|
|
758
|
+
const i = Math.min(t.x1, t.x2, t.x3), s = Math.max(t.x1, t.x2, t.x3), r = Math.min(t.y1, t.y2, t.y3), n = s - i, o = Math.max(t.y1, t.y2, t.y3) - r, c = this.As(i, r, n, o, e), l = i + 0.5 * n, u = r + o * (1 / 3);
|
|
759
759
|
return this.$s(c, l, u), this.ps.Fe(c);
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
function et(
|
|
763
|
-
const r = 1 -
|
|
764
|
-
return n * r * t + 3 * n *
|
|
762
|
+
function et(h, t, e, i, s) {
|
|
763
|
+
const r = 1 - h, n = r * r, o = h * h;
|
|
764
|
+
return n * r * t + 3 * n * h * e + 3 * r * o * i + o * h * s;
|
|
765
765
|
}
|
|
766
|
-
const Ut = {
|
|
766
|
+
const Ut = { ws: function(h = 16) {
|
|
767
767
|
const t = [];
|
|
768
|
-
for (let e = 0; e <
|
|
769
|
-
const i = e /
|
|
768
|
+
for (let e = 0; e < h; e++) {
|
|
769
|
+
const i = e / h, s = (e + 1) / h;
|
|
770
770
|
t.push(i, -0.5, i, 0), t.push(s, -0.5, s, 0), t.push(i, 0.5, i, 1), t.push(i, 0.5, i, 1), t.push(s, -0.5, s, 0), t.push(s, 0.5, s, 1);
|
|
771
771
|
}
|
|
772
772
|
return new Float32Array(t);
|
|
@@ -776,32 +776,32 @@ class Ft extends _ {
|
|
|
776
776
|
super(t, e, y.BEZIER_CURVE, Ut);
|
|
777
777
|
}
|
|
778
778
|
Fe(t, e) {
|
|
779
|
-
const i = e.I || 1, s = et(0.5, t.x1, t.cp1x, t.cp2x, t.x2), r = et(0.5, t.y1, t.cp1y, t.cp2y, t.y2), n = this.
|
|
779
|
+
const i = e.I || 1, s = et(0.5, t.x1, t.cp1x, t.cp2x, t.x2), r = et(0.5, t.y1, t.cp1y, t.cp2y, t.y2), n = this.As(0, 0, 1, i, e);
|
|
780
780
|
return this.$s(n, s, r), n.qe = [t.x1, t.y1], n.je = [t.cp1x, t.cp1y], n.Ye = [t.cp2x, t.cp2y], n.Ze = [t.x2, t.y2], this.ps.Fe(n);
|
|
781
781
|
}
|
|
782
782
|
}
|
|
783
783
|
class Bt {
|
|
784
784
|
constructor(t) {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
this.vt = t, this.Fs = new ft(t), this.Bs = new
|
|
785
|
+
a(this, "vt");
|
|
786
|
+
a(this, "Ms", null);
|
|
787
|
+
a(this, "Fs");
|
|
788
|
+
a(this, "Rs", null);
|
|
789
|
+
a(this, "zs", {});
|
|
790
|
+
a(this, "Ps", null);
|
|
791
|
+
a(this, "Ts", /* @__PURE__ */ new Map());
|
|
792
|
+
a(this, "Ss");
|
|
793
|
+
a(this, "Es");
|
|
794
|
+
a(this, "Bs");
|
|
795
|
+
a(this, "k", []);
|
|
796
|
+
this.vt = t, this.Fs = new ft(t), this.Bs = new ht(), this.Ss = new gt(t, this), this.Es = new pt(), this.Ps = t.createBuffer(), H(this.vt, [0, 0, this.vt.canvas.width, this.vt.canvas.height]);
|
|
797
797
|
}
|
|
798
|
-
|
|
798
|
+
Gs(t) {
|
|
799
799
|
let e = this.Ts.get(t);
|
|
800
800
|
if (e) return e;
|
|
801
801
|
const i = new mt(this.vt);
|
|
802
802
|
return e = (0, { [y.RECTANGLE]: () => new At(this.vt, i), [y.LINE]: () => new Et(this.vt, i), [y.ELLIPSE]: () => new wt(this.vt, i), [y.ARC]: () => new Rt(this.vt, i), [y.TRIANGLE]: () => new Ct(this.vt, i), [y.BEZIER_CURVE]: () => new Ft(this.vt, i) }[t])(), this.Ts.set(t, e), e;
|
|
803
803
|
}
|
|
804
|
-
|
|
804
|
+
Ds(t) {
|
|
805
805
|
this.Ms !== t && (this.Ms = t, t.Xt());
|
|
806
806
|
}
|
|
807
807
|
ae(t, e) {
|
|
@@ -833,11 +833,11 @@ class Bt {
|
|
|
833
833
|
}
|
|
834
834
|
ks(t, e, i, s, r) {
|
|
835
835
|
const n = this.ie(), o = { Ue: t.textures[0], Uf: t.textures[1], Ug: t.textures[2], Uh: t.textures[3], Ui: t.textures[4], Uj: [t.width, t.height] };
|
|
836
|
-
this.Es.
|
|
836
|
+
this.Es.De(e, i, s, r, n, o, this.Bs);
|
|
837
837
|
}
|
|
838
838
|
Hs(t, e, i, s, r) {
|
|
839
839
|
const n = this.ne(), o = t.Is(), c = { Uk: o.texture, Ul: !!o.invert, Um: !!o.flipX, Un: !!o.flipY, Uo: o.charRotation, Up: o.charColorFixed, Uq: o.charColor, Ur: o.cellColorFixed, Us: o.cellColor, Ut: o.backgroundColor, Uu: o.charCount, Uv: o.charList };
|
|
840
|
-
this.Es.
|
|
840
|
+
this.Es.De(e, i, s, r, n, c, this.Bs);
|
|
841
841
|
}
|
|
842
842
|
Ns(t, e, i, s) {
|
|
843
843
|
var d;
|
|
@@ -847,7 +847,7 @@ class Bt {
|
|
|
847
847
|
m !== -1 && (r.enableVertexAttribArray(m), r.vertexAttribPointer(m, 2, r.FLOAT, !1, 8, 0)), r.drawArrays(r.TRIANGLES, 0, 6), m !== -1 && r.disableVertexAttribArray(m);
|
|
848
848
|
}
|
|
849
849
|
Xs(t, e, i, s) {
|
|
850
|
-
this.Rs ? (this.Es.
|
|
850
|
+
this.Rs ? (this.Es.De(t, e, i, s, this.Rs, { ...this.zs }, this.Bs), this.Rs = null, this.zs = {}) : this.Es.Ge(t, e, i, s, this.Bs);
|
|
851
851
|
}
|
|
852
852
|
Ws(t, e, i, s) {
|
|
853
853
|
this.Es.Le(t, e, i, s, this.Bs.lineWeight, this.Bs);
|
|
@@ -892,55 +892,55 @@ class Bt {
|
|
|
892
892
|
}
|
|
893
893
|
St(t) {
|
|
894
894
|
const e = t, i = k(this.vt) ?? this.vt.getParameter(this.vt.VIEWPORT), s = { shader: e, gl: this.vt, viewport: i };
|
|
895
|
-
this.
|
|
895
|
+
this.Ds(e);
|
|
896
896
|
const r = /* @__PURE__ */ new Set();
|
|
897
897
|
for (const n of this.Es) n.type === y.CUSTOM ? r.add(y.RECTANGLE) : r.add(n.type);
|
|
898
|
-
for (const n of r) n !== y.CUSTOM && this.
|
|
898
|
+
for (const n of r) n !== y.CUSTOM && this.Gs(n);
|
|
899
899
|
this.Ss.ve(s, this.Es, this.Ts), this.Es.Ne();
|
|
900
900
|
}
|
|
901
|
-
|
|
901
|
+
Gt() {
|
|
902
902
|
this.vt.deleteBuffer(this.Ps), this.Es.Ne();
|
|
903
|
-
for (const t of this.Ts.values()) t.
|
|
904
|
-
this.Fs.
|
|
903
|
+
for (const t of this.Ts.values()) t.Gt();
|
|
904
|
+
this.Fs.Gt(), this.Ss.Gt();
|
|
905
905
|
}
|
|
906
906
|
}
|
|
907
|
-
const w = { readShort: (
|
|
907
|
+
const w = { readShort: (h, t) => (w.t.uint16[0] = h[t] << 8 | h[t + 1], w.t.int16[0]), readUshort: (h, t) => h[t] << 8 | h[t + 1], readUshorts(h, t, e) {
|
|
908
908
|
const i = [];
|
|
909
|
-
for (let s = 0; s < e; s++) i.push(w.readUshort(
|
|
909
|
+
for (let s = 0; s < e; s++) i.push(w.readUshort(h, t + 2 * s));
|
|
910
910
|
return i;
|
|
911
|
-
}, readUint(
|
|
911
|
+
}, readUint(h, t) {
|
|
912
912
|
const e = w.t.uint8;
|
|
913
|
-
return e[3] =
|
|
914
|
-
}, readASCII(
|
|
913
|
+
return e[3] = h[t], e[2] = h[t + 1], e[1] = h[t + 2], e[0] = h[t + 3], w.t.uint32[0];
|
|
914
|
+
}, readASCII(h, t, e) {
|
|
915
915
|
let i = "";
|
|
916
|
-
for (let s = 0; s < e; s++) i += String.fromCharCode(
|
|
916
|
+
for (let s = 0; s < e; s++) i += String.fromCharCode(h[t + s]);
|
|
917
917
|
return i;
|
|
918
|
-
}, writeUshort(
|
|
919
|
-
|
|
920
|
-
}, writeUint(
|
|
921
|
-
|
|
922
|
-
}, writeASCII(
|
|
923
|
-
for (let i = 0; i < e.length; i++)
|
|
918
|
+
}, writeUshort(h, t, e) {
|
|
919
|
+
h[t] = e >>> 8 & 255, h[t + 1] = 255 & e;
|
|
920
|
+
}, writeUint(h, t, e) {
|
|
921
|
+
h[t] = e >>> 24 & 255, h[t + 1] = e >>> 16 & 255, h[t + 2] = e >>> 8 & 255, h[t + 3] = 255 & e;
|
|
922
|
+
}, writeASCII(h, t, e) {
|
|
923
|
+
for (let i = 0; i < e.length; i++) h[t + i] = 255 & e.charCodeAt(i);
|
|
924
924
|
}, t: (() => {
|
|
925
|
-
const
|
|
926
|
-
return { uint8: new Uint8Array(
|
|
925
|
+
const h = new ArrayBuffer(8);
|
|
926
|
+
return { uint8: new Uint8Array(h), int16: new Int16Array(h), uint16: new Uint16Array(h), uint32: new Uint32Array(h) };
|
|
927
927
|
})() };
|
|
928
|
-
function X(
|
|
929
|
-
return
|
|
928
|
+
function X(h) {
|
|
929
|
+
return h + 3 & -4;
|
|
930
930
|
}
|
|
931
|
-
function V(
|
|
931
|
+
function V(h, t, e) {
|
|
932
932
|
const i = t + e;
|
|
933
933
|
let s = 0;
|
|
934
934
|
const r = w.t;
|
|
935
|
-
for (let n = t; n < i; n += 4) r.uint8[3] =
|
|
935
|
+
for (let n = t; n < i; n += 4) r.uint8[3] = h[n] || 0, r.uint8[2] = h[n + 1] || 0, r.uint8[1] = h[n + 2] || 0, r.uint8[0] = h[n + 3] || 0, s = s + (r.uint32[0] >>> 0) >>> 0;
|
|
936
936
|
return s >>> 0;
|
|
937
937
|
}
|
|
938
938
|
class Lt {
|
|
939
939
|
constructor(t) {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
940
|
+
a(this, "b");
|
|
941
|
+
a(this, "p", 0);
|
|
942
|
+
a(this, "bitbuf", 0);
|
|
943
|
+
a(this, "bitcnt", 0);
|
|
944
944
|
this.b = t;
|
|
945
945
|
}
|
|
946
946
|
readBits(t) {
|
|
@@ -958,19 +958,19 @@ class Lt {
|
|
|
958
958
|
return this.p;
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
|
-
function N(
|
|
961
|
+
function N(h) {
|
|
962
962
|
let t = 32, e = 0;
|
|
963
|
-
for (const o of
|
|
963
|
+
for (const o of h) o && (o < t && (t = o), o > e && (e = o));
|
|
964
964
|
if (e === 0) return { min: 0, max: 0, table: /* @__PURE__ */ new Map() };
|
|
965
965
|
const i = new Uint32Array(e + 1);
|
|
966
|
-
for (const o of
|
|
966
|
+
for (const o of h) o && i[o]++;
|
|
967
967
|
const s = new Uint32Array(e + 1);
|
|
968
968
|
let r = 0;
|
|
969
969
|
i[0] = 0;
|
|
970
970
|
for (let o = 1; o <= e; o++) r = r + i[o - 1] << 1, s[o] = r;
|
|
971
971
|
const n = /* @__PURE__ */ new Map();
|
|
972
|
-
for (let o = 0; o <
|
|
973
|
-
const c =
|
|
972
|
+
for (let o = 0; o < h.length; o++) {
|
|
973
|
+
const c = h[o];
|
|
974
974
|
if (!c) continue;
|
|
975
975
|
const l = s[c]++;
|
|
976
976
|
let u = n.get(c);
|
|
@@ -978,10 +978,10 @@ function N(a) {
|
|
|
978
978
|
}
|
|
979
979
|
return { min: t, max: e, table: n };
|
|
980
980
|
}
|
|
981
|
-
function j(
|
|
981
|
+
function j(h, t) {
|
|
982
982
|
let e = 0;
|
|
983
983
|
for (let i = 1; i <= t.max; i++) {
|
|
984
|
-
e |=
|
|
984
|
+
e |= h.readBits(1) << i - 1;
|
|
985
985
|
const s = t.table.get(i);
|
|
986
986
|
if (s && e < s.length) {
|
|
987
987
|
const r = s[e];
|
|
@@ -990,14 +990,14 @@ function j(a, t) {
|
|
|
990
990
|
}
|
|
991
991
|
throw Error("Invalid Huffman code");
|
|
992
992
|
}
|
|
993
|
-
function Pt(
|
|
993
|
+
function Pt(h, t) {
|
|
994
994
|
let e = 0;
|
|
995
|
-
for (let i = 0; i < t; i++) e = e << 1 | 1 &
|
|
995
|
+
for (let i = 0; i < t; i++) e = e << 1 | 1 & h, h >>>= 1;
|
|
996
996
|
return e >>> 0;
|
|
997
997
|
}
|
|
998
|
-
function St(
|
|
999
|
-
if (
|
|
1000
|
-
const t =
|
|
998
|
+
function St(h) {
|
|
999
|
+
if (h.length < 2) throw Error("ZLIB data too short");
|
|
1000
|
+
const t = h[0], e = h[1];
|
|
1001
1001
|
if ((15 & t) != 8) throw Error("Unsupported ZLIB compression method");
|
|
1002
1002
|
if (((t << 8) + e) % 31 != 0) throw Error("Bad ZLIB header check");
|
|
1003
1003
|
let i = 2;
|
|
@@ -1073,10 +1073,10 @@ function St(a) {
|
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
|
-
}(new Lt(
|
|
1076
|
+
}(new Lt(h.subarray(i)), s), new Uint8Array(s);
|
|
1077
1077
|
}
|
|
1078
|
-
function Dt(
|
|
1079
|
-
const t = w, e = new Uint8Array(
|
|
1078
|
+
function Dt(h) {
|
|
1079
|
+
const t = w, e = new Uint8Array(h);
|
|
1080
1080
|
if (t.readASCII(e, 0, 4) !== "wOFF") throw Error("Invalid WOFF signature");
|
|
1081
1081
|
const i = t.readUint(e, 4), s = t.readUshort(e, 12), r = t.readUint(e, 16), n = [];
|
|
1082
1082
|
let o = 44;
|
|
@@ -1131,87 +1131,87 @@ function Dt(a) {
|
|
|
1131
1131
|
}
|
|
1132
1132
|
return d.buffer;
|
|
1133
1133
|
}
|
|
1134
|
-
const Mt = { parseTab(
|
|
1134
|
+
const Mt = { parseTab(h, t, e) {
|
|
1135
1135
|
const i = { tables: [], ids: {}, off: t };
|
|
1136
|
-
|
|
1137
|
-
const s = w, r = s.readUshort, n = r(
|
|
1136
|
+
h = new Uint8Array(h.buffer, t, e), t = 0;
|
|
1137
|
+
const s = w, r = s.readUshort, n = r(h, t += 2);
|
|
1138
1138
|
t += 2;
|
|
1139
1139
|
const o = [];
|
|
1140
1140
|
for (let c = 0; c < n; c++) {
|
|
1141
|
-
const l = r(
|
|
1141
|
+
const l = r(h, t), u = r(h, t += 2);
|
|
1142
1142
|
t += 2;
|
|
1143
|
-
const f = s.readUint(
|
|
1143
|
+
const f = s.readUint(h, t);
|
|
1144
1144
|
t += 4;
|
|
1145
1145
|
const g = `p${l}e${u}`;
|
|
1146
1146
|
let v = o.indexOf(f);
|
|
1147
1147
|
if (v === -1) {
|
|
1148
1148
|
let m;
|
|
1149
1149
|
v = i.tables.length, o.push(f);
|
|
1150
|
-
const d = r(
|
|
1151
|
-
m = d === 4 ? this.parse4(
|
|
1150
|
+
const d = r(h, f);
|
|
1151
|
+
m = d === 4 ? this.parse4(h, f) : d === 12 ? this.parse12(h, f) : { format: d }, i.tables.push(m);
|
|
1152
1152
|
}
|
|
1153
1153
|
i.ids[g] = v;
|
|
1154
1154
|
}
|
|
1155
1155
|
return i;
|
|
1156
|
-
}, parse4(
|
|
1157
|
-
const e = w, i = e.readUshort, s = e.readUshorts, r = t, n = i(
|
|
1156
|
+
}, parse4(h, t) {
|
|
1157
|
+
const e = w, i = e.readUshort, s = e.readUshorts, r = t, n = i(h, t += 2);
|
|
1158
1158
|
t += 2;
|
|
1159
|
-
const o = i(
|
|
1160
|
-
t += 2, c.entrySelector = i(
|
|
1161
|
-
for (let l = 0; l < o; l++) c.idDelta.push(e.readShort(
|
|
1162
|
-
return c.idRangeOffset = s(
|
|
1163
|
-
}, parse12(
|
|
1159
|
+
const o = i(h, t += 2) >>> 1, c = { format: 4, searchRange: i(h, t += 2), entrySelector: 0, rangeShift: 0, endCount: [], startCount: [], idDelta: [], idRangeOffset: [], glyphIdArray: [] };
|
|
1160
|
+
t += 2, c.entrySelector = i(h, t), t += 2, c.rangeShift = i(h, t), t += 2, c.endCount = s(h, t, o), t += 2 * o, t += 2, c.startCount = s(h, t, o), t += 2 * o;
|
|
1161
|
+
for (let l = 0; l < o; l++) c.idDelta.push(e.readShort(h, t)), t += 2;
|
|
1162
|
+
return c.idRangeOffset = s(h, t, o), t += 2 * o, c.glyphIdArray = s(h, t, r + n - t >> 1), c;
|
|
1163
|
+
}, parse12(h, t) {
|
|
1164
1164
|
const e = w.readUint;
|
|
1165
|
-
e(
|
|
1166
|
-
const i = e(
|
|
1165
|
+
e(h, t += 4), e(h, t += 4);
|
|
1166
|
+
const i = e(h, t += 4);
|
|
1167
1167
|
t += 4;
|
|
1168
1168
|
const s = new Uint32Array(3 * i);
|
|
1169
|
-
for (let r = 0; r < 3 * i; r += 3) s[r] = e(
|
|
1169
|
+
for (let r = 0; r < 3 * i; r += 3) s[r] = e(h, t + (r << 2)), s[r + 1] = e(h, t + (r << 2) + 4), s[r + 2] = e(h, t + (r << 2) + 8);
|
|
1170
1170
|
return { format: 12, groups: s };
|
|
1171
|
-
} }, It = { parseTab(
|
|
1171
|
+
} }, It = { parseTab(h, t, e) {
|
|
1172
1172
|
const i = w;
|
|
1173
1173
|
t += 18;
|
|
1174
|
-
const s = i.readUshort(
|
|
1174
|
+
const s = i.readUshort(h, t);
|
|
1175
1175
|
t += 2, t += 16;
|
|
1176
|
-
const r = i.readShort(
|
|
1176
|
+
const r = i.readShort(h, t);
|
|
1177
1177
|
t += 2;
|
|
1178
|
-
const n = i.readShort(
|
|
1178
|
+
const n = i.readShort(h, t);
|
|
1179
1179
|
t += 2;
|
|
1180
|
-
const o = i.readShort(
|
|
1180
|
+
const o = i.readShort(h, t);
|
|
1181
1181
|
t += 2;
|
|
1182
|
-
const c = i.readShort(
|
|
1183
|
-
return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: n, xMax: o, yMax: c, indexToLocFormat: i.readShort(
|
|
1184
|
-
} }, _t = { parseTab(
|
|
1182
|
+
const c = i.readShort(h, t);
|
|
1183
|
+
return t += 2, t += 6, { unitsPerEm: s, xMin: r, yMin: n, xMax: o, yMax: c, indexToLocFormat: i.readShort(h, t) };
|
|
1184
|
+
} }, _t = { parseTab(h, t, e) {
|
|
1185
1185
|
const i = w;
|
|
1186
1186
|
t += 4;
|
|
1187
1187
|
const s = ["ascender", "descender", "lineGap", "advanceWidthMax", "minLeftSideBearing", "minRightSideBearing", "xMaxExtent", "caretSlopeRise", "caretSlopeRun", "caretOffset", "res0", "res1", "res2", "res3", "metricDataFormat", "numberOfHMetrics"], r = {};
|
|
1188
1188
|
for (let n = 0; n < s.length; n++) {
|
|
1189
1189
|
const o = s[n], c = o === "advanceWidthMax" || o === "numberOfHMetrics" ? i.readUshort : i.readShort;
|
|
1190
|
-
r[o] = c(
|
|
1190
|
+
r[o] = c(h, t + 2 * n);
|
|
1191
1191
|
}
|
|
1192
1192
|
return r;
|
|
1193
|
-
} }, Ot = { parseTab(
|
|
1193
|
+
} }, Ot = { parseTab(h, t, e, i) {
|
|
1194
1194
|
const s = w, r = [], n = [], o = i.maxp.numGlyphs, c = i.hhea.numberOfHMetrics;
|
|
1195
1195
|
let l = 0, u = 0, f = 0;
|
|
1196
|
-
for (; f < c; ) l = s.readUshort(
|
|
1196
|
+
for (; f < c; ) l = s.readUshort(h, t + (f << 2)), u = s.readShort(h, t + (f << 2) + 2), r.push(l), n.push(u), f++;
|
|
1197
1197
|
for (; f < o; ) r.push(l), n.push(u), f++;
|
|
1198
1198
|
return { aWidth: r, lsBearing: n };
|
|
1199
|
-
} }, it = { cmap: Mt, head: It, hhea: _t, maxp: { parseTab(
|
|
1199
|
+
} }, it = { cmap: Mt, head: It, hhea: _t, maxp: { parseTab(h, t, e) {
|
|
1200
1200
|
const i = w;
|
|
1201
|
-
return i.readUint(
|
|
1202
|
-
} }, hmtx: Ot, loca: { parseTab(
|
|
1201
|
+
return i.readUint(h, t), t += 4, { numGlyphs: i.readUshort(h, t) };
|
|
1202
|
+
} }, hmtx: Ot, loca: { parseTab(h, t, e, i) {
|
|
1203
1203
|
const s = w, r = [], n = i.head.indexToLocFormat, o = i.maxp.numGlyphs + 1;
|
|
1204
|
-
if (n === 0) for (let c = 0; c < o; c++) r.push(s.readUshort(
|
|
1205
|
-
else if (n === 1) for (let c = 0; c < o; c++) r.push(s.readUint(
|
|
1204
|
+
if (n === 0) for (let c = 0; c < o; c++) r.push(s.readUshort(h, t + (c << 1)) << 1);
|
|
1205
|
+
else if (n === 1) for (let c = 0; c < o; c++) r.push(s.readUint(h, t + (c << 2)));
|
|
1206
1206
|
return r;
|
|
1207
|
-
} }, glyf: { parseTab(
|
|
1207
|
+
} }, glyf: { parseTab(h, t, e, i) {
|
|
1208
1208
|
const s = [], r = i.maxp.numGlyphs;
|
|
1209
1209
|
for (let n = 0; n < r; n++) s.push(null);
|
|
1210
1210
|
return s;
|
|
1211
|
-
}, Js(
|
|
1212
|
-
const e = w, i =
|
|
1211
|
+
}, Js(h, t) {
|
|
1212
|
+
const e = w, i = h.ti, s = h.loca;
|
|
1213
1213
|
if (s[t] === s[t + 1]) return null;
|
|
1214
|
-
const r = L.findTable(i, "glyf",
|
|
1214
|
+
const r = L.findTable(i, "glyf", h.ei);
|
|
1215
1215
|
if (!r) return null;
|
|
1216
1216
|
let n = r[0] + s[t];
|
|
1217
1217
|
const o = {};
|
|
@@ -1246,9 +1246,9 @@ const Mt = { parseTab(a, t, e) {
|
|
|
1246
1246
|
for (let g = 0; g < l; g++) u += o.xs[g], f += o.ys[g], o.xs[g] = u, o.ys[g] = f;
|
|
1247
1247
|
} else o.parts = [], o.endPts = [], o.flags = [], o.xs = [], o.ys = [];
|
|
1248
1248
|
return o;
|
|
1249
|
-
} } }, L = { parse(
|
|
1250
|
-
const t = new Uint8Array(
|
|
1251
|
-
if (e === "wOFF")
|
|
1249
|
+
} } }, L = { parse(h) {
|
|
1250
|
+
const t = new Uint8Array(h), e = w.readASCII(t, 0, 4);
|
|
1251
|
+
if (e === "wOFF") h = Dt(h);
|
|
1252
1252
|
else if (e === "wOF2") throw Error("WOFF2 is not supported in this build (Brotli + WOFF2 transforms required)");
|
|
1253
1253
|
return [((i, s, r, n) => {
|
|
1254
1254
|
const o = it, c = { ti: i, si: s, ei: r };
|
|
@@ -1261,14 +1261,14 @@ const Mt = { parseTab(a, t, e) {
|
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
1263
|
return c;
|
|
1264
|
-
})(new Uint8Array(
|
|
1265
|
-
}, findTable(
|
|
1266
|
-
const i = w, s = i.readUshort(
|
|
1264
|
+
})(new Uint8Array(h), 0, 0, {})];
|
|
1265
|
+
}, findTable(h, t, e) {
|
|
1266
|
+
const i = w, s = i.readUshort(h, e + 4);
|
|
1267
1267
|
let r = e + 12;
|
|
1268
1268
|
for (let n = 0; n < s; n++) {
|
|
1269
|
-
const o = i.readASCII(
|
|
1270
|
-
i.readUint(
|
|
1271
|
-
const c = i.readUint(
|
|
1269
|
+
const o = i.readASCII(h, r, 4);
|
|
1270
|
+
i.readUint(h, r + 4);
|
|
1271
|
+
const c = i.readUint(h, r + 8), l = i.readUint(h, r + 12);
|
|
1272
1272
|
if (o === t) return [c, l];
|
|
1273
1273
|
r += 16;
|
|
1274
1274
|
}
|
|
@@ -1339,8 +1339,8 @@ class Nt {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
class Z {
|
|
1341
1341
|
constructor() {
|
|
1342
|
-
|
|
1343
|
-
|
|
1342
|
+
a(this, "ci", /* @__PURE__ */ new Map());
|
|
1343
|
+
a(this, "li", /* @__PURE__ */ new Map());
|
|
1344
1344
|
}
|
|
1345
1345
|
ui(t, e) {
|
|
1346
1346
|
const i = `${this.fi(t)}_${e}`;
|
|
@@ -1363,7 +1363,7 @@ class Z {
|
|
|
1363
1363
|
const i = e / t.head.unitsPerEm, s = t.hhea.ascender * i, r = t.hhea.descender * i, n = t.hhea.lineGap * i;
|
|
1364
1364
|
return { ascender: s, descender: r, lineGap: n, lineHeight: s - r + n, unitsPerEm: t.head.unitsPerEm, scale: i };
|
|
1365
1365
|
}
|
|
1366
|
-
|
|
1366
|
+
wi() {
|
|
1367
1367
|
this.ci.clear(), this.li.clear();
|
|
1368
1368
|
}
|
|
1369
1369
|
fi(t) {
|
|
@@ -1398,20 +1398,20 @@ class Z {
|
|
|
1398
1398
|
}
|
|
1399
1399
|
class Gt {
|
|
1400
1400
|
constructor(t) {
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
this.xt = t, this.Ci = new Z(), this.
|
|
1401
|
+
a(this, "yi");
|
|
1402
|
+
a(this, "Ai");
|
|
1403
|
+
a(this, "xt");
|
|
1404
|
+
a(this, "Ci");
|
|
1405
|
+
this.xt = t, this.Ci = new Z(), this.yi = document.createElement("canvas"), this.Ai = this.yi.getContext("2d", { willReadFrequently: !0, alpha: !1 });
|
|
1406
1406
|
}
|
|
1407
1407
|
createTextureAtlas(t, e, i, s) {
|
|
1408
1408
|
const r = t.length, n = Math.ceil(Math.sqrt(r)), o = Math.ceil(r / n), c = e.width * n, l = e.height * o, u = typeof s == "object" ? s : null;
|
|
1409
1409
|
this.bi(c, l), this.xi(t, e, n, i, u);
|
|
1410
1410
|
const f = this.xt.Ys(c, l, 1, { filter: "nearest" });
|
|
1411
|
-
return f.zt(this.
|
|
1411
|
+
return f.zt(this.yi), { framebuffer: f, columns: n, rows: o };
|
|
1412
1412
|
}
|
|
1413
1413
|
bi(t, e) {
|
|
1414
|
-
this.
|
|
1414
|
+
this.yi.width = t, this.yi.height = e, this.yi.style.width = t + "px", this.yi.style.height = t + "px", this.Ai.imageSmoothingEnabled = !1, this.yi.style.imageRendering = "pixelated", this.Ai.fillStyle = "black", this.Ai.fillRect(0, 0, t, e), this.Ai.textBaseline = "top", this.Ai.textAlign = "left", this.Ai.fillStyle = "white";
|
|
1415
1415
|
}
|
|
1416
1416
|
xi(t, e, i, s, r) {
|
|
1417
1417
|
const n = s / r.head.unitsPerEm;
|
|
@@ -1440,41 +1440,41 @@ class Gt {
|
|
|
1440
1440
|
if (!t || !t.xs || t.noc === 0) return;
|
|
1441
1441
|
const { xs: r, ys: n, endPts: o, flags: c } = t;
|
|
1442
1442
|
if (!(r && n && o && c)) return;
|
|
1443
|
-
this.
|
|
1443
|
+
this.Ai.beginPath();
|
|
1444
1444
|
let l = 0;
|
|
1445
1445
|
for (let u = 0; u < o.length; u++) {
|
|
1446
1446
|
const f = o[u];
|
|
1447
1447
|
if (!(f < l)) {
|
|
1448
1448
|
if (f >= l) {
|
|
1449
1449
|
const g = e + r[l] * s, v = i - n[l] * s;
|
|
1450
|
-
this.
|
|
1450
|
+
this.Ai.moveTo(g, v);
|
|
1451
1451
|
let m = l + 1;
|
|
1452
1452
|
for (; m <= f; )
|
|
1453
1453
|
if (1 & c[m]) {
|
|
1454
1454
|
const d = e + r[m] * s, A = i - n[m] * s;
|
|
1455
|
-
this.
|
|
1455
|
+
this.Ai.lineTo(d, A), m++;
|
|
1456
1456
|
} else {
|
|
1457
1457
|
const d = e + r[m] * s, A = i - n[m] * s;
|
|
1458
1458
|
let p = m + 1 > f ? l : m + 1;
|
|
1459
1459
|
if (1 & c[p]) {
|
|
1460
1460
|
const E = e + r[p] * s, x = i - n[p] * s;
|
|
1461
|
-
this.
|
|
1461
|
+
this.Ai.quadraticCurveTo(d, A, E, x), m = p + 1;
|
|
1462
1462
|
} else {
|
|
1463
1463
|
const E = (d + (e + r[p] * s)) / 2, x = (A + (i - n[p] * s)) / 2;
|
|
1464
|
-
this.
|
|
1464
|
+
this.Ai.quadraticCurveTo(d, A, E, x), m = p;
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
|
-
this.
|
|
1467
|
+
this.Ai.closePath();
|
|
1468
1468
|
}
|
|
1469
1469
|
l = f + 1;
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
|
-
this.
|
|
1472
|
+
this.Ai.fill();
|
|
1473
1473
|
}
|
|
1474
1474
|
}
|
|
1475
1475
|
class zt {
|
|
1476
1476
|
constructor() {
|
|
1477
|
-
|
|
1477
|
+
a(this, "Ri");
|
|
1478
1478
|
this.Ri = new Z();
|
|
1479
1479
|
}
|
|
1480
1480
|
zi(t, e, i) {
|
|
@@ -1488,13 +1488,13 @@ class zt {
|
|
|
1488
1488
|
}
|
|
1489
1489
|
return { width: Math.ceil(s), height: Math.ceil(n) };
|
|
1490
1490
|
}
|
|
1491
|
-
|
|
1492
|
-
this.Ri.
|
|
1491
|
+
wi() {
|
|
1492
|
+
this.Ri.wi();
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
1495
|
class Wt {
|
|
1496
1496
|
constructor() {
|
|
1497
|
-
|
|
1497
|
+
a(this, "Ci");
|
|
1498
1498
|
this.Ci = new Z();
|
|
1499
1499
|
}
|
|
1500
1500
|
createCharacterObjects(t, e) {
|
|
@@ -1522,19 +1522,19 @@ class Wt {
|
|
|
1522
1522
|
}
|
|
1523
1523
|
class Xt {
|
|
1524
1524
|
constructor(t, e = 16) {
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
this.
|
|
1525
|
+
a(this, "Ei");
|
|
1526
|
+
a(this, "Bi", []);
|
|
1527
|
+
a(this, "Gi");
|
|
1528
|
+
a(this, "Di", 16);
|
|
1529
|
+
a(this, "Li", 0);
|
|
1530
|
+
a(this, "Oi", 0);
|
|
1531
|
+
a(this, "ki", { width: 0, height: 0 });
|
|
1532
|
+
a(this, "Hi");
|
|
1533
|
+
a(this, "Ii");
|
|
1534
|
+
a(this, "Ni");
|
|
1535
|
+
a(this, "Xi");
|
|
1536
|
+
a(this, "Wi");
|
|
1537
|
+
this.Di = e, this.Ii = new Nt(), this.Ni = new Gt(t), this.Xi = new zt(), this.Wi = new Wt();
|
|
1538
1538
|
}
|
|
1539
1539
|
async Vi(t) {
|
|
1540
1540
|
let e;
|
|
@@ -1547,10 +1547,10 @@ class Xt {
|
|
|
1547
1547
|
await this.Ki(e), this.Ei = L.parse(e)[0], await this.ji();
|
|
1548
1548
|
}
|
|
1549
1549
|
Yi(t) {
|
|
1550
|
-
if (t === void 0) return this.
|
|
1551
|
-
this.
|
|
1552
|
-
const e = this.Ni.createTextureAtlas(this.Bi, this.ki, this.
|
|
1553
|
-
this.
|
|
1550
|
+
if (t === void 0) return this.Di;
|
|
1551
|
+
this.Di = t, this.ki = this.Xi.zi(this.Bi.map((i) => i.character), this.Di, this.Ei);
|
|
1552
|
+
const e = this.Ni.createTextureAtlas(this.Bi, this.ki, this.Di, this.Ei);
|
|
1553
|
+
this.Gi = e.framebuffer, this.Li = e.columns, this.Oi = e.rows;
|
|
1554
1554
|
}
|
|
1555
1555
|
async qi(t) {
|
|
1556
1556
|
try {
|
|
@@ -1571,9 +1571,9 @@ class Xt {
|
|
|
1571
1571
|
}
|
|
1572
1572
|
async ji() {
|
|
1573
1573
|
const t = this.Ii.ii(this.Ei), e = this.Ii.oi(t);
|
|
1574
|
-
this.Bi = this.Wi.createCharacterObjects(e, this.Ei), this.ki = this.Xi.zi(e, this.
|
|
1575
|
-
const i = this.Ni.createTextureAtlas(this.Bi, this.ki, this.
|
|
1576
|
-
this.
|
|
1574
|
+
this.Bi = this.Wi.createCharacterObjects(e, this.Ei), this.ki = this.Xi.zi(e, this.Di, this.Ei);
|
|
1575
|
+
const i = this.Ni.createTextureAtlas(this.Bi, this.ki, this.Di, this.Ei);
|
|
1576
|
+
this.Gi = i.framebuffer, this.Li = i.columns, this.Oi = i.rows;
|
|
1577
1577
|
}
|
|
1578
1578
|
Ti(t) {
|
|
1579
1579
|
return this.Wi.Ti(t, this.Bi);
|
|
@@ -1581,11 +1581,11 @@ class Xt {
|
|
|
1581
1581
|
Si(t) {
|
|
1582
1582
|
return this.Wi.Si(t, this.Bi);
|
|
1583
1583
|
}
|
|
1584
|
-
|
|
1585
|
-
this.
|
|
1584
|
+
Gt() {
|
|
1585
|
+
this.Gi.Gt(), document.fonts.delete(this.Hi);
|
|
1586
1586
|
}
|
|
1587
1587
|
get fontFramebuffer() {
|
|
1588
|
-
return this.
|
|
1588
|
+
return this.Gi;
|
|
1589
1589
|
}
|
|
1590
1590
|
get characters() {
|
|
1591
1591
|
return this.Bi;
|
|
@@ -1600,7 +1600,7 @@ class Xt {
|
|
|
1600
1600
|
return this.ki;
|
|
1601
1601
|
}
|
|
1602
1602
|
get fontSize() {
|
|
1603
|
-
return this.
|
|
1603
|
+
return this.Di;
|
|
1604
1604
|
}
|
|
1605
1605
|
get font() {
|
|
1606
1606
|
return this.Ei;
|
|
@@ -1608,15 +1608,15 @@ class Xt {
|
|
|
1608
1608
|
}
|
|
1609
1609
|
class Ht {
|
|
1610
1610
|
constructor(t, e, i) {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1611
|
+
a(this, "Zi");
|
|
1612
|
+
a(this, "Qi");
|
|
1613
|
+
a(this, "dt");
|
|
1614
|
+
a(this, "gt");
|
|
1615
|
+
a(this, "Ji");
|
|
1616
|
+
a(this, "tr");
|
|
1617
|
+
a(this, "er");
|
|
1618
|
+
a(this, "sr");
|
|
1619
|
+
a(this, "ir");
|
|
1620
1620
|
this.er = t, this.sr = e, this.ir = i, this.rr();
|
|
1621
1621
|
}
|
|
1622
1622
|
rr() {
|
|
@@ -1652,11 +1652,11 @@ class Ht {
|
|
|
1652
1652
|
}
|
|
1653
1653
|
class kt {
|
|
1654
1654
|
constructor(t = {}) {
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1655
|
+
a(this, "er");
|
|
1656
|
+
a(this, "ar", null);
|
|
1657
|
+
a(this, "hr", !1);
|
|
1658
|
+
a(this, "cr");
|
|
1659
|
+
a(this, "lr");
|
|
1660
1660
|
this.hr = t.overlay ?? !1, this.hr && t.canvas ? (this.ar = t.canvas, this.er = this.ur(), this.lr = !0, this.dr()) : t.canvas ? (this.er = t.canvas, this.lr = !1) : (this.er = this.pr(t.width, t.height), this.lr = !0), this.er.style.imageRendering = "pixelated";
|
|
1661
1661
|
}
|
|
1662
1662
|
pr(t, e) {
|
|
@@ -1710,7 +1710,7 @@ class kt {
|
|
|
1710
1710
|
if (!t) throw new U("`textmode.js` requires WebGL2 support.");
|
|
1711
1711
|
return t;
|
|
1712
1712
|
}
|
|
1713
|
-
|
|
1713
|
+
Gt() {
|
|
1714
1714
|
this.cr && this.cr.disconnect();
|
|
1715
1715
|
const t = this.er.getContext("webgl") || this.er.getContext("webgl2");
|
|
1716
1716
|
if (t) {
|
|
@@ -1734,31 +1734,31 @@ class kt {
|
|
|
1734
1734
|
}
|
|
1735
1735
|
class z {
|
|
1736
1736
|
constructor(t, e, i, s) {
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1737
|
+
a(this, "vr");
|
|
1738
|
+
a(this, "dt");
|
|
1739
|
+
a(this, "gt");
|
|
1740
|
+
a(this, "vt");
|
|
1741
|
+
a(this, "D", 0);
|
|
1742
|
+
a(this, "V", 0);
|
|
1743
|
+
a(this, "K", 0);
|
|
1744
|
+
a(this, "L", [0, 0]);
|
|
1745
|
+
a(this, "wr", "sampled");
|
|
1746
|
+
a(this, "yr", "fixed");
|
|
1747
|
+
a(this, "Y", [1, 1, 1]);
|
|
1748
|
+
a(this, "q", [0, 0, 0]);
|
|
1749
|
+
a(this, "Ar", [0, 0, 0, 1]);
|
|
1750
|
+
a(this, "Cr", [[0.1, 0, 0]]);
|
|
1751
|
+
a(this, "br");
|
|
1752
1752
|
this.vt = t, this.vr = e, this.dt = i, this.gt = s;
|
|
1753
1753
|
}
|
|
1754
|
-
|
|
1754
|
+
Gt() {
|
|
1755
1755
|
this.vt.deleteTexture(this.vr);
|
|
1756
1756
|
}
|
|
1757
1757
|
$r(t) {
|
|
1758
1758
|
return typeof t == "boolean" ? t ? 1 : 0 : (t == null ? 0 : Number(t)) > 0 ? 1 : 0;
|
|
1759
1759
|
}
|
|
1760
1760
|
invert(t = !0) {
|
|
1761
|
-
return this.
|
|
1761
|
+
return this.D = this.$r(t), this;
|
|
1762
1762
|
}
|
|
1763
1763
|
flipX(t = !0) {
|
|
1764
1764
|
return this.V = this.$r(t), this;
|
|
@@ -1771,13 +1771,13 @@ class z {
|
|
|
1771
1771
|
return this.L = [i, s], this;
|
|
1772
1772
|
}
|
|
1773
1773
|
Is() {
|
|
1774
|
-
return { texture: this.vr, invert: this.
|
|
1774
|
+
return { texture: this.vr, invert: this.D, flipX: this.V, flipY: this.K, charRotation: this.L, charColorFixed: this.wr === "fixed", charColor: this.Y, cellColorFixed: this.yr === "fixed", cellColor: this.q, backgroundColor: this.Ar, charCount: this.Cr.length, charList: this.Cr };
|
|
1775
1775
|
}
|
|
1776
1776
|
charColorMode(t) {
|
|
1777
|
-
return this.
|
|
1777
|
+
return this.wr = t, this;
|
|
1778
1778
|
}
|
|
1779
1779
|
cellColorMode(t) {
|
|
1780
|
-
return this.
|
|
1780
|
+
return this.yr = t, this;
|
|
1781
1781
|
}
|
|
1782
1782
|
charColor(t, e, i) {
|
|
1783
1783
|
return this.Y = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255], this;
|
|
@@ -1786,7 +1786,7 @@ class z {
|
|
|
1786
1786
|
return this.q = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255], this;
|
|
1787
1787
|
}
|
|
1788
1788
|
background(t, e, i, s) {
|
|
1789
|
-
return this.
|
|
1789
|
+
return this.Ar = [(t ?? 0) / 255, (e ?? t ?? 0) / 255, (i ?? t ?? 0) / 255, (s ?? 255) / 255], this;
|
|
1790
1790
|
}
|
|
1791
1791
|
characters(t) {
|
|
1792
1792
|
const e = this.br(t).filter((i) => Array.isArray(i)).slice(0, 64);
|
|
@@ -1810,16 +1810,16 @@ class z {
|
|
|
1810
1810
|
}
|
|
1811
1811
|
class Yt {
|
|
1812
1812
|
constructor(t = 60) {
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1813
|
+
a(this, "Fr");
|
|
1814
|
+
a(this, "Rr");
|
|
1815
|
+
a(this, "zr", null);
|
|
1816
|
+
a(this, "Pr", 0);
|
|
1817
|
+
a(this, "Tr", !0);
|
|
1818
|
+
a(this, "Sr", 0);
|
|
1819
|
+
a(this, "Er", 0);
|
|
1820
|
+
a(this, "Br", []);
|
|
1821
|
+
a(this, "Gr", 10);
|
|
1822
|
+
a(this, "Dr", 0);
|
|
1823
1823
|
this.Fr = t, this.Rr = 1e3 / t;
|
|
1824
1824
|
}
|
|
1825
1825
|
start(t) {
|
|
@@ -1849,7 +1849,7 @@ class Yt {
|
|
|
1849
1849
|
const t = performance.now();
|
|
1850
1850
|
if (this.Er > 0) {
|
|
1851
1851
|
const e = t - this.Er;
|
|
1852
|
-
this.Br.push(e), this.Br.length > this.
|
|
1852
|
+
this.Br.push(e), this.Br.length > this.Gr && this.Br.shift();
|
|
1853
1853
|
const i = this.Br.reduce((s, r) => s + r, 0) / this.Br.length;
|
|
1854
1854
|
this.Sr = 1e3 / i;
|
|
1855
1855
|
}
|
|
@@ -1865,29 +1865,29 @@ class Yt {
|
|
|
1865
1865
|
return this.Sr;
|
|
1866
1866
|
}
|
|
1867
1867
|
get frameCount() {
|
|
1868
|
-
return this.
|
|
1868
|
+
return this.Dr;
|
|
1869
1869
|
}
|
|
1870
1870
|
set frameCount(t) {
|
|
1871
|
-
this.
|
|
1871
|
+
this.Dr = t;
|
|
1872
1872
|
}
|
|
1873
1873
|
incrementFrame() {
|
|
1874
|
-
this.
|
|
1874
|
+
this.Dr++;
|
|
1875
1875
|
}
|
|
1876
1876
|
resetFrameCount() {
|
|
1877
|
-
this.
|
|
1877
|
+
this.Dr = 0;
|
|
1878
1878
|
}
|
|
1879
1879
|
}
|
|
1880
1880
|
class Vt {
|
|
1881
1881
|
constructor() {
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1882
|
+
a(this, "Lr", /* @__PURE__ */ new Map());
|
|
1883
|
+
a(this, "Or", null);
|
|
1884
|
+
a(this, "kr", null);
|
|
1885
|
+
a(this, "Hr");
|
|
1886
|
+
a(this, "Ir");
|
|
1887
|
+
a(this, "Nr", !1);
|
|
1888
|
+
a(this, "Xr");
|
|
1889
|
+
a(this, "Wr");
|
|
1890
|
+
a(this, "Vr", { ArrowUp: "UP_ARROW", ArrowDown: "DOWN_ARROW", ArrowLeft: "LEFT_ARROW", ArrowRight: "RIGHT_ARROW", F1: "F1", F2: "F2", F3: "F3", F4: "F4", F5: "F5", F6: "F6", F7: "F7", F8: "F8", F9: "F9", F10: "F10", F11: "F11", F12: "F12", Enter: "ENTER", Return: "RETURN", Tab: "TAB", Escape: "ESCAPE", Backspace: "BACKSPACE", Delete: "DELETE", Insert: "INSERT", Home: "HOME", End: "END", PageUp: "PAGE_UP", PageDown: "PAGE_DOWN", Shift: "SHIFT", Control: "CONTROL", Alt: "ALT", Meta: "META", " ": "SPACE" });
|
|
1891
1891
|
}
|
|
1892
1892
|
Kr() {
|
|
1893
1893
|
this.Nr || (this.Hr = (t) => {
|
|
@@ -1950,23 +1950,23 @@ class Vt {
|
|
|
1950
1950
|
}
|
|
1951
1951
|
class jt {
|
|
1952
1952
|
constructor(t) {
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1953
|
+
a(this, "er");
|
|
1954
|
+
a(this, "hn");
|
|
1955
|
+
a(this, "cn", { x: -1, y: -1 });
|
|
1956
|
+
a(this, "ln", { x: -1, y: -1 });
|
|
1957
|
+
a(this, "un", null);
|
|
1958
|
+
a(this, "fn");
|
|
1959
|
+
a(this, "dn");
|
|
1960
|
+
a(this, "pn");
|
|
1961
|
+
a(this, "mn");
|
|
1962
|
+
a(this, "gn");
|
|
1963
|
+
a(this, "_n");
|
|
1964
|
+
a(this, "Nr", !1);
|
|
1965
|
+
a(this, "vn");
|
|
1966
|
+
a(this, "wn");
|
|
1967
|
+
a(this, "yn");
|
|
1968
|
+
a(this, "An");
|
|
1969
|
+
a(this, "Cn");
|
|
1970
1970
|
this.er = t;
|
|
1971
1971
|
}
|
|
1972
1972
|
Vi(t) {
|
|
@@ -2008,13 +2008,13 @@ class jt {
|
|
|
2008
2008
|
this.vn = t;
|
|
2009
2009
|
}
|
|
2010
2010
|
Zr(t) {
|
|
2011
|
-
this.
|
|
2011
|
+
this.wn = t;
|
|
2012
2012
|
}
|
|
2013
2013
|
Qr(t) {
|
|
2014
|
-
this.
|
|
2014
|
+
this.yn = t;
|
|
2015
2015
|
}
|
|
2016
2016
|
Tn(t) {
|
|
2017
|
-
this.
|
|
2017
|
+
this.An = t;
|
|
2018
2018
|
}
|
|
2019
2019
|
Sn(t) {
|
|
2020
2020
|
this.Cn = t;
|
|
@@ -2023,21 +2023,21 @@ class jt {
|
|
|
2023
2023
|
return { x: this.cn.x, y: this.cn.y };
|
|
2024
2024
|
}
|
|
2025
2025
|
$n(t) {
|
|
2026
|
-
if (this.
|
|
2026
|
+
if (this.An) {
|
|
2027
2027
|
const e = { position: { ...this.cn }, previousPosition: { ...this.ln }, originalEvent: t };
|
|
2028
|
-
this.
|
|
2028
|
+
this.An(e);
|
|
2029
2029
|
}
|
|
2030
2030
|
}
|
|
2031
2031
|
Mn(t) {
|
|
2032
|
-
if (this.
|
|
2032
|
+
if (this.wn) {
|
|
2033
2033
|
const e = { position: { ...this.cn }, previousPosition: { ...this.ln }, button: t.button, originalEvent: t };
|
|
2034
|
-
this.
|
|
2034
|
+
this.wn(e);
|
|
2035
2035
|
}
|
|
2036
2036
|
}
|
|
2037
2037
|
Fn(t) {
|
|
2038
|
-
if (this.
|
|
2038
|
+
if (this.yn) {
|
|
2039
2039
|
const e = { position: { ...this.cn }, previousPosition: { ...this.ln }, button: t.button, originalEvent: t };
|
|
2040
|
-
this.
|
|
2040
|
+
this.yn(e);
|
|
2041
2041
|
}
|
|
2042
2042
|
}
|
|
2043
2043
|
Rn(t) {
|
|
@@ -2059,7 +2059,7 @@ class jt {
|
|
|
2059
2059
|
u >= 0 && u < this.hn.cols && f >= 0 && f < this.hn.rows ? (this.cn.x = u, this.cn.y = f) : (this.cn.x = -1, this.cn.y = -1);
|
|
2060
2060
|
}
|
|
2061
2061
|
}
|
|
2062
|
-
const Kt = (
|
|
2062
|
+
const Kt = (h) => class extends h {
|
|
2063
2063
|
rotate(t = 0, e = 0, i = 0) {
|
|
2064
2064
|
this.xt.state.et(t), this.xt.state.st(e), this.xt.state.it(i);
|
|
2065
2065
|
}
|
|
@@ -2167,10 +2167,10 @@ class $ {
|
|
|
2167
2167
|
const e = t.Pt(0), i = t.Pt(1), s = t.Pt(2), r = t.Pt(3);
|
|
2168
2168
|
return { characterPixels: e, primaryColorPixels: i, secondaryColorPixels: s, transformPixels: t.Pt(4), rotationPixels: r };
|
|
2169
2169
|
}
|
|
2170
|
-
|
|
2170
|
+
Gn(t, e) {
|
|
2171
2171
|
return t[e] + (t[e + 1] << 8);
|
|
2172
2172
|
}
|
|
2173
|
-
|
|
2173
|
+
Dn(t, e) {
|
|
2174
2174
|
return { r: t[e], g: t[e + 1], b: t[e + 2], a: t[e + 3] };
|
|
2175
2175
|
}
|
|
2176
2176
|
}
|
|
@@ -2212,8 +2212,8 @@ class qt extends $ {
|
|
|
2212
2212
|
const i = [];
|
|
2213
2213
|
let s = 0;
|
|
2214
2214
|
for (let r = 0; r < e.rows; r++) for (let n = 0; n < e.cols; n++) {
|
|
2215
|
-
const o = 4 * s, c = this.
|
|
2216
|
-
let l = this.
|
|
2215
|
+
const o = 4 * s, c = this.Gn(t.characterPixels, o);
|
|
2216
|
+
let l = this.Dn(t.primaryColorPixels, o), u = this.Dn(t.secondaryColorPixels, o);
|
|
2217
2217
|
const f = this.Xn(t.transformPixels, t.rotationPixels, o);
|
|
2218
2218
|
if (f.isInverted) {
|
|
2219
2219
|
const v = l;
|
|
@@ -2299,7 +2299,7 @@ class Zt {
|
|
|
2299
2299
|
}
|
|
2300
2300
|
class $t {
|
|
2301
2301
|
constructor() {
|
|
2302
|
-
|
|
2302
|
+
a(this, "Qn");
|
|
2303
2303
|
this.Qn = new Zt();
|
|
2304
2304
|
}
|
|
2305
2305
|
Jn(t) {
|
|
@@ -2369,9 +2369,9 @@ class Jt extends J {
|
|
|
2369
2369
|
}
|
|
2370
2370
|
class st {
|
|
2371
2371
|
constructor() {
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2372
|
+
a(this, "uo");
|
|
2373
|
+
a(this, "fo");
|
|
2374
|
+
a(this, "do");
|
|
2375
2375
|
this.uo = new qt(), this.fo = new $t(), this.do = new Jt();
|
|
2376
2376
|
}
|
|
2377
2377
|
po(t) {
|
|
@@ -2393,7 +2393,7 @@ class Qt extends $ {
|
|
|
2393
2393
|
for (let c = 0; c < e.rows; c++) {
|
|
2394
2394
|
const l = [];
|
|
2395
2395
|
for (let u = 0; u < e.cols; u++) {
|
|
2396
|
-
const f = 4 * n, g = this.
|
|
2396
|
+
const f = 4 * n, g = this.Gn(t.characterPixels, f), v = ((o = i.characters[g]) == null ? void 0 : o.character) || s;
|
|
2397
2397
|
l.push(v), n++;
|
|
2398
2398
|
}
|
|
2399
2399
|
r.push(l);
|
|
@@ -2415,31 +2415,31 @@ class te {
|
|
|
2415
2415
|
}
|
|
2416
2416
|
}
|
|
2417
2417
|
class ee extends J {
|
|
2418
|
-
|
|
2419
|
-
const i = this.
|
|
2418
|
+
wo(t, e) {
|
|
2419
|
+
const i = this.yo(e);
|
|
2420
2420
|
this.On(t, i, "text/plain;charset=utf-8");
|
|
2421
2421
|
}
|
|
2422
|
-
|
|
2422
|
+
yo(t) {
|
|
2423
2423
|
let e = this.In(t);
|
|
2424
2424
|
return e === ".txt" || e.length <= 4 ? this.Nn() : e;
|
|
2425
2425
|
}
|
|
2426
2426
|
}
|
|
2427
2427
|
class rt {
|
|
2428
2428
|
constructor() {
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2429
|
+
a(this, "uo");
|
|
2430
|
+
a(this, "fo");
|
|
2431
|
+
a(this, "do");
|
|
2432
2432
|
this.uo = new Qt(), this.fo = new te(), this.do = new ee();
|
|
2433
2433
|
}
|
|
2434
2434
|
po(t) {
|
|
2435
2435
|
return { preserveTrailingSpaces: t.preserveTrailingSpaces ?? !1, lineEnding: t.lineEnding ?? "lf", emptyCharacter: t.emptyCharacter ?? " ", filename: t.filename || this.do.Nn() };
|
|
2436
2436
|
}
|
|
2437
|
-
|
|
2437
|
+
Ao(t, e = {}) {
|
|
2438
2438
|
const i = this.po(e), s = this.uo._o(this.uo.Bn(t.pipeline), t.grid, t.font, i.emptyCharacter);
|
|
2439
2439
|
return this.fo.vo(s, i);
|
|
2440
2440
|
}
|
|
2441
|
-
|
|
2442
|
-
this.do.
|
|
2441
|
+
wo(t, e = {}) {
|
|
2442
|
+
this.do.wo(this.Ao(t, e), e.filename);
|
|
2443
2443
|
}
|
|
2444
2444
|
}
|
|
2445
2445
|
class ie extends $ {
|
|
@@ -2496,9 +2496,9 @@ class ne extends J {
|
|
|
2496
2496
|
}
|
|
2497
2497
|
class oe {
|
|
2498
2498
|
constructor() {
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2499
|
+
a(this, "uo");
|
|
2500
|
+
a(this, "fo");
|
|
2501
|
+
a(this, "do");
|
|
2502
2502
|
this.uo = new ie(), this.fo = new se(), this.do = new ne();
|
|
2503
2503
|
}
|
|
2504
2504
|
po(t) {
|
|
@@ -2522,15 +2522,15 @@ class oe {
|
|
|
2522
2522
|
this.do.Mo(s, i.filename, i.format);
|
|
2523
2523
|
}
|
|
2524
2524
|
}
|
|
2525
|
-
const
|
|
2525
|
+
const he = (h) => class extends h {
|
|
2526
2526
|
Po() {
|
|
2527
2527
|
this.xt.St(this.To);
|
|
2528
2528
|
}
|
|
2529
2529
|
toString(t = {}) {
|
|
2530
|
-
return this.Po(), new rt().
|
|
2530
|
+
return this.Po(), new rt().Ao({ pipeline: this.So, grid: this.hn, font: this.Ei }, t);
|
|
2531
2531
|
}
|
|
2532
2532
|
saveStrings(t = {}) {
|
|
2533
|
-
this.Po(), new rt().
|
|
2533
|
+
this.Po(), new rt().wo({ pipeline: this.So, grid: this.hn, font: this.Ei }, t);
|
|
2534
2534
|
}
|
|
2535
2535
|
toSVG(t = {}) {
|
|
2536
2536
|
return this.Po(), new st().mo({ pipeline: this.So, grid: this.hn, font: this.Ei }, t);
|
|
@@ -2541,7 +2541,7 @@ const ae = (a) => class extends a {
|
|
|
2541
2541
|
async saveCanvas(t = {}) {
|
|
2542
2542
|
await new oe().Mo(this.er, t);
|
|
2543
2543
|
}
|
|
2544
|
-
},
|
|
2544
|
+
}, ae = (h) => class extends h {
|
|
2545
2545
|
async loadFont(t) {
|
|
2546
2546
|
return this.Ei.qi(t).then(() => {
|
|
2547
2547
|
const e = this.Ei.maxGlyphDimensions;
|
|
@@ -2560,7 +2560,7 @@ const ae = (a) => class extends a {
|
|
|
2560
2560
|
glyphColors(t) {
|
|
2561
2561
|
return this.Ei.Si(t);
|
|
2562
2562
|
}
|
|
2563
|
-
}, ce = (
|
|
2563
|
+
}, ce = (h) => class extends h {
|
|
2564
2564
|
get frameCount() {
|
|
2565
2565
|
return this.Bo.frameCount;
|
|
2566
2566
|
}
|
|
@@ -2568,21 +2568,21 @@ const ae = (a) => class extends a {
|
|
|
2568
2568
|
this.Bo.frameCount = t;
|
|
2569
2569
|
}
|
|
2570
2570
|
frameRate(t) {
|
|
2571
|
-
return t === void 0 ? this.Bo.currentFrameRate : this.Bo.frameRate(t, () => this.
|
|
2571
|
+
return t === void 0 ? this.Bo.currentFrameRate : this.Bo.frameRate(t, () => this.Go());
|
|
2572
2572
|
}
|
|
2573
2573
|
noLoop() {
|
|
2574
2574
|
this.Bo.pause();
|
|
2575
2575
|
}
|
|
2576
2576
|
loop() {
|
|
2577
|
-
this.Bo.resume(() => this.
|
|
2577
|
+
this.Bo.resume(() => this.Go());
|
|
2578
2578
|
}
|
|
2579
2579
|
redraw(t = 1) {
|
|
2580
|
-
if (G.v(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.
|
|
2580
|
+
if (G.v(typeof t == "number" && t > 0 && Number.isInteger(t), "Redraw count must be a positive integer.", { method: "redraw", providedValue: t })) for (let e = 0; e < t; e++) this.Go();
|
|
2581
2581
|
}
|
|
2582
2582
|
isLooping() {
|
|
2583
2583
|
return this.Bo.isLooping;
|
|
2584
2584
|
}
|
|
2585
|
-
}, le = (
|
|
2585
|
+
}, le = (h) => class extends h {
|
|
2586
2586
|
constructor(...t) {
|
|
2587
2587
|
super(...t);
|
|
2588
2588
|
}
|
|
@@ -2604,91 +2604,91 @@ const ae = (a) => class extends a {
|
|
|
2604
2604
|
get mouse() {
|
|
2605
2605
|
return this.Eo.En();
|
|
2606
2606
|
}
|
|
2607
|
-
}, ue = (
|
|
2607
|
+
}, ue = (h) => class extends h {
|
|
2608
2608
|
constructor(...t) {
|
|
2609
2609
|
super(...t);
|
|
2610
2610
|
}
|
|
2611
2611
|
keyPressed(t) {
|
|
2612
|
-
this.
|
|
2612
|
+
this.Do.Zr(t);
|
|
2613
2613
|
}
|
|
2614
2614
|
keyReleased(t) {
|
|
2615
|
-
this.
|
|
2615
|
+
this.Do.Qr(t);
|
|
2616
2616
|
}
|
|
2617
2617
|
isKeyPressed(t) {
|
|
2618
|
-
return this.
|
|
2618
|
+
return this.Do.Jr(t);
|
|
2619
2619
|
}
|
|
2620
2620
|
get lastKeyPressed() {
|
|
2621
|
-
return this.
|
|
2621
|
+
return this.Do.en();
|
|
2622
2622
|
}
|
|
2623
2623
|
get lastKeyReleased() {
|
|
2624
|
-
return this.
|
|
2624
|
+
return this.Do.sn();
|
|
2625
2625
|
}
|
|
2626
2626
|
get pressedKeys() {
|
|
2627
|
-
return this.
|
|
2627
|
+
return this.Do.rn();
|
|
2628
2628
|
}
|
|
2629
2629
|
get modifierState() {
|
|
2630
|
-
return this.
|
|
2630
|
+
return this.Do.nn();
|
|
2631
2631
|
}
|
|
2632
2632
|
};
|
|
2633
2633
|
class fe {
|
|
2634
2634
|
constructor() {
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
}
|
|
2648
|
-
|
|
2635
|
+
a(this, "xt");
|
|
2636
|
+
a(this, "Ei");
|
|
2637
|
+
a(this, "er");
|
|
2638
|
+
a(this, "hn");
|
|
2639
|
+
a(this, "Bo");
|
|
2640
|
+
a(this, "Eo");
|
|
2641
|
+
a(this, "Do");
|
|
2642
|
+
a(this, "To");
|
|
2643
|
+
a(this, "So");
|
|
2644
|
+
a(this, "Lo");
|
|
2645
|
+
a(this, "Oo");
|
|
2646
|
+
a(this, "ko");
|
|
2647
|
+
}
|
|
2648
|
+
Go() {
|
|
2649
2649
|
}
|
|
2650
2650
|
}
|
|
2651
2651
|
class de extends function(e, ...i) {
|
|
2652
2652
|
return i.reduce((s, r) => r(s), e);
|
|
2653
|
-
}(fe, Kt,
|
|
2653
|
+
}(fe, Kt, he, ae, ce, le, ue) {
|
|
2654
2654
|
constructor(e = {}) {
|
|
2655
2655
|
super();
|
|
2656
|
-
|
|
2657
|
-
|
|
2656
|
+
a(this, "Ho", !1);
|
|
2657
|
+
a(this, "Io", () => {
|
|
2658
2658
|
});
|
|
2659
|
-
|
|
2659
|
+
a(this, "No", () => {
|
|
2660
2660
|
});
|
|
2661
|
-
|
|
2661
|
+
a(this, "Xo", () => {
|
|
2662
2662
|
});
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
this.hr = e.overlay ?? !1, this.er = new kt(e), this.xt = new Bt(this.er._r()), this.Ei = new Xt(this.xt, e.fontSize ?? 16), this.Bo = new Yt(e.frameRate ?? 60), this.Eo = new jt(this.er), this.
|
|
2663
|
+
a(this, "Wo");
|
|
2664
|
+
a(this, "cr");
|
|
2665
|
+
a(this, "hr", !1);
|
|
2666
|
+
a(this, "Vo");
|
|
2667
|
+
this.hr = e.overlay ?? !1, this.er = new kt(e), this.xt = new Bt(this.er._r()), this.Ei = new Xt(this.xt, e.fontSize ?? 16), this.Bo = new Yt(e.frameRate ?? 60), this.Eo = new jt(this.er), this.Do = new Vt(), this.To = this.xt.Tt(), this.Lo = this.xt.re(), this.Ko(e);
|
|
2668
2668
|
}
|
|
2669
2669
|
async Ko(e) {
|
|
2670
2670
|
await this.Ei.Vi(e.fontSource);
|
|
2671
2671
|
const i = this.Ei.maxGlyphDimensions;
|
|
2672
|
-
this.hn = new Ht(this.er.canvas, i.width, i.height), this.Eo.Vi(this.hn), this.So = this.xt.Ys(this.hn.cols, this.hn.rows, 5), this.Oo = this.xt.Ys(this.hn.width, this.hn.height, 1), this.hr && (this.Vo = z.Mr(this.xt, this.er.targetCanvas, (s) => this.Ei.Si(s))), this.ko = this.xt.ae(
|
|
2672
|
+
this.hn = new Ht(this.er.canvas, i.width, i.height), this.Eo.Vi(this.hn), this.So = this.xt.Ys(this.hn.cols, this.hn.rows, 5), this.Oo = this.xt.Ys(this.hn.width, this.hn.height, 1), this.hr && (this.Vo = z.Mr(this.xt, this.er.targetCanvas, (s) => this.Ei.Si(s))), this.ko = this.xt.ae(at, "precision mediump float;uniform sampler2D Ua;uniform vec2 Ub;uniform vec2 Uc;uniform vec2 Ud;void main(){vec2 A=gl_FragCoord.xy-Uc;vec2 B=A*(Ub/Ud);vec2 C=(floor(B)+0.5)/Ub;gl_FragColor=texture2D(Ua,C);}"), this.jo(), this.Io(), this.Bo.start(() => this.Go());
|
|
2673
2673
|
}
|
|
2674
2674
|
jo() {
|
|
2675
2675
|
this.Wo = () => {
|
|
2676
2676
|
this.hr && this.resizeCanvas(this.er.targetCanvas.width, this.er.targetCanvas.height), this.Xo();
|
|
2677
|
-
}, window.addEventListener("resize", this.Wo), this.Eo.Kr(), this.
|
|
2678
|
-
this.
|
|
2677
|
+
}, window.addEventListener("resize", this.Wo), this.Eo.Kr(), this.Do.Kr(), window.addEventListener("blur", () => {
|
|
2678
|
+
this.Do.an();
|
|
2679
2679
|
}), window.ResizeObserver && this.hr && (this.cr = new ResizeObserver(() => {
|
|
2680
2680
|
this.resizeCanvas(this.er.targetCanvas.width, this.er.targetCanvas.height);
|
|
2681
2681
|
}), this.cr.observe(this.er.targetCanvas));
|
|
2682
2682
|
}
|
|
2683
|
-
|
|
2683
|
+
Go() {
|
|
2684
2684
|
if (this.Bo.measureFrameRate(), this.Bo.incrementFrame(), this.Ho) return;
|
|
2685
2685
|
if (this.hr) {
|
|
2686
2686
|
const i = this.xt.context;
|
|
2687
2687
|
i.bindTexture(i.TEXTURE_2D, this.Vo.texture), i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, 1), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, this.er.targetCanvas), i.bindTexture(i.TEXTURE_2D, null);
|
|
2688
2688
|
}
|
|
2689
|
-
this.So.begin(), this.xt.
|
|
2689
|
+
this.So.begin(), this.xt.Ds(this.To), this.No(), this.xt.St(this.To), this.So.end(), this.Oo.begin(), this.xt.Ds(this.Lo), this.Lo.Vt({ U0: this.Ei.fontFramebuffer, U1: [this.Ei.textureColumns, this.Ei.textureRows], U2: this.So.textures[0], U3: this.So.textures[1], U4: this.So.textures[2], U5: this.So.textures[4], U6: this.So.textures[3], U7: [this.hn.cols, this.hn.rows], U8: [this.Oo.width, this.Oo.height], U9: this.Oo.width / this.Oo.height }), this.xt.Ns(0, 0, this.er.width, this.er.height), this.Oo.end();
|
|
2690
2690
|
const e = this.xt.state.canvasBackgroundColor;
|
|
2691
|
-
this.xt.Ne(e[0], e[1], e[2], e[3]), this.xt.
|
|
2691
|
+
this.xt.Ne(e[0], e[1], e[2], e[3]), this.xt.Ds(this.ko), this.ko.Vt({ Ua: this.Oo.textures[0], Ub: [this.Oo.width, this.Oo.height], Uc: [this.hn.offsetX, this.hn.offsetY], Ud: [this.hn.width, this.hn.height] }), this.xt.Ns(this.hn.offsetX, this.hn.offsetY, this.hn.width, this.hn.height);
|
|
2692
2692
|
}
|
|
2693
2693
|
setup(e) {
|
|
2694
2694
|
this.Io = e;
|
|
@@ -2700,10 +2700,10 @@ class de extends function(e, ...i) {
|
|
|
2700
2700
|
this.Xo = e;
|
|
2701
2701
|
}
|
|
2702
2702
|
resizeCanvas(e, i) {
|
|
2703
|
-
this.er.gr(e, i), this.hn.rr(), this.So.resize(this.hn.cols, this.hn.rows), this.Oo.resize(this.hn.width, this.hn.height), this.xt.Qs(), this.Eo.bn(), this.
|
|
2703
|
+
this.er.gr(e, i), this.hn.rr(), this.So.resize(this.hn.cols, this.hn.rows), this.Oo.resize(this.hn.width, this.hn.height), this.xt.Qs(), this.Eo.bn(), this.Go();
|
|
2704
2704
|
}
|
|
2705
2705
|
destroy() {
|
|
2706
|
-
this.Ho || (this.Bo.stop(), window.removeEventListener("resize", this.Wo), this.Eo.qr(), this.
|
|
2706
|
+
this.Ho || (this.Bo.stop(), window.removeEventListener("resize", this.Wo), this.Eo.qr(), this.Do.qr(), this.Ei.Gt(), this.xt.Gt(), this.Oo.Gt(), this.ko.Gt(), this.Vo && this.Vo.Gt(), this.Ho = !0);
|
|
2707
2707
|
}
|
|
2708
2708
|
get grid() {
|
|
2709
2709
|
return this.hn;
|
|
@@ -2737,7 +2737,7 @@ class Q {
|
|
|
2737
2737
|
G.A(t);
|
|
2738
2738
|
}
|
|
2739
2739
|
static get version() {
|
|
2740
|
-
return "0.2.1-beta.
|
|
2740
|
+
return "0.2.1-beta.8";
|
|
2741
2741
|
}
|
|
2742
2742
|
}
|
|
2743
2743
|
const pe = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), me = Q.create, ve = Q.setErrorLevel, Ae = Q.version;
|