@genome-spy/app 0.84.0 → 0.86.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-DHXYZVvQ.js → agentApi-DgopQbMV.js} +5804 -7009
- package/dist/agentApi.es.js +2823 -2594
- package/dist/agentShared.es.js +15 -14
- package/dist/canvas2d-8uxuN_vx.js +619 -0
- package/dist/canvas2d-BtQC7Xr8.js +619 -0
- package/dist/canvasSizeHelper-7h_8rOcx.js +56 -0
- package/dist/clipOptions-BQfNhxgP.js +2239 -0
- package/dist/clipOptions-taFzEljc.js +2259 -0
- package/dist/{debug-aHQsa6hU.js → debug-Bzc3SoRg.js} +8 -8
- package/dist/{debug-D6FqxKEj.js → debug-D_VtWQ6l.js} +8 -8
- package/dist/{esm-CGLz7idZ.js → esm-BA6yMcc-.js} +438 -434
- package/dist/{esm-D8vvQAP3.js → esm-CcDLRSvC.js} +33 -33
- package/dist/{esm-BeV56E_5.js → esm-CfYZhLHN.js} +33 -33
- package/dist/{esm-DQ3lJSQN.js → esm-JAiZmFIS.js} +1 -1
- package/dist/index.es.js +3067 -2987
- package/dist/index.js +2030 -2022
- package/dist/indexer-qiFctgR3.js +72 -0
- package/dist/indexer-qy_dq5l5.js +72 -0
- package/dist/layoutResult-D50MSHXR.js +97 -0
- package/dist/nativeText-DFV5XIx8.js +860 -0
- package/dist/nativeText-vT3AWE14.js +860 -0
- package/dist/performanceProfiler-CPLEjApa.js +20 -0
- package/dist/rasterExport-B8pVoOsj.js +44 -0
- package/dist/rasterExport-C4r4xjQT.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-BQrRWp2Z.js +271 -0
- package/dist/renderCanvas2D-CHVNfIUz.js +271 -0
- package/dist/schema.json +1559 -219
- package/dist/style.css +1 -1
- package/dist/svg-C-Sw6E6G.js +1167 -0
- package/dist/svg-CKHwwKRt.js +1167 -0
- package/dist/{svgNumber-C6aRPc8Z.js → svgNumber-DNxESJQB.js} +1 -1
- package/dist/svgRasterizer-BgD72AmG.js +40 -0
- package/dist/svgRasterizer-BgSNqI3L.js +40 -0
- package/dist/vega-scale-CK0_al6O.js +2700 -0
- package/dist/vega-scale-D46-iCaL.js +2700 -0
- package/dist/viewError-BiR9VCgL.js +29 -0
- package/dist/{viewIdentityRegistry-Dl7rR4Ay.js → viewIdentityRegistry-B-VGlez1.js} +1 -1
- package/dist/{viewIdentityRegistry-AEQpJTDm.js → viewIdentityRegistry-CDtVktJD.js} +1 -1
- package/dist/viewSelectors-CKfxF_LM.js +1817 -0
- package/dist/viewSelectors-D_imtq5Z.js +1817 -0
- package/dist/viewUtils-nCJ7AoaI.js +5782 -0
- package/dist/warning-CpIIpk8e.js +7 -0
- package/dist/webgl-BaA3jSa2.js +4128 -0
- package/dist/webgl-FP-4EsBL.js +4128 -0
- package/package.json +7 -6
- package/dist/bmFontMetrics-CuNB-kNN.js +0 -31
- package/dist/clipOptions-Dqco1p8b.js +0 -377
- package/dist/framebufferReadback-Bje9lHb7.js +0 -1993
- package/dist/framebufferReadback-CC0D6Haw.js +0 -147
- package/dist/raster-9uKYMjHZ.js +0 -53
- package/dist/raster-BofBWXbe.js +0 -54
- package/dist/svg-CvsT1Y2V.js +0 -1793
- package/dist/svg-DRgWfcsL.js +0 -1793
- package/dist/twgl-full.module-BNEMlXRV.js +0 -1849
- package/dist/viewRenderingContext-HtpqwS_x.js +0 -120
- package/dist/viewSelectors-BhW4mTR1.js +0 -6386
- package/dist/viewSelectors-Bwzj10Qz.js +0 -6363
- package/dist/viewUtils-DMNiWslc.js +0 -7228
|
@@ -0,0 +1,860 @@
|
|
|
1
|
+
import { Ct as e, Ft as t, Xt as n, it as r } from "./clipOptions-BQfNhxgP.js";
|
|
2
|
+
import { t as i } from "./rectangle-DKnrAmKs.js";
|
|
3
|
+
//#region ../core/src/rendering/immediate/markData.js
|
|
4
|
+
var a = [], o = class {
|
|
5
|
+
#e = {
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0,
|
|
8
|
+
width: 0,
|
|
9
|
+
height: 0
|
|
10
|
+
};
|
|
11
|
+
#t = new i(() => 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 s(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) ?? a;
|
|
40
|
+
}
|
|
41
|
+
function c(e, t, n, r, i, a) {
|
|
42
|
+
let o = s(e, t);
|
|
43
|
+
if (t.sampleFacetRenderingOptions) i(r.resolveFacet(n, t.sampleFacetRenderingOptions), o);
|
|
44
|
+
else if (e.encoders.facetIndex) for (let [s, c] of l(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 l(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 u(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 d(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 f(e) {
|
|
78
|
+
return e.x1 <= e.x2 && e.y1 <= e.y2;
|
|
79
|
+
}
|
|
80
|
+
function p(e, t, n) {
|
|
81
|
+
return t < e.x1 || t > e.x2 || n < e.y1 || n > e.y2;
|
|
82
|
+
}
|
|
83
|
+
function m(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 h = 1e-8;
|
|
89
|
+
function g(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 && _(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 <= h) continue;
|
|
102
|
+
let s = C(r.a, r.b, a), c = C(r.a, r.b, o), l = C(s, c, .5);
|
|
103
|
+
e.some((e, t) => t != r.polygonIndex && x(l, e)) || n.push({
|
|
104
|
+
a: s,
|
|
105
|
+
b: c,
|
|
106
|
+
polygonIndex: r.polygonIndex
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return b(y(n));
|
|
111
|
+
}
|
|
112
|
+
function _(e, t, n) {
|
|
113
|
+
let r = T(e.b, e.a), i = T(t.b, t.a), a = T(t.a, e.a), o = D(r, i);
|
|
114
|
+
if (Math.abs(o) > h) {
|
|
115
|
+
let e = D(a, i) / o, t = D(a, r) / o;
|
|
116
|
+
e > h && e < 1 - h && t >= -1e-8 && t <= 1.00000001 && n.push(e);
|
|
117
|
+
} else Math.abs(D(a, r)) <= h && (v(e, t.a, n), v(e, t.b, n));
|
|
118
|
+
}
|
|
119
|
+
function v(e, t, n) {
|
|
120
|
+
let r = T(e.b, e.a), i = E(r, r), a = E(T(t, e.a), r) / i;
|
|
121
|
+
a > h && a < 1 - h && n.push(a);
|
|
122
|
+
}
|
|
123
|
+
function y(e) {
|
|
124
|
+
let t = /* @__PURE__ */ new Map();
|
|
125
|
+
for (let n of e) {
|
|
126
|
+
let e = w(n.a) + ":" + w(n.b), r = w(n.b) + ":" + w(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 b(e) {
|
|
132
|
+
let t = /* @__PURE__ */ new Map();
|
|
133
|
+
for (let n of e) {
|
|
134
|
+
let e = w(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), w(a.b) == w(i[0])) {
|
|
142
|
+
i.pop();
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
let e = (t.get(w(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 x(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 (S(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 S(e, t, n) {
|
|
163
|
+
return Math.abs(D(T(e, t), T(n, t))) <= h && E(T(e, t), T(e, n)) <= h;
|
|
164
|
+
}
|
|
165
|
+
function C(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 w(e) {
|
|
172
|
+
return `${Math.round(e.x / h)},${Math.round(e.y / h)}`;
|
|
173
|
+
}
|
|
174
|
+
function T(e, t) {
|
|
175
|
+
return {
|
|
176
|
+
x: e.x - t.x,
|
|
177
|
+
y: e.y - t.y
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function E(e, t) {
|
|
181
|
+
return e.x * t.x + e.y * t.y;
|
|
182
|
+
}
|
|
183
|
+
function D(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 O(e, t, n) {
|
|
189
|
+
return e.x + t * e.width + n;
|
|
190
|
+
}
|
|
191
|
+
function k(e, t, n) {
|
|
192
|
+
return e.y + (1 - t) * e.height + n;
|
|
193
|
+
}
|
|
194
|
+
function A(e, t, n, r = [0, 0]) {
|
|
195
|
+
return N(e, t.x, t.x2, t.xOffset, t.x2Offset, n, O, r);
|
|
196
|
+
}
|
|
197
|
+
function j(e, t, n, r = [0, 0]) {
|
|
198
|
+
return N(e, t.y, t.y2, t.yOffset, t.y2Offset, n, k, r);
|
|
199
|
+
}
|
|
200
|
+
function M(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 = I(i), f = a ? I(a) : 0, p = i.constant ? P(i, r) + d : 0, m = a?.constant ? P(a, r) + f : 0, h = o.constant ? P(o, r) : 0, g = a && s?.constant ? P(s, r) : 0;
|
|
202
|
+
return (e, t) => {
|
|
203
|
+
let n = o.constant ? h : P(o, e), r = i.constant ? p : P(i, e) + d, c = l + r * u + n, _ = c;
|
|
204
|
+
if (a) {
|
|
205
|
+
let t = a.constant ? m : P(a, e) + f, r = s ? s.constant ? g : P(s, e) : n;
|
|
206
|
+
_ = l + t * u + r;
|
|
207
|
+
}
|
|
208
|
+
return t[0] = c, t[1] = _, t;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function N(e, t, n, r, i, a, o, s) {
|
|
212
|
+
let c = P(r, a), l = o(e, F(t, a), c), u = n ? o(e, F(n, a), i ? P(i, a) : c) : l;
|
|
213
|
+
return s[0] = l, s[1] = u, s;
|
|
214
|
+
}
|
|
215
|
+
function P(e, t) {
|
|
216
|
+
return e(t);
|
|
217
|
+
}
|
|
218
|
+
function F(e, t) {
|
|
219
|
+
return P(e, t) + I(e);
|
|
220
|
+
}
|
|
221
|
+
function I(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 L(e, t) {
|
|
232
|
+
return z(e(t));
|
|
233
|
+
}
|
|
234
|
+
function R(t, n) {
|
|
235
|
+
return e(n) ? t.unitView.paramRuntime.evaluateAndGet(n.expr) : n;
|
|
236
|
+
}
|
|
237
|
+
function z(e) {
|
|
238
|
+
return e == null ? "none" : "" + e;
|
|
239
|
+
}
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region ../core/src/rendering/immediate/marks/arrow.js
|
|
242
|
+
function B(e) {
|
|
243
|
+
let t = e.properties, n = R(e, t.headSpacing);
|
|
244
|
+
return {
|
|
245
|
+
configuredRHeadSlope: oe(R(e, t.headAngle)),
|
|
246
|
+
configuredRHeadNotchSlope: oe(R(e, t.headNotchAngle)),
|
|
247
|
+
headShape: R(e, t.headShape),
|
|
248
|
+
headWidth: R(e, t.headWidth),
|
|
249
|
+
minSize: R(e, t.minSize),
|
|
250
|
+
stem: R(e, t.stem),
|
|
251
|
+
startNotch: R(e, t.startNotch),
|
|
252
|
+
minStemLength: R(e, t.minStemLength),
|
|
253
|
+
headSpacing: n,
|
|
254
|
+
repeatHeads: n != null && n >= 0,
|
|
255
|
+
headPlacement: R(e, t.headPlacement)
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function V(e, t, n, r) {
|
|
259
|
+
let { viewOpacity: i } = n, a = e.encoders;
|
|
260
|
+
return H(e, t, n, (e) => {
|
|
261
|
+
let n = t.stem ? te(e.tail, e.tip, e.tangent, e.normal, e.stemHalfWidth, e.rHeadSlope, t.startNotch) : null, o = n ? [n] : [];
|
|
262
|
+
U(e, (t, n) => {
|
|
263
|
+
let r = {
|
|
264
|
+
x: t,
|
|
265
|
+
y: n
|
|
266
|
+
};
|
|
267
|
+
o.push(e.renderedHeadShape == "open" ? ne(r, e.tangent, e.normal, e.headHalfWidth, e.rHeadSlope, e.rHeadNotchSlope, e.size) : ee(r, e.tangent, e.normal, e.headHalfWidth, e.rHeadSlope, e.rHeadNotchSlope));
|
|
268
|
+
});
|
|
269
|
+
let s = z(a.stroke(e.datum)) != "none" && P(a.strokeOpacity, e.datum) * i > 0 && e.strokeWidth > 0;
|
|
270
|
+
r({
|
|
271
|
+
datum: e.datum,
|
|
272
|
+
boundaryLoops: o.length == 1 || !s ? o : g(o),
|
|
273
|
+
strokeWidth: e.strokeWidth,
|
|
274
|
+
headShapeFallback: e.headShapeFallback
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
function H(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 = M(i, c, "x", a[0]), u = M(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
|
+
}, h = 0;
|
|
313
|
+
for (let e of a) {
|
|
314
|
+
l(e, d), u(e, f);
|
|
315
|
+
let n = L(c.direction, e) == "reverse", i = n ? d[1] : d[0], a = n ? f[1] : f[0], g = n ? d[0] : d[1], _ = n ? f[0] : f[1], v = g - i, y = _ - a, b = Math.hypot(v, y);
|
|
316
|
+
if (b == 0) continue;
|
|
317
|
+
let x = v / b, S = y / b, C = Math.max(P(c.size, e), t.minSize), w = C / 2, T = Math.max(t.headWidth * C, 0) / 2, E = re({
|
|
318
|
+
segmentLength: b,
|
|
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" ? ae(T, E, D, O) : 0, A = g + x * k, j = _ + S * k, M = T * E, N = Math.hypot(T, M), F = t.headShape == "open" && N > 0 ? C * T / N : 0, I = A - x * (M + F), R = j - S * (M + F), z = P(c.strokeWidth, e), B = Math.max(t.stem ? w : 0, T) + z * 2;
|
|
329
|
+
if (!m(o, Math.min(i, A, I), Math.min(a, j, R), Math.max(i, A, I), Math.max(a, j, R), B) || (h++, s)) continue;
|
|
330
|
+
let V = t.headShape == "triangle" || t.headShape == "open" ? t.headShape : "triangle", H = M + O / Math.hypot(E, 1) + z, U = t.repeatHeads ? Math.max((t.headSpacing ?? 0) * C, H) : Infinity;
|
|
331
|
+
p.datum = e, K(p.tail, i, a), K(p.tip, A, j), K(p.tangent, x, S), K(p.normal, -S, x), p.size = C, p.stemHalfWidth = w, p.headHalfWidth = T, p.headAxisLength = M, p.rHeadSlope = E, p.rHeadNotchSlope = D, p.strokeWidth = z, p.repeatSpacing = U, p.headRepeatFootprint = H, p.geometryLength = Math.hypot(A - i, j - a), p.stemContainsHead = t.stem && V == "triangle" && !t.repeatHeads && T <= w, p.renderedHeadShape = V, p.headShapeFallback = V != t.headShape, r(p);
|
|
332
|
+
}
|
|
333
|
+
return h;
|
|
334
|
+
}
|
|
335
|
+
function U(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 ee(e, t, n, r, i, a) {
|
|
339
|
+
let o = r * i, s = o - r * a, c = W(W(e, G(t, -o)), G(n, r)), l = W(W(e, G(t, -o)), G(n, -r));
|
|
340
|
+
return [
|
|
341
|
+
e,
|
|
342
|
+
c,
|
|
343
|
+
W(e, G(t, -s)),
|
|
344
|
+
l
|
|
345
|
+
];
|
|
346
|
+
}
|
|
347
|
+
function te(e, t, n, r, i, a, o) {
|
|
348
|
+
let s = i * a, c = W(W(t, G(n, -s)), G(r, i)), l = W(W(t, G(n, -s)), G(r, -i)), u = W(e, G(r, i)), d = W(e, G(r, -i));
|
|
349
|
+
return [
|
|
350
|
+
t,
|
|
351
|
+
c,
|
|
352
|
+
u,
|
|
353
|
+
...o ? [W(e, G(n, i * a))] : [],
|
|
354
|
+
d,
|
|
355
|
+
l
|
|
356
|
+
];
|
|
357
|
+
}
|
|
358
|
+
function ne(e, t, n, r, i, a, o) {
|
|
359
|
+
let s = r * i, c = W(W(e, G(t, -s)), G(n, r)), l = W(W(e, G(t, -s)), G(n, -r)), u = Math.hypot(r, s), d = o * r / u, f = o * s / u, p = W(W(c, G(t, -d)), G(n, -f)), m = W(W(l, G(t, -d)), G(n, f));
|
|
360
|
+
return [
|
|
361
|
+
e,
|
|
362
|
+
c,
|
|
363
|
+
p,
|
|
364
|
+
W(e, G(t, -(s + d - (r - f) * a))),
|
|
365
|
+
m,
|
|
366
|
+
l
|
|
367
|
+
];
|
|
368
|
+
}
|
|
369
|
+
function re({ 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 ie(n, t, r, i) <= u ? r : u < n * i ? n > 0 ? q(u / n, 0, r) : 0 : q((u + (t - n) * i) / t, 0, r);
|
|
375
|
+
}
|
|
376
|
+
function ie(e, t, n, r) {
|
|
377
|
+
return t * n - (t - e) * Math.min(r, n);
|
|
378
|
+
}
|
|
379
|
+
function ae(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 oe(e) {
|
|
385
|
+
let t = q(e, 1, 90) * Math.PI / 180;
|
|
386
|
+
return 1 / Math.max(Math.tan(t), 1e-6);
|
|
387
|
+
}
|
|
388
|
+
function W(e, t) {
|
|
389
|
+
return {
|
|
390
|
+
x: e.x + t.x,
|
|
391
|
+
y: e.y + t.y
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function G(e, t) {
|
|
395
|
+
return {
|
|
396
|
+
x: e.x * t,
|
|
397
|
+
y: e.y * t
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
function K(e, t, n) {
|
|
401
|
+
e.x = t, e.y = n;
|
|
402
|
+
}
|
|
403
|
+
function q(e, t, n) {
|
|
404
|
+
return Math.min(Math.max(e, t), n);
|
|
405
|
+
}
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region ../core/src/rendering/immediate/geometry/linkGeometry.js
|
|
408
|
+
function se(e, t, n, r) {
|
|
409
|
+
if (r.shape == "arc") {
|
|
410
|
+
let i = [...e], a = [...t], o = Y(a, i), s = de(o);
|
|
411
|
+
if (s == 0) return [
|
|
412
|
+
i,
|
|
413
|
+
i,
|
|
414
|
+
a,
|
|
415
|
+
a
|
|
416
|
+
];
|
|
417
|
+
let c = X(o, 1 / s), l = [-c[1], c[0]];
|
|
418
|
+
s = ce(i, a, s, r.maxChordLength, n);
|
|
419
|
+
let u = X(l, Math.max(s / 2 * r.arcHeightFactor, r.minArcHeight) / .75);
|
|
420
|
+
return [
|
|
421
|
+
i,
|
|
422
|
+
J(i, u),
|
|
423
|
+
J(a, u),
|
|
424
|
+
a
|
|
425
|
+
];
|
|
426
|
+
} else if (r.shape == "dome") {
|
|
427
|
+
let i, a, o;
|
|
428
|
+
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]);
|
|
429
|
+
let s = de(Y(a, i));
|
|
430
|
+
ce(i, a, s, r.maxChordLength, n), r.clampApex && le(i, a, r.orient, n);
|
|
431
|
+
let c = X(o, 1 / .75);
|
|
432
|
+
return [
|
|
433
|
+
i,
|
|
434
|
+
J(i, c),
|
|
435
|
+
J(a, c),
|
|
436
|
+
a
|
|
437
|
+
];
|
|
438
|
+
} else if (r.shape == "diagonal") if (r.orient == "vertical") {
|
|
439
|
+
let n = (e[1] + t[1]) / 2;
|
|
440
|
+
return [
|
|
441
|
+
e,
|
|
442
|
+
[e[0], n],
|
|
443
|
+
[t[0], n],
|
|
444
|
+
t
|
|
445
|
+
];
|
|
446
|
+
} else {
|
|
447
|
+
let n = (e[0] + t[0]) / 2;
|
|
448
|
+
return [
|
|
449
|
+
e,
|
|
450
|
+
[n, e[1]],
|
|
451
|
+
[n, t[1]],
|
|
452
|
+
t
|
|
453
|
+
];
|
|
454
|
+
}
|
|
455
|
+
else if (r.shape == "line") {
|
|
456
|
+
let n = X(J(e, t), .5);
|
|
457
|
+
return [
|
|
458
|
+
e,
|
|
459
|
+
n,
|
|
460
|
+
n,
|
|
461
|
+
t
|
|
462
|
+
];
|
|
463
|
+
} else throw Error(`Unsupported link shape: ${r.shape}`);
|
|
464
|
+
}
|
|
465
|
+
function ce(e, t, n, r, i) {
|
|
466
|
+
if (n <= r) return n;
|
|
467
|
+
let a = X(Y(t, e), 1 / n);
|
|
468
|
+
return ue(e, i, 2) ? (fe(t, J(e, X(a, r))), r) : ue(t, i, 2) ? (fe(e, Y(t, X(a, r))), r) : n;
|
|
469
|
+
}
|
|
470
|
+
function le(e, t, n, r) {
|
|
471
|
+
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])));
|
|
472
|
+
}
|
|
473
|
+
function ue(e, t, n) {
|
|
474
|
+
return e[0] >= -t.width * n && e[0] <= t.width * (1 + n) && e[1] >= -t.height * n && e[1] <= t.height * (1 + n);
|
|
475
|
+
}
|
|
476
|
+
function J(e, t) {
|
|
477
|
+
return [e[0] + t[0], e[1] + t[1]];
|
|
478
|
+
}
|
|
479
|
+
function Y(e, t) {
|
|
480
|
+
return [e[0] - t[0], e[1] - t[1]];
|
|
481
|
+
}
|
|
482
|
+
function X(e, t) {
|
|
483
|
+
return [e[0] * t, e[1] * t];
|
|
484
|
+
}
|
|
485
|
+
function de(e) {
|
|
486
|
+
return Math.hypot(e[0], e[1]);
|
|
487
|
+
}
|
|
488
|
+
function fe(e, t) {
|
|
489
|
+
e[0] = t[0], e[1] = t[1];
|
|
490
|
+
}
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region ../core/src/rendering/immediate/marks/link.js
|
|
493
|
+
function pe(e) {
|
|
494
|
+
let t = e.properties;
|
|
495
|
+
return {
|
|
496
|
+
shape: R(e, t.linkShape),
|
|
497
|
+
orient: R(e, t.orient),
|
|
498
|
+
arcHeightFactor: R(e, t.arcHeightFactor),
|
|
499
|
+
minArcHeight: R(e, t.minArcHeight),
|
|
500
|
+
maxChordLength: R(e, t.maxChordLength),
|
|
501
|
+
clampApex: R(e, t.clampApex)
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
function me(e, t, n, r) {
|
|
505
|
+
let { coords: i, data: a, visibleBounds: o } = n, s = e.encoders;
|
|
506
|
+
if (a.length == 0) return 0;
|
|
507
|
+
let c = M(i, s, "x", a[0]), l = M(i, s, "y", a[0]), u = [0, 0], d = [0, 0], f = i.x, p = i.y, h = {
|
|
508
|
+
width: i.width,
|
|
509
|
+
height: i.height
|
|
510
|
+
}, g = p + h.height, _ = 0;
|
|
511
|
+
for (let e of a) {
|
|
512
|
+
c(e, u), l(e, d);
|
|
513
|
+
let [n, i] = u, [a, p] = d, v = se([n - f, g - a], [i - f, g - p], h, t);
|
|
514
|
+
for (let e of v) e[0] += f, e[1] = g - e[1];
|
|
515
|
+
let [y, b, x, S] = v, C = P(s.size, e);
|
|
516
|
+
m(o, Math.min(y[0], b[0], x[0], S[0]), Math.min(y[1], b[1], x[1], S[1]), Math.max(y[0], b[0], x[0], S[0]), Math.max(y[1], b[1], x[1], S[1]), C / 2) && (_++, r({
|
|
517
|
+
datum: e,
|
|
518
|
+
points: v,
|
|
519
|
+
strokeWidth: C
|
|
520
|
+
}));
|
|
521
|
+
}
|
|
522
|
+
return _;
|
|
523
|
+
}
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region ../core/src/rendering/immediate/marks/point.js
|
|
526
|
+
function he(e) {
|
|
527
|
+
return { inwardStroke: R(e, e.properties.inwardStroke) };
|
|
528
|
+
}
|
|
529
|
+
function ge(e, t, n, r) {
|
|
530
|
+
let { coords: i, data: a, visibleBounds: o, anchorCullBounds: s } = n, c = n.start ?? 0, l = n.end ?? a.length, u = e.encoders;
|
|
531
|
+
if (c === l) return 0;
|
|
532
|
+
let d = M(i, u, "x", a[c]), f = M(i, u, "y", a[c]), h = [0, 0], g = [0, 0], _ = e.getSemanticThreshold(), v = {
|
|
533
|
+
datum: {},
|
|
534
|
+
shape: "circle",
|
|
535
|
+
x: 0,
|
|
536
|
+
y: 0,
|
|
537
|
+
geometryRadius: 0,
|
|
538
|
+
boundsRadius: 0,
|
|
539
|
+
angle: 0,
|
|
540
|
+
strokeWidth: 0,
|
|
541
|
+
lineShape: !1
|
|
542
|
+
}, y = 0;
|
|
543
|
+
for (let e = c; e < l; e++) {
|
|
544
|
+
let n = a[e];
|
|
545
|
+
if (P(u.semanticScore, n) < _) continue;
|
|
546
|
+
d(n, h), f(n, g);
|
|
547
|
+
let i = h[0] + P(u.dx, n), c = g[0] - P(u.dy, n);
|
|
548
|
+
if (p(s, i, c)) continue;
|
|
549
|
+
let l = Math.sqrt(P(u.size, n)) / 2;
|
|
550
|
+
if (t.inwardStroke && l <= 0) continue;
|
|
551
|
+
let b = L(u.shape, n), x = P(u.strokeWidth, n), S = b == "x" || b == "+", 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;
|
|
552
|
+
m(o, i - E, c - E, i + E, c + E) && (y++, v.datum = n, v.shape = b, v.x = i, v.y = c, v.geometryRadius = w, v.boundsRadius = E, v.angle = P(u.angle, n), v.strokeWidth = C, v.lineShape = S, r(v));
|
|
553
|
+
}
|
|
554
|
+
return y;
|
|
555
|
+
}
|
|
556
|
+
//#endregion
|
|
557
|
+
//#region ../core/src/rendering/immediate/geometry/pointPath.js
|
|
558
|
+
function _e(e, t, n, r, i) {
|
|
559
|
+
let a = r * .4, o = r * .15, s = Math.sqrt(3) * r / 2;
|
|
560
|
+
switch (e) {
|
|
561
|
+
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;
|
|
562
|
+
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;
|
|
563
|
+
case "triangle-up": return i.moveTo(t, n - s), i.lineTo(t + r, n + s), i.lineTo(t - r, n + s), i.closePath(), !0;
|
|
564
|
+
case "triangle-right": return i.moveTo(t + s, n), i.lineTo(t - s, n + r), i.lineTo(t - s, n - r), i.closePath(), !0;
|
|
565
|
+
case "triangle-down": return i.moveTo(t, n + s), i.lineTo(t - r, n - s), i.lineTo(t + r, n - s), i.closePath(), !0;
|
|
566
|
+
case "triangle-left": return i.moveTo(t - s, n), i.lineTo(t + s, n - r), i.lineTo(t + s, n + r), i.closePath(), !0;
|
|
567
|
+
case "tick-up": return Z(i, t - o, n - r, t + o, n), !0;
|
|
568
|
+
case "tick-right": return Z(i, t, n - o, t + r, n + o), !0;
|
|
569
|
+
case "tick-down": return Z(i, t - o, n, t + o, n + r), !0;
|
|
570
|
+
case "tick-left": return Z(i, t - r, n - o, t, n + o), !0;
|
|
571
|
+
case "+": return i.moveTo(t - r, n), i.lineTo(t + r, n), i.moveTo(t, n - r), i.lineTo(t, n + r), !0;
|
|
572
|
+
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;
|
|
573
|
+
default: return !1;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
function Z(e, t, n, r, i) {
|
|
577
|
+
e.moveTo(t, n), e.lineTo(r, n), e.lineTo(r, i), e.lineTo(t, i), e.closePath();
|
|
578
|
+
}
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region ../core/src/rendering/immediate/marks/rect.js
|
|
581
|
+
var ve = .1;
|
|
582
|
+
function ye(e) {
|
|
583
|
+
let t = e.properties, n = R(e, t.cornerRadius), r = {
|
|
584
|
+
topLeft: R(e, t.cornerRadiusTopLeft ?? n),
|
|
585
|
+
topRight: R(e, t.cornerRadiusTopRight ?? n),
|
|
586
|
+
bottomRight: R(e, t.cornerRadiusBottomRight ?? n),
|
|
587
|
+
bottomLeft: R(e, t.cornerRadiusBottomLeft ?? n)
|
|
588
|
+
}, i = {
|
|
589
|
+
blur: R(e, t.shadowBlur ?? 0),
|
|
590
|
+
color: R(e, t.shadowColor ?? "black"),
|
|
591
|
+
offsetX: R(e, t.shadowOffsetX ?? 0),
|
|
592
|
+
offsetY: R(e, t.shadowOffsetY ?? 0),
|
|
593
|
+
opacity: R(e, t.shadowOpacity ?? 0)
|
|
594
|
+
}, a = R(e, t.hatch ?? "none"), o = !Ce(r);
|
|
595
|
+
return {
|
|
596
|
+
cornerRadii: r,
|
|
597
|
+
minWidth: R(e, t.minWidth),
|
|
598
|
+
minHeight: R(e, t.minHeight),
|
|
599
|
+
minOpacity: R(e, t.minOpacity),
|
|
600
|
+
shadow: i,
|
|
601
|
+
hatch: a,
|
|
602
|
+
hasCornerRadii: o,
|
|
603
|
+
canPadSeams: a == "none" && i.opacity == 0 && !o
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
function be(e, t, n, r) {
|
|
607
|
+
let { coords: i, data: a, visibleBounds: o, viewOpacity: s } = n, c = n.start ?? 0, l = n.end ?? a.length, u = e.encoders;
|
|
608
|
+
if (c === l) return 0;
|
|
609
|
+
let d = u.strokeWidth.constant, f = u.fillOpacity.constant, p = d ? P(u.strokeWidth, a[c]) : 0, h = f ? P(u.fillOpacity, a[c]) : 0, g = u.fill.constant, _ = g ? z(u.fill(a[c])) : "none", v = t.shadow.opacity > 0 ? t.shadow.blur + Math.max(Math.abs(t.shadow.offsetX), Math.abs(t.shadow.offsetY)) : 0, y = M(i, u, "x", a[c]), b = M(i, u, "y", a[c]), x = [0, 0], S = [0, 0], C = {
|
|
610
|
+
datum: {},
|
|
611
|
+
x: 0,
|
|
612
|
+
y: 0,
|
|
613
|
+
width: 0,
|
|
614
|
+
height: 0,
|
|
615
|
+
radii: {
|
|
616
|
+
topLeft: 0,
|
|
617
|
+
topRight: 0,
|
|
618
|
+
bottomRight: 0,
|
|
619
|
+
bottomLeft: 0
|
|
620
|
+
},
|
|
621
|
+
opacityFactor: 1,
|
|
622
|
+
strokeWidth: 0,
|
|
623
|
+
fill: "none",
|
|
624
|
+
fillOpacity: 0
|
|
625
|
+
}, w = 0;
|
|
626
|
+
for (let e = c; e < l; e++) {
|
|
627
|
+
let n = a[e];
|
|
628
|
+
y(n, x), b(n, S);
|
|
629
|
+
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 = xe(l, t.minWidth), D = xe(T, t.minHeight), O = Math.max(t.minOpacity, E * D);
|
|
630
|
+
l < t.minWidth && (i -= (t.minWidth - l) / 2, l = t.minWidth), T < t.minHeight && (c -= (t.minHeight - T) / 2, T = t.minHeight);
|
|
631
|
+
let k = d ? p : P(u.strokeWidth, n), A = g ? _ : z(u.fill(n)), j = (f ? h : P(u.fillOpacity, n)) * s, M = k == 0 && j == 1 && O == 1 && t.canPadSeams && A != "none" ? ve : 0;
|
|
632
|
+
M && (i -= M, c -= M, l += M * 2, T += M * 2), m(o, i, c, i + l, c + T, k / 2 + v) && (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 && Se(t.cornerRadii, l, T, C.radii), r(C));
|
|
633
|
+
}
|
|
634
|
+
return w;
|
|
635
|
+
}
|
|
636
|
+
function xe(e, t) {
|
|
637
|
+
return t > 0 && e < t ? e / t : 1;
|
|
638
|
+
}
|
|
639
|
+
function Se(e, t, n, r) {
|
|
640
|
+
let i = Math.min(t, n) / 2;
|
|
641
|
+
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));
|
|
642
|
+
}
|
|
643
|
+
function Ce(e) {
|
|
644
|
+
return e.topLeft == 0 && e.topRight == 0 && e.bottomRight == 0 && e.bottomLeft == 0;
|
|
645
|
+
}
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region ../core/src/rendering/immediate/marks/rule.js
|
|
648
|
+
function we(e) {
|
|
649
|
+
return { minLength: R(e, e.properties.minLength) };
|
|
650
|
+
}
|
|
651
|
+
function Te(e, t, n, r) {
|
|
652
|
+
let { coords: i, data: a, visibleBounds: o } = n, s = e.encoders;
|
|
653
|
+
if (a.length == 0) return 0;
|
|
654
|
+
let c = M(i, s, "x", a[0]), l = M(i, s, "y", a[0]), u = [0, 0], d = [0, 0], f = {
|
|
655
|
+
datum: {},
|
|
656
|
+
x1: 0,
|
|
657
|
+
y1: 0,
|
|
658
|
+
x2: 0,
|
|
659
|
+
y2: 0,
|
|
660
|
+
strokeWidth: 0
|
|
661
|
+
}, p = 0;
|
|
662
|
+
for (let e of a) {
|
|
663
|
+
c(e, u), l(e, d);
|
|
664
|
+
let [n, i] = u, [a, h] = d, g = i - n, _ = h - a, v = Math.hypot(g, _);
|
|
665
|
+
if (v > 0 && v < t.minLength) {
|
|
666
|
+
let e = (t.minLength - v) / 2, r = g / v, o = _ / v;
|
|
667
|
+
n -= r * e, a -= o * e, i += r * e, h += o * e;
|
|
668
|
+
}
|
|
669
|
+
let y = P(s.size, e);
|
|
670
|
+
m(o, n, a, i, h, y / 2) && (p++, f.datum = e, f.x1 = n, f.y1 = a, f.x2 = i, f.y2 = h, f.strokeWidth = y, r(f));
|
|
671
|
+
}
|
|
672
|
+
return p;
|
|
673
|
+
}
|
|
674
|
+
//#endregion
|
|
675
|
+
//#region ../core/src/rendering/immediate/marks/text.js
|
|
676
|
+
function Ee(e) {
|
|
677
|
+
let t = e.properties;
|
|
678
|
+
return {
|
|
679
|
+
align: R(e, t.align),
|
|
680
|
+
baseline: R(e, t.baseline),
|
|
681
|
+
logoLetters: R(e, t.logoLetters),
|
|
682
|
+
paddingX: R(e, t.paddingX),
|
|
683
|
+
paddingY: R(e, t.paddingY),
|
|
684
|
+
flushX: R(e, t.flushX),
|
|
685
|
+
flushY: R(e, t.flushY),
|
|
686
|
+
squeeze: R(e, t.squeeze),
|
|
687
|
+
dx: R(e, t.dx),
|
|
688
|
+
dy: R(e, t.dy)
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function De(e, i, a, o) {
|
|
692
|
+
let { coords: s, data: c, visibleBounds: l, anchorCullBounds: u } = a, { align: d, baseline: f } = i, m = e.encoders;
|
|
693
|
+
if (c.length == 0) return 0;
|
|
694
|
+
let h = m.size.constant ? P(m.size, c[0]) : 0, g = m.angle.constant ? P(m.angle, c[0]) : 0, _ = M(s, m, "x", c[0]), v = M(s, m, "y", c[0]), y = e.encoding.text, b = "format" in y ? t(y.format) : (e) => e, x = [0, 0], S = [0, 0], C = {
|
|
695
|
+
width: 0,
|
|
696
|
+
height: 0
|
|
697
|
+
}, w = {
|
|
698
|
+
x: 0,
|
|
699
|
+
y: 0
|
|
700
|
+
}, T = {
|
|
701
|
+
position: 0,
|
|
702
|
+
scale: 0
|
|
703
|
+
}, E = {
|
|
704
|
+
width: 0,
|
|
705
|
+
heightScale: 0
|
|
706
|
+
}, D = Array(8).fill(0), O = {
|
|
707
|
+
datum: {},
|
|
708
|
+
text: "",
|
|
709
|
+
x: 0,
|
|
710
|
+
y: 0,
|
|
711
|
+
size: 0,
|
|
712
|
+
width: 0,
|
|
713
|
+
angle: 0,
|
|
714
|
+
dx: i.dx,
|
|
715
|
+
dy: i.dy,
|
|
716
|
+
fadeOpacity: 1,
|
|
717
|
+
scale: 1,
|
|
718
|
+
logoScale: void 0,
|
|
719
|
+
multiCharacterLogo: !1,
|
|
720
|
+
boundsQuad: D
|
|
721
|
+
}, k = !!m.x2, A = !!m.y2, j = 0;
|
|
722
|
+
for (let t of c) {
|
|
723
|
+
let a = b(m.text(t)), c = n(a) ? a : a === null ? "" : "" + a;
|
|
724
|
+
if (!c) continue;
|
|
725
|
+
_(t, x), v(t, S);
|
|
726
|
+
let [y, M] = x, [N, F] = S, I = m.size.constant ? h : P(m.size, t), L = m.angle.constant ? g : P(m.angle, t);
|
|
727
|
+
if (i.logoLetters) {
|
|
728
|
+
let n = I, r = I;
|
|
729
|
+
if (k && (n = M - y, y = (y + M) / 2), A && (r = N - F, N = (N + F) / 2), Oe(D, y, N, Math.abs(n), Math.abs(r), "center", "middle", L, i.dx, i.dy), !n || !r || p(u, y, N) || !ke(l, D)) continue;
|
|
730
|
+
let a = e.font.metrics.getChar(c[0]), s = r * e.font.metrics.common.base * (a.height + 10) / (a.height * a.height);
|
|
731
|
+
j++, O.datum = t, O.text = c, O.x = y, O.y = N, O.size = 1, O.width = 1, O.angle = L, O.fadeOpacity = 1, O.scale = 1, E.width = n, E.heightScale = s, O.logoScale = E, O.multiCharacterLogo = c.length > 1, o(O);
|
|
732
|
+
continue;
|
|
733
|
+
}
|
|
734
|
+
let R = e.font.metrics.measureWidth(c, I);
|
|
735
|
+
Ae(R, I, L, C), k || A ? Me(d, f, L, w) : (w.x = $[d], w.y = Ne[f]);
|
|
736
|
+
let z = 1;
|
|
737
|
+
if (k && (je(Math.min(y, M), Math.max(y, M), C.width, i.paddingX, w.x, i.flushX, s.x, s.x2, T), y = T.position, z *= T.scale), A && (je(Math.min(N, F), Math.max(N, F), C.height * z, i.paddingY, w.y, i.flushY, s.y, s.y2, T), N = T.position, z *= T.scale), p(u, y, N)) continue;
|
|
738
|
+
let B = 1;
|
|
739
|
+
if (z < 1) {
|
|
740
|
+
if (!i.squeeze || z < 3 / I) continue;
|
|
741
|
+
B = r(3 / I, 6 / I, z);
|
|
742
|
+
}
|
|
743
|
+
let V = I * z, H = R * z;
|
|
744
|
+
Oe(D, y, N, H, V, d, f, L, i.dx, i.dy), ke(l, D) && (j++, O.datum = t, O.text = c, O.x = y, O.y = N, O.size = V, O.width = H, O.angle = L, O.fadeOpacity = B, O.scale = z, O.logoScale = void 0, O.multiCharacterLogo = !1, o(O));
|
|
745
|
+
}
|
|
746
|
+
return j;
|
|
747
|
+
}
|
|
748
|
+
function Oe(e, t, n, r, i, a, o, s, c, l) {
|
|
749
|
+
let u = t + c - ($[a] + 1) / 2 * r, d = n + l - (Ne[o] + 1) / 2 * i, f = u + r, p = d + i, m = s * Math.PI / 180, h = Math.sin(m), g = Math.cos(m);
|
|
750
|
+
return Q(e, 0, t, n, u, d, h, g), Q(e, 2, t, n, f, d, h, g), Q(e, 4, t, n, f, p, h, g), Q(e, 6, t, n, u, p, h, g), e;
|
|
751
|
+
}
|
|
752
|
+
function ke(e, t) {
|
|
753
|
+
return m(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);
|
|
754
|
+
}
|
|
755
|
+
function Q(e, t, n, r, i, a, o, s) {
|
|
756
|
+
e[t] = n + (i - n) * s - (a - r) * o, e[t + 1] = r + (i - n) * o + (a - r) * s;
|
|
757
|
+
}
|
|
758
|
+
function Ae(e, t, n, r) {
|
|
759
|
+
let i = n * Math.PI / 180, a = Math.abs(Math.sin(i)), o = Math.abs(Math.cos(i));
|
|
760
|
+
r.width = e * o + t * a, r.height = e * a + t * o;
|
|
761
|
+
}
|
|
762
|
+
function je(e, t, n, r, i, a, o, s, c) {
|
|
763
|
+
let l = t - e, u = n + 2 * r;
|
|
764
|
+
if (e > s || t < o) {
|
|
765
|
+
c.position = 0, c.scale = 0;
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
let d = Math.max(0, l - u), f;
|
|
769
|
+
if (i == 0) {
|
|
770
|
+
let n = e + t;
|
|
771
|
+
if (a) {
|
|
772
|
+
let e = Math.max(0, 2 * o + u - n);
|
|
773
|
+
n += Math.min(e, d);
|
|
774
|
+
let t = Math.max(0, u + n - 2 * s);
|
|
775
|
+
n -= Math.min(t, d);
|
|
776
|
+
}
|
|
777
|
+
f = n / 2;
|
|
778
|
+
} else if (i < 0) {
|
|
779
|
+
let t = e;
|
|
780
|
+
a && (t += Math.min(Math.max(0, o - t), d)), f = t + r;
|
|
781
|
+
} else {
|
|
782
|
+
let e = t;
|
|
783
|
+
a && (e -= Math.min(Math.max(0, e - s), d)), f = e - r;
|
|
784
|
+
}
|
|
785
|
+
c.position = f, c.scale = Math.max(0, Math.min(1, (l - r) / u));
|
|
786
|
+
}
|
|
787
|
+
function Me(e, t, n, r) {
|
|
788
|
+
let i = $[e], a = -Ne[t], o = ((n + 45) % 360 + 360) % 360, s, c;
|
|
789
|
+
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;
|
|
790
|
+
}
|
|
791
|
+
var $ = {
|
|
792
|
+
left: -1,
|
|
793
|
+
center: 0,
|
|
794
|
+
right: 1
|
|
795
|
+
}, Ne = {
|
|
796
|
+
top: -1,
|
|
797
|
+
middle: 0,
|
|
798
|
+
bottom: 1,
|
|
799
|
+
alphabetic: 1,
|
|
800
|
+
baseline: 1
|
|
801
|
+
}, Pe = {
|
|
802
|
+
thin: 100,
|
|
803
|
+
light: 300,
|
|
804
|
+
regular: 400,
|
|
805
|
+
normal: 400,
|
|
806
|
+
medium: 500,
|
|
807
|
+
bold: 700,
|
|
808
|
+
black: 900
|
|
809
|
+
};
|
|
810
|
+
function Fe(e) {
|
|
811
|
+
return typeof e == "number" ? e : Pe[e];
|
|
812
|
+
}
|
|
813
|
+
//#endregion
|
|
814
|
+
//#region ../core/src/rendering/nativeText.js
|
|
815
|
+
var Ie = [
|
|
816
|
+
"Lato",
|
|
817
|
+
"Avenir Next",
|
|
818
|
+
"Avenir",
|
|
819
|
+
"Segoe UI",
|
|
820
|
+
"Ubuntu",
|
|
821
|
+
"Noto Sans",
|
|
822
|
+
"Helvetica Neue",
|
|
823
|
+
"Helvetica",
|
|
824
|
+
"Arial",
|
|
825
|
+
"sans-serif"
|
|
826
|
+
], Le = /* @__PURE__ */ new Set([
|
|
827
|
+
"serif",
|
|
828
|
+
"sans-serif",
|
|
829
|
+
"monospace",
|
|
830
|
+
"cursive",
|
|
831
|
+
"fantasy",
|
|
832
|
+
"system-ui",
|
|
833
|
+
"ui-serif",
|
|
834
|
+
"ui-sans-serif",
|
|
835
|
+
"ui-monospace",
|
|
836
|
+
"ui-rounded",
|
|
837
|
+
"emoji",
|
|
838
|
+
"math",
|
|
839
|
+
"fangsong"
|
|
840
|
+
]);
|
|
841
|
+
function Re(e) {
|
|
842
|
+
let t = e ?? "Lato";
|
|
843
|
+
return [t, ...Ie.filter((e) => e.toLowerCase() != t.toLowerCase())].map(Be).join(", ");
|
|
844
|
+
}
|
|
845
|
+
function ze(e, t) {
|
|
846
|
+
switch (e) {
|
|
847
|
+
case "top": return .79 * t;
|
|
848
|
+
case "middle": return .35 * t;
|
|
849
|
+
case "bottom": return -.21 * t;
|
|
850
|
+
case "alphabetic":
|
|
851
|
+
case "baseline": return 0;
|
|
852
|
+
default: throw Error(`Unknown text baseline: ${e}`);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
function Be(e) {
|
|
856
|
+
let t = e.toLowerCase();
|
|
857
|
+
return Le.has(t) ? t : `'${e.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
858
|
+
}
|
|
859
|
+
//#endregion
|
|
860
|
+
export { z as C, m as D, f as E, o as O, R as S, u as T, V as _, De as a, A as b, ye as c, he as d, ge as f, U as g, B as h, Ee as i, c as k, be as l, me as m, ze as n, we as o, pe as p, Fe as r, Te as s, Re as t, _e as u, H as v, d as w, j as x, P as y };
|