@genome-spy/app 1.1.1 → 1.2.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/{agentApi-sPuuT0KS.js → agentApi-8hMSlqAQ.js} +8307 -6861
- package/dist/agentApi.es.js +5569 -4250
- package/dist/agentShared.es.js +9 -9
- package/dist/{canvas2d-iDK4BC5j.js → canvas2d-Bd8H8MMo.js} +149 -134
- package/dist/{canvas2d-MXaFeZnP.js → canvas2d-D6VYooRf.js} +136 -122
- package/dist/{clipOptions-Cba4I0AO.js → clipOptions-DElJ8dTZ.js} +2274 -2080
- package/dist/{clipOptions-B5PibDq3.js → clipOptions-D_wBNhzs.js} +2121 -1957
- package/dist/{viewIdentityRegistry-BDKkEjXl.js → containerView-CRJSc4bM.js} +24 -31
- package/dist/{viewIdentityRegistry-BIYd4TE0.js → containerView-aEVmYmkA.js} +24 -31
- package/dist/{debug-DbigmdrK.js → debug-CQ0agCrd.js} +9 -9
- package/dist/{debug-BlqDxTw3.js → debug-DkIMiGdW.js} +10 -10
- package/dist/index.es.js +3582 -3566
- package/dist/index.js +698 -454
- package/dist/{indexer-En7gpvLN.js → indexer-DDC0YRGn.js} +1 -1
- package/dist/{indexer-DbFTKGlm.js → indexer-DOYMJ-Md.js} +1 -1
- package/dist/markUtils-CvLDz744.js +75 -0
- package/dist/{metadataChannels-DV62inJh.js → metadataChannels-DLSmx7kU.js} +6 -3
- package/dist/{order-B4uR9Q04.js → order-BVvkjDRT.js} +369 -316
- package/dist/{order-BSPy5DI8.js → order-DmMoZsi1.js} +360 -308
- package/dist/{rasterExport-DQH3hVg_.js → rasterExport-DxvowWjH.js} +3 -3
- package/dist/{rasterExport-B62RmAK1.js → rasterExport-jeRVq6kY.js} +4 -4
- package/dist/{rasterization-B05bDo5e.js → rasterization-DFj3Cvx4.js} +26 -19
- package/dist/{rectangle-DE98gIxF.js → rectangle-DZTR6NFQ.js} +10 -1
- package/dist/rectangle-Dl4Dy0hS.js +191 -0
- package/dist/{renderCanvas2D-Bdv-B4wj.js → renderCanvas2D-Bfm1NHFu.js} +96 -91
- package/dist/{renderCanvas2D-ChdoHGrU.js → renderCanvas2D-DVjhp834.js} +98 -93
- package/dist/{scalePosition-ByvlXaML.js → scalePosition-0aeqp_kz.js} +8 -1
- package/dist/schema.json +27198 -13709
- package/dist/style.css +1 -1
- package/dist/{svg-N3tj05-e.js → svg-Bm2zxBPu.js} +315 -316
- package/dist/{svg-DHsq1RpV.js → svg-CkfuhONt.js} +290 -291
- package/dist/{svgRasterizer-CYVDlt5z.js → svgRasterizer-DoRQEqFA.js} +2 -2
- package/dist/{svgRasterizer-CvCBlxLj.js → svgRasterizer-raDDhBF-.js} +3 -3
- package/dist/{vega-scale-Byaw1K8O.js → vega-scale-BoGHANI7.js} +90 -90
- package/dist/{vega-scale-Ctz_wa3z.js → vega-scale-o9TRyzYH.js} +699 -699
- package/dist/viewError-BkJeVYXA.js +33 -0
- package/dist/viewError-IYqyluc7.js +33 -0
- package/dist/{viewSelectors-DDLW-byr.js → viewSelectors-7LyasQN-.js} +498 -434
- package/dist/{viewSelectors-j-F9XwsE.js → viewSelectors-CbmkSQRT.js} +549 -485
- package/dist/{viewUtils-JX6CMEYH.js → viewUtils-DuddMNNw.js} +2138 -2009
- package/dist/{webgl-Dw8xqZpX.js → webgl-CQfvgnxo.js} +1229 -1140
- package/dist/{webgl-DdmOwEH0.js → webgl-DVYkXtiZ.js} +1477 -1389
- package/package.json +4 -4
- package/src/spec/view.d.ts +44 -5
- package/dist/viewError-BiR9VCgL.js +0 -29
package/dist/agentShared.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as e } from "./rolldown-runtime-DF993M8W.js";
|
|
2
|
-
import { B as t,
|
|
3
|
-
import { C as h, i as g, m as _, o as v, t as y } from "./viewSelectors-
|
|
4
|
-
import { y as b } from "./vega-scale-
|
|
2
|
+
import { B as t, G as n, H as r, J as i, K as a, U as o, V as s, W as c, Y as l, c as u, ct as d, ot as f, r as p, st as m } from "./viewUtils-DuddMNNw.js";
|
|
3
|
+
import { C as h, i as g, m as _, o as v, t as y } from "./viewSelectors-CbmkSQRT.js";
|
|
4
|
+
import { y as b } from "./vega-scale-BoGHANI7.js";
|
|
5
5
|
import { n as x, t as S } from "./componentStyles-DGtQXvwc.js";
|
|
6
6
|
//#region src/viewScopeUtils.js
|
|
7
7
|
function C(e, t) {
|
|
@@ -71,7 +71,7 @@ function N(e, t, n) {
|
|
|
71
71
|
if (n) try {
|
|
72
72
|
let t = [];
|
|
73
73
|
e.visit((e) => {
|
|
74
|
-
e instanceof
|
|
74
|
+
e instanceof u && e.isVisible() && ne(e, r) && t.push(e);
|
|
75
75
|
});
|
|
76
76
|
for (let e of t) {
|
|
77
77
|
let t = e.getEncoding(), n = t?.x && "field" in t.x, r = Object.entries(t).some(([e, t]) => ![
|
|
@@ -119,7 +119,7 @@ function F(e) {
|
|
|
119
119
|
}
|
|
120
120
|
function I(e) {
|
|
121
121
|
try {
|
|
122
|
-
return
|
|
122
|
+
return p(e).filter((e) => ![
|
|
123
123
|
"sample",
|
|
124
124
|
"x",
|
|
125
125
|
"x2"
|
|
@@ -193,7 +193,7 @@ function ce({ viewSelector: e, field: t, selectionSelector: n, aggregation: r, f
|
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
|
-
var le =
|
|
196
|
+
var le = d({
|
|
197
197
|
name: "paramProvenance",
|
|
198
198
|
initialState: { entries: {} },
|
|
199
199
|
reducers: {
|
|
@@ -4793,10 +4793,10 @@ function Jn(e) {
|
|
|
4793
4793
|
//#endregion
|
|
4794
4794
|
//#region src/agentShared/index.js
|
|
4795
4795
|
function Yn(e) {
|
|
4796
|
-
if (e.startsWith("sampleView/")) return
|
|
4796
|
+
if (e.startsWith("sampleView/")) return i.actions[e.slice(11)];
|
|
4797
4797
|
if (e.startsWith("paramProvenance/")) return le.actions[e.slice(16)];
|
|
4798
|
-
if (e.startsWith("viewSettings/")) return
|
|
4798
|
+
if (e.startsWith("viewSettings/")) return m.actions[e.slice(13)];
|
|
4799
4799
|
throw Error("Unsupported app actionType " + e + ".");
|
|
4800
4800
|
}
|
|
4801
4801
|
//#endregion
|
|
4802
|
-
export {
|
|
4802
|
+
export { t as addValueColors, r as buildCategoricalCountsSummary, o as buildCategoricalFieldSummary, c as buildQuantitativeFieldSummary, ce as buildSelectionAggregationAttributeIdentifier, n as buildTopCategorySummary, se as createSelectionAggregationCandidateId, S as faStyles, x as formStyles, l as formatAggregationExpression, C as formatScopedParamName, Yn as getActionCreator, s as getConcreteColorScale, P as getContextMenuFieldInfos, D as isBaselineAction, f as makeViewSelectorKey, qn as safeMarkdown, T as serializeBookmarkableParamValue, a as templateResultToString };
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { v as a } from "./vega-scale-
|
|
1
|
+
import { Dt as e, _ as t, o as n, s as r, xt as i } from "./clipOptions-D_wBNhzs.js";
|
|
2
|
+
import { v as a } from "./vega-scale-BoGHANI7.js";
|
|
3
3
|
import { t as o } from "./warning-CpIIpk8e.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
7
|
-
import {
|
|
8
|
-
import { n as j,
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
4
|
+
import { c as s } from "./markUtils-CvLDz744.js";
|
|
5
|
+
import { t as c } from "./rectangle-DZTR6NFQ.js";
|
|
6
|
+
import { n as l, t as u } from "./layoutResult-D50MSHXR.js";
|
|
7
|
+
import { n as d, r as f, t as p } from "./performanceProfiler-CPLEjApa.js";
|
|
8
|
+
import { A as m, C as h, D as g, E as _, I as v, L as y, M as b, N as x, P as S, S as C, _ as w, c as T, d as E, f as D, g as O, i as ee, l as te, m as ne, n as re, p as ie, u as k, v as A, w as j, x as M, y as N } from "./order-BVvkjDRT.js";
|
|
9
|
+
import { n as P, t as F } from "./renderCanvas2D-DVjhp834.js";
|
|
10
|
+
import { t as I } from "./canvasSizeHelper-foL2YvGL.js";
|
|
11
|
+
import { exportCanvas as L, exportRaster as R } from "./rasterExport-DxvowWjH.js";
|
|
12
|
+
import { createCanvas2DSvgRasterizer as z } from "./svgRasterizer-DoRQEqFA.js";
|
|
12
13
|
//#region ../core/src/rendering/canvas2d/picking/softwarePickingRasterizer.js
|
|
13
|
-
var
|
|
14
|
+
var B = 12, V = .5, H = class {
|
|
14
15
|
#e = [];
|
|
15
16
|
#t = [];
|
|
16
17
|
#n = [
|
|
@@ -50,7 +51,7 @@ var L = 12, R = .5, z = class {
|
|
|
50
51
|
}
|
|
51
52
|
setClip(e, t, n, r) {
|
|
52
53
|
if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r)) throw RangeError("Software picking clip must be finite.");
|
|
53
|
-
this.#r =
|
|
54
|
+
this.#r = G(Math.floor(Math.min(e, n)), 0, this.buffer.width), this.#i = G(Math.floor(Math.min(t, r)), 0, this.buffer.height), this.#a = G(Math.ceil(Math.max(e, n)), this.#r, this.buffer.width), this.#o = G(Math.ceil(Math.max(t, r)), this.#i, this.buffer.height);
|
|
54
55
|
}
|
|
55
56
|
fillRect(e, t, n, r, i) {
|
|
56
57
|
this.#s++, this.#p(e, t, n, r, i);
|
|
@@ -95,7 +96,7 @@ var L = 12, R = .5, z = class {
|
|
|
95
96
|
if (!(a > 0) || !Number.isFinite(a)) return;
|
|
96
97
|
this.#u++;
|
|
97
98
|
let s = a / 2, c = this.#n;
|
|
98
|
-
if (!
|
|
99
|
+
if (!D(t, n, r, i, this.#r - s, this.#i - s, this.#a + s, this.#o + s, c)) return;
|
|
99
100
|
let l = c[2] - c[0], u = c[3] - c[1], d = Math.ceil(Math.max(Math.abs(l), Math.abs(u)));
|
|
100
101
|
if (d == 0) {
|
|
101
102
|
this.#h(e, c[0], c[1], s, o);
|
|
@@ -106,13 +107,13 @@ var L = 12, R = .5, z = class {
|
|
|
106
107
|
this.#h(e, c[0] + l * n, c[1] + u * n, s, o);
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
|
-
strokeCubic(e, t, n, r, i, a, o, s, c, l, u =
|
|
110
|
+
strokeCubic(e, t, n, r, i, a, o, s, c, l, u = V, d) {
|
|
110
111
|
if (!(l > 0) || !Number.isFinite(l) || !(u > 0) || !Number.isFinite(u) || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r) || !Number.isFinite(i) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c)) return;
|
|
111
112
|
this.#d++;
|
|
112
113
|
let f = this.#e;
|
|
113
114
|
for (f.length = 0, f.push(t, n, r, i, a, o, s, c, 0); f.length;) {
|
|
114
115
|
let t = f.pop(), n = f.pop(), r = f.pop(), i = f.pop(), a = f.pop(), o = f.pop(), s = f.pop(), c = f.pop(), p = f.pop();
|
|
115
|
-
if (t >=
|
|
116
|
+
if (t >= B || U(p, c, s, o, a, i, r, n, u)) {
|
|
116
117
|
this.strokeSegment(e, p, c, r, n, l, d);
|
|
117
118
|
continue;
|
|
118
119
|
}
|
|
@@ -138,106 +139,105 @@ var L = 12, R = .5, z = class {
|
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
};
|
|
141
|
-
function
|
|
142
|
-
if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r)) return !1;
|
|
143
|
-
let l = n - e, u = r - t, d = 0, f = 1;
|
|
144
|
-
if (l == 0) {
|
|
145
|
-
if (e < i || e > o) return !1;
|
|
146
|
-
} else {
|
|
147
|
-
let t = (i - e) / l, n = (o - e) / l;
|
|
148
|
-
d = Math.max(d, Math.min(t, n)), f = Math.min(f, Math.max(t, n));
|
|
149
|
-
}
|
|
150
|
-
if (u == 0) {
|
|
151
|
-
if (t < a || t > s) return !1;
|
|
152
|
-
} else {
|
|
153
|
-
let e = (a - t) / u, n = (s - t) / u;
|
|
154
|
-
d = Math.max(d, Math.min(e, n)), f = Math.min(f, Math.max(e, n));
|
|
155
|
-
}
|
|
156
|
-
return d > f ? !1 : (c[0] = e + d * l, c[1] = t + d * u, c[2] = e + f * l, c[3] = t + f * u, !0);
|
|
157
|
-
}
|
|
158
|
-
function V(e, t, n, r, i, a, o, s, c) {
|
|
142
|
+
function U(e, t, n, r, i, a, o, s, c) {
|
|
159
143
|
let l = o - e, u = s - t, d = l * l + u * u, f = c * c;
|
|
160
144
|
if (d == 0) {
|
|
161
|
-
let o =
|
|
145
|
+
let o = W(e, t, n, r), s = W(e, t, i, a);
|
|
162
146
|
return Math.max(o, s) <= f;
|
|
163
147
|
}
|
|
164
148
|
let p = u * (n - e) - l * (r - t), m = u * (i - e) - l * (a - t);
|
|
165
149
|
return Math.max(p * p, m * m) <= f * d;
|
|
166
150
|
}
|
|
167
|
-
function
|
|
151
|
+
function W(e, t, n, r) {
|
|
168
152
|
let i = n - e, a = r - t;
|
|
169
153
|
return i * i + a * a;
|
|
170
154
|
}
|
|
171
|
-
function
|
|
155
|
+
function G(e, t, n) {
|
|
172
156
|
return Math.max(t, Math.min(n, e));
|
|
173
157
|
}
|
|
174
158
|
//#endregion
|
|
175
159
|
//#region ../core/src/rendering/canvas2d/picking/renderers/index.js
|
|
176
|
-
var
|
|
177
|
-
function
|
|
160
|
+
var K = 1;
|
|
161
|
+
function q(e, t) {
|
|
178
162
|
let n = e.getType();
|
|
179
|
-
return n == "arrow" ?
|
|
163
|
+
return n == "arrow" ? ae(e, t) : n == "rect" ? oe(e, t) : n == "point" ? se(e, t) : n == "rule" || n == "tick" ? ce(e, t) : n == "link" ? le(e, t) : n == "text" ? ue(e, t) : 0;
|
|
180
164
|
}
|
|
181
|
-
function
|
|
165
|
+
function J(e) {
|
|
182
166
|
let t = e.getType();
|
|
183
167
|
return t == "rect" || t == "arrow" || t == "point" || t == "rule" || t == "tick" || t == "link" || t == "text";
|
|
184
168
|
}
|
|
185
|
-
function
|
|
186
|
-
let n = e, r =
|
|
187
|
-
return
|
|
169
|
+
function ae(e, t) {
|
|
170
|
+
let n = e, r = h(n), i = Array(8).fill(0);
|
|
171
|
+
return _(n, r, t, (e) => {
|
|
188
172
|
let a = Y(n, e.datum), o = e.strokeWidth / 2;
|
|
189
|
-
r.stem && t.rasterizer.strokeSegment(a, e.tail.x, e.tail.y, e.tip.x, e.tip.y, e.stemHalfWidth * 2 + e.strokeWidth),
|
|
173
|
+
r.stem && t.rasterizer.strokeSegment(a, e.tail.x, e.tail.y, e.tip.x, e.tip.y, e.stemHalfWidth * 2 + e.strokeWidth), j(e, (n, r, s, c) => {
|
|
190
174
|
let l = e.headHalfWidth + o, u = n + s.x * o, d = r + s.y * o, f = e.headRepeatFootprint + o, p = n - s.x * f, m = r - s.y * f;
|
|
191
|
-
|
|
175
|
+
de(i, u, d, p, m, c.x, c.y, l), t.rasterizer.fillConvexPolygon(a, i);
|
|
192
176
|
});
|
|
193
177
|
});
|
|
194
178
|
}
|
|
195
|
-
function J(e, t) {
|
|
196
|
-
let n = e;
|
|
197
|
-
return re(n, T(n), t, (e) => t.rasterizer.fillRect(Y(n, e.datum), e.x, e.y, e.width, e.height));
|
|
198
|
-
}
|
|
199
179
|
function oe(e, t) {
|
|
200
|
-
let n = e
|
|
201
|
-
return
|
|
180
|
+
let n = e;
|
|
181
|
+
return ne(n, ie(n), t, (e) => t.rasterizer.fillRect(Y(n, e.datum), e.x, e.y, e.width, e.height));
|
|
202
182
|
}
|
|
203
183
|
function se(e, t) {
|
|
204
|
-
let n = e;
|
|
205
|
-
return w(n,
|
|
184
|
+
let n = e, r = m(n, n.properties.minPickingSize);
|
|
185
|
+
return w(n, O(n), t, (e) => t.rasterizer.fillSquare(Y(n, e.datum), e.x, e.y, Math.max(e.boundsRadius, r / 2)));
|
|
206
186
|
}
|
|
207
187
|
function ce(e, t) {
|
|
208
|
-
let n = e
|
|
209
|
-
return
|
|
210
|
-
let [i, o, s, c] = e.points, l = a && S(i, c, a);
|
|
211
|
-
t.rasterizer.strokeCubic(Y(n, e.datum), i[0], i[1], o[0], o[1], s[0], s[1], c[0], c[1], Math.max(e.strokeWidth, r), void 0, l ? (e, t) => Math.abs(l.normalX * e + l.normalY * t - l.offset) < l.end : void 0);
|
|
212
|
-
});
|
|
188
|
+
let n = e;
|
|
189
|
+
return E(n, k(n), t, (e) => t.rasterizer.strokeSegment(Y(n, e.datum), e.x1, e.y1, e.x2, e.y2, Math.max(e.strokeWidth, K)));
|
|
213
190
|
}
|
|
214
191
|
function le(e, t) {
|
|
215
|
-
let n = e, r =
|
|
216
|
-
return
|
|
192
|
+
let n = e, r = m(n, n.properties.minPickingSize), i = A(n), a = C(n, i.shape);
|
|
193
|
+
return N(n, i, {
|
|
194
|
+
...t,
|
|
195
|
+
minPickingSize: r
|
|
196
|
+
}, (e) => {
|
|
197
|
+
let { geometry: i } = e;
|
|
198
|
+
if (i.type == "orthogonal") {
|
|
199
|
+
let [a, o, s] = i.points, c = Y(n, e.datum), l = Math.max(e.strokeWidth, r) / 2;
|
|
200
|
+
for (let e = 0; e < 2; e++) {
|
|
201
|
+
let n = i.points[e], r = i.points[e + 1], a = Math.abs(r[0] - n[0]), o = Math.abs(r[1] - n[1]);
|
|
202
|
+
(a != 0 || o != 0) && t.rasterizer.fillRect(c, Math.min(n[0], r[0]) - (a == 0 ? l : 0), Math.min(n[1], r[1]) - (o == 0 ? l : 0), a + (a == 0 ? 2 * l : 0), o + (o == 0 ? 2 * l : 0));
|
|
203
|
+
}
|
|
204
|
+
if ((a[0] != o[0] || a[1] != o[1]) && (s[0] != o[0] || s[1] != o[1])) {
|
|
205
|
+
let e = o[0] + l * (Math.sign(o[0] - a[0]) - Math.sign(s[0] - o[0])), n = o[1] + l * (Math.sign(o[1] - a[1]) - Math.sign(s[1] - o[1]));
|
|
206
|
+
t.rasterizer.fillRect(c, Math.min(o[0], e), Math.min(o[1], n), l, l);
|
|
207
|
+
}
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
let [o, s, c, l] = i.points, u = a && M(o, l, a);
|
|
211
|
+
t.rasterizer.strokeCubic(Y(n, e.datum), o[0], o[1], s[0], s[1], c[0], c[1], l[0], l[1], Math.max(e.strokeWidth, r), void 0, u ? (e, t) => Math.abs(u.normalX * e + u.normalY * t - u.offset) < u.end : void 0);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function ue(e, t) {
|
|
215
|
+
let n = e, r = t.textMetrics ?? n.unitView.context.textMetrics, i = r.requestFont(n.properties), a = ee(r, n.properties);
|
|
216
|
+
return te(n, T(n), {
|
|
217
217
|
...t,
|
|
218
218
|
fontMeasurement: i,
|
|
219
219
|
measureLogoInkBounds: a
|
|
220
220
|
}, (e) => t.rasterizer.fillConvexPolygon(Y(n, e.datum), e.boundsQuad));
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function de(e, t, n, r, i, a, o, s) {
|
|
223
223
|
let c = a * s, l = o * s;
|
|
224
224
|
e[0] = t + c, e[1] = n + l, e[2] = r + c, e[3] = i + l, e[4] = r - c, e[5] = i - l, e[6] = t - c, e[7] = n - l;
|
|
225
225
|
}
|
|
226
226
|
function Y(e, t) {
|
|
227
227
|
let n = e.encoders;
|
|
228
|
-
return
|
|
228
|
+
return g(n.uniqueId, t);
|
|
229
229
|
}
|
|
230
230
|
//#endregion
|
|
231
231
|
//#region ../core/src/rendering/canvas2d/picking/softwarePickingViewRenderingContext.js
|
|
232
|
-
var
|
|
232
|
+
var fe = class extends l {
|
|
233
233
|
#e = [];
|
|
234
234
|
#t = /* @__PURE__ */ new Set();
|
|
235
235
|
#n;
|
|
236
|
-
#r = new
|
|
236
|
+
#r = new v();
|
|
237
237
|
#i;
|
|
238
238
|
#a = [0, 0];
|
|
239
239
|
constructor(e) {
|
|
240
|
-
super({ picking: !0 }), this.width = e.width, this.height = e.height, this.devicePixelRatio = e.devicePixelRatio, this.getRasterizer = e.getRasterizer, this.textMetrics = e.textMetrics, this.#n =
|
|
240
|
+
super({ picking: !0 }), this.width = e.width, this.height = e.height, this.devicePixelRatio = e.devicePixelRatio, this.getRasterizer = e.getRasterizer, this.textMetrics = e.textMetrics, this.#n = d(), this.#i = e.xIndexManager;
|
|
241
241
|
}
|
|
242
242
|
getDevicePixelRatio() {
|
|
243
243
|
return this.devicePixelRatio;
|
|
@@ -251,24 +251,24 @@ var de = class extends c {
|
|
|
251
251
|
popView(e) {
|
|
252
252
|
if (this.#e.pop()?.view !== e) throw Error("Unbalanced software picking view rendering context stack.");
|
|
253
253
|
}
|
|
254
|
-
renderMark(e,
|
|
255
|
-
if (!e.isPickingParticipant() || !
|
|
256
|
-
let i =
|
|
257
|
-
if (i && !e.encoders.facetIndex && (this.#n?.addCount("canvasSampleFacetOccurrences"), !
|
|
254
|
+
renderMark(e, t) {
|
|
255
|
+
if (!e.isPickingParticipant() || !J(e)) return;
|
|
256
|
+
let i = t.sampleFacetRenderingOptions;
|
|
257
|
+
if (i && !e.encoders.facetIndex && (this.#n?.addCount("canvasSampleFacetOccurrences"), !P(i))) {
|
|
258
258
|
this.#n?.addCount("canvasCulledSampleFacetOccurrences");
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
261
|
let a = e.unitView.getEffectiveOpacity();
|
|
262
262
|
if (a <= 0) return;
|
|
263
|
-
let s = this.currentCoords, c = t
|
|
264
|
-
if (!
|
|
265
|
-
let d =
|
|
266
|
-
|
|
263
|
+
let s = this.currentCoords, c = n(t), l = r(c, e.properties.clip, s), u = x(this.width, this.height, l);
|
|
264
|
+
if (!S(u)) return;
|
|
265
|
+
let d = b(s, c, e.properties.cullByVisibleRange), f = this.#i?.prepare(e) ?? !1;
|
|
266
|
+
y(e, t, s, this.#r, (t, n) => {
|
|
267
267
|
if (n.length == 0) return;
|
|
268
268
|
let r = 0, i = n.length;
|
|
269
269
|
if (f && this.#i.query(n, this.#a) && (r = this.#a[0], i = this.#a[1], r === i)) return;
|
|
270
270
|
let o = this.getRasterizer();
|
|
271
|
-
o.setClip(u.x1, u.y1, u.x2, u.y2),
|
|
271
|
+
o.setClip(u.x1, u.y1, u.x2, u.y2), q(e, {
|
|
272
272
|
rasterizer: o,
|
|
273
273
|
coords: t,
|
|
274
274
|
data: n,
|
|
@@ -282,44 +282,44 @@ var de = class extends c {
|
|
|
282
282
|
}, (t) => o(`Canvas2D picking could not resolve sample facet index ${t}. View: ${e.unitView.getPathString()}`));
|
|
283
283
|
}
|
|
284
284
|
get currentCoords() {
|
|
285
|
-
let
|
|
286
|
-
if (!
|
|
287
|
-
return
|
|
285
|
+
let t = e(this.#e);
|
|
286
|
+
if (!t) throw Error("No current view in software picking rendering context.");
|
|
287
|
+
return t.coords;
|
|
288
288
|
}
|
|
289
|
-
}, X = 2 ** 31 - 1,
|
|
290
|
-
function
|
|
291
|
-
let a = Array(
|
|
289
|
+
}, X = 2 ** 31 - 1, pe = -(2 ** 31);
|
|
290
|
+
function me(e, t, n, r = n) {
|
|
291
|
+
let a = Array(e);
|
|
292
292
|
a.fill(X);
|
|
293
|
-
let o =
|
|
293
|
+
let o = pe, s = -Infinity, c = !1, l = Array(e);
|
|
294
294
|
l.fill(0);
|
|
295
|
-
let u =
|
|
296
|
-
let
|
|
297
|
-
return
|
|
295
|
+
let u = t[0], d = (t[1] - t[0]) / e, f = (t, n) => {
|
|
296
|
+
let r = (t - u) / d, a = Math.floor(r);
|
|
297
|
+
return i(n && a == r ? a - 1 : a, 0, e - 1);
|
|
298
298
|
};
|
|
299
|
-
function p(e, t,
|
|
299
|
+
function p(e, t, r) {
|
|
300
300
|
if (c) return;
|
|
301
301
|
if (t > o) o = t;
|
|
302
302
|
else {
|
|
303
303
|
c = !0;
|
|
304
304
|
return;
|
|
305
305
|
}
|
|
306
|
-
let i =
|
|
306
|
+
let i = n(e);
|
|
307
307
|
if (!Number.isFinite(i) || i < s) {
|
|
308
308
|
c = !0;
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
311
|
s = i;
|
|
312
312
|
let u = f(i, !1);
|
|
313
|
-
a[u] > t && (a[u] = t), l[u] <
|
|
313
|
+
a[u] > t && (a[u] = t), l[u] < r && (l[u] = r);
|
|
314
314
|
}
|
|
315
|
-
function m(e, t,
|
|
315
|
+
function m(e, t, i) {
|
|
316
316
|
if (c) return;
|
|
317
317
|
if (t > o) o = t;
|
|
318
318
|
else {
|
|
319
319
|
c = !0, console.debug("Items (vertices) are not ordered properly. Disabling binned index.");
|
|
320
320
|
return;
|
|
321
321
|
}
|
|
322
|
-
let u =
|
|
322
|
+
let u = n(e), d = r(e);
|
|
323
323
|
if (!Number.isFinite(u) || !Number.isFinite(d)) {
|
|
324
324
|
c = !0;
|
|
325
325
|
return;
|
|
@@ -334,7 +334,7 @@ function pe(t, n, r, i = r) {
|
|
|
334
334
|
}
|
|
335
335
|
s = u;
|
|
336
336
|
let p = f(u, !1), m = u === d ? p : f(d, !0);
|
|
337
|
-
for (let e = p; e <= m; e++) a[e] > t && (a[e] = t), l[e] <
|
|
337
|
+
for (let e = p; e <= m; e++) a[e] > t && (a[e] = t), l[e] < i && (l[e] = i);
|
|
338
338
|
}
|
|
339
339
|
let h = (e, t, n = [0, 0]) => {
|
|
340
340
|
let r = f(e, !1), i = f(t, !0), o = a[r], s = Math.max(l[i], o);
|
|
@@ -346,31 +346,46 @@ function pe(t, n, r, i = r) {
|
|
|
346
346
|
for (let t = a.length - 1; t > 0; t--) e && a[t] == X ? (a[t] = l[t], e = !1) : a[t - 1] > a[t] && (a[t - 1] = a[t]);
|
|
347
347
|
return h;
|
|
348
348
|
};
|
|
349
|
-
return p.getIndex = g, m.getIndex = g,
|
|
349
|
+
return p.getIndex = g, m.getIndex = g, n == r ? p : m;
|
|
350
|
+
}
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region ../core/src/utils/forEachInBatch.js
|
|
353
|
+
var he = 0;
|
|
354
|
+
function ge(e, t) {
|
|
355
|
+
if (e.length > 1e4) Function("data", "visit", `
|
|
356
|
+
// batch loop ${he++}
|
|
357
|
+
for (let i = 0; i < data.length; i++) {
|
|
358
|
+
visit(data[i], i);
|
|
359
|
+
}
|
|
360
|
+
`)(e, t);
|
|
361
|
+
else for (let n = 0; n < e.length; n++) t(e[n], n);
|
|
350
362
|
}
|
|
351
363
|
//#endregion
|
|
352
364
|
//#region ../core/src/rendering/xIndex/markXIndex.js
|
|
353
|
-
function
|
|
365
|
+
function _e(e, t, n = 0) {
|
|
354
366
|
if (!t.length) return;
|
|
355
|
-
let r =
|
|
356
|
-
return t
|
|
367
|
+
let r = me(Math.min(256, Math.ceil(Math.sqrt(t.length))), e.indexDomain, e.xAccessor, e.x2Accessor);
|
|
368
|
+
return ge(t, (e, t) => {
|
|
369
|
+
let i = n + t;
|
|
370
|
+
r(e, i, i + 1);
|
|
371
|
+
}), r.getIndex();
|
|
357
372
|
}
|
|
358
|
-
function
|
|
359
|
-
let
|
|
360
|
-
if (!
|
|
361
|
-
let
|
|
362
|
-
if (
|
|
363
|
-
let o =
|
|
373
|
+
function ve(e) {
|
|
374
|
+
let n = e.encoders?.x, r = e.encoders?.x2;
|
|
375
|
+
if (!n?.channelDef || !("buildIndex" in n.channelDef) || !n.channelDef.buildIndex || !n.scale || !a(n.scale.type) && !["index", "locus"].includes(n.scale.type) || n.branches.length !== 1) return;
|
|
376
|
+
let i = e.getType();
|
|
377
|
+
if (i === "point" && s(e, "x") || i !== "point" && i !== "rect") return;
|
|
378
|
+
let o = t(n)?.asNumberAccessor();
|
|
364
379
|
if (!o) return;
|
|
365
|
-
let
|
|
366
|
-
if (
|
|
367
|
-
let
|
|
368
|
-
if (!(!
|
|
380
|
+
let c;
|
|
381
|
+
if (r && (r.scale !== n.scale || r.branches.length !== 1 || (c = t(r)?.asNumberAccessor(), !c))) return;
|
|
382
|
+
let l = e.unitView.getScaleResolution("x"), u = l?.zoomExtent;
|
|
383
|
+
if (!(!l || !u || !Number.isFinite(u[0]) || !Number.isFinite(u[1]) || u[1] <= u[0])) return {
|
|
369
384
|
xAccessor: o,
|
|
370
|
-
x2Accessor:
|
|
371
|
-
scaleResolution:
|
|
372
|
-
indexDomain: [
|
|
373
|
-
domainStartOffset: ["index", "locus"].includes(
|
|
385
|
+
x2Accessor: c,
|
|
386
|
+
scaleResolution: l,
|
|
387
|
+
indexDomain: [u[0], u[1]],
|
|
388
|
+
domainStartOffset: ["index", "locus"].includes(n.scale.type) ? -1 : 0
|
|
374
389
|
};
|
|
375
390
|
}
|
|
376
391
|
function Z(e, t) {
|
|
@@ -381,7 +396,7 @@ function Z(e, t) {
|
|
|
381
396
|
}
|
|
382
397
|
//#endregion
|
|
383
398
|
//#region ../core/src/rendering/canvas2d/canvasXIndexManager.js
|
|
384
|
-
var
|
|
399
|
+
var ye = class {
|
|
385
400
|
#e = /* @__PURE__ */ new WeakMap();
|
|
386
401
|
#t = [0, 0];
|
|
387
402
|
#n;
|
|
@@ -389,7 +404,7 @@ var ge = class {
|
|
|
389
404
|
if (this.#n = void 0, e.encoders.facetIndex) return this.#r();
|
|
390
405
|
let t = e.unitView.getCollector(), n = e.unitView.getScaleResolution("x"), r = n?.zoomExtent, i = this.#e.get(e);
|
|
391
406
|
if (!i || i.collector !== t || i.dataRevision !== t.dataRevision || i.xEncoder !== e.encoders.x || i.x2Encoder !== e.encoders.x2 || i.xScaleResolution !== n || i.xIndexDomainStart !== r?.[0] || i.xIndexDomainEnd !== r?.[1]) {
|
|
392
|
-
let a =
|
|
407
|
+
let a = ve(e);
|
|
393
408
|
i = {
|
|
394
409
|
collector: t,
|
|
395
410
|
dataRevision: t.dataRevision,
|
|
@@ -408,16 +423,16 @@ var ge = class {
|
|
|
408
423
|
query(e, t) {
|
|
409
424
|
let n = this.#n;
|
|
410
425
|
if (!n?.spec) throw Error("Canvas x-index query was not prepared.");
|
|
411
|
-
|
|
426
|
+
p("canvasXIndexNativeItems", e.length);
|
|
412
427
|
let r = n.batches.get(e);
|
|
413
|
-
return r === void 0 && (r =
|
|
428
|
+
return r === void 0 && (r = _e(n.spec, e) ?? null, n.batches.set(e, r), p("canvasXIndexBuilds"), r || p("canvasXIndexRejectedBuilds")), r ? (r(this.#t[0], this.#t[1], t), p("canvasXIndexQueries"), p("canvasXIndexCandidateItems", t[1] - t[0]), t[0] === t[1] && p("canvasXIndexEmptyRanges"), !0) : this.#r();
|
|
414
429
|
}
|
|
415
430
|
#r() {
|
|
416
|
-
return
|
|
431
|
+
return p("canvasXIndexFallbackQueries"), !1;
|
|
417
432
|
}
|
|
418
|
-
},
|
|
433
|
+
}, be = class {
|
|
419
434
|
constructor(e) {
|
|
420
|
-
this.viewRoot = e.viewRoot, this.context = e.context, this.surface = e.surface, this.textMetrics = e.textMetrics, this.getBackground = e.getBackground, this.broadcast = e.broadcast, this.onLayoutComputed = e.onLayoutComputed, this.layoutResult = void 0, this.pickingRasterizer = void 0, this.dirtyPickingBuffer = !0, this.xIndexManager = new
|
|
435
|
+
this.viewRoot = e.viewRoot, this.context = e.context, this.surface = e.surface, this.textMetrics = e.textMetrics, this.getBackground = e.getBackground, this.broadcast = e.broadcast, this.onLayoutComputed = e.onLayoutComputed, this.layoutResult = void 0, this.pickingRasterizer = void 0, this.dirtyPickingBuffer = !0, this.xIndexManager = new ye(), this.opacityLayers = [];
|
|
421
436
|
}
|
|
422
437
|
computeLayout() {
|
|
423
438
|
this.broadcast("layout"), this.surface.invalidateSize();
|
|
@@ -437,10 +452,10 @@ var ge = class {
|
|
|
437
452
|
if (!e) return;
|
|
438
453
|
let t = this.surface.getLogicalCanvasSize();
|
|
439
454
|
if (isNaN(t.width) || isNaN(t.height)) return;
|
|
440
|
-
let n =
|
|
455
|
+
let n = d();
|
|
441
456
|
n?.beginFrame("canvas");
|
|
442
457
|
try {
|
|
443
|
-
|
|
458
|
+
f("render", () => F({
|
|
444
459
|
layoutResult: e,
|
|
445
460
|
context: this.context,
|
|
446
461
|
width: t.width,
|
|
@@ -462,17 +477,17 @@ var ge = class {
|
|
|
462
477
|
let t = this.surface.getLogicalCanvasSize();
|
|
463
478
|
if (isNaN(t.width) || isNaN(t.height)) return;
|
|
464
479
|
this.surface.clearPickingBuffer();
|
|
465
|
-
let n = this.pickingRasterizer, r = !1, i = new
|
|
480
|
+
let n = this.pickingRasterizer, r = !1, i = new fe({
|
|
466
481
|
width: t.width,
|
|
467
482
|
height: t.height,
|
|
468
483
|
devicePixelRatio: this.surface.getDevicePixelRatio(),
|
|
469
484
|
textMetrics: this.textMetrics,
|
|
470
|
-
getRasterizer: () => (n || (n = new
|
|
485
|
+
getRasterizer: () => (n || (n = new H(this.surface.getPickingBuffer()), this.pickingRasterizer = n), r ||= (n.resetClip(), n.resetStatistics(), !0), n),
|
|
471
486
|
xIndexManager: this.xIndexManager
|
|
472
|
-
}), a =
|
|
487
|
+
}), a = d();
|
|
473
488
|
a?.beginFrame("canvas", "picking");
|
|
474
489
|
try {
|
|
475
|
-
|
|
490
|
+
f("picking", () => e.collectRenderCommands(i)), this.dirtyPickingBuffer = !1, r && xe(n, a);
|
|
476
491
|
} finally {
|
|
477
492
|
a?.endFrame();
|
|
478
493
|
}
|
|
@@ -482,20 +497,20 @@ var ge = class {
|
|
|
482
497
|
}
|
|
483
498
|
#e() {
|
|
484
499
|
let e = this.surface.getLogicalCanvasSize();
|
|
485
|
-
if (!(isNaN(e.width) || isNaN(e.height))) return
|
|
500
|
+
if (!(isNaN(e.width) || isNaN(e.height))) return u(this.viewRoot, c.create(0, 0, e.width, e.height), {
|
|
486
501
|
devicePixelRatio: this.surface.getDevicePixelRatio(),
|
|
487
502
|
renderingOptions: { firstFacet: !0 }
|
|
488
503
|
});
|
|
489
504
|
}
|
|
490
505
|
};
|
|
491
|
-
function
|
|
506
|
+
function xe(e, t) {
|
|
492
507
|
if (!t) return;
|
|
493
508
|
let n = e.getStatistics();
|
|
494
509
|
t.addCount("pickingRectangles", n.rectangles), t.addCount("pickingSquares", n.squares), t.addCount("pickingPolygons", n.polygons), t.addCount("pickingSegments", n.segments), t.addCount("pickingCubics", n.cubics), t.addCount("pickingSpans", n.spans);
|
|
495
510
|
}
|
|
496
511
|
//#endregion
|
|
497
512
|
//#region ../core/src/rendering/canvas2d/picking/softwarePickingBuffer.js
|
|
498
|
-
var Q = /* @__PURE__ */ new Uint32Array(),
|
|
513
|
+
var Q = /* @__PURE__ */ new Uint32Array(), Se = class {
|
|
499
514
|
#e = Q;
|
|
500
515
|
width = 0;
|
|
501
516
|
height = 0;
|
|
@@ -530,7 +545,7 @@ function $(e, t) {
|
|
|
530
545
|
}
|
|
531
546
|
//#endregion
|
|
532
547
|
//#region ../core/src/rendering/canvas2d/canvas2DSurface.js
|
|
533
|
-
var
|
|
548
|
+
var Ce = class {
|
|
534
549
|
#e;
|
|
535
550
|
#t;
|
|
536
551
|
#n;
|
|
@@ -540,7 +555,7 @@ var be = class {
|
|
|
540
555
|
if (!n) throw Error("Unable to initialize a Canvas2D rendering context.");
|
|
541
556
|
this.canvas = t, this.context = n, e.container.appendChild(t);
|
|
542
557
|
try {
|
|
543
|
-
this.#e = new
|
|
558
|
+
this.#e = new I(e.container, t, e.sizeSource, () => {
|
|
544
559
|
this.#i() && e.onCanvasResize();
|
|
545
560
|
}), this.#i();
|
|
546
561
|
} catch (e) {
|
|
@@ -568,7 +583,7 @@ var be = class {
|
|
|
568
583
|
getPickingBuffer() {
|
|
569
584
|
if (this.#r) throw Error("Canvas2D surface has been finalized.");
|
|
570
585
|
let e = this.getLogicalCanvasSize();
|
|
571
|
-
return this.#n ??= new
|
|
586
|
+
return this.#n ??= new Se(e.width, e.height), this.#n;
|
|
572
587
|
}
|
|
573
588
|
clearPickingBuffer() {
|
|
574
589
|
this.#n?.clear();
|
|
@@ -602,32 +617,32 @@ var be = class {
|
|
|
602
617
|
};
|
|
603
618
|
//#endregion
|
|
604
619
|
//#region ../core/src/rendering/canvas2d/index.js
|
|
605
|
-
function
|
|
606
|
-
let t = new
|
|
620
|
+
function we(e) {
|
|
621
|
+
let t = new Ce(e), n = re(e.container.ownerDocument);
|
|
607
622
|
return {
|
|
608
623
|
surface: t,
|
|
609
624
|
textMetrics: n,
|
|
610
|
-
createRenderCoordinator: (e) => new
|
|
625
|
+
createRenderCoordinator: (e) => new be({
|
|
611
626
|
...e,
|
|
612
627
|
surface: t,
|
|
613
628
|
context: t.context,
|
|
614
629
|
textMetrics: n
|
|
615
630
|
}),
|
|
616
|
-
exportCanvas: (e) =>
|
|
631
|
+
exportCanvas: (e) => L({
|
|
617
632
|
...e,
|
|
618
633
|
liveSize: t.getLogicalCanvasSize(),
|
|
619
634
|
liveDevicePixelRatio: t.getDevicePixelRatio(),
|
|
620
635
|
textMetrics: n
|
|
621
636
|
}),
|
|
622
|
-
exportRaster: (e) =>
|
|
637
|
+
exportRaster: (e) => R({
|
|
623
638
|
...e,
|
|
624
639
|
liveSize: t.getLogicalCanvasSize(),
|
|
625
640
|
liveDevicePixelRatio: t.getDevicePixelRatio(),
|
|
626
641
|
textMetrics: n
|
|
627
642
|
}),
|
|
628
|
-
rasterizeSvgRuns: (e) =>
|
|
643
|
+
rasterizeSvgRuns: (e) => z()(e),
|
|
629
644
|
readPickingId: (e, n) => t.readPickingId(e, n)
|
|
630
645
|
};
|
|
631
646
|
}
|
|
632
647
|
//#endregion
|
|
633
|
-
export {
|
|
648
|
+
export { we as createCanvas2DRenderingBackend };
|