@genome-spy/app 0.85.0 → 0.87.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/README.md +28 -0
- package/dist/{agentApi-Cz0hCnVp.js → agentApi-BZ1JCo1N.js} +7174 -8484
- package/dist/agentApi.es.js +3312 -3575
- package/dist/agentShared.es.js +14 -13
- package/dist/canvas2d-B_PnIof-.js +620 -0
- package/dist/canvas2d-Cafq5v-N.js +620 -0
- package/dist/{arrayUtils-LJpQOu-U.js → clipOptions-D6eh9T-_.js} +1060 -634
- package/dist/{paramUtils-BYI4rwyL.js → clipOptions-H68pJyEZ.js} +940 -514
- package/dist/{debug-CgDtmspT.js → debug-BGzgZmyk.js} +8 -8
- package/dist/{debug-BvCZWumf.js → debug-UYKZLNh4.js} +8 -8
- package/dist/index.es.js +2983 -2916
- package/dist/index.js +2006 -1997
- package/dist/indexer-Di57GyxX.js +72 -0
- package/dist/indexer-o6Hpg4nN.js +72 -0
- package/dist/layoutResult-D50MSHXR.js +97 -0
- package/dist/nativeText-D9SoxpaD.js +934 -0
- package/dist/nativeText-DAjvkrzc.js +934 -0
- package/dist/performanceProfiler-CPLEjApa.js +20 -0
- package/dist/rasterExport-DzldLv6E.js +44 -0
- package/dist/rasterExport-IAbJwi8F.js +44 -0
- package/dist/rasterImage-B4rPLaW9.js +18 -0
- package/dist/rasterization-CFogVB3B.js +50 -0
- package/dist/rectangle-DKnrAmKs.js +142 -0
- package/dist/renderCanvas2D-BJ93Ptqj.js +277 -0
- package/dist/renderCanvas2D-yJ1IrDcX.js +277 -0
- package/dist/schema.json +11685 -4428
- package/dist/{svg-yFj875aX.js → svg-BRpl2Xub.js} +412 -449
- package/dist/{svg-CCu8kYy2.js → svg-DJuqHIyc.js} +399 -436
- package/dist/svgRasterizer-CGZQ5njV.js +40 -0
- package/dist/svgRasterizer-PAoqLn1j.js +40 -0
- package/dist/vega-scale-BGC53c22.js +2403 -0
- package/dist/vega-scale-DdW2NzQ3.js +2403 -0
- package/dist/viewError-BiR9VCgL.js +29 -0
- package/dist/{viewIdentityRegistry-BUdkK9zT.js → viewIdentityRegistry-D4p067HU.js} +1 -1
- package/dist/{viewIdentityRegistry-D3oPbN4O.js → viewIdentityRegistry-Dc2hXYsO.js} +1 -1
- package/dist/viewSelectors-DNXnGwEW.js +2015 -0
- package/dist/viewSelectors-DYYlOt91.js +2015 -0
- package/dist/viewUtils-EdhZTPrJ.js +6448 -0
- package/dist/webgl-C53DwzVT.js +4127 -0
- package/dist/webgl-CdgNFlJk.js +4127 -0
- package/package.json +7 -6
- package/dist/bmFontMetrics-CuNB-kNN.js +0 -31
- package/dist/canvas2d-DoAXEiF9.js +0 -309
- package/dist/canvas2d-f5jl4A5D.js +0 -310
- package/dist/clipOptions-gqdb3fvW.js +0 -43
- package/dist/color-W5zffv-z.js +0 -335
- package/dist/framebufferReadback-CCLOjStu.js +0 -148
- package/dist/framebufferReadback-THWwFqs8.js +0 -1994
- package/dist/nativeText-DMO8gLt7.js +0 -806
- package/dist/nativeText-m5AUINMq.js +0 -806
- package/dist/twgl-full.module-DB2UdP1k.js +0 -1849
- package/dist/viewRenderingContext-HtpqwS_x.js +0 -120
- package/dist/viewSelectors-DGCspRN3.js +0 -4198
- package/dist/viewSelectors-U5oLCLHV.js +0 -4195
- package/dist/viewUtils-Dg4RA40Q.js +0 -7503
- package/dist/warning-DRGdb6BF.js +0 -59
- package/dist/webgl-Ci6ZhCCf.js +0 -54
- package/dist/webgl-Dpz8a3TI.js +0 -53
|
@@ -0,0 +1,934 @@
|
|
|
1
|
+
import { F as e, L as t, Ot as n, Wt as r, Y as i, b as a, ot as o, rt as s, sn as c, z as l } from "./clipOptions-H68pJyEZ.js";
|
|
2
|
+
import { t as u } from "./rectangle-DKnrAmKs.js";
|
|
3
|
+
//#region ../core/src/rendering/immediate/markData.js
|
|
4
|
+
var d = [], f = class {
|
|
5
|
+
#e = {
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0,
|
|
8
|
+
width: 0,
|
|
9
|
+
height: 0
|
|
10
|
+
};
|
|
11
|
+
#t = new u(() => this.#e.x, () => this.#e.y, () => this.#e.width, () => this.#e.height);
|
|
12
|
+
#n;
|
|
13
|
+
#r = 0;
|
|
14
|
+
#i = 0;
|
|
15
|
+
#a = NaN;
|
|
16
|
+
#o = NaN;
|
|
17
|
+
#s = NaN;
|
|
18
|
+
resolveFacet(e, t) {
|
|
19
|
+
this.#c(e);
|
|
20
|
+
let n = t.locSize.location, r = t.locSize.size;
|
|
21
|
+
return (this.#a !== n || this.#o !== r || this.#s !== t.pixelToUnit) && (this.#l(n, r, t.pixelToUnit), this.#a = n, this.#o = r, this.#s = t.pixelToUnit), this.#t;
|
|
22
|
+
}
|
|
23
|
+
resolvePlacement(e, t, n) {
|
|
24
|
+
if (!t) return;
|
|
25
|
+
let r = t.getSnapshot().rectangles, i = n * 4;
|
|
26
|
+
if (!(i + 3 >= r.length)) return this.#c(e), this.#l(r[i + 1], r[i + 3], 1), this.#a = NaN, this.#o = NaN, this.#s = NaN, this.#t;
|
|
27
|
+
}
|
|
28
|
+
#c(e) {
|
|
29
|
+
this.#n !== e && (this.#e.x = e.x, this.#r = e.y, this.#e.width = e.width, this.#i = e.height, this.#n = e, this.#a = NaN, this.#o = NaN, this.#s = NaN);
|
|
30
|
+
}
|
|
31
|
+
#l(e, t, n) {
|
|
32
|
+
this.#e.y = this.#r + e * n * this.#i, this.#e.height = t * n * this.#i;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
function p(e, t) {
|
|
36
|
+
let n = e.unitView.getCollector();
|
|
37
|
+
if (!n) throw Error(`Cannot render an uninitialized mark. View: ${e.unitView.getPathString()}`);
|
|
38
|
+
let r = n.facetBatches.get(void 0);
|
|
39
|
+
return r?.length ? r : n.facetBatches.get(t.facetId) ?? d;
|
|
40
|
+
}
|
|
41
|
+
function m(e, t, n, r, i, a) {
|
|
42
|
+
let o = p(e, t);
|
|
43
|
+
if (t.sampleFacetRenderingOptions) i(r.resolveFacet(n, t.sampleFacetRenderingOptions), o);
|
|
44
|
+
else if (e.encoders.facetIndex) for (let [s, c] of h(e.encoders.facetIndex, o)) {
|
|
45
|
+
let e = r.resolvePlacement(n, t.placement?.source, s);
|
|
46
|
+
e ? i(e, c) : a(s);
|
|
47
|
+
}
|
|
48
|
+
else i(n, o);
|
|
49
|
+
}
|
|
50
|
+
function h(e, t) {
|
|
51
|
+
let n = /* @__PURE__ */ new Map();
|
|
52
|
+
for (let r of t) {
|
|
53
|
+
let t = +e(r), i = n.get(t);
|
|
54
|
+
i || (i = [], n.set(t, i)), i.push(r);
|
|
55
|
+
}
|
|
56
|
+
return n;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region ../core/src/rendering/immediate/bounds.js
|
|
60
|
+
function g(e, t, n) {
|
|
61
|
+
return {
|
|
62
|
+
x1: n?.clipX ? Math.max(0, n.rect.x) : 0,
|
|
63
|
+
y1: n?.clipY ? Math.max(0, n.rect.y) : 0,
|
|
64
|
+
x2: n?.clipX ? Math.min(e, n.rect.x2) : e,
|
|
65
|
+
y2: n?.clipY ? Math.min(t, n.rect.y2) : t
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function _(e, t, n) {
|
|
69
|
+
let r = n === !0 || n === "x", i = n === !0 || n === "y";
|
|
70
|
+
return {
|
|
71
|
+
x1: r ? t?.clipX ? t.rect.x : e.x : -Infinity,
|
|
72
|
+
y1: i ? t?.clipY ? t.rect.y : e.y : -Infinity,
|
|
73
|
+
x2: r ? t?.clipX ? t.rect.x2 : e.x2 : Infinity,
|
|
74
|
+
y2: i ? t?.clipY ? t.rect.y2 : e.y2 : Infinity
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function v(e) {
|
|
78
|
+
return e.x1 <= e.x2 && e.y1 <= e.y2;
|
|
79
|
+
}
|
|
80
|
+
function y(e, t, n) {
|
|
81
|
+
return t < e.x1 || t > e.x2 || n < e.y1 || n > e.y2;
|
|
82
|
+
}
|
|
83
|
+
function b(e, t, n, r, i, a = 0) {
|
|
84
|
+
return !(Math.max(t, r) + a < e.x1 || Math.min(t, r) - a > e.x2 || Math.max(n, i) + a < e.y1 || Math.min(n, i) - a > e.y2);
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region ../core/src/rendering/immediate/geometry/polygonUnion.js
|
|
88
|
+
var x = 1e-8;
|
|
89
|
+
function S(e) {
|
|
90
|
+
let t = e.flatMap((e, t) => e.map((n, r) => ({
|
|
91
|
+
a: n,
|
|
92
|
+
b: e[(r + 1) % e.length],
|
|
93
|
+
polygonIndex: t
|
|
94
|
+
}))), n = [];
|
|
95
|
+
for (let r of t) {
|
|
96
|
+
let i = [0, 1];
|
|
97
|
+
for (let e of t) r.polygonIndex != e.polygonIndex && C(r, e, i);
|
|
98
|
+
i.sort((e, t) => e - t);
|
|
99
|
+
for (let t = 0; t < i.length - 1; t++) {
|
|
100
|
+
let a = i[t], o = i[t + 1];
|
|
101
|
+
if (o - a <= x) continue;
|
|
102
|
+
let s = k(r.a, r.b, a), c = k(r.a, r.b, o), l = k(s, c, .5);
|
|
103
|
+
e.some((e, t) => t != r.polygonIndex && D(l, e)) || n.push({
|
|
104
|
+
a: s,
|
|
105
|
+
b: c,
|
|
106
|
+
polygonIndex: r.polygonIndex
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return E(T(n));
|
|
111
|
+
}
|
|
112
|
+
function C(e, t, n) {
|
|
113
|
+
let r = j(e.b, e.a), i = j(t.b, t.a), a = j(t.a, e.a), o = N(r, i);
|
|
114
|
+
if (Math.abs(o) > x) {
|
|
115
|
+
let e = N(a, i) / o, t = N(a, r) / o;
|
|
116
|
+
e > x && e < 1 - x && t >= -1e-8 && t <= 1.00000001 && n.push(e);
|
|
117
|
+
} else Math.abs(N(a, r)) <= x && (w(e, t.a, n), w(e, t.b, n));
|
|
118
|
+
}
|
|
119
|
+
function w(e, t, n) {
|
|
120
|
+
let r = j(e.b, e.a), i = M(r, r), a = M(j(t, e.a), r) / i;
|
|
121
|
+
a > x && a < 1 - x && n.push(a);
|
|
122
|
+
}
|
|
123
|
+
function T(e) {
|
|
124
|
+
let t = /* @__PURE__ */ new Map();
|
|
125
|
+
for (let n of e) {
|
|
126
|
+
let e = A(n.a) + ":" + A(n.b), r = A(n.b) + ":" + A(n.a);
|
|
127
|
+
t.has(r) ? t.delete(r) : t.has(e) || t.set(e, n);
|
|
128
|
+
}
|
|
129
|
+
return Array.from(t.values());
|
|
130
|
+
}
|
|
131
|
+
function E(e) {
|
|
132
|
+
let t = /* @__PURE__ */ new Map();
|
|
133
|
+
for (let n of e) {
|
|
134
|
+
let e = A(n.a), r = t.get(e) ?? [];
|
|
135
|
+
r.push(n), t.set(e, r);
|
|
136
|
+
}
|
|
137
|
+
let n = new Set(e), r = [];
|
|
138
|
+
for (; n.size;) {
|
|
139
|
+
let e = n.values().next().value, i = [e.a], a = e;
|
|
140
|
+
for (;;) {
|
|
141
|
+
if (n.delete(a), i.push(a.b), A(a.b) == A(i[0])) {
|
|
142
|
+
i.pop();
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
let e = (t.get(A(a.b)) ?? []).find((e) => n.has(e));
|
|
146
|
+
if (!e) throw Error("Cannot chain SVG polygon union boundary.");
|
|
147
|
+
a = e;
|
|
148
|
+
}
|
|
149
|
+
r.push(i);
|
|
150
|
+
}
|
|
151
|
+
return r;
|
|
152
|
+
}
|
|
153
|
+
function D(e, t) {
|
|
154
|
+
let n = !1;
|
|
155
|
+
for (let r = 0, i = t.length - 1; r < t.length; i = r++) {
|
|
156
|
+
let a = t[i], o = t[r];
|
|
157
|
+
if (O(e, a, o)) return !1;
|
|
158
|
+
a.y > e.y != o.y > e.y && e.x < (o.x - a.x) * (e.y - a.y) / (o.y - a.y) + a.x && (n = !n);
|
|
159
|
+
}
|
|
160
|
+
return n;
|
|
161
|
+
}
|
|
162
|
+
function O(e, t, n) {
|
|
163
|
+
return Math.abs(N(j(e, t), j(n, t))) <= x && M(j(e, t), j(e, n)) <= x;
|
|
164
|
+
}
|
|
165
|
+
function k(e, t, n) {
|
|
166
|
+
return {
|
|
167
|
+
x: e.x + (t.x - e.x) * n,
|
|
168
|
+
y: e.y + (t.y - e.y) * n
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function A(e) {
|
|
172
|
+
return `${Math.round(e.x / x)},${Math.round(e.y / x)}`;
|
|
173
|
+
}
|
|
174
|
+
function j(e, t) {
|
|
175
|
+
return {
|
|
176
|
+
x: e.x - t.x,
|
|
177
|
+
y: e.y - t.y
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function M(e, t) {
|
|
181
|
+
return e.x * t.x + e.y * t.y;
|
|
182
|
+
}
|
|
183
|
+
function N(e, t) {
|
|
184
|
+
return e.x * t.y - e.y * t.x;
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region ../core/src/rendering/immediate/markEncoding.js
|
|
188
|
+
function P(e, t, n) {
|
|
189
|
+
return e.x + t * e.width + n;
|
|
190
|
+
}
|
|
191
|
+
function F(e, t, n) {
|
|
192
|
+
return e.y + (1 - t) * e.height + n;
|
|
193
|
+
}
|
|
194
|
+
function I(e, t, n, r = [0, 0]) {
|
|
195
|
+
return z(e, t.x, t.x2, t.xOffset, t.x2Offset, n, P, r);
|
|
196
|
+
}
|
|
197
|
+
function L(e, t, n, r = [0, 0]) {
|
|
198
|
+
return z(e, t.y, t.y2, t.yOffset, t.y2Offset, n, F, r);
|
|
199
|
+
}
|
|
200
|
+
function R(e, t, n, r) {
|
|
201
|
+
let i = t[n], a = t[n + "2"], o = t[n + "Offset"], s = t[n + "2Offset"], c = n == "x" ? e.width : e.height, l = n == "x" ? e.x : e.y + c, u = n == "x" ? c : -c, d = H(i), f = a ? H(a) : 0, p = i.constant ? B(i, r) + d : 0, m = a?.constant ? B(a, r) + f : 0, h = o.constant ? B(o, r) : 0, g = a && s?.constant ? B(s, r) : 0;
|
|
202
|
+
return (e, t) => {
|
|
203
|
+
let n = o.constant ? h : B(o, e), r = i.constant ? p : B(i, e) + d, c = l + r * u + n, _ = c;
|
|
204
|
+
if (a) {
|
|
205
|
+
let t = a.constant ? m : B(a, e) + f, r = s ? s.constant ? g : B(s, e) : n;
|
|
206
|
+
_ = l + t * u + r;
|
|
207
|
+
}
|
|
208
|
+
return t[0] = c, t[1] = _, t;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function z(e, t, n, r, i, a, o, s) {
|
|
212
|
+
let c = B(r, a), l = o(e, V(t, a), c), u = n ? o(e, V(n, a), i ? B(i, a) : c) : l;
|
|
213
|
+
return s[0] = l, s[1] = u, s;
|
|
214
|
+
}
|
|
215
|
+
function B(e, t) {
|
|
216
|
+
return e(t);
|
|
217
|
+
}
|
|
218
|
+
function V(e, t) {
|
|
219
|
+
return B(e, t) + H(e);
|
|
220
|
+
}
|
|
221
|
+
function H(e) {
|
|
222
|
+
let t = e.scale;
|
|
223
|
+
if (!t) return 0;
|
|
224
|
+
let n = e.channelDef, r = n && "band" in n ? n.band ?? .5 : .5;
|
|
225
|
+
if (t.type == "band" || t.type == "point") return t.bandwidth() * r;
|
|
226
|
+
if (t.type == "index" || t.type == "locus") {
|
|
227
|
+
let e = t;
|
|
228
|
+
return Math.sign(e.step()) * e.bandwidth() * (r - e.align());
|
|
229
|
+
} else return 0;
|
|
230
|
+
}
|
|
231
|
+
function ee(e, t) {
|
|
232
|
+
return W(e(t));
|
|
233
|
+
}
|
|
234
|
+
function U(e, t) {
|
|
235
|
+
return a(t) ? e.unitView.paramRuntime.evaluateAndGet(t.expr) : t;
|
|
236
|
+
}
|
|
237
|
+
function W(e) {
|
|
238
|
+
return e == null ? "none" : "" + e;
|
|
239
|
+
}
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region ../core/src/rendering/immediate/marks/arrow.js
|
|
242
|
+
function te(e) {
|
|
243
|
+
let t = e.properties, n = U(e, t.headSpacing);
|
|
244
|
+
return {
|
|
245
|
+
configuredRHeadSlope: de(U(e, t.headAngle)),
|
|
246
|
+
configuredRHeadNotchSlope: de(U(e, t.headNotchAngle)),
|
|
247
|
+
headShape: U(e, t.headShape),
|
|
248
|
+
headWidth: U(e, t.headWidth),
|
|
249
|
+
minSize: U(e, t.minSize),
|
|
250
|
+
stem: U(e, t.stem),
|
|
251
|
+
startNotch: U(e, t.startNotch),
|
|
252
|
+
minStemLength: U(e, t.minStemLength),
|
|
253
|
+
headSpacing: n,
|
|
254
|
+
repeatHeads: n != null && n >= 0,
|
|
255
|
+
headPlacement: U(e, t.headPlacement)
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function ne(e, t, n, r) {
|
|
259
|
+
let { viewOpacity: i } = n, a = e.encoders;
|
|
260
|
+
return re(e, t, n, (e) => {
|
|
261
|
+
let n = t.stem ? oe(e.tail, e.tip, e.tangent, e.normal, e.stemHalfWidth, e.rHeadSlope, t.startNotch) : null, o = n ? [n] : [];
|
|
262
|
+
ie(e, (t, n) => {
|
|
263
|
+
let r = {
|
|
264
|
+
x: t,
|
|
265
|
+
y: n
|
|
266
|
+
};
|
|
267
|
+
o.push(e.renderedHeadShape == "open" ? se(r, e.tangent, e.normal, e.headHalfWidth, e.rHeadSlope, e.rHeadNotchSlope, e.size) : ae(r, e.tangent, e.normal, e.headHalfWidth, e.rHeadSlope, e.rHeadNotchSlope));
|
|
268
|
+
});
|
|
269
|
+
let s = W(a.stroke(e.datum)) != "none" && B(a.strokeOpacity, e.datum) * i > 0 && e.strokeWidth > 0;
|
|
270
|
+
r({
|
|
271
|
+
datum: e.datum,
|
|
272
|
+
boundaryLoops: o.length == 1 || !s ? o : S(o),
|
|
273
|
+
strokeWidth: e.strokeWidth,
|
|
274
|
+
headShapeFallback: e.headShapeFallback
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
function re(e, t, n, r) {
|
|
279
|
+
let { coords: i, data: a, visibleBounds: o, countOnly: s } = n, c = e.encoders;
|
|
280
|
+
if (a.length == 0) return 0;
|
|
281
|
+
let l = R(i, c, "x", a[0]), u = R(i, c, "y", a[0]), d = [0, 0], f = [0, 0], p = {
|
|
282
|
+
datum: {},
|
|
283
|
+
tail: {
|
|
284
|
+
x: 0,
|
|
285
|
+
y: 0
|
|
286
|
+
},
|
|
287
|
+
tip: {
|
|
288
|
+
x: 0,
|
|
289
|
+
y: 0
|
|
290
|
+
},
|
|
291
|
+
tangent: {
|
|
292
|
+
x: 0,
|
|
293
|
+
y: 0
|
|
294
|
+
},
|
|
295
|
+
normal: {
|
|
296
|
+
x: 0,
|
|
297
|
+
y: 0
|
|
298
|
+
},
|
|
299
|
+
size: 0,
|
|
300
|
+
stemHalfWidth: 0,
|
|
301
|
+
headHalfWidth: 0,
|
|
302
|
+
headAxisLength: 0,
|
|
303
|
+
rHeadSlope: 0,
|
|
304
|
+
rHeadNotchSlope: 0,
|
|
305
|
+
strokeWidth: 0,
|
|
306
|
+
repeatSpacing: Infinity,
|
|
307
|
+
headRepeatFootprint: 0,
|
|
308
|
+
geometryLength: 0,
|
|
309
|
+
stemContainsHead: !1,
|
|
310
|
+
renderedHeadShape: "triangle",
|
|
311
|
+
headShapeFallback: !1
|
|
312
|
+
}, m = 0;
|
|
313
|
+
for (let e of a) {
|
|
314
|
+
l(e, d), u(e, f);
|
|
315
|
+
let n = ee(c.direction, e) == "reverse", i = n ? d[1] : d[0], a = n ? f[1] : f[0], h = n ? d[0] : d[1], g = n ? f[0] : f[1], _ = h - i, v = g - a, y = Math.hypot(_, v);
|
|
316
|
+
if (y == 0) continue;
|
|
317
|
+
let x = _ / y, S = v / y, C = Math.max(B(c.size, e), t.minSize), w = C / 2, T = Math.max(t.headWidth * C, 0) / 2, E = ce({
|
|
318
|
+
segmentLength: y,
|
|
319
|
+
headHalfWidth: T,
|
|
320
|
+
stemHalfWidth: t.stem ? w : -w,
|
|
321
|
+
configuredRHeadSlope: t.configuredRHeadSlope,
|
|
322
|
+
configuredRHeadNotchSlope: t.configuredRHeadNotchSlope,
|
|
323
|
+
headRepeat: t.repeatHeads,
|
|
324
|
+
headPlacement: t.headPlacement,
|
|
325
|
+
startNotch: t.startNotch,
|
|
326
|
+
minStemLength: t.minStemLength,
|
|
327
|
+
headShape: t.headShape
|
|
328
|
+
}), D = t.headShape == "open" ? E : Math.min(t.configuredRHeadNotchSlope, E), O = t.headShape == "open" ? C : 0, k = t.headPlacement == "outside" ? ue(T, E, D, O) : 0, A = h + x * k, j = g + S * k, M = T * E, N = Math.hypot(T, M), P = t.headShape == "open" && N > 0 ? C * T / N : 0, F = A - x * (M + P), I = j - S * (M + P), L = B(c.strokeWidth, e), R = Math.max(t.stem ? w : 0, T) + L * 2;
|
|
329
|
+
if (!b(o, Math.min(i, A, F), Math.min(a, j, I), Math.max(i, A, F), Math.max(a, j, I), R) || (m++, s)) continue;
|
|
330
|
+
let z = t.headShape == "triangle" || t.headShape == "open" ? t.headShape : "triangle", V = M + O / Math.hypot(E, 1) + L, H = t.repeatHeads ? Math.max((t.headSpacing ?? 0) * C, V) : Infinity;
|
|
331
|
+
p.datum = e, q(p.tail, i, a), q(p.tip, A, j), q(p.tangent, x, S), q(p.normal, -S, x), p.size = C, p.stemHalfWidth = w, p.headHalfWidth = T, p.headAxisLength = M, p.rHeadSlope = E, p.rHeadNotchSlope = D, p.strokeWidth = L, p.repeatSpacing = H, p.headRepeatFootprint = V, p.geometryLength = Math.hypot(A - i, j - a), p.stemContainsHead = t.stem && z == "triangle" && !t.repeatHeads && T <= w, p.renderedHeadShape = z, p.headShapeFallback = z != t.headShape, r(p);
|
|
332
|
+
}
|
|
333
|
+
return m;
|
|
334
|
+
}
|
|
335
|
+
function ie(e, t) {
|
|
336
|
+
for (let n = 0; !e.stemContainsHead && !(n > 0 && n + e.headRepeatFootprint - e.strokeWidth / 2 > e.geometryLength || (t(e.tip.x - e.tangent.x * n, e.tip.y - e.tangent.y * n), !(e.repeatSpacing > 0) || !Number.isFinite(e.repeatSpacing))); n += e.repeatSpacing);
|
|
337
|
+
}
|
|
338
|
+
function ae(e, t, n, r, i, a) {
|
|
339
|
+
let o = r * i, s = o - r * a, c = G(G(e, K(t, -o)), K(n, r)), l = G(G(e, K(t, -o)), K(n, -r));
|
|
340
|
+
return [
|
|
341
|
+
e,
|
|
342
|
+
c,
|
|
343
|
+
G(e, K(t, -s)),
|
|
344
|
+
l
|
|
345
|
+
];
|
|
346
|
+
}
|
|
347
|
+
function oe(e, t, n, r, i, a, o) {
|
|
348
|
+
let s = i * a, c = G(G(t, K(n, -s)), K(r, i)), l = G(G(t, K(n, -s)), K(r, -i)), u = G(e, K(r, i)), d = G(e, K(r, -i));
|
|
349
|
+
return [
|
|
350
|
+
t,
|
|
351
|
+
c,
|
|
352
|
+
u,
|
|
353
|
+
...o ? [G(e, K(n, i * a))] : [],
|
|
354
|
+
d,
|
|
355
|
+
l
|
|
356
|
+
];
|
|
357
|
+
}
|
|
358
|
+
function se(e, t, n, r, i, a, o) {
|
|
359
|
+
let s = r * i, c = G(G(e, K(t, -s)), K(n, r)), l = G(G(e, K(t, -s)), K(n, -r)), u = Math.hypot(r, s), d = o * r / u, f = o * s / u, p = G(G(c, K(t, -d)), K(n, -f)), m = G(G(l, K(t, -d)), K(n, f));
|
|
360
|
+
return [
|
|
361
|
+
e,
|
|
362
|
+
c,
|
|
363
|
+
p,
|
|
364
|
+
G(e, K(t, -(s + d - (r - f) * a))),
|
|
365
|
+
m,
|
|
366
|
+
l
|
|
367
|
+
];
|
|
368
|
+
}
|
|
369
|
+
function ce({ segmentLength: e, headHalfWidth: t, stemHalfWidth: n, configuredRHeadSlope: r, configuredRHeadNotchSlope: i, headRepeat: a, headPlacement: o, startNotch: s, minStemLength: c, headShape: l }) {
|
|
370
|
+
if (a || n < 0) return r;
|
|
371
|
+
if (o == "outside") return !s || n <= 0 ? r : Math.min(r, Math.max(e - c, 0) / n);
|
|
372
|
+
if (l != "triangle") return r;
|
|
373
|
+
let u = Math.max(e - c, 0);
|
|
374
|
+
return le(n, t, r, i) <= u ? r : u < n * i ? n > 0 ? fe(u / n, 0, r) : 0 : fe((u + (t - n) * i) / t, 0, r);
|
|
375
|
+
}
|
|
376
|
+
function le(e, t, n, r) {
|
|
377
|
+
return t * n - (t - e) * Math.min(r, n);
|
|
378
|
+
}
|
|
379
|
+
function ue(e, t, n, r) {
|
|
380
|
+
if (e <= 0) return 0;
|
|
381
|
+
let i = e * t, a = Math.hypot(e, i);
|
|
382
|
+
return i + r * e / a - (e - r * i / a) * n;
|
|
383
|
+
}
|
|
384
|
+
function de(e) {
|
|
385
|
+
let t = fe(e, 1, 90) * Math.PI / 180;
|
|
386
|
+
return 1 / Math.max(Math.tan(t), 1e-6);
|
|
387
|
+
}
|
|
388
|
+
function G(e, t) {
|
|
389
|
+
return {
|
|
390
|
+
x: e.x + t.x,
|
|
391
|
+
y: e.y + t.y
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function K(e, t) {
|
|
395
|
+
return {
|
|
396
|
+
x: e.x * t,
|
|
397
|
+
y: e.y * t
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
function q(e, t, n) {
|
|
401
|
+
e.x = t, e.y = n;
|
|
402
|
+
}
|
|
403
|
+
function fe(e, t, n) {
|
|
404
|
+
return Math.min(Math.max(e, t), n);
|
|
405
|
+
}
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region ../core/src/rendering/immediate/linkFading.js
|
|
408
|
+
var pe = 4;
|
|
409
|
+
function me(e, t, n) {
|
|
410
|
+
let r = t[0] - e[0], i = t[1] - e[1], a = Math.hypot(r, i);
|
|
411
|
+
if (a == 0) return;
|
|
412
|
+
let o = -i / a, s = r / a;
|
|
413
|
+
(o < 0 || o == 0 && s < 0) && (o = -o, s = -s);
|
|
414
|
+
let c = o * e[0] + s * e[1], [l, u] = n, d = JSON.stringify([
|
|
415
|
+
J(o, 6),
|
|
416
|
+
J(s, 6),
|
|
417
|
+
J(c, 1),
|
|
418
|
+
J(l, 1),
|
|
419
|
+
J(u, 1)
|
|
420
|
+
]);
|
|
421
|
+
return {
|
|
422
|
+
normalX: o,
|
|
423
|
+
normalY: s,
|
|
424
|
+
offset: c,
|
|
425
|
+
start: l,
|
|
426
|
+
end: u,
|
|
427
|
+
key: d
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function he(e, t) {
|
|
431
|
+
let n = U(e, e.properties.arcFadingDistance);
|
|
432
|
+
if (t != "arc" && t != "dome" || n === !1 || n[0] <= 0 || n[1] <= 0) return () => !1;
|
|
433
|
+
let r = e.encoders.uniqueId && U(e, e.properties.noFadingOnPointSelection) ? ge(e) : [];
|
|
434
|
+
return (e) => !r.some((t) => t(e)) && n;
|
|
435
|
+
}
|
|
436
|
+
function ge(r) {
|
|
437
|
+
let i = new Set(Object.values(r.encoders).flatMap((e) => e.branches).map((e) => e.predicate.param).filter((e) => e));
|
|
438
|
+
return Array.from(i, (i) => {
|
|
439
|
+
let a = r.unitView.paramRuntime.findValue(i);
|
|
440
|
+
if (l(a)) return (e) => a.uniqueId != null && a.uniqueId == e.__uniqueId;
|
|
441
|
+
if (t(a)) return (e) => a.data.has(e[n]);
|
|
442
|
+
if (e(a)) {
|
|
443
|
+
let e = Object.entries(a.intervals).map(([e, t]) => {
|
|
444
|
+
if (e != "x" && e != "y") throw Error(`Unsupported link selection channel: ${e}`);
|
|
445
|
+
let n = r.encoders[e], i = r.encoders[o(e)];
|
|
446
|
+
return {
|
|
447
|
+
interval: t,
|
|
448
|
+
start: s(n) ?? n.branches[0].accessor,
|
|
449
|
+
end: s(i) ?? i.branches[0].accessor
|
|
450
|
+
};
|
|
451
|
+
});
|
|
452
|
+
return (t) => e.every(({ interval: e, start: n, end: r }) => {
|
|
453
|
+
if (!e) return !1;
|
|
454
|
+
let i = +n(t), a = +r(t);
|
|
455
|
+
return e[0] <= i && i <= e[1] || e[0] <= a && a <= e[1];
|
|
456
|
+
});
|
|
457
|
+
} else throw Error(`Unsupported link selection type: ${a.type}`);
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
function _e(e, t) {
|
|
461
|
+
let n = [], r = (r) => {
|
|
462
|
+
for (let i = 0; i <= pe; i++) {
|
|
463
|
+
let a = i / pe, o = r ? t + (e - t) * a : e + (t - e) * a, s = r ? (t - o) / (2 * t) : (t + o) / (2 * t), c = (o - e) / (t - e);
|
|
464
|
+
n.push({
|
|
465
|
+
offset: s,
|
|
466
|
+
opacity: 1 - ve(c)
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
return r(!0), r(!1), n;
|
|
471
|
+
}
|
|
472
|
+
function ve(e) {
|
|
473
|
+
let t = Math.max(0, Math.min(1, e));
|
|
474
|
+
return t * t * (3 - 2 * t);
|
|
475
|
+
}
|
|
476
|
+
function J(e, t) {
|
|
477
|
+
let n = 10 ** t;
|
|
478
|
+
return Math.round(e * n) / n;
|
|
479
|
+
}
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region ../core/src/rendering/immediate/geometry/linkGeometry.js
|
|
482
|
+
function ye(e, t, n, r) {
|
|
483
|
+
if (r.shape == "arc") {
|
|
484
|
+
let i = [...e], a = [...t], o = X(a, i), s = Ce(o);
|
|
485
|
+
if (s == 0) return [
|
|
486
|
+
i,
|
|
487
|
+
i,
|
|
488
|
+
a,
|
|
489
|
+
a
|
|
490
|
+
];
|
|
491
|
+
let c = Z(o, 1 / s), l = [-c[1], c[0]];
|
|
492
|
+
s = be(i, a, s, r.maxChordLength, n);
|
|
493
|
+
let u = Z(l, Math.max(s / 2 * r.arcHeightFactor, r.minArcHeight) / .75);
|
|
494
|
+
return [
|
|
495
|
+
i,
|
|
496
|
+
Y(i, u),
|
|
497
|
+
Y(a, u),
|
|
498
|
+
a
|
|
499
|
+
];
|
|
500
|
+
} else if (r.shape == "dome") {
|
|
501
|
+
let i, a, o;
|
|
502
|
+
r.orient == "vertical" ? (i = [Math.min(e[0], t[0]), t[1]], a = [Math.max(e[0], t[0]), t[1]], o = [0, e[1] - t[1]]) : (i = [t[0], Math.min(e[1], t[1])], a = [t[0], Math.max(e[1], t[1])], o = [e[0] - t[0], 0]);
|
|
503
|
+
let s = Ce(X(a, i));
|
|
504
|
+
be(i, a, s, r.maxChordLength, n), r.clampApex && xe(i, a, r.orient, n);
|
|
505
|
+
let c = Z(o, 1 / .75);
|
|
506
|
+
return [
|
|
507
|
+
i,
|
|
508
|
+
Y(i, c),
|
|
509
|
+
Y(a, c),
|
|
510
|
+
a
|
|
511
|
+
];
|
|
512
|
+
} else if (r.shape == "diagonal") if (r.orient == "vertical") {
|
|
513
|
+
let n = (e[1] + t[1]) / 2;
|
|
514
|
+
return [
|
|
515
|
+
e,
|
|
516
|
+
[e[0], n],
|
|
517
|
+
[t[0], n],
|
|
518
|
+
t
|
|
519
|
+
];
|
|
520
|
+
} else {
|
|
521
|
+
let n = (e[0] + t[0]) / 2;
|
|
522
|
+
return [
|
|
523
|
+
e,
|
|
524
|
+
[n, e[1]],
|
|
525
|
+
[n, t[1]],
|
|
526
|
+
t
|
|
527
|
+
];
|
|
528
|
+
}
|
|
529
|
+
else if (r.shape == "line") {
|
|
530
|
+
let n = Z(Y(e, t), .5);
|
|
531
|
+
return [
|
|
532
|
+
e,
|
|
533
|
+
n,
|
|
534
|
+
n,
|
|
535
|
+
t
|
|
536
|
+
];
|
|
537
|
+
} else throw Error(`Unsupported link shape: ${r.shape}`);
|
|
538
|
+
}
|
|
539
|
+
function be(e, t, n, r, i) {
|
|
540
|
+
if (n <= r) return n;
|
|
541
|
+
let a = Z(X(t, e), 1 / n);
|
|
542
|
+
return Se(e, i, 2) ? (we(t, Y(e, Z(a, r))), r) : Se(t, i, 2) ? (we(e, X(t, Z(a, r))), r) : n;
|
|
543
|
+
}
|
|
544
|
+
function xe(e, t, n, r) {
|
|
545
|
+
n == "vertical" ? (t[0] > 0 && (e[0] = Math.max(e[0], -t[0])), e[0] < r.width && (t[0] = Math.min(t[0], 2 * r.width - e[0]))) : (t[1] > 0 && (e[1] = Math.max(e[1], -t[1])), e[1] < r.height && (t[1] = Math.min(t[1], 2 * r.height - e[1])));
|
|
546
|
+
}
|
|
547
|
+
function Se(e, t, n) {
|
|
548
|
+
return e[0] >= -t.width * n && e[0] <= t.width * (1 + n) && e[1] >= -t.height * n && e[1] <= t.height * (1 + n);
|
|
549
|
+
}
|
|
550
|
+
function Y(e, t) {
|
|
551
|
+
return [e[0] + t[0], e[1] + t[1]];
|
|
552
|
+
}
|
|
553
|
+
function X(e, t) {
|
|
554
|
+
return [e[0] - t[0], e[1] - t[1]];
|
|
555
|
+
}
|
|
556
|
+
function Z(e, t) {
|
|
557
|
+
return [e[0] * t, e[1] * t];
|
|
558
|
+
}
|
|
559
|
+
function Ce(e) {
|
|
560
|
+
return Math.hypot(e[0], e[1]);
|
|
561
|
+
}
|
|
562
|
+
function we(e, t) {
|
|
563
|
+
e[0] = t[0], e[1] = t[1];
|
|
564
|
+
}
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region ../core/src/rendering/immediate/marks/link.js
|
|
567
|
+
function Te(e) {
|
|
568
|
+
let t = e.properties;
|
|
569
|
+
return {
|
|
570
|
+
shape: U(e, t.linkShape),
|
|
571
|
+
orient: U(e, t.orient),
|
|
572
|
+
arcHeightFactor: U(e, t.arcHeightFactor),
|
|
573
|
+
minArcHeight: U(e, t.minArcHeight),
|
|
574
|
+
maxChordLength: U(e, t.maxChordLength),
|
|
575
|
+
clampApex: U(e, t.clampApex)
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
function Ee(e, t, n, r) {
|
|
579
|
+
let { coords: i, data: a, visibleBounds: o } = n, s = e.encoders;
|
|
580
|
+
if (a.length == 0) return 0;
|
|
581
|
+
let c = R(i, s, "x", a[0]), l = R(i, s, "y", a[0]), u = [0, 0], d = [0, 0], f = i.x, p = i.y, m = {
|
|
582
|
+
width: i.width,
|
|
583
|
+
height: i.height
|
|
584
|
+
}, h = p + m.height, g = 0;
|
|
585
|
+
for (let e of a) {
|
|
586
|
+
c(e, u), l(e, d);
|
|
587
|
+
let [n, i] = u, [a, p] = d, _ = ye([n - f, h - a], [i - f, h - p], m, t);
|
|
588
|
+
for (let e of _) e[0] += f, e[1] = h - e[1];
|
|
589
|
+
let [v, y, x, S] = _, C = B(s.size, e);
|
|
590
|
+
b(o, Math.min(v[0], y[0], x[0], S[0]), Math.min(v[1], y[1], x[1], S[1]), Math.max(v[0], y[0], x[0], S[0]), Math.max(v[1], y[1], x[1], S[1]), C / 2) && (g++, r({
|
|
591
|
+
datum: e,
|
|
592
|
+
points: _,
|
|
593
|
+
strokeWidth: C
|
|
594
|
+
}));
|
|
595
|
+
}
|
|
596
|
+
return g;
|
|
597
|
+
}
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region ../core/src/rendering/immediate/marks/point.js
|
|
600
|
+
function De(e) {
|
|
601
|
+
return { inwardStroke: U(e, e.properties.inwardStroke) };
|
|
602
|
+
}
|
|
603
|
+
function Oe(e, t, n, r) {
|
|
604
|
+
let { coords: i, data: a, visibleBounds: o, anchorCullBounds: s } = n, c = n.start ?? 0, l = n.end ?? a.length, u = e.encoders;
|
|
605
|
+
if (c === l) return 0;
|
|
606
|
+
let d = R(i, u, "x", a[c]), f = R(i, u, "y", a[c]), p = [0, 0], m = [0, 0], h = e.getSemanticThreshold(), g = {
|
|
607
|
+
datum: {},
|
|
608
|
+
shape: "circle",
|
|
609
|
+
x: 0,
|
|
610
|
+
y: 0,
|
|
611
|
+
geometryRadius: 0,
|
|
612
|
+
boundsRadius: 0,
|
|
613
|
+
angle: 0,
|
|
614
|
+
strokeWidth: 0,
|
|
615
|
+
lineShape: !1
|
|
616
|
+
}, _ = 0;
|
|
617
|
+
for (let e = c; e < l; e++) {
|
|
618
|
+
let n = a[e];
|
|
619
|
+
if (B(u.semanticScore, n) < h) continue;
|
|
620
|
+
d(n, p), f(n, m);
|
|
621
|
+
let i = p[0] + B(u.dx, n), c = m[0] - B(u.dy, n);
|
|
622
|
+
if (y(s, i, c)) continue;
|
|
623
|
+
let l = Math.sqrt(B(u.size, n)) / 2;
|
|
624
|
+
if (t.inwardStroke && l <= 0) continue;
|
|
625
|
+
let v = ee(u.shape, n), x = B(u.strokeWidth, n), S = v == "x" || v == "+", C = t.inwardStroke && !S ? Math.min(x, l) : x, w = t.inwardStroke && !S ? l - C / 2 : l, T = t.inwardStroke ? 0 : x / 2, E = l * Math.SQRT2 + T;
|
|
626
|
+
b(o, i - E, c - E, i + E, c + E) && (_++, g.datum = n, g.shape = v, g.x = i, g.y = c, g.geometryRadius = w, g.boundsRadius = E, g.angle = B(u.angle, n), g.strokeWidth = C, g.lineShape = S, r(g));
|
|
627
|
+
}
|
|
628
|
+
return _;
|
|
629
|
+
}
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region ../core/src/rendering/immediate/geometry/pointPath.js
|
|
632
|
+
function ke(e, t, n, r, i) {
|
|
633
|
+
let a = r * .4, o = r * .15, s = Math.sqrt(3) * r / 2;
|
|
634
|
+
switch (e) {
|
|
635
|
+
case "diamond": return i.moveTo(t, n - r), i.lineTo(t + r, n), i.lineTo(t, n + r), i.lineTo(t - r, n), i.closePath(), !0;
|
|
636
|
+
case "cross": return i.moveTo(t - a, n - r), i.lineTo(t + a, n - r), i.lineTo(t + a, n - a), i.lineTo(t + r, n - a), i.lineTo(t + r, n + a), i.lineTo(t + a, n + a), i.lineTo(t + a, n + r), i.lineTo(t - a, n + r), i.lineTo(t - a, n + a), i.lineTo(t - r, n + a), i.lineTo(t - r, n - a), i.lineTo(t - a, n - a), i.closePath(), !0;
|
|
637
|
+
case "triangle-up": return i.moveTo(t, n - s), i.lineTo(t + r, n + s), i.lineTo(t - r, n + s), i.closePath(), !0;
|
|
638
|
+
case "triangle-right": return i.moveTo(t + s, n), i.lineTo(t - s, n + r), i.lineTo(t - s, n - r), i.closePath(), !0;
|
|
639
|
+
case "triangle-down": return i.moveTo(t, n + s), i.lineTo(t - r, n - s), i.lineTo(t + r, n - s), i.closePath(), !0;
|
|
640
|
+
case "triangle-left": return i.moveTo(t - s, n), i.lineTo(t + s, n - r), i.lineTo(t + s, n + r), i.closePath(), !0;
|
|
641
|
+
case "tick-up": return Q(i, t - o, n - r, t + o, n), !0;
|
|
642
|
+
case "tick-right": return Q(i, t, n - o, t + r, n + o), !0;
|
|
643
|
+
case "tick-down": return Q(i, t - o, n, t + o, n + r), !0;
|
|
644
|
+
case "tick-left": return Q(i, t - r, n - o, t, n + o), !0;
|
|
645
|
+
case "+": return i.moveTo(t - r, n), i.lineTo(t + r, n), i.moveTo(t, n - r), i.lineTo(t, n + r), !0;
|
|
646
|
+
case "x": return i.moveTo(t - r, n - r), i.lineTo(t + r, n + r), i.moveTo(t + r, n - r), i.lineTo(t - r, n + r), !0;
|
|
647
|
+
default: return !1;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
function Q(e, t, n, r, i) {
|
|
651
|
+
e.moveTo(t, n), e.lineTo(r, n), e.lineTo(r, i), e.lineTo(t, i), e.closePath();
|
|
652
|
+
}
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region ../core/src/rendering/immediate/marks/rect.js
|
|
655
|
+
var Ae = .1;
|
|
656
|
+
function je(e) {
|
|
657
|
+
let t = e.properties, n = U(e, t.cornerRadius), r = {
|
|
658
|
+
topLeft: U(e, t.cornerRadiusTopLeft ?? n),
|
|
659
|
+
topRight: U(e, t.cornerRadiusTopRight ?? n),
|
|
660
|
+
bottomRight: U(e, t.cornerRadiusBottomRight ?? n),
|
|
661
|
+
bottomLeft: U(e, t.cornerRadiusBottomLeft ?? n)
|
|
662
|
+
}, i = {
|
|
663
|
+
blur: U(e, t.shadowBlur ?? 0),
|
|
664
|
+
color: U(e, t.shadowColor ?? "black"),
|
|
665
|
+
offsetX: U(e, t.shadowOffsetX ?? 0),
|
|
666
|
+
offsetY: U(e, t.shadowOffsetY ?? 0),
|
|
667
|
+
opacity: U(e, t.shadowOpacity ?? 0)
|
|
668
|
+
}, a = U(e, t.hatch ?? "none"), o = !Fe(r);
|
|
669
|
+
return {
|
|
670
|
+
cornerRadii: r,
|
|
671
|
+
minWidth: U(e, t.minWidth),
|
|
672
|
+
minHeight: U(e, t.minHeight),
|
|
673
|
+
minOpacity: U(e, t.minOpacity),
|
|
674
|
+
shadow: i,
|
|
675
|
+
hatch: a,
|
|
676
|
+
hasCornerRadii: o,
|
|
677
|
+
canPadSeams: a == "none" && i.opacity == 0 && !o
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
function Me(e, t, n, r) {
|
|
681
|
+
let { coords: i, data: a, visibleBounds: o, viewOpacity: s } = n, c = n.start ?? 0, l = n.end ?? a.length, u = e.encoders;
|
|
682
|
+
if (c === l) return 0;
|
|
683
|
+
let d = u.strokeWidth.constant, f = u.fillOpacity.constant, p = d ? B(u.strokeWidth, a[c]) : 0, m = f ? B(u.fillOpacity, a[c]) : 0, h = u.fill.constant, g = h ? W(u.fill(a[c])) : "none", _ = t.shadow.opacity > 0 ? t.shadow.blur + Math.max(Math.abs(t.shadow.offsetX), Math.abs(t.shadow.offsetY)) : 0, v = R(i, u, "x", a[c]), y = R(i, u, "y", a[c]), x = [0, 0], S = [0, 0], C = {
|
|
684
|
+
datum: {},
|
|
685
|
+
x: 0,
|
|
686
|
+
y: 0,
|
|
687
|
+
width: 0,
|
|
688
|
+
height: 0,
|
|
689
|
+
radii: {
|
|
690
|
+
topLeft: 0,
|
|
691
|
+
topRight: 0,
|
|
692
|
+
bottomRight: 0,
|
|
693
|
+
bottomLeft: 0
|
|
694
|
+
},
|
|
695
|
+
opacityFactor: 1,
|
|
696
|
+
strokeWidth: 0,
|
|
697
|
+
fill: "none",
|
|
698
|
+
fillOpacity: 0
|
|
699
|
+
}, w = 0;
|
|
700
|
+
for (let e = c; e < l; e++) {
|
|
701
|
+
let n = a[e];
|
|
702
|
+
v(n, x), y(n, S);
|
|
703
|
+
let i = Math.min(x[0], x[1]), c = Math.min(S[0], S[1]), l = Math.abs(x[1] - x[0]), T = Math.abs(S[1] - S[0]), E = Ne(l, t.minWidth), D = Ne(T, t.minHeight), O = Math.max(t.minOpacity, E * D);
|
|
704
|
+
l < t.minWidth && (i -= (t.minWidth - l) / 2, l = t.minWidth), T < t.minHeight && (c -= (t.minHeight - T) / 2, T = t.minHeight);
|
|
705
|
+
let k = d ? p : B(u.strokeWidth, n), A = h ? g : W(u.fill(n)), j = (f ? m : B(u.fillOpacity, n)) * s, M = k == 0 && j == 1 && O == 1 && t.canPadSeams && A != "none" ? Ae : 0;
|
|
706
|
+
M && (i -= M, c -= M, l += M * 2, T += M * 2), b(o, i, c, i + l, c + T, k / 2 + _) && (w++, C.datum = n, C.x = i, C.y = c, C.width = l, C.height = T, C.opacityFactor = O, C.strokeWidth = k, C.fill = A, C.fillOpacity = j, t.hasCornerRadii && Pe(t.cornerRadii, l, T, C.radii), r(C));
|
|
707
|
+
}
|
|
708
|
+
return w;
|
|
709
|
+
}
|
|
710
|
+
function Ne(e, t) {
|
|
711
|
+
return t > 0 && e < t ? e / t : 1;
|
|
712
|
+
}
|
|
713
|
+
function Pe(e, t, n, r) {
|
|
714
|
+
let i = Math.min(t, n) / 2;
|
|
715
|
+
r.topLeft = Math.max(0, Math.min(e.topLeft, i)), r.topRight = Math.max(0, Math.min(e.topRight, i)), r.bottomRight = Math.max(0, Math.min(e.bottomRight, i)), r.bottomLeft = Math.max(0, Math.min(e.bottomLeft, i));
|
|
716
|
+
}
|
|
717
|
+
function Fe(e) {
|
|
718
|
+
return e.topLeft == 0 && e.topRight == 0 && e.bottomRight == 0 && e.bottomLeft == 0;
|
|
719
|
+
}
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region ../core/src/rendering/immediate/marks/rule.js
|
|
722
|
+
function Ie(e) {
|
|
723
|
+
return { minLength: U(e, e.properties.minLength) };
|
|
724
|
+
}
|
|
725
|
+
function Le(e, t, n, r) {
|
|
726
|
+
let { coords: i, data: a, visibleBounds: o } = n, s = e.encoders;
|
|
727
|
+
if (a.length == 0) return 0;
|
|
728
|
+
let c = R(i, s, "x", a[0]), l = R(i, s, "y", a[0]), u = [0, 0], d = [0, 0], f = {
|
|
729
|
+
datum: {},
|
|
730
|
+
x1: 0,
|
|
731
|
+
y1: 0,
|
|
732
|
+
x2: 0,
|
|
733
|
+
y2: 0,
|
|
734
|
+
strokeWidth: 0
|
|
735
|
+
}, p = 0;
|
|
736
|
+
for (let e of a) {
|
|
737
|
+
c(e, u), l(e, d);
|
|
738
|
+
let [n, i] = u, [a, m] = d, h = i - n, g = m - a, _ = Math.hypot(h, g);
|
|
739
|
+
if (_ > 0 && _ < t.minLength) {
|
|
740
|
+
let e = (t.minLength - _) / 2, r = h / _, o = g / _;
|
|
741
|
+
n -= r * e, a -= o * e, i += r * e, m += o * e;
|
|
742
|
+
}
|
|
743
|
+
let v = B(s.size, e);
|
|
744
|
+
b(o, n, a, i, m, v / 2) && (p++, f.datum = e, f.x1 = n, f.y1 = a, f.x2 = i, f.y2 = m, f.strokeWidth = v, r(f));
|
|
745
|
+
}
|
|
746
|
+
return p;
|
|
747
|
+
}
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region ../core/src/rendering/immediate/marks/text.js
|
|
750
|
+
function Re(e) {
|
|
751
|
+
let t = e.properties;
|
|
752
|
+
return {
|
|
753
|
+
align: U(e, t.align),
|
|
754
|
+
baseline: U(e, t.baseline),
|
|
755
|
+
logoLetters: U(e, t.logoLetters),
|
|
756
|
+
paddingX: U(e, t.paddingX),
|
|
757
|
+
paddingY: U(e, t.paddingY),
|
|
758
|
+
flushX: U(e, t.flushX),
|
|
759
|
+
flushY: U(e, t.flushY),
|
|
760
|
+
squeeze: U(e, t.squeeze),
|
|
761
|
+
dx: U(e, t.dx),
|
|
762
|
+
dy: U(e, t.dy)
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
function ze(e, t, n, a) {
|
|
766
|
+
let { coords: o, data: s, visibleBounds: l, anchorCullBounds: u } = n, { align: d, baseline: f } = t, p = e.encoders;
|
|
767
|
+
if (s.length == 0) return 0;
|
|
768
|
+
let m = p.size.constant ? B(p.size, s[0]) : 0, h = p.angle.constant ? B(p.angle, s[0]) : 0, g = R(o, p, "x", s[0]), _ = R(o, p, "y", s[0]), v = e.encoding.text, b = "format" in v ? c(v.format) : (e) => e, x = [0, 0], S = [0, 0], C = {
|
|
769
|
+
width: 0,
|
|
770
|
+
height: 0
|
|
771
|
+
}, w = {
|
|
772
|
+
x: 0,
|
|
773
|
+
y: 0
|
|
774
|
+
}, T = {
|
|
775
|
+
position: 0,
|
|
776
|
+
scale: 0
|
|
777
|
+
}, E = {
|
|
778
|
+
width: 0,
|
|
779
|
+
heightScale: 0
|
|
780
|
+
}, D = Array(8).fill(0), O = {
|
|
781
|
+
datum: {},
|
|
782
|
+
text: "",
|
|
783
|
+
x: 0,
|
|
784
|
+
y: 0,
|
|
785
|
+
size: 0,
|
|
786
|
+
width: 0,
|
|
787
|
+
angle: 0,
|
|
788
|
+
dx: t.dx,
|
|
789
|
+
dy: t.dy,
|
|
790
|
+
fadeOpacity: 1,
|
|
791
|
+
scale: 1,
|
|
792
|
+
logoScale: void 0,
|
|
793
|
+
multiCharacterLogo: !1,
|
|
794
|
+
boundsQuad: D
|
|
795
|
+
}, k = !!p.x2, A = !!p.y2, j = 0;
|
|
796
|
+
for (let n of s) {
|
|
797
|
+
let s = b(p.text(n)), c = r(s) ? s : s === null ? "" : "" + s;
|
|
798
|
+
if (!c) continue;
|
|
799
|
+
g(n, x), _(n, S);
|
|
800
|
+
let [v, M] = x, [N, P] = S, F = p.size.constant ? m : B(p.size, n), I = p.angle.constant ? h : B(p.angle, n);
|
|
801
|
+
if (t.logoLetters) {
|
|
802
|
+
let r = F, i = F;
|
|
803
|
+
if (k && (r = M - v, v = (v + M) / 2), A && (i = N - P, N = (N + P) / 2), Be(D, v, N, Math.abs(r), Math.abs(i), "center", "middle", I, t.dx, t.dy), !r || !i || y(u, v, N) || !Ve(l, D)) continue;
|
|
804
|
+
let o = e.font.metrics.getChar(c[0]), s = i * e.font.metrics.common.base * (o.height + 10) / (o.height * o.height);
|
|
805
|
+
j++, O.datum = n, O.text = c, O.x = v, O.y = N, O.size = 1, O.width = 1, O.angle = I, O.fadeOpacity = 1, O.scale = 1, E.width = r, E.heightScale = s, O.logoScale = E, O.multiCharacterLogo = c.length > 1, a(O);
|
|
806
|
+
continue;
|
|
807
|
+
}
|
|
808
|
+
let L = e.font.metrics.measureWidth(c, F);
|
|
809
|
+
He(L, F, I, C), k || A ? We(d, f, I, w) : (w.x = Ge[d], w.y = Ke[f]);
|
|
810
|
+
let R = 1;
|
|
811
|
+
if (k && (Ue(Math.min(v, M), Math.max(v, M), C.width, t.paddingX, w.x, t.flushX, o.x, o.x2, T), v = T.position, R *= T.scale), A && (Ue(Math.min(N, P), Math.max(N, P), C.height * R, t.paddingY, w.y, t.flushY, o.y, o.y2, T), N = T.position, R *= T.scale), y(u, v, N)) continue;
|
|
812
|
+
let z = 1;
|
|
813
|
+
if (R < 1) {
|
|
814
|
+
if (!t.squeeze || R < 3 / F) continue;
|
|
815
|
+
z = i(3 / F, 6 / F, R);
|
|
816
|
+
}
|
|
817
|
+
let V = F * R, H = L * R;
|
|
818
|
+
Be(D, v, N, H, V, d, f, I, t.dx, t.dy), Ve(l, D) && (j++, O.datum = n, O.text = c, O.x = v, O.y = N, O.size = V, O.width = H, O.angle = I, O.fadeOpacity = z, O.scale = R, O.logoScale = void 0, O.multiCharacterLogo = !1, a(O));
|
|
819
|
+
}
|
|
820
|
+
return j;
|
|
821
|
+
}
|
|
822
|
+
function Be(e, t, n, r, i, a, o, s, c, l) {
|
|
823
|
+
let u = t + c - (Ge[a] + 1) / 2 * r, d = n + l - (Ke[o] + 1) / 2 * i, f = u + r, p = d + i, m = s * Math.PI / 180, h = Math.sin(m), g = Math.cos(m);
|
|
824
|
+
return $(e, 0, t, n, u, d, h, g), $(e, 2, t, n, f, d, h, g), $(e, 4, t, n, f, p, h, g), $(e, 6, t, n, u, p, h, g), e;
|
|
825
|
+
}
|
|
826
|
+
function Ve(e, t) {
|
|
827
|
+
return b(e, Math.min(t[0], t[2], t[4], t[6]), Math.min(t[1], t[3], t[5], t[7]), Math.max(t[0], t[2], t[4], t[6]), Math.max(t[1], t[3], t[5], t[7]), 1);
|
|
828
|
+
}
|
|
829
|
+
function $(e, t, n, r, i, a, o, s) {
|
|
830
|
+
e[t] = n + (i - n) * s - (a - r) * o, e[t + 1] = r + (i - n) * o + (a - r) * s;
|
|
831
|
+
}
|
|
832
|
+
function He(e, t, n, r) {
|
|
833
|
+
let i = n * Math.PI / 180, a = Math.abs(Math.sin(i)), o = Math.abs(Math.cos(i));
|
|
834
|
+
r.width = e * o + t * a, r.height = e * a + t * o;
|
|
835
|
+
}
|
|
836
|
+
function Ue(e, t, n, r, i, a, o, s, c) {
|
|
837
|
+
let l = t - e, u = n + 2 * r;
|
|
838
|
+
if (e > s || t < o) {
|
|
839
|
+
c.position = 0, c.scale = 0;
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
let d = Math.max(0, l - u), f;
|
|
843
|
+
if (i == 0) {
|
|
844
|
+
let n = e + t;
|
|
845
|
+
if (a) {
|
|
846
|
+
let e = Math.max(0, 2 * o + u - n);
|
|
847
|
+
n += Math.min(e, d);
|
|
848
|
+
let t = Math.max(0, u + n - 2 * s);
|
|
849
|
+
n -= Math.min(t, d);
|
|
850
|
+
}
|
|
851
|
+
f = n / 2;
|
|
852
|
+
} else if (i < 0) {
|
|
853
|
+
let t = e;
|
|
854
|
+
a && (t += Math.min(Math.max(0, o - t), d)), f = t + r;
|
|
855
|
+
} else {
|
|
856
|
+
let e = t;
|
|
857
|
+
a && (e -= Math.min(Math.max(0, e - s), d)), f = e - r;
|
|
858
|
+
}
|
|
859
|
+
c.position = f, c.scale = Math.max(0, Math.min(1, (l - r) / u));
|
|
860
|
+
}
|
|
861
|
+
function We(e, t, n, r) {
|
|
862
|
+
let i = Ge[e], a = -Ke[t], o = ((n + 45) % 360 + 360) % 360, s, c;
|
|
863
|
+
o < 90 ? (s = i, c = a) : o < 180 ? (s = a, c = -i) : o < 270 ? (s = -i, c = a) : (s = -a, c = i), r.x = s, r.y = -c;
|
|
864
|
+
}
|
|
865
|
+
var Ge = {
|
|
866
|
+
left: -1,
|
|
867
|
+
center: 0,
|
|
868
|
+
right: 1
|
|
869
|
+
}, Ke = {
|
|
870
|
+
top: -1,
|
|
871
|
+
middle: 0,
|
|
872
|
+
bottom: 1,
|
|
873
|
+
alphabetic: 1,
|
|
874
|
+
baseline: 1
|
|
875
|
+
}, qe = {
|
|
876
|
+
thin: 100,
|
|
877
|
+
light: 300,
|
|
878
|
+
regular: 400,
|
|
879
|
+
normal: 400,
|
|
880
|
+
medium: 500,
|
|
881
|
+
bold: 700,
|
|
882
|
+
black: 900
|
|
883
|
+
};
|
|
884
|
+
function Je(e) {
|
|
885
|
+
return typeof e == "number" ? e : qe[e];
|
|
886
|
+
}
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region ../core/src/rendering/nativeText.js
|
|
889
|
+
var Ye = [
|
|
890
|
+
"Lato",
|
|
891
|
+
"Avenir Next",
|
|
892
|
+
"Avenir",
|
|
893
|
+
"Segoe UI",
|
|
894
|
+
"Ubuntu",
|
|
895
|
+
"Noto Sans",
|
|
896
|
+
"Helvetica Neue",
|
|
897
|
+
"Helvetica",
|
|
898
|
+
"Arial",
|
|
899
|
+
"sans-serif"
|
|
900
|
+
], Xe = /* @__PURE__ */ new Set([
|
|
901
|
+
"serif",
|
|
902
|
+
"sans-serif",
|
|
903
|
+
"monospace",
|
|
904
|
+
"cursive",
|
|
905
|
+
"fantasy",
|
|
906
|
+
"system-ui",
|
|
907
|
+
"ui-serif",
|
|
908
|
+
"ui-sans-serif",
|
|
909
|
+
"ui-monospace",
|
|
910
|
+
"ui-rounded",
|
|
911
|
+
"emoji",
|
|
912
|
+
"math",
|
|
913
|
+
"fangsong"
|
|
914
|
+
]);
|
|
915
|
+
function Ze(e) {
|
|
916
|
+
let t = e ?? "Lato";
|
|
917
|
+
return [t, ...Ye.filter((e) => e.toLowerCase() != t.toLowerCase())].map($e).join(", ");
|
|
918
|
+
}
|
|
919
|
+
function Qe(e, t) {
|
|
920
|
+
switch (e) {
|
|
921
|
+
case "top": return .79 * t;
|
|
922
|
+
case "middle": return .35 * t;
|
|
923
|
+
case "bottom": return -.21 * t;
|
|
924
|
+
case "alphabetic":
|
|
925
|
+
case "baseline": return 0;
|
|
926
|
+
default: throw Error(`Unknown text baseline: ${e}`);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
function $e(e) {
|
|
930
|
+
let t = e.toLowerCase();
|
|
931
|
+
return Xe.has(t) ? t : `'${e.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
932
|
+
}
|
|
933
|
+
//#endregion
|
|
934
|
+
export { b as A, I as C, _ as D, W as E, m as M, g as O, B as S, U as T, me as _, ze as a, ne as b, je as c, De as d, Oe as f, he as g, _e as h, Re as i, f as j, v as k, Me as l, Ee as m, Qe as n, Ie as o, Te as p, Je as r, Le as s, Ze as t, ke as u, te as v, L as w, re as x, ie as y };
|