@tradecanvas/core 1.10.0 → 1.11.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/{WebGLSeriesRenderer-DQOPCwno.js → WebGLSeriesRenderer-DVJBHdfm.js} +266 -169
- package/dist/WebGLSeriesRenderer-DVJBHdfm.js.map +1 -0
- package/dist/WebGLSeriesRenderer-DjkYvHPQ.cjs +429 -0
- package/dist/WebGLSeriesRenderer-DjkYvHPQ.cjs.map +1 -0
- package/dist/charts/DepthHeatmapBuffer.d.ts +6 -3
- package/dist/charts/DepthHeatmapBuffer.d.ts.map +1 -1
- package/dist/charts/MarketProfileRenderer.d.ts +2 -0
- package/dist/charts/MarketProfileRenderer.d.ts.map +1 -1
- package/dist/charts/VolumeCandleRenderer.d.ts.map +1 -1
- package/dist/charts/pixelGrid.d.ts +10 -0
- package/dist/charts/pixelGrid.d.ts.map +1 -1
- package/dist/engine/RenderEngine.d.ts +10 -4
- package/dist/engine/RenderEngine.d.ts.map +1 -1
- package/dist/engine/gpu.d.ts +15 -2
- package/dist/engine/gpu.d.ts.map +1 -1
- package/dist/{gridLines-kFhXyH-u.js → gridLines-BJLaM2d7.js} +28 -24
- package/dist/gridLines-BJLaM2d7.js.map +1 -0
- package/dist/gridLines-CBmfrSCE.cjs +2 -0
- package/dist/gridLines-CBmfrSCE.cjs.map +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +735 -709
- package/dist/index.js.map +1 -1
- package/dist/webgl/WebGLSeriesRenderer.d.ts +1 -0
- package/dist/webgl/WebGLSeriesRenderer.d.ts.map +1 -1
- package/dist/webgl/commandDrawer.d.ts.map +1 -1
- package/dist/webgl/recorder.d.ts +18 -1
- package/dist/webgl/recorder.d.ts.map +1 -1
- package/dist/webgl/shaders.d.ts +8 -7
- package/dist/webgl/shaders.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/WebGLSeriesRenderer-DQOPCwno.js.map +0 -1
- package/dist/WebGLSeriesRenderer-DspCYR38.cjs +0 -429
- package/dist/WebGLSeriesRenderer-DspCYR38.cjs.map +0 -1
- package/dist/gridLines-J41F0DQ6.cjs +0 -2
- package/dist/gridLines-J41F0DQ6.cjs.map +0 -1
- package/dist/gridLines-kFhXyH-u.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as e, o as t, r as n,
|
|
2
|
-
import { resolveVolumeColors as
|
|
3
|
-
var
|
|
1
|
+
import { i as e, o as t, r as n, s as r, t as i } from "./gridLines-BJLaM2d7.js";
|
|
2
|
+
import { resolveVolumeColors as a } from "@tradecanvas/commons";
|
|
3
|
+
var o = (e, t) => e.time === t.time && e.open === t.open && e.high === t.high && e.low === t.low && e.close === t.close && e.volume === t.volume, s = class {
|
|
4
4
|
buffer = new Float32Array();
|
|
5
5
|
count = 0;
|
|
6
6
|
basePrice = 0;
|
|
@@ -24,12 +24,12 @@ var a = (e, t) => e.time === t.time && e.open === t.open && e.high === t.high &&
|
|
|
24
24
|
to: 0
|
|
25
25
|
};
|
|
26
26
|
let n = this.count;
|
|
27
|
-
if (!(e === this.source && n > 0 && t >= n && this.samples.every(({ index: t, bar: n }) =>
|
|
27
|
+
if (!(e === this.source && n > 0 && t >= n && this.samples.every(({ index: t, bar: n }) => o(e[t], n)))) return this.basePrice = e[t - 1].close, this.ensure(t), this.write(e, 0, t), this.remember(e), {
|
|
28
28
|
full: !0,
|
|
29
29
|
from: 0,
|
|
30
30
|
to: t
|
|
31
31
|
};
|
|
32
|
-
let r = this.last !== null &&
|
|
32
|
+
let r = this.last !== null && o(e[n - 1], this.last) ? n : n - 1;
|
|
33
33
|
return t > this.buffer.length / 6 ? (this.ensure(t), this.write(e, 0, t), this.remember(e), {
|
|
34
34
|
full: !0,
|
|
35
35
|
from: 0,
|
|
@@ -62,11 +62,11 @@ var a = (e, t) => e.time === t.time && e.open === t.open && e.high === t.high &&
|
|
|
62
62
|
bar: { ...e[t] }
|
|
63
63
|
})), this.last = { ...e[t - 1] }, this.source = e;
|
|
64
64
|
}
|
|
65
|
-
},
|
|
66
|
-
function
|
|
65
|
+
}, c = /* @__PURE__ */ new Map(), l;
|
|
66
|
+
function u(e, t) {
|
|
67
67
|
return e.endsWith("%") ? parseFloat(e) / 100 : parseFloat(e) / t;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function d(e) {
|
|
70
70
|
let t = e.trim();
|
|
71
71
|
if (t.toLowerCase() === "transparent") return [
|
|
72
72
|
0,
|
|
@@ -88,28 +88,28 @@ function u(e) {
|
|
|
88
88
|
}
|
|
89
89
|
let r = /^rgba?\(\s*([\d.]+%?)[\s,]+([\d.]+%?)[\s,]+([\d.]+%?)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/i.exec(t);
|
|
90
90
|
return r ? [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
r[4] === void 0 ? 1 :
|
|
91
|
+
u(r[1], 255),
|
|
92
|
+
u(r[2], 255),
|
|
93
|
+
u(r[3], 255),
|
|
94
|
+
r[4] === void 0 ? 1 : u(r[4], 1)
|
|
95
95
|
] : null;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
if (
|
|
97
|
+
function f() {
|
|
98
|
+
if (l !== void 0) return l;
|
|
99
99
|
try {
|
|
100
|
-
|
|
100
|
+
l = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1).getContext("2d") : typeof document < "u" ? document.createElement("canvas").getContext("2d") : null;
|
|
101
101
|
} catch {
|
|
102
|
-
|
|
102
|
+
l = null;
|
|
103
103
|
}
|
|
104
|
-
return
|
|
104
|
+
return l;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
let t =
|
|
106
|
+
function p(e) {
|
|
107
|
+
let t = f();
|
|
108
108
|
if (!t) return null;
|
|
109
109
|
t.fillStyle = "#000", t.fillStyle = e;
|
|
110
110
|
let n = String(t.fillStyle);
|
|
111
111
|
if (t.fillStyle = "#fff", t.fillStyle = e, String(t.fillStyle) !== n) return null;
|
|
112
|
-
let r =
|
|
112
|
+
let r = d(n);
|
|
113
113
|
if (r) return r;
|
|
114
114
|
t.clearRect(0, 0, 1, 1), t.fillRect(0, 0, 1, 1);
|
|
115
115
|
let i = t.getImageData(0, 0, 1, 1).data;
|
|
@@ -120,23 +120,23 @@ function f(e) {
|
|
|
120
120
|
i[3] / 255
|
|
121
121
|
];
|
|
122
122
|
}
|
|
123
|
-
var
|
|
124
|
-
function
|
|
125
|
-
let t =
|
|
123
|
+
var m = /* @__PURE__ */ new Set();
|
|
124
|
+
function h(e) {
|
|
125
|
+
let t = c.get(e);
|
|
126
126
|
if (t) return t;
|
|
127
|
-
if (
|
|
128
|
-
let n =
|
|
129
|
-
return
|
|
127
|
+
if (m.has(e)) return null;
|
|
128
|
+
let n = d(e) ?? p(e);
|
|
129
|
+
return c.size > 256 && c.clear(), m.size > 256 && m.clear(), n ? c.set(e, n) : m.add(e), n;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
return
|
|
131
|
+
function g(e) {
|
|
132
|
+
return h(e) ?? [
|
|
133
133
|
0,
|
|
134
134
|
0,
|
|
135
135
|
0,
|
|
136
136
|
0
|
|
137
137
|
];
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function _([e, t, n, r]) {
|
|
140
140
|
return [
|
|
141
141
|
e * r,
|
|
142
142
|
t * r,
|
|
@@ -146,7 +146,7 @@ function g([e, t, n, r]) {
|
|
|
146
146
|
}
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region src/webgl/yMapping.ts
|
|
149
|
-
function
|
|
149
|
+
function v(e, t) {
|
|
150
150
|
let { min: n, max: r } = e.priceRange, { y: i, height: a } = e.chartRect, o = +(e.invertScale === !0), s = {
|
|
151
151
|
log: 0,
|
|
152
152
|
invert: o,
|
|
@@ -185,7 +185,7 @@ function _(e, t) {
|
|
|
185
185
|
}
|
|
186
186
|
//#endregion
|
|
187
187
|
//#region src/webgl/glKit.ts
|
|
188
|
-
var
|
|
188
|
+
var ee = class {
|
|
189
189
|
constructor(e) {
|
|
190
190
|
this.gl = e;
|
|
191
191
|
}
|
|
@@ -253,14 +253,14 @@ var v = class {
|
|
|
253
253
|
};
|
|
254
254
|
//#endregion
|
|
255
255
|
//#region src/webgl/polygonSpans.ts
|
|
256
|
-
function
|
|
256
|
+
function te(e) {
|
|
257
257
|
let t = e.length / 2;
|
|
258
258
|
if (t < 3) return [];
|
|
259
259
|
let n = 0, r = 0;
|
|
260
260
|
for (let i = 1; i < t; i++) e[2 * i] < e[2 * n] && (n = i), e[2 * i] > e[2 * r] && (r = i);
|
|
261
261
|
if (e[2 * n] === e[2 * r]) return [];
|
|
262
262
|
let i = b(e, n, r, 1, t), a = b(e, n, r, -1, t);
|
|
263
|
-
return !i || !a ? null :
|
|
263
|
+
return !i || !a ? null : ne(i, a);
|
|
264
264
|
}
|
|
265
265
|
function y(e) {
|
|
266
266
|
let t = 0, n = e.length / 2;
|
|
@@ -290,7 +290,7 @@ var x = class {
|
|
|
290
290
|
return [s(e), s(t)];
|
|
291
291
|
}
|
|
292
292
|
};
|
|
293
|
-
function
|
|
293
|
+
function ne(e, t) {
|
|
294
294
|
let n = /* @__PURE__ */ new Set();
|
|
295
295
|
for (let t = 0; t < e.length; t += 2) n.add(e[t]);
|
|
296
296
|
for (let e = 0; e < t.length; e += 2) n.add(t[e]);
|
|
@@ -303,7 +303,7 @@ function te(e, t) {
|
|
|
303
303
|
}
|
|
304
304
|
//#endregion
|
|
305
305
|
//#region src/webgl/recordedShaders.ts
|
|
306
|
-
var S = "#version 300 es\nprecision highp float;\nuniform vec2 u_canvas;\nuniform vec4 u_clip;\n\nvec4 toClip(vec2 dev) {\n return vec4(dev.x / u_canvas.x * 2.0 - 1.0, 1.0 - dev.y / u_canvas.y * 2.0, 0.0, 1.0);\n}\n", C = "\nvec2 corner(int k) {\n if (k == 0) return vec2(0.0, 0.0);\n if (k == 1 || k == 4) return vec2(1.0, 0.0);\n if (k == 2 || k == 3) return vec2(0.0, 1.0);\n return vec2(1.0, 1.0);\n}\nconst vec4 NOWHERE = vec4(-2.0, -2.0, 0.0, 1.0);\n", w = "\n// This fragment's pixel centre in device pixels, y down.\nvec2 pixelCentre() { return vec2(gl_FragCoord.x, u_canvas.y - gl_FragCoord.y); }\n\n// The share of the pixel centred at p inside the clip.\nfloat clipCoverage(vec2 p) {\n vec2 lo = p - 0.5;\n vec2 c = clamp(min(lo + 1.0, u_clip.zw) - max(lo, u_clip.xy), 0.0, 1.0);\n return c.x * c.y;\n}\n",
|
|
306
|
+
var S = "#version 300 es\nprecision highp float;\nuniform vec2 u_canvas;\nuniform vec4 u_clip;\n\nvec4 toClip(vec2 dev) {\n return vec4(dev.x / u_canvas.x * 2.0 - 1.0, 1.0 - dev.y / u_canvas.y * 2.0, 0.0, 1.0);\n}\n", C = "\nvec2 corner(int k) {\n if (k == 0) return vec2(0.0, 0.0);\n if (k == 1 || k == 4) return vec2(1.0, 0.0);\n if (k == 2 || k == 3) return vec2(0.0, 1.0);\n return vec2(1.0, 1.0);\n}\nconst vec4 NOWHERE = vec4(-2.0, -2.0, 0.0, 1.0);\n", w = "\n// This fragment's pixel centre in device pixels, y down.\nvec2 pixelCentre() { return vec2(gl_FragCoord.x, u_canvas.y - gl_FragCoord.y); }\n\n// The share of the pixel centred at p inside the clip.\nfloat clipCoverage(vec2 p) {\n vec2 lo = p - 0.5;\n vec2 c = clamp(min(lo + 1.0, u_clip.zw) - max(lo, u_clip.xy), 0.0, 1.0);\n return c.x * c.y;\n}\n", re = `${S}${C}
|
|
307
307
|
uniform float u_hw;
|
|
308
308
|
in vec4 a_p0;
|
|
309
309
|
in vec4 a_p1;
|
|
@@ -332,7 +332,7 @@ void main() {
|
|
|
332
332
|
vec2 pos = mix(a - dir * m, b + dir * m, cr.x) + n * mix(-m, m, cr.y);
|
|
333
333
|
gl_Position = toClip(pos);
|
|
334
334
|
}
|
|
335
|
-
`,
|
|
335
|
+
`, ie = `${S}${w}
|
|
336
336
|
uniform vec4 u_color;
|
|
337
337
|
uniform float u_hw;
|
|
338
338
|
uniform int u_cap;
|
|
@@ -411,7 +411,7 @@ void main() {
|
|
|
411
411
|
if (cov <= 0.0) discard;
|
|
412
412
|
outColor = u_color * (cov * clipCov);
|
|
413
413
|
}
|
|
414
|
-
`,
|
|
414
|
+
`, ae = `${S}${C}
|
|
415
415
|
in vec2 a_x;
|
|
416
416
|
in vec4 a_ab;
|
|
417
417
|
in vec2 a_ends;
|
|
@@ -428,7 +428,7 @@ void main() {
|
|
|
428
428
|
vec2 cr = corner(gl_VertexID % 6);
|
|
429
429
|
gl_Position = toClip(mix(vec2(floor(a_x.x), floor(lo) - 1.0), vec2(ceil(a_x.y), ceil(hi) + 1.0), cr));
|
|
430
430
|
}
|
|
431
|
-
`,
|
|
431
|
+
`, oe = `${S}${w}
|
|
432
432
|
uniform int u_kind;
|
|
433
433
|
uniform vec4 u_color;
|
|
434
434
|
uniform vec4 u_line;
|
|
@@ -486,7 +486,7 @@ void main() {
|
|
|
486
486
|
vec4 color = u_kind == 1 ? gradient(p) : u_color;
|
|
487
487
|
outColor = color * cov;
|
|
488
488
|
}
|
|
489
|
-
`,
|
|
489
|
+
`, se = `${S}${C}
|
|
490
490
|
in vec3 a_disc;
|
|
491
491
|
in vec4 a_color;
|
|
492
492
|
flat out vec3 v_disc;
|
|
@@ -497,7 +497,7 @@ void main() {
|
|
|
497
497
|
float m = a_disc.z + 1.0;
|
|
498
498
|
gl_Position = toClip(mix(a_disc.xy - m, a_disc.xy + m, corner(gl_VertexID % 6)));
|
|
499
499
|
}
|
|
500
|
-
`,
|
|
500
|
+
`, ce = `${S}${w}
|
|
501
501
|
flat in vec3 v_disc;
|
|
502
502
|
flat in vec4 v_color;
|
|
503
503
|
out vec4 outColor;
|
|
@@ -507,29 +507,36 @@ void main() {
|
|
|
507
507
|
if (cov <= 0.0) discard;
|
|
508
508
|
outColor = v_color * cov;
|
|
509
509
|
}
|
|
510
|
-
`, T = 4, E = T * 4, D = 32, O = 7, k = O * 4,
|
|
510
|
+
`, T = 4, E = T * 4, D = 32, O = 7, k = O * 4, le = class {
|
|
511
511
|
stroke;
|
|
512
512
|
span;
|
|
513
513
|
disc;
|
|
514
514
|
buffer;
|
|
515
515
|
constructor(e) {
|
|
516
|
-
this.kit = e, this.stroke = e.program(
|
|
516
|
+
this.kit = e, this.stroke = e.program(re, ie, [
|
|
517
517
|
"a_p0",
|
|
518
518
|
"a_p1",
|
|
519
519
|
"a_p2",
|
|
520
520
|
"a_p3",
|
|
521
521
|
"a_p4",
|
|
522
522
|
"a_p5"
|
|
523
|
-
]), this.span = e.program(
|
|
523
|
+
]), this.span = e.program(ae, oe, [
|
|
524
524
|
"a_x",
|
|
525
525
|
"a_ab",
|
|
526
526
|
"a_ends"
|
|
527
|
-
]), this.disc = e.program(
|
|
527
|
+
]), this.disc = e.program(se, ce, ["a_disc", "a_color"]), this.buffer = e.buffer();
|
|
528
528
|
}
|
|
529
529
|
draw(e, t, n, r) {
|
|
530
530
|
let i = this.kit.gl;
|
|
531
531
|
i.enable(i.BLEND);
|
|
532
|
-
for (let a
|
|
532
|
+
for (let a = 0; a < e.length; a++) {
|
|
533
|
+
let o = e[a];
|
|
534
|
+
if (i.blendFunc(i.ONE, i.ONE_MINUS_SRC_ALPHA), i.disable(i.SCISSOR_TEST), o.type === "rects") {
|
|
535
|
+
let t = [o.values];
|
|
536
|
+
for (; e[a + 1]?.type === "rects";) t.push(e[++a].values);
|
|
537
|
+
this.drawRects(t, r);
|
|
538
|
+
} else o.type === "stroke" ? this.drawStroke(o, t, n) : o.type === "fill" ? this.drawFill(o, t, n) : this.drawDiscs(o.values, o.clip, t, n);
|
|
539
|
+
}
|
|
533
540
|
i.disable(i.SCISSOR_TEST);
|
|
534
541
|
}
|
|
535
542
|
destroy() {
|
|
@@ -554,8 +561,10 @@ void main() {
|
|
|
554
561
|
]), !0) : !1;
|
|
555
562
|
}
|
|
556
563
|
drawRects(e, t) {
|
|
557
|
-
let n =
|
|
558
|
-
for (let t
|
|
564
|
+
let n = 0;
|
|
565
|
+
for (let t of e) n += t.length / 8;
|
|
566
|
+
let r = new Float32Array(n * 10), i = 0;
|
|
567
|
+
for (let t of e) for (let e = 0; e < t.length; e += 8, i++) for (let n = 0; n < 8; n++) r[i * 10 + n] = t[e + n];
|
|
559
568
|
t(r, n);
|
|
560
569
|
}
|
|
561
570
|
drawStroke(e, t, n) {
|
|
@@ -610,13 +619,13 @@ void main() {
|
|
|
610
619
|
let i = this.disc;
|
|
611
620
|
this.common(i, t, n, r) && (this.upload(new Float32Array(e)), this.kit.attrib(i, "a_disc", 3, k, 0), this.kit.attrib(i, "a_color", 4, k, 12), this.kit.gl.drawArraysInstanced(this.kit.gl.TRIANGLES, 0, 6, e.length / O));
|
|
612
621
|
}
|
|
613
|
-
},
|
|
622
|
+
}, A = (e, t) => ({
|
|
614
623
|
x0: Math.max(e.x0, t.x0),
|
|
615
624
|
y0: Math.max(e.y0, t.y0),
|
|
616
625
|
x1: Math.min(e.x1, t.x1),
|
|
617
626
|
y1: Math.min(e.y1, t.y1)
|
|
618
|
-
}),
|
|
619
|
-
function
|
|
627
|
+
}), j = (e) => !(e.x1 > e.x0 && e.y1 > e.y0);
|
|
628
|
+
function M(e, t = 0) {
|
|
620
629
|
let n = Infinity, r = Infinity, i = -Infinity, a = -Infinity;
|
|
621
630
|
for (let t = 0; t < e.length; t += 2) {
|
|
622
631
|
let o = e[t], s = e[t + 1];
|
|
@@ -629,7 +638,7 @@ function N(e, t = 0) {
|
|
|
629
638
|
y1: a + t
|
|
630
639
|
};
|
|
631
640
|
}
|
|
632
|
-
function
|
|
641
|
+
function N(e) {
|
|
633
642
|
let t = [...e].sort((e, t) => e.x0 - t.x0), n = [];
|
|
634
643
|
for (let e of t) {
|
|
635
644
|
for (let t = n.length - 1; t >= 0; t--) n[t].x1 <= e.x0 && n.splice(t, 1);
|
|
@@ -640,7 +649,7 @@ function P(e) {
|
|
|
640
649
|
}
|
|
641
650
|
//#endregion
|
|
642
651
|
//#region src/webgl/recordedPath.ts
|
|
643
|
-
var
|
|
652
|
+
var P = class {
|
|
644
653
|
stops = [];
|
|
645
654
|
constructor(e, t, n, r) {
|
|
646
655
|
this.x0 = e, this.y0 = t, this.x1 = n, this.y1 = r;
|
|
@@ -652,14 +661,14 @@ var F = class {
|
|
|
652
661
|
color: t
|
|
653
662
|
});
|
|
654
663
|
}
|
|
655
|
-
},
|
|
664
|
+
}, F = typeof Path2D == "function" ? Path2D : class {}, I = class e extends F {
|
|
656
665
|
calls = [];
|
|
657
666
|
unsupported = !1;
|
|
658
667
|
constructor(t) {
|
|
659
668
|
super(t), t instanceof e ? (this.calls.push(...t.calls), this.unsupported = t.unsupported) : t !== void 0 && (this.unsupported = !0);
|
|
660
669
|
}
|
|
661
670
|
note(e, t, n = t) {
|
|
662
|
-
this.calls.push([e, t]),
|
|
671
|
+
this.calls.push([e, t]), F.prototype[e]?.apply(this, n);
|
|
663
672
|
}
|
|
664
673
|
unfollowed(e, t) {
|
|
665
674
|
this.unsupported = !0, this.note(e, [], t);
|
|
@@ -719,12 +728,12 @@ var F = class {
|
|
|
719
728
|
this.unfollowed("roundRect", e);
|
|
720
729
|
}
|
|
721
730
|
addPath(t, n) {
|
|
722
|
-
!(t instanceof e) || n !== void 0 ? this.unsupported = !0 : (this.calls.push(...t.calls), this.unsupported ||= t.unsupported),
|
|
731
|
+
!(t instanceof e) || n !== void 0 ? this.unsupported = !0 : (this.calls.push(...t.calls), this.unsupported ||= t.unsupported), F.prototype.addPath?.call(this, t, n);
|
|
723
732
|
}
|
|
724
733
|
};
|
|
725
|
-
function
|
|
734
|
+
function ue(e) {
|
|
726
735
|
let t = globalThis, n = Object.prototype.hasOwnProperty.call(t, "Path2D"), r = t.Path2D;
|
|
727
|
-
t.Path2D =
|
|
736
|
+
t.Path2D = I;
|
|
728
737
|
try {
|
|
729
738
|
e();
|
|
730
739
|
} finally {
|
|
@@ -733,24 +742,24 @@ function ce(e) {
|
|
|
733
742
|
}
|
|
734
743
|
//#endregion
|
|
735
744
|
//#region src/webgl/strokeGeometry.ts
|
|
736
|
-
var
|
|
737
|
-
function
|
|
745
|
+
var de = .25;
|
|
746
|
+
function fe(e, t, n, r) {
|
|
738
747
|
if (n === "round") return !1;
|
|
739
748
|
let i = e.points, a = i.length / 2, o = +!e.closed, s = e.closed ? a : a - 1;
|
|
740
749
|
for (let e = o; e < s; e++) {
|
|
741
750
|
let o = (e - 1 + a) % a, s = (e + 1) % a, c = i[2 * e] - i[2 * o], l = i[2 * e + 1] - i[2 * o + 1], u = i[2 * s] - i[2 * e], d = i[2 * s + 1] - i[2 * e + 1], f = Math.hypot(c, l), p = Math.hypot(u, d);
|
|
742
751
|
if (f === 0 || p === 0) continue;
|
|
743
752
|
let m = Math.max(-1, Math.min(1, (c * u + l * d) / (f * p))), h = Math.sqrt((1 + m) / 2);
|
|
744
|
-
if ((n === "miter" && h > 0 && 1 / h <= r ? t * (1 / h - 1) : t * (1 - h)) >
|
|
753
|
+
if ((n === "miter" && h > 0 && 1 / h <= r ? t * (1 / h - 1) : t * (1 - h)) > de) return !0;
|
|
745
754
|
}
|
|
746
755
|
return !1;
|
|
747
756
|
}
|
|
748
|
-
function
|
|
757
|
+
function pe(e, t) {
|
|
749
758
|
let n = e.points;
|
|
750
759
|
for (let e = 2; e < n.length; e += 2) if (Math.hypot(n[e] - n[e - 2], n[e + 1] - n[e - 1]) < t) return !0;
|
|
751
760
|
return !1;
|
|
752
761
|
}
|
|
753
|
-
function
|
|
762
|
+
function me(e) {
|
|
754
763
|
let t = [], n = () => t.push(0, 0, -1, 0);
|
|
755
764
|
n(), n();
|
|
756
765
|
for (let { points: r, closed: i } of e) {
|
|
@@ -764,8 +773,8 @@ function fe(e) {
|
|
|
764
773
|
}
|
|
765
774
|
//#endregion
|
|
766
775
|
//#region src/webgl/recorder.ts
|
|
767
|
-
var
|
|
768
|
-
function
|
|
776
|
+
var L = Math.PI * 2;
|
|
777
|
+
function R(e, t) {
|
|
769
778
|
let n = 2 * Math.sqrt(Math.max(.2 / Math.max(e, .1), 1e-6));
|
|
770
779
|
return Math.min(512, Math.max(4, Math.ceil(Math.abs(t) / Math.min(n, Math.PI / 4))));
|
|
771
780
|
}
|
|
@@ -795,14 +804,17 @@ var z = new Set([
|
|
|
795
804
|
"letterSpacing",
|
|
796
805
|
"wordSpacing",
|
|
797
806
|
"textRendering"
|
|
798
|
-
]), V = new Set(["imageSmoothingEnabled", "imageSmoothingQuality"]), H = (e) => !!(e.rect || e.circle) || e.points.length >= 6,
|
|
807
|
+
]), V = new Set(["imageSmoothingEnabled", "imageSmoothingQuality"]), H = (e) => !!(e.rect || e.circle) || e.points.length >= 6, he = class {
|
|
799
808
|
commands = [];
|
|
800
809
|
ctx;
|
|
801
810
|
texts = [];
|
|
811
|
+
takesText = !0;
|
|
802
812
|
state;
|
|
803
813
|
stack = [];
|
|
804
814
|
path = [];
|
|
805
815
|
ok = !0;
|
|
816
|
+
stepStart = 0;
|
|
817
|
+
solid = null;
|
|
806
818
|
constructor(e, t) {
|
|
807
819
|
this.dpr = e, this.measure = t, this.reset({
|
|
808
820
|
x0: 0,
|
|
@@ -811,29 +823,29 @@ var z = new Set([
|
|
|
811
823
|
y1: Infinity
|
|
812
824
|
}), this.ctx = this.proxy();
|
|
813
825
|
}
|
|
814
|
-
region(e) {
|
|
815
|
-
let
|
|
816
|
-
x0: e.x *
|
|
817
|
-
y0: e.y *
|
|
818
|
-
x1: (e.x + e.width) *
|
|
819
|
-
y1: (e.y + e.height) *
|
|
820
|
-
},
|
|
826
|
+
region(e, t) {
|
|
827
|
+
let n = this.dpr, r = {
|
|
828
|
+
x0: e.x * n,
|
|
829
|
+
y0: e.y * n,
|
|
830
|
+
x1: (e.x + e.width) * n,
|
|
831
|
+
y1: (e.y + e.height) * n
|
|
832
|
+
}, i = [], a = t?.text !== !1;
|
|
821
833
|
return {
|
|
822
834
|
step: (e) => {
|
|
823
|
-
this.reset(
|
|
835
|
+
this.reset(r), this.texts = i, this.takesText = a;
|
|
824
836
|
let t = {
|
|
825
837
|
commands: this.commands.length,
|
|
826
|
-
texts:
|
|
838
|
+
texts: i.length
|
|
827
839
|
};
|
|
828
|
-
this.ok = !0;
|
|
840
|
+
this.stepStart = t.commands, this.ok = !0;
|
|
829
841
|
try {
|
|
830
|
-
|
|
842
|
+
ue(() => e(this.ctx));
|
|
831
843
|
} catch {
|
|
832
844
|
this.ok = !1;
|
|
833
845
|
}
|
|
834
|
-
return this.ok ? !0 : (this.commands.length = t.commands,
|
|
846
|
+
return this.ok ? !0 : (this.commands.length = t.commands, i.length = t.texts, !1);
|
|
835
847
|
},
|
|
836
|
-
drawText: (e) =>
|
|
848
|
+
drawText: (e) => ge(e, i)
|
|
837
849
|
};
|
|
838
850
|
}
|
|
839
851
|
reset(e) {
|
|
@@ -967,14 +979,14 @@ var z = new Set([
|
|
|
967
979
|
].every(Number.isFinite)) return;
|
|
968
980
|
if (n < 0) throw new DOMException("negative radius", "IndexSizeError");
|
|
969
981
|
let o = i - r;
|
|
970
|
-
o = !a && o >=
|
|
971
|
-
let s = this.current(), c = this.state.transform, l = e + n * Math.cos(r), u = t + n * Math.sin(r), d = !s || s.closed || s.points.length === 2 && Math.abs(s.points[0] - (c[0] * l + c[2] * u + c[4])) < 1e-6 && Math.abs(s.points[1] - (c[1] * l + c[3] * u + c[5])) < 1e-6, f =
|
|
982
|
+
o = !a && o >= L ? L : a && -o >= L ? -L : a ? -(((r - i) % L + L) % L) : (o % L + L) % L;
|
|
983
|
+
let s = this.current(), c = this.state.transform, l = e + n * Math.cos(r), u = t + n * Math.sin(r), d = !s || s.closed || s.points.length === 2 && Math.abs(s.points[0] - (c[0] * l + c[2] * u + c[4])) < 1e-6 && Math.abs(s.points[1] - (c[1] * l + c[3] * u + c[5])) < 1e-6, f = R(n * Math.abs(c[0]), o);
|
|
972
984
|
for (let i = 0; i <= f; i++) {
|
|
973
985
|
let a = r + o * i / f;
|
|
974
986
|
this.lineTo(e + n * Math.cos(a), t + n * Math.sin(a));
|
|
975
987
|
}
|
|
976
988
|
let p = this.current();
|
|
977
|
-
Math.abs(o) >=
|
|
989
|
+
Math.abs(o) >= L - 1e-9 && d && this.uniform() && p && (p.circle = {
|
|
978
990
|
x: c[0] * e + c[4],
|
|
979
991
|
y: c[3] * t + c[5],
|
|
980
992
|
r: n * Math.abs(c[0])
|
|
@@ -1013,7 +1025,7 @@ var z = new Set([
|
|
|
1013
1025
|
this.path = [], e(), t(), this.path = n;
|
|
1014
1026
|
}
|
|
1015
1027
|
onPath(e, t) {
|
|
1016
|
-
if (!(e instanceof
|
|
1028
|
+
if (!(e instanceof I) || e.unsupported) return this.unsupported();
|
|
1017
1029
|
this.withPath(() => {
|
|
1018
1030
|
for (let [t, n] of e.calls) t === "moveTo" ? this.moveTo(n[0], n[1]) : t === "lineTo" ? this.lineTo(n[0], n[1]) : t === "closePath" ? this.closePath() : t === "rect" ? this.rect(n[0], n[1], n[2], n[3]) : t === "arc" ? this.arc(n[0], n[1], n[2], n[3], n[4], !!n[5]) : t === "quadraticCurveTo" ? this.curve([n[0], n[1]], [n[2], n[3]]) : t === "bezierCurveTo" && this.curve([
|
|
1019
1031
|
n[0],
|
|
@@ -1023,21 +1035,34 @@ var z = new Set([
|
|
|
1023
1035
|
], [n[4], n[5]]);
|
|
1024
1036
|
}, t);
|
|
1025
1037
|
}
|
|
1038
|
+
baseColor(e) {
|
|
1039
|
+
let t = this.solid;
|
|
1040
|
+
if (t && t.style === e) return t.color;
|
|
1041
|
+
let n = _(g(e));
|
|
1042
|
+
return this.solid = {
|
|
1043
|
+
style: e,
|
|
1044
|
+
color: n
|
|
1045
|
+
}, n;
|
|
1046
|
+
}
|
|
1047
|
+
alpha() {
|
|
1048
|
+
return Math.max(0, Math.min(1, this.state.globalAlpha));
|
|
1049
|
+
}
|
|
1050
|
+
solidColor(e) {
|
|
1051
|
+
let t = this.baseColor(e), n = this.alpha();
|
|
1052
|
+
return [
|
|
1053
|
+
t[0] * n,
|
|
1054
|
+
t[1] * n,
|
|
1055
|
+
t[2] * n,
|
|
1056
|
+
t[3] * n
|
|
1057
|
+
];
|
|
1058
|
+
}
|
|
1026
1059
|
paint(e) {
|
|
1027
|
-
let t =
|
|
1028
|
-
if (typeof e == "string") {
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
n[0] * t,
|
|
1034
|
-
n[1] * t,
|
|
1035
|
-
n[2] * t,
|
|
1036
|
-
n[3] * t
|
|
1037
|
-
]
|
|
1038
|
-
};
|
|
1039
|
-
}
|
|
1040
|
-
if (!(e instanceof F)) return null;
|
|
1060
|
+
let t = this.alpha();
|
|
1061
|
+
if (typeof e == "string") return {
|
|
1062
|
+
kind: "solid",
|
|
1063
|
+
color: this.solidColor(e)
|
|
1064
|
+
};
|
|
1065
|
+
if (!(e instanceof P)) return null;
|
|
1041
1066
|
if (e.stops.length === 0) return {
|
|
1042
1067
|
kind: "solid",
|
|
1043
1068
|
color: [
|
|
@@ -1051,7 +1076,7 @@ var z = new Set([
|
|
|
1051
1076
|
let n = this.state.transform, r = e.x0 === e.x1 || e.y0 === e.y1;
|
|
1052
1077
|
if (!this.axisAligned() || !this.uniform() && !r) return null;
|
|
1053
1078
|
let i = [...e.stops].sort((e, t) => e.offset - t.offset).map((e) => {
|
|
1054
|
-
let n =
|
|
1079
|
+
let n = g(e.color);
|
|
1055
1080
|
return {
|
|
1056
1081
|
offset: e.offset,
|
|
1057
1082
|
color: [
|
|
@@ -1073,7 +1098,7 @@ var z = new Set([
|
|
|
1073
1098
|
}
|
|
1074
1099
|
plain() {
|
|
1075
1100
|
let e = this.state;
|
|
1076
|
-
return e.globalCompositeOperation !== "source-over" || e.filter !== "none" ? !1 :
|
|
1101
|
+
return e.globalCompositeOperation !== "source-over" || e.filter !== "none" ? !1 : e.shadowBlur === 0 && e.shadowOffsetX === 0 && e.shadowOffsetY === 0 ? !0 : !(g(e.shadowColor)[3] > 0);
|
|
1077
1102
|
}
|
|
1078
1103
|
fill(e = "nonzero") {
|
|
1079
1104
|
if (!this.plain()) return this.unsupported();
|
|
@@ -1081,7 +1106,7 @@ var z = new Set([
|
|
|
1081
1106
|
if (!t) return this.unsupported();
|
|
1082
1107
|
let n = this.path.filter(H);
|
|
1083
1108
|
if (n.length === 0 || t.kind === "solid" && t.color[3] === 0) return;
|
|
1084
|
-
if (n.length > 1 &&
|
|
1109
|
+
if (n.length > 1 && N(n.map((e) => M(e.points)))) {
|
|
1085
1110
|
let r = t.kind === "solid" && t.color[3] >= 1, i = Math.sign(y(n[0].points));
|
|
1086
1111
|
if (!r || e !== "nonzero" || n.some((e) => Math.sign(y(e.points)) !== i)) return this.unsupported();
|
|
1087
1112
|
}
|
|
@@ -1098,17 +1123,17 @@ var z = new Set([
|
|
|
1098
1123
|
}
|
|
1099
1124
|
let r = [];
|
|
1100
1125
|
for (let e of n) {
|
|
1101
|
-
let t =
|
|
1126
|
+
let t = te(e.points);
|
|
1102
1127
|
if (!t) return this.unsupported();
|
|
1103
1128
|
for (let e of t) r.push(e);
|
|
1104
1129
|
}
|
|
1105
|
-
let i =
|
|
1130
|
+
let i = M(n.flatMap((e) => e.points)), a = A({
|
|
1106
1131
|
x0: Math.floor(i.x0),
|
|
1107
1132
|
y0: Math.floor(i.y0),
|
|
1108
1133
|
x1: Math.ceil(i.x1),
|
|
1109
1134
|
y1: Math.ceil(i.y1)
|
|
1110
1135
|
}, this.state.clip);
|
|
1111
|
-
r.length > 0 && !
|
|
1136
|
+
r.length > 0 && !j(a) && this.commands.push({
|
|
1112
1137
|
type: "fill",
|
|
1113
1138
|
spans: r,
|
|
1114
1139
|
bounds: a,
|
|
@@ -1117,16 +1142,40 @@ var z = new Set([
|
|
|
1117
1142
|
});
|
|
1118
1143
|
}
|
|
1119
1144
|
fillRects(e, t) {
|
|
1120
|
-
let n
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1145
|
+
for (let n of e) this.pushRect(n.rect, t);
|
|
1146
|
+
}
|
|
1147
|
+
pushRect(e, t, n = 1) {
|
|
1148
|
+
let r = this.state.clip, i = Math.max(e.x0, r.x0), a = Math.max(e.y0, r.y0), o = Math.min(e.x1, r.x1), s = Math.min(e.y1, r.y1);
|
|
1149
|
+
if (!(o > i && s > a)) return;
|
|
1150
|
+
let c = this.commands[this.commands.length - 1], l = c && c.type === "rects" && this.commands.length > this.stepStart ? c.values : null, u = t[0] * n, d = t[1] * n, f = t[2] * n, p = t[3] * n;
|
|
1151
|
+
l ? l.push(i, a, o, s, u, d, f, p) : this.commands.push({
|
|
1126
1152
|
type: "rects",
|
|
1127
|
-
values:
|
|
1153
|
+
values: [
|
|
1154
|
+
i,
|
|
1155
|
+
a,
|
|
1156
|
+
o,
|
|
1157
|
+
s,
|
|
1158
|
+
u,
|
|
1159
|
+
d,
|
|
1160
|
+
f,
|
|
1161
|
+
p
|
|
1162
|
+
]
|
|
1128
1163
|
});
|
|
1129
1164
|
}
|
|
1165
|
+
fillRect(e, t, n, r) {
|
|
1166
|
+
let i = this.state.fillStyle;
|
|
1167
|
+
if (typeof i != "string" || !this.axisAligned() || !this.plain()) return this.withPath(() => this.rect(e, t, n, r), () => this.fill());
|
|
1168
|
+
if (!(Number.isFinite(e) && Number.isFinite(t) && Number.isFinite(n) && Number.isFinite(r))) return;
|
|
1169
|
+
let a = this.baseColor(i), o = this.alpha();
|
|
1170
|
+
if (a[3] * o === 0) return;
|
|
1171
|
+
let s = this.state.transform, c = s[0] * e + s[4], l = s[0] * (e + n) + s[4], u = s[3] * t + s[5], d = s[3] * (t + r) + s[5];
|
|
1172
|
+
this.pushRect({
|
|
1173
|
+
x0: Math.min(c, l),
|
|
1174
|
+
y0: Math.min(u, d),
|
|
1175
|
+
x1: Math.max(c, l),
|
|
1176
|
+
y1: Math.max(u, d)
|
|
1177
|
+
}, a, o);
|
|
1178
|
+
}
|
|
1130
1179
|
stroke() {
|
|
1131
1180
|
if (!this.plain()) return this.unsupported();
|
|
1132
1181
|
let e = this.paint(this.state.strokeStyle);
|
|
@@ -1139,7 +1188,7 @@ var z = new Set([
|
|
|
1139
1188
|
let o = t.lineCap === "round" ? 1 : t.lineCap === "square" ? 2 : 0;
|
|
1140
1189
|
this.commands.push({
|
|
1141
1190
|
type: "stroke",
|
|
1142
|
-
points:
|
|
1191
|
+
points: me(i),
|
|
1143
1192
|
color: e.color,
|
|
1144
1193
|
width: r,
|
|
1145
1194
|
cap: o,
|
|
@@ -1157,17 +1206,18 @@ var z = new Set([
|
|
|
1157
1206
|
}
|
|
1158
1207
|
drawsAlike(e, t, n) {
|
|
1159
1208
|
let r = this.state, i = t / 2;
|
|
1160
|
-
if (t > 1 && e.some((e) =>
|
|
1209
|
+
if (t > 1 && e.some((e) => fe(e, i, r.lineJoin, r.miterLimit))) return !1;
|
|
1161
1210
|
let a = i + (r.lineCap === "butt" ? 0 : i);
|
|
1162
|
-
return !(e.length > 1 &&
|
|
1211
|
+
return !(e.length > 1 && N(e.map((e) => M(e.points, a))) || n < 1 && e.some((e) => pe(e, t)));
|
|
1163
1212
|
}
|
|
1164
1213
|
clip() {
|
|
1165
1214
|
let e = this.path.filter(H);
|
|
1166
1215
|
if (e.length !== 1 || !e[0].rect) return this.unsupported();
|
|
1167
|
-
this.state.clip =
|
|
1216
|
+
this.state.clip = A(this.state.clip, e[0].rect);
|
|
1168
1217
|
}
|
|
1169
1218
|
text(e, t, n, r, i) {
|
|
1170
|
-
|
|
1219
|
+
let a = e ? this.state.strokeStyle : this.state.fillStyle;
|
|
1220
|
+
if (!this.takesText || typeof a != "string" || !this.plain()) return this.unsupported();
|
|
1171
1221
|
this.texts.push({
|
|
1172
1222
|
stroke: e,
|
|
1173
1223
|
text: String(t),
|
|
@@ -1213,7 +1263,7 @@ var z = new Set([
|
|
|
1213
1263
|
fill: (e, t) => typeof e == "object" ? this.onPath(e, () => this.fill(t)) : this.fill(e),
|
|
1214
1264
|
stroke: (e) => e ? this.onPath(e, () => this.stroke()) : this.stroke(),
|
|
1215
1265
|
clip: (e) => typeof e == "object" ? this.onPath(e, () => this.clip()) : this.clip(),
|
|
1216
|
-
fillRect: (e, t, n, r) => this.
|
|
1266
|
+
fillRect: (e, t, n, r) => this.fillRect(e, t, n, r),
|
|
1217
1267
|
strokeRect: (e, t, n, r) => this.withPath(() => this.rect(e, t, n, r), () => this.stroke()),
|
|
1218
1268
|
fillText: (e, t, n, r) => this.text(!1, e, t, n, r),
|
|
1219
1269
|
strokeText: (e, t, n, r) => this.text(!0, e, t, n, r),
|
|
@@ -1261,7 +1311,7 @@ var z = new Set([
|
|
|
1261
1311
|
isIdentity: t === 1 && n === 0 && r === 0 && i === 1 && a === 0 && o === 0
|
|
1262
1312
|
};
|
|
1263
1313
|
},
|
|
1264
|
-
createLinearGradient: (e, t, n, r) => new
|
|
1314
|
+
createLinearGradient: (e, t, n, r) => new P(e, t, n, r)
|
|
1265
1315
|
}), t;
|
|
1266
1316
|
}
|
|
1267
1317
|
proxy() {
|
|
@@ -1281,24 +1331,66 @@ var z = new Set([
|
|
|
1281
1331
|
}
|
|
1282
1332
|
setProp(e, t) {
|
|
1283
1333
|
let n = this.state;
|
|
1284
|
-
e === "lineWidth" || e === "miterLimit" ? typeof t == "number" && Number.isFinite(t) && t > 0 && (n[e] = t) : e === "globalAlpha" ? typeof t == "number" && Number.isFinite(t) && t >= 0 && t <= 1 && (n.globalAlpha = t) : e === "fillStyle" || e === "strokeStyle" ? t instanceof
|
|
1334
|
+
e === "lineWidth" || e === "miterLimit" ? typeof t == "number" && Number.isFinite(t) && t > 0 && (n[e] = t) : e === "globalAlpha" ? typeof t == "number" && Number.isFinite(t) && t >= 0 && t <= 1 && (n.globalAlpha = t) : e === "fillStyle" || e === "strokeStyle" ? t instanceof P ? n[e] = t : typeof t == "string" ? h(t) && (n[e] = t) : this.unsupported() : z.has(e) ? n[e] = t : B.has(e) ? this.state.textExtras[e] = t : V.has(e) || this.unsupported();
|
|
1285
1335
|
}
|
|
1286
1336
|
};
|
|
1287
|
-
function
|
|
1337
|
+
function ge(e, t) {
|
|
1288
1338
|
for (let n of t) {
|
|
1289
1339
|
let t = n.state;
|
|
1290
|
-
if (
|
|
1340
|
+
if (j(t.clip)) continue;
|
|
1291
1341
|
e.save(), e.setTransform(1, 0, 0, 1, 0, 0), Number.isFinite(t.clip.x1) && Number.isFinite(t.clip.y1) && (e.beginPath(), e.rect(t.clip.x0, t.clip.y0, t.clip.x1 - t.clip.x0, t.clip.y1 - t.clip.y0), e.clip());
|
|
1292
1342
|
let [r, i, a, o, s, c] = t.transform;
|
|
1293
1343
|
e.setTransform(r, i, a, o, s, c), e.font = t.font, e.textAlign = t.textAlign, e.textBaseline = t.textBaseline, e.direction = t.direction, e.globalAlpha = t.globalAlpha, Object.assign(e, t.textExtras), n.stroke ? (e.strokeStyle = t.strokeStyle, e.lineWidth = t.lineWidth, e.strokeText(n.text, n.x, n.y, n.maxWidth)) : (e.fillStyle = t.fillStyle, e.fillText(n.text, n.x, n.y, n.maxWidth)), e.restore();
|
|
1294
1344
|
}
|
|
1295
1345
|
}
|
|
1296
|
-
function
|
|
1297
|
-
return new
|
|
1346
|
+
function _e(e, t) {
|
|
1347
|
+
return new he(e, t);
|
|
1298
1348
|
}
|
|
1299
1349
|
//#endregion
|
|
1300
1350
|
//#region src/webgl/shaders.ts
|
|
1301
|
-
var
|
|
1351
|
+
var U = `#version 300 es
|
|
1352
|
+
precision highp float;
|
|
1353
|
+
uniform vec2 u_canvas;
|
|
1354
|
+
uniform float u_dpr;
|
|
1355
|
+
uniform int u_log;
|
|
1356
|
+
uniform int u_invert;
|
|
1357
|
+
uniform float u_yA;
|
|
1358
|
+
uniform float u_yB;
|
|
1359
|
+
uniform float u_logOffset;
|
|
1360
|
+
uniform float u_min;
|
|
1361
|
+
uniform float u_logFloor;
|
|
1362
|
+
uniform float u_logK;
|
|
1363
|
+
uniform float u_top;
|
|
1364
|
+
uniform float u_bottom;
|
|
1365
|
+
out vec4 v_color;
|
|
1366
|
+
|
|
1367
|
+
// A price (relative to the base price) to a CSS-pixel y, as priceToYMapper
|
|
1368
|
+
// does; mappedY in yMapping.ts is the same steps in TypeScript.
|
|
1369
|
+
float cssY(float rel) {
|
|
1370
|
+
if (u_log == 1) {
|
|
1371
|
+
float v = log(max(1.0 + (rel + u_logOffset) / u_min, u_logFloor)) * u_logK;
|
|
1372
|
+
return u_invert == 1 ? u_top + v : u_bottom - v;
|
|
1373
|
+
}
|
|
1374
|
+
return u_yA + rel * u_yB;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
float snap(float v) { return floor(v + ${t.toFixed(4)}); }
|
|
1378
|
+
|
|
1379
|
+
vec4 toClip(vec2 dev) {
|
|
1380
|
+
return vec4(dev.x / u_canvas.x * 2.0 - 1.0, 1.0 - dev.y / u_canvas.y * 2.0, 0.0, 1.0);
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
// The corners of a quad as two triangles.
|
|
1384
|
+
vec2 corner(int k) {
|
|
1385
|
+
if (k == 0) return vec2(0.0, 0.0);
|
|
1386
|
+
if (k == 1 || k == 4) return vec2(1.0, 0.0);
|
|
1387
|
+
if (k == 2 || k == 3) return vec2(0.0, 1.0);
|
|
1388
|
+
return vec2(1.0, 1.0);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
// Nothing to draw: every vertex at one point off the canvas.
|
|
1392
|
+
const vec4 NOWHERE = vec4(-2.0, -2.0, 0.0, 1.0);
|
|
1393
|
+
`, ve = `${U}
|
|
1302
1394
|
in vec4 a_ohlc;
|
|
1303
1395
|
in vec2 a_vd;
|
|
1304
1396
|
uniform float u_x0;
|
|
@@ -1339,7 +1431,7 @@ void main() {
|
|
|
1339
1431
|
}
|
|
1340
1432
|
gl_Position = toClip(vec2(left + cr.x * width, top + cr.y * height));
|
|
1341
1433
|
}
|
|
1342
|
-
`,
|
|
1434
|
+
`, ye = `${U}
|
|
1343
1435
|
in vec4 a_ohlc;
|
|
1344
1436
|
in vec2 a_vd;
|
|
1345
1437
|
uniform float u_x0;
|
|
@@ -1361,7 +1453,7 @@ void main() {
|
|
|
1361
1453
|
v_color = a_vd.y > 0.5 ? u_volUp : u_volDown;
|
|
1362
1454
|
gl_Position = toClip(vec2(left + cr.x * u_body, top + cr.y * (bottom - top)));
|
|
1363
1455
|
}
|
|
1364
|
-
`,
|
|
1456
|
+
`, be = `${U}
|
|
1365
1457
|
in vec4 a_col;
|
|
1366
1458
|
in float a_up;
|
|
1367
1459
|
uniform vec4 u_upBody;
|
|
@@ -1376,7 +1468,7 @@ void main() {
|
|
|
1376
1468
|
v_color = a_up > 0.5 ? u_upBody : u_downBody;
|
|
1377
1469
|
gl_Position = toClip(vec2(left + cr.x * width, min(t, b) + cr.y * max(abs(b - t), 1.0)));
|
|
1378
1470
|
}
|
|
1379
|
-
`,
|
|
1471
|
+
`, xe = `${U}
|
|
1380
1472
|
in vec4 a_col;
|
|
1381
1473
|
in float a_up;
|
|
1382
1474
|
uniform float u_volBottom;
|
|
@@ -1394,7 +1486,7 @@ void main() {
|
|
|
1394
1486
|
v_color = a_up > 0.5 ? u_volUp : u_volDown;
|
|
1395
1487
|
gl_Position = toClip(vec2(left + cr.x * width, top + cr.y * (bottom - top)));
|
|
1396
1488
|
}
|
|
1397
|
-
`,
|
|
1489
|
+
`, Se = `${U}
|
|
1398
1490
|
in vec4 a_rect;
|
|
1399
1491
|
in vec4 a_color;
|
|
1400
1492
|
in vec2 a_dash;
|
|
@@ -1408,7 +1500,7 @@ void main() {
|
|
|
1408
1500
|
v_color = a_color;
|
|
1409
1501
|
gl_Position = toClip(mix(floor(v_rect.xy), ceil(v_rect.zw), cr));
|
|
1410
1502
|
}
|
|
1411
|
-
`,
|
|
1503
|
+
`, Ce = "#version 300 es\nprecision highp float;\nuniform vec2 u_canvas;\nuniform int u_union;\nin vec4 v_color;\nflat in vec4 v_rect;\nflat in vec2 v_dash;\nout vec4 outColor;\n\n// The share of rows [y, y + 1] inside the rectangle and, dashed, on a dash.\nfloat rows(float y) {\n float lo = max(y, v_rect.y);\n float hi = min(y + 1.0, v_rect.w);\n if (hi <= lo) return 0.0;\n if (v_dash.x <= 0.0) return hi - lo;\n // A dash period is longer than a device pixel, so the row meets the dash\n // of the period it starts in and the next (a third to spare).\n float period = v_dash.x + v_dash.y;\n float first = v_rect.y + floor((lo - v_rect.y) / period) * period;\n float on = 0.0;\n for (int i = 0; i < 3; i++) {\n float start = first + float(i) * period;\n on += max(0.0, min(hi, start + v_dash.x) - max(lo, start));\n }\n return on;\n}\n\nvoid main() {\n // This pixel's top-left corner in device pixels, y down.\n vec2 p = vec2(floor(gl_FragCoord.x), u_canvas.y - floor(gl_FragCoord.y) - 1.0);\n float coverage = clamp(min(p.x + 1.0, v_rect.z) - max(p.x, v_rect.x), 0.0, 1.0) * rows(p.y);\n outColor = u_union == 1 ? vec4(v_color.rgb * coverage, coverage) : v_color * coverage;\n}\n", W = "#version 300 es\nprecision highp float;\nuniform vec2 u_canvas;\nuniform vec4 u_clip;\nin vec4 v_color;\nout vec4 outColor;\n\nvoid main() {\n vec2 p = vec2(floor(gl_FragCoord.x), u_canvas.y - floor(gl_FragCoord.y) - 1.0);\n vec2 c = clamp(min(p + 1.0, u_clip.zw) - max(p, u_clip.xy), 0.0, 1.0);\n outColor = v_color * (c.x * c.y);\n}\n", G = 24, K = 5, q = K * 4, J = 10, Y = J * 4, X = [
|
|
1412
1504
|
"a_ohlc",
|
|
1413
1505
|
"a_vd",
|
|
1414
1506
|
"a_col",
|
|
@@ -1416,7 +1508,7 @@ void main() {
|
|
|
1416
1508
|
"a_rect",
|
|
1417
1509
|
"a_color",
|
|
1418
1510
|
"a_dash"
|
|
1419
|
-
],
|
|
1511
|
+
], we = class t {
|
|
1420
1512
|
label;
|
|
1421
1513
|
gl;
|
|
1422
1514
|
kit;
|
|
@@ -1429,10 +1521,10 @@ void main() {
|
|
|
1429
1521
|
seriesBuffer;
|
|
1430
1522
|
columnBuffer;
|
|
1431
1523
|
rectBuffer;
|
|
1432
|
-
uploads = new
|
|
1524
|
+
uploads = new s();
|
|
1433
1525
|
gpuFloats = 0;
|
|
1434
|
-
columns = new Float32Array(4096 *
|
|
1435
|
-
rectValues = new Float32Array(64 *
|
|
1526
|
+
columns = new Float32Array(4096 * K);
|
|
1527
|
+
rectValues = new Float32Array(64 * J);
|
|
1436
1528
|
clip = [
|
|
1437
1529
|
0,
|
|
1438
1530
|
0,
|
|
@@ -1443,9 +1535,9 @@ void main() {
|
|
|
1443
1535
|
lostCallback = null;
|
|
1444
1536
|
static create(e = {}) {
|
|
1445
1537
|
if (typeof document > "u") return null;
|
|
1446
|
-
let
|
|
1538
|
+
let n = document.createElement("canvas"), r = null;
|
|
1447
1539
|
try {
|
|
1448
|
-
|
|
1540
|
+
r = n.getContext("webgl2", {
|
|
1449
1541
|
alpha: !0,
|
|
1450
1542
|
premultipliedAlpha: !0,
|
|
1451
1543
|
antialias: !1,
|
|
@@ -1457,19 +1549,19 @@ void main() {
|
|
|
1457
1549
|
} catch (e) {
|
|
1458
1550
|
return $(e), null;
|
|
1459
1551
|
}
|
|
1460
|
-
if (!
|
|
1552
|
+
if (!r) return null;
|
|
1461
1553
|
try {
|
|
1462
|
-
return new
|
|
1554
|
+
return new t(n, r);
|
|
1463
1555
|
} catch (e) {
|
|
1464
|
-
return $(e), Q(
|
|
1556
|
+
return $(e), Q(r), null;
|
|
1465
1557
|
}
|
|
1466
1558
|
}
|
|
1467
1559
|
constructor(e, t) {
|
|
1468
|
-
this.canvas = e, this.gl = t, this.kit = new
|
|
1560
|
+
this.canvas = e, this.gl = t, this.kit = new ee(t);
|
|
1469
1561
|
let n = t.getExtension("WEBGL_debug_renderer_info");
|
|
1470
1562
|
this.label = String(n ? t.getParameter(n.UNMASKED_RENDERER_WEBGL) : t.getParameter(t.RENDERER));
|
|
1471
1563
|
let r = this.kit;
|
|
1472
|
-
this.candleBars = r.program(
|
|
1564
|
+
this.candleBars = r.program(ve, W, X), this.volumeBars = r.program(ye, W, X), this.candleColumns = r.program(be, W, X), this.volumeColumns = r.program(xe, W, X), this.rects = r.program(Se, Ce, X), this.seriesBuffer = r.buffer(), this.columnBuffer = r.buffer(), this.rectBuffer = r.buffer(), this.drawer = new le(r), e.addEventListener("webglcontextlost", this.handleLost);
|
|
1473
1565
|
}
|
|
1474
1566
|
onLost(e) {
|
|
1475
1567
|
this.lostCallback = e, (this.lost || this.gl.isContextLost()) && (this.lost = !0, queueMicrotask(() => {
|
|
@@ -1477,7 +1569,7 @@ void main() {
|
|
|
1477
1569
|
}));
|
|
1478
1570
|
}
|
|
1479
1571
|
recorder(e, t) {
|
|
1480
|
-
return
|
|
1572
|
+
return _e(e, t);
|
|
1481
1573
|
}
|
|
1482
1574
|
render(e) {
|
|
1483
1575
|
let t = this.gl;
|
|
@@ -1485,15 +1577,17 @@ void main() {
|
|
|
1485
1577
|
series: !1,
|
|
1486
1578
|
volume: !1,
|
|
1487
1579
|
background: !1,
|
|
1488
|
-
recorded: !1
|
|
1580
|
+
recorded: !1,
|
|
1581
|
+
under: !1
|
|
1489
1582
|
};
|
|
1490
|
-
let n =
|
|
1583
|
+
let n = Z(e.recorded) ? e.recorded : null, r = Z(e.under) ? e.under : null, i = {
|
|
1491
1584
|
series: e.candles,
|
|
1492
1585
|
volume: e.volume !== null,
|
|
1493
1586
|
background: e.background !== null,
|
|
1494
|
-
recorded: n !== null
|
|
1587
|
+
recorded: n !== null,
|
|
1588
|
+
under: r !== null
|
|
1495
1589
|
};
|
|
1496
|
-
return t.viewport(0, 0, this.canvas.width, this.canvas.height), t.disable(t.SCISSOR_TEST), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.enable(t.BLEND), e.background && this.drawBackground(e, e.background),
|
|
1590
|
+
return t.viewport(0, 0, this.canvas.width, this.canvas.height), t.disable(t.SCISSOR_TEST), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.enable(t.BLEND), e.background && this.drawBackground(e, e.background), r && this.drawRecorded(e, r), this.drawSeries(e), n && this.drawRecorded(e, n), i;
|
|
1497
1591
|
}
|
|
1498
1592
|
drawSeries(t) {
|
|
1499
1593
|
let n = this.gl, { data: r, viewport: i, dpr: a } = t;
|
|
@@ -1515,6 +1609,9 @@ void main() {
|
|
|
1515
1609
|
let { min: h, max: g } = i.priceRange;
|
|
1516
1610
|
t.candles && g - h !== 0 && this.drawCandles(t, o, s, p, m), n.disable(n.SCISSOR_TEST);
|
|
1517
1611
|
}
|
|
1612
|
+
drawRecorded(e, t) {
|
|
1613
|
+
t.commands.length !== 0 && this.drawer.draw(t.commands, this.canvas.width, this.canvas.height, (t, n) => this.drawRecordedRects(e, t, n));
|
|
1614
|
+
}
|
|
1518
1615
|
drawRecordedRects(e, t, n) {
|
|
1519
1616
|
let r = this.gl, i = this.use(this.rects, e);
|
|
1520
1617
|
this.kit.float(i, "u_dpr", 1), this.kit.int(i, "u_union", 0), r.bindBuffer(r.ARRAY_BUFFER, this.rectBuffer), r.bufferData(r.ARRAY_BUFFER, t, r.STREAM_DRAW), this.bindRects(i, 0), r.drawArraysInstanced(r.TRIANGLES, 0, 6, n);
|
|
@@ -1539,81 +1636,81 @@ void main() {
|
|
|
1539
1636
|
};
|
|
1540
1637
|
syncSeries(e) {
|
|
1541
1638
|
let t = this.gl, n = this.uploads.sync(e.data), r = this.uploads.values;
|
|
1542
|
-
t.bindBuffer(t.ARRAY_BUFFER, this.seriesBuffer), n.full || r.length !== this.gpuFloats ? (t.bufferData(t.ARRAY_BUFFER, r, t.DYNAMIC_DRAW), this.gpuFloats = r.length) : n.to > n.from && t.bufferSubData(t.ARRAY_BUFFER, n.from *
|
|
1639
|
+
t.bindBuffer(t.ARRAY_BUFFER, this.seriesBuffer), n.full || r.length !== this.gpuFloats ? (t.bufferData(t.ARRAY_BUFFER, r, t.DYNAMIC_DRAW), this.gpuFloats = r.length) : n.to > n.from && t.bufferSubData(t.ARRAY_BUFFER, n.from * G, r, n.from * 6, (n.to - n.from) * 6);
|
|
1543
1640
|
}
|
|
1544
1641
|
buildColumns(e, t, r) {
|
|
1545
1642
|
let { viewport: i, data: a } = e, o = i.barWidth + i.barSpacing, s = -i.offset + i.chartRect.x + i.barWidth / 2, c = this.uploads.base, l = 0;
|
|
1546
1643
|
n(a, t, r, (e) => e * o + s, (e) => {
|
|
1547
|
-
if ((l + 1) *
|
|
1644
|
+
if ((l + 1) * K > this.columns.length) {
|
|
1548
1645
|
let e = new Float32Array(this.columns.length * 2);
|
|
1549
1646
|
e.set(this.columns), this.columns = e;
|
|
1550
1647
|
}
|
|
1551
|
-
let t = l *
|
|
1648
|
+
let t = l * K;
|
|
1552
1649
|
this.columns[t] = e.x, this.columns[t + 1] = e.high - c, this.columns[t + 2] = e.low - c, this.columns[t + 3] = e.volume, this.columns[t + 4] = +(e.close >= e.open), l++;
|
|
1553
1650
|
});
|
|
1554
1651
|
let u = this.gl;
|
|
1555
|
-
return u.bindBuffer(u.ARRAY_BUFFER, this.columnBuffer), u.bufferData(u.ARRAY_BUFFER, this.columns.subarray(0, l *
|
|
1652
|
+
return u.bindBuffer(u.ARRAY_BUFFER, this.columnBuffer), u.bufferData(u.ARRAY_BUFFER, this.columns.subarray(0, l * K), u.STREAM_DRAW), l;
|
|
1556
1653
|
}
|
|
1557
1654
|
drawBackground(e, t) {
|
|
1558
|
-
let { viewport: n, theme:
|
|
1655
|
+
let { viewport: n, theme: r } = e, a = t.grid ? i(n) : {
|
|
1559
1656
|
horizontal: [],
|
|
1560
1657
|
vertical: []
|
|
1561
1658
|
}, o = a.horizontal.length + a.vertical.length, s = o + t.rects.length;
|
|
1562
1659
|
if (s === 0) return;
|
|
1563
|
-
this.rectValues.length < s *
|
|
1660
|
+
this.rectValues.length < s * J && (this.rectValues = new Float32Array(s * J * 2));
|
|
1564
1661
|
let c = this.rectValues, l = 0, u = (e, t, n, r, i, a, o) => {
|
|
1565
1662
|
c[l++] = e, c[l++] = t, c[l++] = n, c[l++] = r;
|
|
1566
1663
|
for (let e = 0; e < 4; e++) c[l++] = i[e] * a;
|
|
1567
1664
|
c[l++] = o ? o[0] : 0, c[l++] = o ? o[1] : 0;
|
|
1568
|
-
}, d = g(
|
|
1665
|
+
}, d = _(g(r.grid)), { chartRect: f } = n;
|
|
1569
1666
|
for (let e of a.horizontal) u(f.x, e - .5, f.x + f.width, e + .5, d, 1);
|
|
1570
1667
|
for (let e of a.vertical) u(e - .5, f.y, e + .5, f.y + f.height, d, 1);
|
|
1571
1668
|
let p = "", m = d;
|
|
1572
|
-
for (let e of t.rects) e.color !== p && (p = e.color, m = g(
|
|
1573
|
-
let
|
|
1574
|
-
|
|
1669
|
+
for (let e of t.rects) e.color !== p && (p = e.color, m = _(g(e.color))), u(e.x, e.y, e.x + e.width, e.y + e.height, m, e.alpha, e.dash);
|
|
1670
|
+
let h = this.gl, v = this.use(this.rects, e);
|
|
1671
|
+
h.bindBuffer(h.ARRAY_BUFFER, this.rectBuffer), h.bufferData(h.ARRAY_BUFFER, c.subarray(0, l), h.STREAM_DRAW), o > 0 && (h.uniform1i(this.loc(v, "u_union"), 1), h.blendColor(0, 0, 0, d[3]), h.blendFuncSeparate(h.ONE, h.ONE_MINUS_SRC_ALPHA, h.CONSTANT_ALPHA, h.ONE_MINUS_SRC_ALPHA), this.bindRects(v, 0), h.drawArraysInstanced(h.TRIANGLES, 0, 6, o)), t.rects.length > 0 && (h.uniform1i(this.loc(v, "u_union"), 0), h.blendFunc(h.ONE, h.ONE_MINUS_SRC_ALPHA), this.bindRects(v, o), h.drawArraysInstanced(h.TRIANGLES, 0, 6, t.rects.length));
|
|
1575
1672
|
}
|
|
1576
1673
|
drawCandles(e, t, n, r, i) {
|
|
1577
|
-
let { theme: a, viewport: o, dpr: s } = e, c = g(
|
|
1674
|
+
let { theme: a, viewport: o, dpr: s } = e, c = _(g(a.candleUp)), l = _(g(a.candleDown));
|
|
1578
1675
|
if (r) {
|
|
1579
1676
|
let t = this.use(this.candleColumns, e);
|
|
1580
1677
|
this.vec4(t, "u_upBody", c), this.vec4(t, "u_downBody", l), this.bindColumns(t), this.gl.drawArraysInstanced(this.gl.TRIANGLES, 0, 6, i);
|
|
1581
1678
|
return;
|
|
1582
1679
|
}
|
|
1583
1680
|
let u = this.use(this.candleBars, e);
|
|
1584
|
-
this.barUniforms(u, o, t, s), this.vec4(u, "u_upBody", c), this.vec4(u, "u_downBody", l), this.vec4(u, "u_upWick", g(
|
|
1681
|
+
this.barUniforms(u, o, t, s), this.vec4(u, "u_upBody", c), this.vec4(u, "u_downBody", l), this.vec4(u, "u_upWick", _(g(a.candleUpWick))), this.vec4(u, "u_downWick", _(g(a.candleDownWick))), this.bindBars(u, t), this.gl.drawArraysInstanced(this.gl.TRIANGLES, 0, 12, n - t + 1);
|
|
1585
1682
|
}
|
|
1586
|
-
drawVolume(e, t, n, r,
|
|
1683
|
+
drawVolume(e, t, n, r, i) {
|
|
1587
1684
|
let { data: o, viewport: s, theme: c, dpr: l } = e, u = 0;
|
|
1588
1685
|
for (let e = t; e <= n; e++) o[e].volume > u && (u = o[e].volume);
|
|
1589
1686
|
if (u === 0) return;
|
|
1590
|
-
let { chartRect: d } = s, f =
|
|
1591
|
-
if (this.float(p, "u_volBottom", d.y + d.height), this.float(p, "u_volScale", d.height * (e.volume?.heightRatio ?? .15) / u), this.vec4(p, "u_volUp", g(
|
|
1592
|
-
this.bindColumns(p), this.gl.drawArraysInstanced(this.gl.TRIANGLES, 0, 6,
|
|
1687
|
+
let { chartRect: d } = s, f = a(c), p = this.use(r ? this.volumeColumns : this.volumeBars, e);
|
|
1688
|
+
if (this.float(p, "u_volBottom", d.y + d.height), this.float(p, "u_volScale", d.height * (e.volume?.heightRatio ?? .15) / u), this.vec4(p, "u_volUp", _(g(f.up))), this.vec4(p, "u_volDown", _(g(f.down))), r) {
|
|
1689
|
+
this.bindColumns(p), this.gl.drawArraysInstanced(this.gl.TRIANGLES, 0, 6, i);
|
|
1593
1690
|
return;
|
|
1594
1691
|
}
|
|
1595
1692
|
this.barUniforms(p, s, t, l), this.bindBars(p, t), this.gl.drawArraysInstanced(this.gl.TRIANGLES, 0, 6, n - t + 1);
|
|
1596
1693
|
}
|
|
1597
|
-
barUniforms(e,
|
|
1598
|
-
let a =
|
|
1599
|
-
this.float(e, "u_x0",
|
|
1694
|
+
barUniforms(e, t, n, i) {
|
|
1695
|
+
let a = t.barWidth + t.barSpacing, o = -t.offset + t.chartRect.x + t.barWidth / 2, { body: s, wick: c } = r(t.barWidth, i);
|
|
1696
|
+
this.float(e, "u_x0", n * a + o), this.float(e, "u_unit", a), this.float(e, "u_wick", c), this.float(e, "u_body", s);
|
|
1600
1697
|
}
|
|
1601
1698
|
use(e, t) {
|
|
1602
1699
|
let n = this.gl;
|
|
1603
1700
|
this.kit.use(e), n.uniform2f(this.loc(e, "u_canvas"), this.canvas.width, this.canvas.height), this.vec4(e, "u_clip", this.clip), this.float(e, "u_dpr", t.dpr);
|
|
1604
|
-
let r =
|
|
1701
|
+
let r = v(t.viewport, this.uploads.base);
|
|
1605
1702
|
return n.uniform1i(this.loc(e, "u_log"), r.log), n.uniform1i(this.loc(e, "u_invert"), r.invert), this.float(e, "u_yA", r.yA), this.float(e, "u_yB", r.yB), this.float(e, "u_logOffset", r.logOffset), this.float(e, "u_min", r.min), this.float(e, "u_logFloor", r.logFloor), this.float(e, "u_logK", r.logK), this.float(e, "u_top", r.top), this.float(e, "u_bottom", r.bottom), e;
|
|
1606
1703
|
}
|
|
1607
1704
|
bindBars(e, t) {
|
|
1608
1705
|
let n = this.gl;
|
|
1609
|
-
n.bindBuffer(n.ARRAY_BUFFER, this.seriesBuffer), this.attrib(e, "a_ohlc", 4,
|
|
1706
|
+
n.bindBuffer(n.ARRAY_BUFFER, this.seriesBuffer), this.attrib(e, "a_ohlc", 4, G, t * G), this.attrib(e, "a_vd", 2, G, t * G + 16);
|
|
1610
1707
|
}
|
|
1611
1708
|
bindRects(e, t) {
|
|
1612
|
-
this.attrib(e, "a_rect", 4,
|
|
1709
|
+
this.attrib(e, "a_rect", 4, Y, t * Y), this.attrib(e, "a_color", 4, Y, t * Y + 16), this.attrib(e, "a_dash", 2, Y, t * Y + 32);
|
|
1613
1710
|
}
|
|
1614
1711
|
bindColumns(e) {
|
|
1615
1712
|
let t = this.gl;
|
|
1616
|
-
t.bindBuffer(t.ARRAY_BUFFER, this.columnBuffer), this.attrib(e, "a_col", 4,
|
|
1713
|
+
t.bindBuffer(t.ARRAY_BUFFER, this.columnBuffer), this.attrib(e, "a_col", 4, q, 0), this.attrib(e, "a_up", 1, q, 16);
|
|
1617
1714
|
}
|
|
1618
1715
|
attrib(e, t, n, r, i) {
|
|
1619
1716
|
this.kit.attrib(e, t, n, r, i);
|
|
@@ -1628,7 +1725,7 @@ void main() {
|
|
|
1628
1725
|
return this.kit.loc(e, t);
|
|
1629
1726
|
}
|
|
1630
1727
|
};
|
|
1631
|
-
function
|
|
1728
|
+
function Z(e) {
|
|
1632
1729
|
return typeof e == "object" && !!e && Array.isArray(e.commands);
|
|
1633
1730
|
}
|
|
1634
1731
|
function Q(e) {
|
|
@@ -1638,6 +1735,6 @@ function $(e) {
|
|
|
1638
1735
|
console.warn("TradeCanvas: WebGL renderer unavailable, drawing with Canvas 2D.", e);
|
|
1639
1736
|
}
|
|
1640
1737
|
//#endregion
|
|
1641
|
-
export {
|
|
1738
|
+
export { we as WebGLSeriesRenderer };
|
|
1642
1739
|
|
|
1643
|
-
//# sourceMappingURL=WebGLSeriesRenderer-
|
|
1740
|
+
//# sourceMappingURL=WebGLSeriesRenderer-DVJBHdfm.js.map
|