@genome-spy/app 0.86.0 → 0.88.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-DgopQbMV.js → agentApi-BYFBKiRQ.js} +8170 -7390
- package/dist/agentApi.es.js +3945 -3862
- package/dist/agentShared.es.js +7 -7
- package/dist/{canvas2d-BtQC7Xr8.js → canvas2d-BVQ7-2eJ.js} +141 -140
- package/dist/{canvas2d-8uxuN_vx.js → canvas2d-D7SZK3xv.js} +117 -116
- package/dist/clipOptions-BWHr3aTa.js +2675 -0
- package/dist/{clipOptions-BQfNhxgP.js → clipOptions-DTMcB_9z.js} +1147 -731
- package/dist/{debug-D_VtWQ6l.js → debug-CVpoEOWx.js} +2 -2
- package/dist/{debug-Bzc3SoRg.js → debug-DYAMZZKl.js} +2 -2
- package/dist/index.es.js +3398 -3428
- package/dist/index.js +441 -411
- package/dist/{indexer-qy_dq5l5.js → indexer-CXjZDo2Q.js} +1 -1
- package/dist/{indexer-qiFctgR3.js → indexer-DAH_ruVn.js} +1 -1
- package/dist/{nativeText-vT3AWE14.js → order-C5CzA37O.js} +144 -86
- package/dist/{nativeText-DFV5XIx8.js → order-DvY7KNcu.js} +133 -75
- package/dist/{rasterExport-B8pVoOsj.js → rasterExport-BgZ98e6U.js} +1 -1
- package/dist/{rasterExport-C4r4xjQT.js → rasterExport-DEr8fOLm.js} +1 -1
- package/dist/{renderCanvas2D-CHVNfIUz.js → renderCanvas2D-DtcJjqpB.js} +109 -96
- package/dist/{renderCanvas2D-BQrRWp2Z.js → renderCanvas2D-DxturTEW.js} +108 -95
- package/dist/schema.json +10839 -2862
- package/dist/{svg-C-Sw6E6G.js → svg-CyrLfa9e.js} +389 -428
- package/dist/{svg-CKHwwKRt.js → svg-SDJMzL--.js} +389 -428
- package/dist/{svgRasterizer-BgD72AmG.js → svgRasterizer-f7DJ3UO0.js} +1 -1
- package/dist/{svgRasterizer-BgSNqI3L.js → svgRasterizer-mWK7HTkx.js} +1 -1
- package/dist/{vega-scale-D46-iCaL.js → vega-scale-CypF85iS.js} +894 -1191
- package/dist/{vega-scale-CK0_al6O.js → vega-scale-DLKCwWRs.js} +893 -1190
- package/dist/{viewIdentityRegistry-B-VGlez1.js → viewIdentityRegistry-DIDo44XQ.js} +1 -1
- package/dist/{viewIdentityRegistry-CDtVktJD.js → viewIdentityRegistry-Dl-vMN9I.js} +1 -1
- package/dist/{viewSelectors-CKfxF_LM.js → viewSelectors-CymbZyE6.js} +692 -459
- package/dist/{viewSelectors-D_imtq5Z.js → viewSelectors-DNiDip5e.js} +667 -434
- package/dist/{viewUtils-nCJ7AoaI.js → viewUtils-BrJLIj2o.js} +3032 -2332
- package/dist/{webgl-BaA3jSa2.js → webgl-CqTDifWM.js} +1087 -1056
- package/dist/{webgl-FP-4EsBL.js → webgl-jaC2m0Zr.js} +1113 -1082
- package/package.json +5 -5
- package/src/embedTypes.d.ts +1 -1
- package/dist/clipOptions-taFzEljc.js +0 -2259
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { v as a } from "./vega-scale-
|
|
3
|
-
import { t as o } from "./
|
|
4
|
-
import { t as s } from "./
|
|
5
|
-
import { n as c,
|
|
6
|
-
import { n as
|
|
7
|
-
import {
|
|
8
|
-
import { n as
|
|
9
|
-
import { t as
|
|
10
|
-
import { exportCanvas as
|
|
11
|
-
import { createCanvas2DSvgRasterizer as
|
|
1
|
+
import { ct as e, et as t, o as n, s as r, un as i } from "./clipOptions-BWHr3aTa.js";
|
|
2
|
+
import { v as a } from "./vega-scale-CypF85iS.js";
|
|
3
|
+
import { t as o } from "./warning-CpIIpk8e.js";
|
|
4
|
+
import { t as s } from "./rectangle-DKnrAmKs.js";
|
|
5
|
+
import { n as c, r as l, t as u } from "./performanceProfiler-CPLEjApa.js";
|
|
6
|
+
import { n as d, t as f } from "./layoutResult-D50MSHXR.js";
|
|
7
|
+
import { A as p, C as m, E as h, M as g, N as _, O as v, S as y, _ as b, a as x, b as S, c as C, f as w, h as T, k as E, l as D, m as O, o as ee, p as te, s as ne, u as re, v as ie, y as k } from "./order-C5CzA37O.js";
|
|
8
|
+
import { n as A, t as j } from "./renderCanvas2D-DxturTEW.js";
|
|
9
|
+
import { t as M } from "./canvasSizeHelper-7h_8rOcx.js";
|
|
10
|
+
import { exportCanvas as N, exportRaster as P } from "./rasterExport-DEr8fOLm.js";
|
|
11
|
+
import { createCanvas2DSvgRasterizer as F } from "./svgRasterizer-mWK7HTkx.js";
|
|
12
12
|
//#region ../core/src/rendering/canvas2d/picking/softwarePickingRasterizer.js
|
|
13
|
-
var
|
|
13
|
+
var I = 12, L = .5, R = class {
|
|
14
14
|
#e = [];
|
|
15
15
|
#t = [];
|
|
16
16
|
#n = [
|
|
@@ -50,7 +50,7 @@ var P = 12, F = .5, I = class {
|
|
|
50
50
|
}
|
|
51
51
|
setClip(e, t, n, r) {
|
|
52
52
|
if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r)) throw RangeError("Software picking clip must be finite.");
|
|
53
|
-
this.#r =
|
|
53
|
+
this.#r = H(Math.floor(Math.min(e, n)), 0, this.buffer.width), this.#i = H(Math.floor(Math.min(t, r)), 0, this.buffer.height), this.#a = H(Math.ceil(Math.max(e, n)), this.#r, this.buffer.width), this.#o = H(Math.ceil(Math.max(t, r)), this.#i, this.buffer.height);
|
|
54
54
|
}
|
|
55
55
|
fillRect(e, t, n, r, i) {
|
|
56
56
|
this.#s++, this.#p(e, t, n, r, i);
|
|
@@ -91,33 +91,33 @@ var P = 12, F = .5, I = class {
|
|
|
91
91
|
let s = t.length - 2;
|
|
92
92
|
for (let n = 0; n < t.length; n += 2) this.strokeSegment(e, t[s], t[s + 1], t[n], t[n + 1], 1), s = n;
|
|
93
93
|
}
|
|
94
|
-
strokeSegment(e, t, n, r, i, a) {
|
|
94
|
+
strokeSegment(e, t, n, r, i, a, o) {
|
|
95
95
|
if (!(a > 0) || !Number.isFinite(a)) return;
|
|
96
96
|
this.#u++;
|
|
97
|
-
let
|
|
98
|
-
if (!
|
|
99
|
-
let
|
|
100
|
-
if (
|
|
101
|
-
this.#h(e,
|
|
97
|
+
let s = a / 2, c = this.#n;
|
|
98
|
+
if (!z(t, n, r, i, this.#r - s, this.#i - s, this.#a + s, this.#o + s, c)) return;
|
|
99
|
+
let l = c[2] - c[0], u = c[3] - c[1], d = Math.ceil(Math.max(Math.abs(l), Math.abs(u)));
|
|
100
|
+
if (d == 0) {
|
|
101
|
+
this.#h(e, c[0], c[1], s, o);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
for (let t = 0; t <=
|
|
105
|
-
let n = t /
|
|
106
|
-
this.#h(e,
|
|
104
|
+
for (let t = 0; t <= d; t++) {
|
|
105
|
+
let n = t / d;
|
|
106
|
+
this.#h(e, c[0] + l * n, c[1] + u * n, s, o);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
strokeCubic(e, t, n, r, i, a, o, s, c, l, u =
|
|
109
|
+
strokeCubic(e, t, n, r, i, a, o, s, c, l, u = L, d) {
|
|
110
110
|
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
111
|
this.#d++;
|
|
112
|
-
let
|
|
113
|
-
for (
|
|
114
|
-
let t =
|
|
115
|
-
if (t >=
|
|
116
|
-
this.strokeSegment(e,
|
|
112
|
+
let f = this.#e;
|
|
113
|
+
for (f.length = 0, f.push(t, n, r, i, a, o, s, c, 0); f.length;) {
|
|
114
|
+
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 >= I || B(p, c, s, o, a, i, r, n, u)) {
|
|
116
|
+
this.strokeSegment(e, p, c, r, n, l, d);
|
|
117
117
|
continue;
|
|
118
118
|
}
|
|
119
|
-
let
|
|
120
|
-
|
|
119
|
+
let m = (p + s) / 2, h = (c + o) / 2, g = (s + a) / 2, _ = (o + i) / 2, v = (a + r) / 2, y = (i + n) / 2, b = (m + g) / 2, x = (h + _) / 2, S = (g + v) / 2, C = (_ + y) / 2, w = (b + S) / 2, T = (x + C) / 2, E = t + 1;
|
|
120
|
+
f.push(w, T, S, C, v, y, r, n, E, p, c, m, h, b, x, w, T, E);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
#m(e, t, n, r) {
|
|
@@ -125,19 +125,20 @@ var P = 12, F = .5, I = class {
|
|
|
125
125
|
let i = t * this.buffer.width;
|
|
126
126
|
this.buffer.ids.fill(e >>> 0, i + n, i + r);
|
|
127
127
|
}
|
|
128
|
-
#h(e, t, n, r) {
|
|
129
|
-
let
|
|
130
|
-
if (
|
|
131
|
-
let
|
|
132
|
-
for (let e =
|
|
128
|
+
#h(e, t, n, r, i) {
|
|
129
|
+
let a = Math.max(this.#r, Math.floor(t - r)), o = Math.max(this.#i, Math.floor(n - r)), s = Math.min(this.#a, Math.ceil(t + r)), c = Math.min(this.#o, Math.ceil(n + r));
|
|
130
|
+
if (a >= s || o >= c) return;
|
|
131
|
+
let l = e >>> 0, u = this.buffer.ids, d = this.buffer.width, f = s - a;
|
|
132
|
+
for (let e = o; e < c; e++) {
|
|
133
133
|
this.#f++;
|
|
134
|
-
let t = e *
|
|
135
|
-
if (
|
|
136
|
-
else
|
|
134
|
+
let t = e * d + a, n = t + f;
|
|
135
|
+
if (i) for (let t = a; t < s; t++) i(t + .5, e + .5) && (u[e * d + t] = l);
|
|
136
|
+
else if (f > 16) u.fill(l, t, n);
|
|
137
|
+
else for (let e = t; e < n; e++) u[e] = l;
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
};
|
|
140
|
-
function
|
|
141
|
+
function z(e, t, n, r, i, a, o, s, c) {
|
|
141
142
|
if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r)) return !1;
|
|
142
143
|
let l = n - e, u = r - t, d = 0, f = 1;
|
|
143
144
|
if (l == 0) {
|
|
@@ -154,85 +155,85 @@ function L(e, t, n, r, i, a, o, s, c) {
|
|
|
154
155
|
}
|
|
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);
|
|
156
157
|
}
|
|
157
|
-
function
|
|
158
|
+
function B(e, t, n, r, i, a, o, s, c) {
|
|
158
159
|
let l = o - e, u = s - t, d = l * l + u * u, f = c * c;
|
|
159
160
|
if (d == 0) {
|
|
160
|
-
let o =
|
|
161
|
+
let o = V(e, t, n, r), s = V(e, t, i, a);
|
|
161
162
|
return Math.max(o, s) <= f;
|
|
162
163
|
}
|
|
163
164
|
let p = u * (n - e) - l * (r - t), m = u * (i - e) - l * (a - t);
|
|
164
165
|
return Math.max(p * p, m * m) <= f * d;
|
|
165
166
|
}
|
|
166
|
-
function
|
|
167
|
+
function V(e, t, n, r) {
|
|
167
168
|
let i = n - e, a = r - t;
|
|
168
169
|
return i * i + a * a;
|
|
169
170
|
}
|
|
170
|
-
function
|
|
171
|
+
function H(e, t, n) {
|
|
171
172
|
return Math.max(t, Math.min(n, e));
|
|
172
173
|
}
|
|
173
174
|
//#endregion
|
|
174
175
|
//#region ../core/src/rendering/canvas2d/picking/renderers/index.js
|
|
175
|
-
var
|
|
176
|
-
function
|
|
176
|
+
var U = 1;
|
|
177
|
+
function W(e, t) {
|
|
177
178
|
let n = e.getType();
|
|
178
|
-
return n == "arrow" ?
|
|
179
|
+
return n == "arrow" ? K(e, t) : n == "rect" ? q(e, t) : n == "point" ? J(e, t) : n == "rule" || n == "tick" ? ae(e, t) : n == "link" ? oe(e, t) : n == "text" ? se(e, t) : 0;
|
|
179
180
|
}
|
|
180
|
-
function
|
|
181
|
+
function G(e) {
|
|
181
182
|
let t = e.getType();
|
|
182
183
|
return t == "rect" || t == "arrow" || t == "point" || t == "rule" || t == "tick" || t == "link" || t == "text";
|
|
183
184
|
}
|
|
184
|
-
function
|
|
185
|
-
let n = e, r =
|
|
186
|
-
return
|
|
185
|
+
function K(e, t) {
|
|
186
|
+
let n = e, r = k(n), i = Array(8).fill(0);
|
|
187
|
+
return y(n, r, t, (e) => {
|
|
187
188
|
let a = Y(n, e.datum), o = e.strokeWidth / 2;
|
|
188
|
-
r.stem && t.rasterizer.strokeSegment(a, e.tail.x, e.tail.y, e.tip.x, e.tip.y, e.stemHalfWidth * 2 + e.strokeWidth),
|
|
189
|
+
r.stem && t.rasterizer.strokeSegment(a, e.tail.x, e.tail.y, e.tip.x, e.tip.y, e.stemHalfWidth * 2 + e.strokeWidth), S(e, (n, r) => {
|
|
189
190
|
let s = e.headHalfWidth + o, c = n + e.tangent.x * o, l = r + e.tangent.y * o, u = e.headRepeatFootprint + o, d = n - e.tangent.x * u, f = r - e.tangent.y * u;
|
|
190
|
-
|
|
191
|
+
ce(i, c, l, d, f, e.normal.x, e.normal.y, s), t.rasterizer.fillConvexPolygon(a, i);
|
|
191
192
|
});
|
|
192
193
|
});
|
|
193
194
|
}
|
|
194
|
-
function
|
|
195
|
+
function q(e, t) {
|
|
195
196
|
let n = e;
|
|
196
|
-
return
|
|
197
|
+
return re(n, D(n), t, (e) => t.rasterizer.fillRect(Y(n, e.datum), e.x, e.y, e.width, e.height));
|
|
197
198
|
}
|
|
198
|
-
function
|
|
199
|
+
function J(e, t) {
|
|
199
200
|
let n = e, r = h(n, n.properties.minPickingSize);
|
|
200
|
-
return
|
|
201
|
+
return te(n, w(n), t, (e) => t.rasterizer.fillSquare(Y(n, e.datum), e.x, e.y, Math.max(e.boundsRadius, r / 2)));
|
|
201
202
|
}
|
|
202
|
-
function
|
|
203
|
+
function ae(e, t) {
|
|
203
204
|
let n = e;
|
|
204
|
-
return
|
|
205
|
+
return C(n, ne(n), t, (e) => t.rasterizer.strokeSegment(Y(n, e.datum), e.x1, e.y1, e.x2, e.y2, Math.max(e.strokeWidth, U)));
|
|
205
206
|
}
|
|
206
|
-
function
|
|
207
|
-
let n = e, r = h(n, n.properties.minPickingSize);
|
|
208
|
-
return
|
|
209
|
-
let [i,
|
|
210
|
-
t.rasterizer.strokeCubic(Y(n, e.datum), i[0], i[1],
|
|
207
|
+
function oe(e, t) {
|
|
208
|
+
let n = e, r = h(n, n.properties.minPickingSize), i = O(n), a = ie(n, i.shape);
|
|
209
|
+
return T(n, i, t, (e) => {
|
|
210
|
+
let [i, o, s, c] = e.points, l = a && b(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);
|
|
211
212
|
});
|
|
212
213
|
}
|
|
213
|
-
function
|
|
214
|
+
function se(e, t) {
|
|
214
215
|
let n = e;
|
|
215
|
-
return
|
|
216
|
+
return ee(n, x(n), t, (e) => t.rasterizer.fillConvexPolygon(Y(n, e.datum), e.boundsQuad));
|
|
216
217
|
}
|
|
217
|
-
function
|
|
218
|
+
function ce(e, t, n, r, i, a, o, s) {
|
|
218
219
|
let c = a * s, l = o * s;
|
|
219
220
|
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;
|
|
220
221
|
}
|
|
221
222
|
function Y(e, t) {
|
|
222
223
|
let n = e.encoders;
|
|
223
|
-
return
|
|
224
|
+
return m(n.uniqueId, t);
|
|
224
225
|
}
|
|
225
226
|
//#endregion
|
|
226
227
|
//#region ../core/src/rendering/canvas2d/picking/softwarePickingViewRenderingContext.js
|
|
227
|
-
var
|
|
228
|
+
var le = class extends d {
|
|
228
229
|
#e = [];
|
|
229
230
|
#t = /* @__PURE__ */ new Set();
|
|
230
231
|
#n;
|
|
231
|
-
#r = new
|
|
232
|
+
#r = new g();
|
|
232
233
|
#i;
|
|
233
234
|
#a = [0, 0];
|
|
234
235
|
constructor(e) {
|
|
235
|
-
super({ picking: !0 }), this.width = e.width, this.height = e.height, this.devicePixelRatio = e.devicePixelRatio, this.getRasterizer = e.getRasterizer, this.#n =
|
|
236
|
+
super({ picking: !0 }), this.width = e.width, this.height = e.height, this.devicePixelRatio = e.devicePixelRatio, this.getRasterizer = e.getRasterizer, this.#n = c(), this.#i = e.xIndexManager;
|
|
236
237
|
}
|
|
237
238
|
getDevicePixelRatio() {
|
|
238
239
|
return this.devicePixelRatio;
|
|
@@ -247,23 +248,23 @@ var se = class extends c {
|
|
|
247
248
|
if (this.#e.pop()?.view !== e) throw Error("Unbalanced software picking view rendering context stack.");
|
|
248
249
|
}
|
|
249
250
|
renderMark(e, t) {
|
|
250
|
-
if (!e.isPickingParticipant() || !
|
|
251
|
+
if (!e.isPickingParticipant() || !G(e)) return;
|
|
251
252
|
let i = t.sampleFacetRenderingOptions;
|
|
252
|
-
if (i && !e.encoders.facetIndex && (this.#n?.addCount("canvasSampleFacetOccurrences"), !
|
|
253
|
+
if (i && !e.encoders.facetIndex && (this.#n?.addCount("canvasSampleFacetOccurrences"), !A(i))) {
|
|
253
254
|
this.#n?.addCount("canvasCulledSampleFacetOccurrences");
|
|
254
255
|
return;
|
|
255
256
|
}
|
|
256
257
|
let a = e.unitView.getEffectiveOpacity();
|
|
257
258
|
if (a <= 0) return;
|
|
258
|
-
let
|
|
259
|
+
let s = this.currentCoords, c = n(t), l = r(c, e.properties.clip, s), u = E(this.width, this.height, l);
|
|
259
260
|
if (!p(u)) return;
|
|
260
|
-
let d =
|
|
261
|
-
|
|
261
|
+
let d = v(s, c, e.properties.cullByVisibleRange), f = this.#i?.prepare(e) ?? !1;
|
|
262
|
+
_(e, t, s, this.#r, (t, n) => {
|
|
262
263
|
if (n.length == 0) return;
|
|
263
264
|
let r = 0, i = n.length;
|
|
264
265
|
if (f && this.#i.query(n, this.#a) && (r = this.#a[0], i = this.#a[1], r === i)) return;
|
|
265
266
|
let o = this.getRasterizer();
|
|
266
|
-
o.setClip(u.x1, u.y1, u.x2, u.y2),
|
|
267
|
+
o.setClip(u.x1, u.y1, u.x2, u.y2), W(e, {
|
|
267
268
|
rasterizer: o,
|
|
268
269
|
coords: t,
|
|
269
270
|
data: n,
|
|
@@ -273,18 +274,18 @@ var se = class extends c {
|
|
|
273
274
|
anchorCullBounds: d,
|
|
274
275
|
viewOpacity: a
|
|
275
276
|
});
|
|
276
|
-
}, (t) =>
|
|
277
|
+
}, (t) => o(`Canvas2D picking could not resolve sample facet index ${t}. View: ${e.unitView.getPathString()}`));
|
|
277
278
|
}
|
|
278
279
|
get currentCoords() {
|
|
279
280
|
let e = i(this.#e);
|
|
280
281
|
if (!e) throw Error("No current view in software picking rendering context.");
|
|
281
282
|
return e.coords;
|
|
282
283
|
}
|
|
283
|
-
}, X = 2 ** 31 - 1,
|
|
284
|
-
function
|
|
284
|
+
}, X = 2 ** 31 - 1, ue = -(2 ** 31);
|
|
285
|
+
function de(e, n, r, i = r) {
|
|
285
286
|
let a = Array(e);
|
|
286
287
|
a.fill(X);
|
|
287
|
-
let o =
|
|
288
|
+
let o = ue, s = -Infinity, c = !1, l = Array(e);
|
|
288
289
|
l.fill(0);
|
|
289
290
|
let u = n[0], d = (n[1] - n[0]) / e, f = (n, r) => {
|
|
290
291
|
let i = (n - u) / d, a = Math.floor(i);
|
|
@@ -342,12 +343,12 @@ function le(e, n, r, i = r) {
|
|
|
342
343
|
}
|
|
343
344
|
//#endregion
|
|
344
345
|
//#region ../core/src/rendering/xIndex/markXIndex.js
|
|
345
|
-
function
|
|
346
|
+
function fe(e, t, n = 0) {
|
|
346
347
|
if (!t.length) return;
|
|
347
|
-
let r =
|
|
348
|
+
let r = de(Math.min(256, Math.ceil(Math.sqrt(t.length))), e.indexDomain, e.xAccessor, e.x2Accessor);
|
|
348
349
|
return t.forEach((e, t) => r(e, n + t, n + t + 1)), r.getIndex();
|
|
349
350
|
}
|
|
350
|
-
function
|
|
351
|
+
function pe(t) {
|
|
351
352
|
let n = t.encoders?.x, r = t.encoders?.x2;
|
|
352
353
|
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;
|
|
353
354
|
let i = t.getType();
|
|
@@ -365,7 +366,7 @@ function de(t) {
|
|
|
365
366
|
domainStartOffset: ["index", "locus"].includes(n.scale.type) ? -1 : 0
|
|
366
367
|
};
|
|
367
368
|
}
|
|
368
|
-
function
|
|
369
|
+
function me(e, t) {
|
|
369
370
|
let n = e.scaleResolution.getScale().domain();
|
|
370
371
|
if (n.length !== 2 || !Number.isFinite(n[0]) || !Number.isFinite(n[1]) || n[1] <= n[0]) return !1;
|
|
371
372
|
let r = n[1] - n[0];
|
|
@@ -373,7 +374,7 @@ function fe(e, t) {
|
|
|
373
374
|
}
|
|
374
375
|
//#endregion
|
|
375
376
|
//#region ../core/src/rendering/canvas2d/canvasXIndexManager.js
|
|
376
|
-
var
|
|
377
|
+
var he = class {
|
|
377
378
|
#e = /* @__PURE__ */ new WeakMap();
|
|
378
379
|
#t = [0, 0];
|
|
379
380
|
#n;
|
|
@@ -381,7 +382,7 @@ var pe = class {
|
|
|
381
382
|
if (this.#n = void 0, e.encoders.facetIndex) return this.#r();
|
|
382
383
|
let t = e.unitView.getCollector(), n = e.unitView.getScaleResolution("x"), r = n?.zoomExtent, i = this.#e.get(e);
|
|
383
384
|
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]) {
|
|
384
|
-
let a =
|
|
385
|
+
let a = pe(e);
|
|
385
386
|
i = {
|
|
386
387
|
collector: t,
|
|
387
388
|
dataRevision: t.dataRevision,
|
|
@@ -395,21 +396,21 @@ var pe = class {
|
|
|
395
396
|
}, this.#e.set(e, i);
|
|
396
397
|
}
|
|
397
398
|
let a = i.spec;
|
|
398
|
-
return !a || !
|
|
399
|
+
return !a || !me(a, this.#t) ? this.#r() : (this.#n = i, !0);
|
|
399
400
|
}
|
|
400
401
|
query(e, t) {
|
|
401
402
|
let n = this.#n;
|
|
402
403
|
if (!n?.spec) throw Error("Canvas x-index query was not prepared.");
|
|
403
|
-
|
|
404
|
+
u("canvasXIndexNativeItems", e.length);
|
|
404
405
|
let r = n.batches.get(e);
|
|
405
|
-
return r === void 0 && (r =
|
|
406
|
+
return r === void 0 && (r = fe(n.spec, e) ?? null, n.batches.set(e, r), u("canvasXIndexBuilds"), r || u("canvasXIndexRejectedBuilds")), r ? (r(this.#t[0], this.#t[1], t), u("canvasXIndexQueries"), u("canvasXIndexCandidateItems", t[1] - t[0]), t[0] === t[1] && u("canvasXIndexEmptyRanges"), !0) : this.#r();
|
|
406
407
|
}
|
|
407
408
|
#r() {
|
|
408
|
-
return
|
|
409
|
+
return u("canvasXIndexFallbackQueries"), !1;
|
|
409
410
|
}
|
|
410
|
-
},
|
|
411
|
+
}, Z = class {
|
|
411
412
|
constructor(e) {
|
|
412
|
-
this.viewRoot = e.viewRoot, this.context = e.context, this.surface = e.surface, 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
|
|
413
|
+
this.viewRoot = e.viewRoot, this.context = e.context, this.surface = e.surface, 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 he(), this.opacityLayers = [];
|
|
413
414
|
}
|
|
414
415
|
computeLayout() {
|
|
415
416
|
this.broadcast("layout"), this.surface.invalidateSize();
|
|
@@ -429,10 +430,10 @@ var pe = class {
|
|
|
429
430
|
if (!e) return;
|
|
430
431
|
let t = this.surface.getLogicalCanvasSize();
|
|
431
432
|
if (isNaN(t.width) || isNaN(t.height)) return;
|
|
432
|
-
let n =
|
|
433
|
+
let n = c();
|
|
433
434
|
n?.beginFrame("canvas");
|
|
434
435
|
try {
|
|
435
|
-
|
|
436
|
+
l("render", () => j({
|
|
436
437
|
layoutResult: e,
|
|
437
438
|
context: this.context,
|
|
438
439
|
width: t.width,
|
|
@@ -453,16 +454,16 @@ var pe = class {
|
|
|
453
454
|
let t = this.surface.getLogicalCanvasSize();
|
|
454
455
|
if (isNaN(t.width) || isNaN(t.height)) return;
|
|
455
456
|
this.surface.clearPickingBuffer();
|
|
456
|
-
let n = this.pickingRasterizer, r = !1, i = new
|
|
457
|
+
let n = this.pickingRasterizer, r = !1, i = new le({
|
|
457
458
|
width: t.width,
|
|
458
459
|
height: t.height,
|
|
459
460
|
devicePixelRatio: this.surface.getDevicePixelRatio(),
|
|
460
|
-
getRasterizer: () => (n || (n = new
|
|
461
|
+
getRasterizer: () => (n || (n = new R(this.surface.getPickingBuffer()), this.pickingRasterizer = n), r ||= (n.resetClip(), n.resetStatistics(), !0), n),
|
|
461
462
|
xIndexManager: this.xIndexManager
|
|
462
|
-
}), a =
|
|
463
|
+
}), a = c();
|
|
463
464
|
a?.beginFrame("canvas", "picking");
|
|
464
465
|
try {
|
|
465
|
-
|
|
466
|
+
l("picking", () => e.collectRenderCommands(i)), this.dirtyPickingBuffer = !1, r && ge(n, a);
|
|
466
467
|
} finally {
|
|
467
468
|
a?.endFrame();
|
|
468
469
|
}
|
|
@@ -472,21 +473,21 @@ var pe = class {
|
|
|
472
473
|
}
|
|
473
474
|
#e() {
|
|
474
475
|
let e = this.surface.getLogicalCanvasSize();
|
|
475
|
-
if (!(isNaN(e.width) || isNaN(e.height))) return
|
|
476
|
+
if (!(isNaN(e.width) || isNaN(e.height))) return f(this.viewRoot, s.create(0, 0, e.width, e.height), {
|
|
476
477
|
devicePixelRatio: this.surface.getDevicePixelRatio(),
|
|
477
478
|
renderingOptions: { firstFacet: !0 }
|
|
478
479
|
});
|
|
479
480
|
}
|
|
480
481
|
};
|
|
481
|
-
function
|
|
482
|
+
function ge(e, t) {
|
|
482
483
|
if (!t) return;
|
|
483
484
|
let n = e.getStatistics();
|
|
484
485
|
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);
|
|
485
486
|
}
|
|
486
487
|
//#endregion
|
|
487
488
|
//#region ../core/src/rendering/canvas2d/picking/softwarePickingBuffer.js
|
|
488
|
-
var
|
|
489
|
-
#e =
|
|
489
|
+
var Q = /* @__PURE__ */ new Uint32Array(), _e = class {
|
|
490
|
+
#e = Q;
|
|
490
491
|
width = 0;
|
|
491
492
|
height = 0;
|
|
492
493
|
constructor(e = 0, t = 0) {
|
|
@@ -496,11 +497,11 @@ var Z = /* @__PURE__ */ new Uint32Array(), ge = class {
|
|
|
496
497
|
return this.#e;
|
|
497
498
|
}
|
|
498
499
|
resize(e, t) {
|
|
499
|
-
let n =
|
|
500
|
+
let n = $(e, "width"), r = $(t, "height");
|
|
500
501
|
if (n == this.width && r == this.height) return !1;
|
|
501
502
|
let i = n * r;
|
|
502
503
|
if (!Number.isSafeInteger(i)) throw RangeError("Software picking buffer is too large.");
|
|
503
|
-
return this.width = n, this.height = r, this.#e = i ? new Uint32Array(i) :
|
|
504
|
+
return this.width = n, this.height = r, this.#e = i ? new Uint32Array(i) : Q, !0;
|
|
504
505
|
}
|
|
505
506
|
clear() {
|
|
506
507
|
this.#e.fill(0);
|
|
@@ -511,16 +512,16 @@ var Z = /* @__PURE__ */ new Uint32Array(), ge = class {
|
|
|
511
512
|
return n < 0 || r < 0 || n >= this.width || r >= this.height ? 0 : this.#e[r * this.width + n];
|
|
512
513
|
}
|
|
513
514
|
dispose() {
|
|
514
|
-
this.width = 0, this.height = 0, this.#e =
|
|
515
|
+
this.width = 0, this.height = 0, this.#e = Q;
|
|
515
516
|
}
|
|
516
517
|
};
|
|
517
|
-
function
|
|
518
|
+
function $(e, t) {
|
|
518
519
|
if (!Number.isFinite(e) || e < 0) throw RangeError(`Software picking buffer ${t} must be a finite nonnegative number.`);
|
|
519
520
|
return Math.floor(e);
|
|
520
521
|
}
|
|
521
522
|
//#endregion
|
|
522
523
|
//#region ../core/src/rendering/canvas2d/canvas2DSurface.js
|
|
523
|
-
var
|
|
524
|
+
var ve = class {
|
|
524
525
|
#e;
|
|
525
526
|
#t;
|
|
526
527
|
#n;
|
|
@@ -530,7 +531,7 @@ var $ = class {
|
|
|
530
531
|
if (!n) throw Error("Unable to initialize a Canvas2D rendering context.");
|
|
531
532
|
this.canvas = t, this.context = n, e.container.appendChild(t);
|
|
532
533
|
try {
|
|
533
|
-
this.#e = new
|
|
534
|
+
this.#e = new M(e.container, t, e.sizeSource, () => {
|
|
534
535
|
this.#i() && e.onCanvasResize();
|
|
535
536
|
}), this.#i();
|
|
536
537
|
} catch (e) {
|
|
@@ -558,7 +559,7 @@ var $ = class {
|
|
|
558
559
|
getPickingBuffer() {
|
|
559
560
|
if (this.#r) throw Error("Canvas2D surface has been finalized.");
|
|
560
561
|
let e = this.getLogicalCanvasSize();
|
|
561
|
-
return this.#n ??= new
|
|
562
|
+
return this.#n ??= new _e(e.width, e.height), this.#n;
|
|
562
563
|
}
|
|
563
564
|
clearPickingBuffer() {
|
|
564
565
|
this.#n?.clear();
|
|
@@ -592,28 +593,28 @@ var $ = class {
|
|
|
592
593
|
};
|
|
593
594
|
//#endregion
|
|
594
595
|
//#region ../core/src/rendering/canvas2d/index.js
|
|
595
|
-
function
|
|
596
|
-
let t = new
|
|
596
|
+
function ye(e) {
|
|
597
|
+
let t = new ve(e);
|
|
597
598
|
return {
|
|
598
599
|
surface: t,
|
|
599
|
-
createRenderCoordinator: (e) => new
|
|
600
|
+
createRenderCoordinator: (e) => new Z({
|
|
600
601
|
...e,
|
|
601
602
|
surface: t,
|
|
602
603
|
context: t.context
|
|
603
604
|
}),
|
|
604
|
-
exportCanvas: (e) =>
|
|
605
|
+
exportCanvas: (e) => N({
|
|
605
606
|
...e,
|
|
606
607
|
liveSize: t.getLogicalCanvasSize(),
|
|
607
608
|
liveDevicePixelRatio: t.getDevicePixelRatio()
|
|
608
609
|
}),
|
|
609
|
-
exportRaster: (e) =>
|
|
610
|
+
exportRaster: (e) => P({
|
|
610
611
|
...e,
|
|
611
612
|
liveSize: t.getLogicalCanvasSize(),
|
|
612
613
|
liveDevicePixelRatio: t.getDevicePixelRatio()
|
|
613
614
|
}),
|
|
614
|
-
rasterizeSvgRuns: (e) =>
|
|
615
|
+
rasterizeSvgRuns: (e) => F()(e),
|
|
615
616
|
readPickingId: (e, n) => t.readPickingId(e, n)
|
|
616
617
|
};
|
|
617
618
|
}
|
|
618
619
|
//#endregion
|
|
619
|
-
export {
|
|
620
|
+
export { ye as createCanvas2DRenderingBackend };
|