@genome-spy/app 1.1.0 → 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-BgZUOeB-.js → agentApi-8hMSlqAQ.js} +8459 -6960
- package/dist/agentApi.es.js +5609 -4236
- package/dist/agentShared.es.js +9 -9
- package/dist/{canvas2d-DiPQvNtZ.js → canvas2d-Bd8H8MMo.js} +149 -134
- package/dist/{canvas2d-t_N10CeW.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-BW415b3o.js → containerView-CRJSc4bM.js} +24 -31
- package/dist/{viewIdentityRegistry-_F0E7nkA.js → containerView-aEVmYmkA.js} +24 -31
- package/dist/{debug-DP4WzTNo.js → debug-CQ0agCrd.js} +9 -9
- package/dist/{debug-CVAlrcZt.js → debug-DkIMiGdW.js} +10 -10
- package/dist/index.es.js +1133 -1115
- package/dist/index.js +757 -513
- 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-R043xTpC.js → order-BVvkjDRT.js} +369 -316
- package/dist/{order-BkYCnwD7.js → order-DmMoZsi1.js} +360 -308
- package/dist/{rasterExport-C_FcNBkC.js → rasterExport-DxvowWjH.js} +4 -4
- package/dist/{rasterExport-Z7gs5346.js → rasterExport-jeRVq6kY.js} +4 -4
- package/dist/rasterization-CFogVB3B.js +50 -0
- package/dist/rasterization-DFj3Cvx4.js +67 -0
- package/dist/{rectangle-DE98gIxF.js → rectangle-DZTR6NFQ.js} +10 -1
- package/dist/rectangle-Dl4Dy0hS.js +191 -0
- package/dist/{renderCanvas2D-DK1c9TFK.js → renderCanvas2D-Bfm1NHFu.js} +99 -94
- package/dist/{renderCanvas2D-IM-A9DYG.js → renderCanvas2D-DVjhp834.js} +101 -96
- package/dist/scalePosition-0aeqp_kz.js +18 -0
- package/dist/schema.json +27198 -13709
- package/dist/style.css +1 -1
- package/dist/{svg-DW3tfUmm.js → svg-Bm2zxBPu.js} +316 -317
- package/dist/{svg-PabUdcDi.js → svg-CkfuhONt.js} +290 -291
- package/dist/{svgRasterizer-B6YtWLJs.js → svgRasterizer-DoRQEqFA.js} +3 -3
- package/dist/{svgRasterizer-BEVDyyS3.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-KtD-QSN0.js → viewSelectors-7LyasQN-.js} +572 -478
- package/dist/{viewSelectors-DYz-PhTO.js → viewSelectors-CbmkSQRT.js} +624 -530
- package/dist/{viewUtils-BZGPseMx.js → viewUtils-DuddMNNw.js} +2146 -2016
- package/dist/{webgl-tdKf9SlZ.js → webgl-CQfvgnxo.js} +1247 -1137
- package/dist/{webgl-BKSGqHaz.js → webgl-DVYkXtiZ.js} +1495 -1386
- package/package.json +4 -4
- package/src/spec/view.d.ts +44 -5
- package/dist/rasterization-_-9JmSas.js +0 -63
- package/dist/viewError-BiR9VCgL.js +0 -29
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { v as a } from "./vega-scale-
|
|
1
|
+
import { ct as e, et as t, in as n, o as r, s as i } from "./clipOptions-DElJ8dTZ.js";
|
|
2
|
+
import { v as a } from "./vega-scale-o9TRyzYH.js";
|
|
3
3
|
import { t as o } from "./warning-CpIIpk8e.js";
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import { n as
|
|
7
|
-
import {
|
|
8
|
-
import { n as
|
|
9
|
-
import { t as
|
|
10
|
-
import { exportCanvas as
|
|
11
|
-
import { createCanvas2DSvgRasterizer as
|
|
4
|
+
import { l as s, t as c } from "./rectangle-Dl4Dy0hS.js";
|
|
5
|
+
import { n as l, r as u, t as d } from "./performanceProfiler-CPLEjApa.js";
|
|
6
|
+
import { n as f, t as p } from "./layoutResult-D50MSHXR.js";
|
|
7
|
+
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-DmMoZsi1.js";
|
|
8
|
+
import { n as P, t as F } from "./renderCanvas2D-Bfm1NHFu.js";
|
|
9
|
+
import { t as I } from "./canvasSizeHelper-foL2YvGL.js";
|
|
10
|
+
import { exportCanvas as L, exportRaster as R } from "./rasterExport-jeRVq6kY.js";
|
|
11
|
+
import { createCanvas2DSvgRasterizer as z } from "./svgRasterizer-raDDhBF-.js";
|
|
12
12
|
//#region ../core/src/rendering/canvas2d/picking/softwarePickingRasterizer.js
|
|
13
|
-
var
|
|
13
|
+
var B = 12, V = .5, H = class {
|
|
14
14
|
#e = [];
|
|
15
15
|
#t = [];
|
|
16
16
|
#n = [
|
|
@@ -50,7 +50,7 @@ var L = 12, R = .5, z = 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 = 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
54
|
}
|
|
55
55
|
fillRect(e, t, n, r, i) {
|
|
56
56
|
this.#s++, this.#p(e, t, n, r, i);
|
|
@@ -95,7 +95,7 @@ var L = 12, R = .5, z = class {
|
|
|
95
95
|
if (!(a > 0) || !Number.isFinite(a)) return;
|
|
96
96
|
this.#u++;
|
|
97
97
|
let s = a / 2, c = this.#n;
|
|
98
|
-
if (!
|
|
98
|
+
if (!D(t, n, r, i, this.#r - s, this.#i - s, this.#a + s, this.#o + s, c)) return;
|
|
99
99
|
let l = c[2] - c[0], u = c[3] - c[1], d = Math.ceil(Math.max(Math.abs(l), Math.abs(u)));
|
|
100
100
|
if (d == 0) {
|
|
101
101
|
this.#h(e, c[0], c[1], s, o);
|
|
@@ -106,13 +106,13 @@ var L = 12, R = .5, z = class {
|
|
|
106
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 = V, 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
112
|
let f = this.#e;
|
|
113
113
|
for (f.length = 0, f.push(t, n, r, i, a, o, s, c, 0); f.length;) {
|
|
114
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 >=
|
|
115
|
+
if (t >= B || U(p, c, s, o, a, i, r, n, u)) {
|
|
116
116
|
this.strokeSegment(e, p, c, r, n, l, d);
|
|
117
117
|
continue;
|
|
118
118
|
}
|
|
@@ -138,106 +138,105 @@ var L = 12, R = .5, z = class {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
};
|
|
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) {
|
|
141
|
+
function U(e, t, n, r, i, a, o, s, c) {
|
|
159
142
|
let l = o - e, u = s - t, d = l * l + u * u, f = c * c;
|
|
160
143
|
if (d == 0) {
|
|
161
|
-
let o =
|
|
144
|
+
let o = W(e, t, n, r), s = W(e, t, i, a);
|
|
162
145
|
return Math.max(o, s) <= f;
|
|
163
146
|
}
|
|
164
147
|
let p = u * (n - e) - l * (r - t), m = u * (i - e) - l * (a - t);
|
|
165
148
|
return Math.max(p * p, m * m) <= f * d;
|
|
166
149
|
}
|
|
167
|
-
function
|
|
150
|
+
function W(e, t, n, r) {
|
|
168
151
|
let i = n - e, a = r - t;
|
|
169
152
|
return i * i + a * a;
|
|
170
153
|
}
|
|
171
|
-
function
|
|
154
|
+
function G(e, t, n) {
|
|
172
155
|
return Math.max(t, Math.min(n, e));
|
|
173
156
|
}
|
|
174
157
|
//#endregion
|
|
175
158
|
//#region ../core/src/rendering/canvas2d/picking/renderers/index.js
|
|
176
|
-
var
|
|
177
|
-
function
|
|
159
|
+
var K = 1;
|
|
160
|
+
function q(e, t) {
|
|
178
161
|
let n = e.getType();
|
|
179
|
-
return n == "arrow" ?
|
|
162
|
+
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
163
|
}
|
|
181
|
-
function
|
|
164
|
+
function J(e) {
|
|
182
165
|
let t = e.getType();
|
|
183
166
|
return t == "rect" || t == "arrow" || t == "point" || t == "rule" || t == "tick" || t == "link" || t == "text";
|
|
184
167
|
}
|
|
185
|
-
function
|
|
186
|
-
let n = e, r =
|
|
187
|
-
return
|
|
168
|
+
function ae(e, t) {
|
|
169
|
+
let n = e, r = h(n), i = Array(8).fill(0);
|
|
170
|
+
return _(n, r, t, (e) => {
|
|
188
171
|
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),
|
|
172
|
+
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
173
|
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
|
-
|
|
174
|
+
de(i, u, d, p, m, c.x, c.y, l), t.rasterizer.fillConvexPolygon(a, i);
|
|
192
175
|
});
|
|
193
176
|
});
|
|
194
177
|
}
|
|
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
178
|
function oe(e, t) {
|
|
200
|
-
let n = e
|
|
201
|
-
return
|
|
179
|
+
let n = e;
|
|
180
|
+
return ne(n, ie(n), t, (e) => t.rasterizer.fillRect(Y(n, e.datum), e.x, e.y, e.width, e.height));
|
|
202
181
|
}
|
|
203
182
|
function se(e, t) {
|
|
204
|
-
let n = e;
|
|
205
|
-
return w(n,
|
|
183
|
+
let n = e, r = m(n, n.properties.minPickingSize);
|
|
184
|
+
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
185
|
}
|
|
207
186
|
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
|
-
});
|
|
187
|
+
let n = e;
|
|
188
|
+
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
189
|
}
|
|
214
190
|
function le(e, t) {
|
|
215
|
-
let n = e, r =
|
|
216
|
-
return
|
|
191
|
+
let n = e, r = m(n, n.properties.minPickingSize), i = A(n), a = C(n, i.shape);
|
|
192
|
+
return N(n, i, {
|
|
193
|
+
...t,
|
|
194
|
+
minPickingSize: r
|
|
195
|
+
}, (e) => {
|
|
196
|
+
let { geometry: i } = e;
|
|
197
|
+
if (i.type == "orthogonal") {
|
|
198
|
+
let [a, o, s] = i.points, c = Y(n, e.datum), l = Math.max(e.strokeWidth, r) / 2;
|
|
199
|
+
for (let e = 0; e < 2; e++) {
|
|
200
|
+
let n = i.points[e], r = i.points[e + 1], a = Math.abs(r[0] - n[0]), o = Math.abs(r[1] - n[1]);
|
|
201
|
+
(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));
|
|
202
|
+
}
|
|
203
|
+
if ((a[0] != o[0] || a[1] != o[1]) && (s[0] != o[0] || s[1] != o[1])) {
|
|
204
|
+
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]));
|
|
205
|
+
t.rasterizer.fillRect(c, Math.min(o[0], e), Math.min(o[1], n), l, l);
|
|
206
|
+
}
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
let [o, s, c, l] = i.points, u = a && M(o, l, a);
|
|
210
|
+
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);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function ue(e, t) {
|
|
214
|
+
let n = e, r = t.textMetrics ?? n.unitView.context.textMetrics, i = r.requestFont(n.properties), a = ee(r, n.properties);
|
|
215
|
+
return te(n, T(n), {
|
|
217
216
|
...t,
|
|
218
217
|
fontMeasurement: i,
|
|
219
218
|
measureLogoInkBounds: a
|
|
220
219
|
}, (e) => t.rasterizer.fillConvexPolygon(Y(n, e.datum), e.boundsQuad));
|
|
221
220
|
}
|
|
222
|
-
function
|
|
221
|
+
function de(e, t, n, r, i, a, o, s) {
|
|
223
222
|
let c = a * s, l = o * s;
|
|
224
223
|
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
224
|
}
|
|
226
225
|
function Y(e, t) {
|
|
227
226
|
let n = e.encoders;
|
|
228
|
-
return
|
|
227
|
+
return g(n.uniqueId, t);
|
|
229
228
|
}
|
|
230
229
|
//#endregion
|
|
231
230
|
//#region ../core/src/rendering/canvas2d/picking/softwarePickingViewRenderingContext.js
|
|
232
|
-
var
|
|
231
|
+
var fe = class extends f {
|
|
233
232
|
#e = [];
|
|
234
233
|
#t = /* @__PURE__ */ new Set();
|
|
235
234
|
#n;
|
|
236
|
-
#r = new
|
|
235
|
+
#r = new v();
|
|
237
236
|
#i;
|
|
238
237
|
#a = [0, 0];
|
|
239
238
|
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 =
|
|
239
|
+
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 = l(), this.#i = e.xIndexManager;
|
|
241
240
|
}
|
|
242
241
|
getDevicePixelRatio() {
|
|
243
242
|
return this.devicePixelRatio;
|
|
@@ -252,23 +251,23 @@ var de = class extends d {
|
|
|
252
251
|
if (this.#e.pop()?.view !== e) throw Error("Unbalanced software picking view rendering context stack.");
|
|
253
252
|
}
|
|
254
253
|
renderMark(e, t) {
|
|
255
|
-
if (!e.isPickingParticipant() || !
|
|
254
|
+
if (!e.isPickingParticipant() || !J(e)) return;
|
|
256
255
|
let n = t.sampleFacetRenderingOptions;
|
|
257
|
-
if (n && !e.encoders.facetIndex && (this.#n?.addCount("canvasSampleFacetOccurrences"), !
|
|
256
|
+
if (n && !e.encoders.facetIndex && (this.#n?.addCount("canvasSampleFacetOccurrences"), !P(n))) {
|
|
258
257
|
this.#n?.addCount("canvasCulledSampleFacetOccurrences");
|
|
259
258
|
return;
|
|
260
259
|
}
|
|
261
260
|
let a = e.unitView.getEffectiveOpacity();
|
|
262
261
|
if (a <= 0) return;
|
|
263
|
-
let s = this.currentCoords, c = r(t), l = i(c, e.properties.clip, s), u =
|
|
264
|
-
if (!
|
|
265
|
-
let d =
|
|
266
|
-
|
|
262
|
+
let s = this.currentCoords, c = r(t), l = i(c, e.properties.clip, s), u = x(this.width, this.height, l);
|
|
263
|
+
if (!S(u)) return;
|
|
264
|
+
let d = b(s, c, e.properties.cullByVisibleRange), f = this.#i?.prepare(e) ?? !1;
|
|
265
|
+
y(e, t, s, this.#r, (t, n) => {
|
|
267
266
|
if (n.length == 0) return;
|
|
268
267
|
let r = 0, i = n.length;
|
|
269
268
|
if (f && this.#i.query(n, this.#a) && (r = this.#a[0], i = this.#a[1], r === i)) return;
|
|
270
269
|
let o = this.getRasterizer();
|
|
271
|
-
o.setClip(u.x1, u.y1, u.x2, u.y2),
|
|
270
|
+
o.setClip(u.x1, u.y1, u.x2, u.y2), q(e, {
|
|
272
271
|
rasterizer: o,
|
|
273
272
|
coords: t,
|
|
274
273
|
data: n,
|
|
@@ -282,19 +281,19 @@ var de = class extends d {
|
|
|
282
281
|
}, (t) => o(`Canvas2D picking could not resolve sample facet index ${t}. View: ${e.unitView.getPathString()}`));
|
|
283
282
|
}
|
|
284
283
|
get currentCoords() {
|
|
285
|
-
let
|
|
286
|
-
if (!
|
|
287
|
-
return
|
|
284
|
+
let e = n(this.#e);
|
|
285
|
+
if (!e) throw Error("No current view in software picking rendering context.");
|
|
286
|
+
return e.coords;
|
|
288
287
|
}
|
|
289
|
-
}, X = 2 ** 31 - 1,
|
|
290
|
-
function
|
|
288
|
+
}, X = 2 ** 31 - 1, pe = -(2 ** 31);
|
|
289
|
+
function me(e, n, r, i = r) {
|
|
291
290
|
let a = Array(e);
|
|
292
291
|
a.fill(X);
|
|
293
|
-
let o =
|
|
292
|
+
let o = pe, s = -Infinity, c = !1, l = Array(e);
|
|
294
293
|
l.fill(0);
|
|
295
|
-
let u =
|
|
296
|
-
let i = (
|
|
297
|
-
return
|
|
294
|
+
let u = n[0], d = (n[1] - n[0]) / e, f = (n, r) => {
|
|
295
|
+
let i = (n - u) / d, a = Math.floor(i);
|
|
296
|
+
return t(r && a == i ? a - 1 : a, 0, e - 1);
|
|
298
297
|
};
|
|
299
298
|
function p(e, t, n) {
|
|
300
299
|
if (c) return;
|
|
@@ -349,27 +348,42 @@ function pe(e, t, r, i = r) {
|
|
|
349
348
|
return p.getIndex = g, m.getIndex = g, r == i ? p : m;
|
|
350
349
|
}
|
|
351
350
|
//#endregion
|
|
351
|
+
//#region ../core/src/utils/forEachInBatch.js
|
|
352
|
+
var he = 0;
|
|
353
|
+
function ge(e, t) {
|
|
354
|
+
if (e.length > 1e4) Function("data", "visit", `
|
|
355
|
+
// batch loop ${he++}
|
|
356
|
+
for (let i = 0; i < data.length; i++) {
|
|
357
|
+
visit(data[i], i);
|
|
358
|
+
}
|
|
359
|
+
`)(e, t);
|
|
360
|
+
else for (let n = 0; n < e.length; n++) t(e[n], n);
|
|
361
|
+
}
|
|
362
|
+
//#endregion
|
|
352
363
|
//#region ../core/src/rendering/xIndex/markXIndex.js
|
|
353
|
-
function
|
|
364
|
+
function _e(e, t, n = 0) {
|
|
354
365
|
if (!t.length) return;
|
|
355
|
-
let r =
|
|
356
|
-
return t
|
|
366
|
+
let r = me(Math.min(256, Math.ceil(Math.sqrt(t.length))), e.indexDomain, e.xAccessor, e.x2Accessor);
|
|
367
|
+
return ge(t, (e, t) => {
|
|
368
|
+
let i = n + t;
|
|
369
|
+
r(e, i, i + 1);
|
|
370
|
+
}), r.getIndex();
|
|
357
371
|
}
|
|
358
|
-
function
|
|
359
|
-
let n =
|
|
372
|
+
function ve(t) {
|
|
373
|
+
let n = t.encoders?.x, r = t.encoders?.x2;
|
|
360
374
|
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;
|
|
361
|
-
let i =
|
|
362
|
-
if (i !== "point" && i !== "rect") return;
|
|
363
|
-
let o =
|
|
375
|
+
let i = t.getType();
|
|
376
|
+
if (i === "point" && s(t, "x") || i !== "point" && i !== "rect") return;
|
|
377
|
+
let o = e(n)?.asNumberAccessor();
|
|
364
378
|
if (!o) return;
|
|
365
|
-
let
|
|
366
|
-
if (r && (r.scale !== n.scale || r.branches.length !== 1 || (
|
|
367
|
-
let
|
|
368
|
-
if (!(!
|
|
379
|
+
let c;
|
|
380
|
+
if (r && (r.scale !== n.scale || r.branches.length !== 1 || (c = e(r)?.asNumberAccessor(), !c))) return;
|
|
381
|
+
let l = t.unitView.getScaleResolution("x"), u = l?.zoomExtent;
|
|
382
|
+
if (!(!l || !u || !Number.isFinite(u[0]) || !Number.isFinite(u[1]) || u[1] <= u[0])) return {
|
|
369
383
|
xAccessor: o,
|
|
370
|
-
x2Accessor:
|
|
371
|
-
scaleResolution:
|
|
372
|
-
indexDomain: [
|
|
384
|
+
x2Accessor: c,
|
|
385
|
+
scaleResolution: l,
|
|
386
|
+
indexDomain: [u[0], u[1]],
|
|
373
387
|
domainStartOffset: ["index", "locus"].includes(n.scale.type) ? -1 : 0
|
|
374
388
|
};
|
|
375
389
|
}
|
|
@@ -381,7 +395,7 @@ function Z(e, t) {
|
|
|
381
395
|
}
|
|
382
396
|
//#endregion
|
|
383
397
|
//#region ../core/src/rendering/canvas2d/canvasXIndexManager.js
|
|
384
|
-
var
|
|
398
|
+
var ye = class {
|
|
385
399
|
#e = /* @__PURE__ */ new WeakMap();
|
|
386
400
|
#t = [0, 0];
|
|
387
401
|
#n;
|
|
@@ -389,7 +403,7 @@ var ge = class {
|
|
|
389
403
|
if (this.#n = void 0, e.encoders.facetIndex) return this.#r();
|
|
390
404
|
let t = e.unitView.getCollector(), n = e.unitView.getScaleResolution("x"), r = n?.zoomExtent, i = this.#e.get(e);
|
|
391
405
|
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 =
|
|
406
|
+
let a = ve(e);
|
|
393
407
|
i = {
|
|
394
408
|
collector: t,
|
|
395
409
|
dataRevision: t.dataRevision,
|
|
@@ -408,16 +422,16 @@ var ge = class {
|
|
|
408
422
|
query(e, t) {
|
|
409
423
|
let n = this.#n;
|
|
410
424
|
if (!n?.spec) throw Error("Canvas x-index query was not prepared.");
|
|
411
|
-
|
|
425
|
+
d("canvasXIndexNativeItems", e.length);
|
|
412
426
|
let r = n.batches.get(e);
|
|
413
|
-
return r === void 0 && (r =
|
|
427
|
+
return r === void 0 && (r = _e(n.spec, e) ?? null, n.batches.set(e, r), d("canvasXIndexBuilds"), r || d("canvasXIndexRejectedBuilds")), r ? (r(this.#t[0], this.#t[1], t), d("canvasXIndexQueries"), d("canvasXIndexCandidateItems", t[1] - t[0]), t[0] === t[1] && d("canvasXIndexEmptyRanges"), !0) : this.#r();
|
|
414
428
|
}
|
|
415
429
|
#r() {
|
|
416
|
-
return
|
|
430
|
+
return d("canvasXIndexFallbackQueries"), !1;
|
|
417
431
|
}
|
|
418
|
-
},
|
|
432
|
+
}, be = class {
|
|
419
433
|
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
|
|
434
|
+
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
435
|
}
|
|
422
436
|
computeLayout() {
|
|
423
437
|
this.broadcast("layout"), this.surface.invalidateSize();
|
|
@@ -437,10 +451,10 @@ var ge = class {
|
|
|
437
451
|
if (!e) return;
|
|
438
452
|
let t = this.surface.getLogicalCanvasSize();
|
|
439
453
|
if (isNaN(t.width) || isNaN(t.height)) return;
|
|
440
|
-
let n =
|
|
454
|
+
let n = l();
|
|
441
455
|
n?.beginFrame("canvas");
|
|
442
456
|
try {
|
|
443
|
-
|
|
457
|
+
u("render", () => F({
|
|
444
458
|
layoutResult: e,
|
|
445
459
|
context: this.context,
|
|
446
460
|
width: t.width,
|
|
@@ -462,17 +476,17 @@ var ge = class {
|
|
|
462
476
|
let t = this.surface.getLogicalCanvasSize();
|
|
463
477
|
if (isNaN(t.width) || isNaN(t.height)) return;
|
|
464
478
|
this.surface.clearPickingBuffer();
|
|
465
|
-
let n = this.pickingRasterizer, r = !1, i = new
|
|
479
|
+
let n = this.pickingRasterizer, r = !1, i = new fe({
|
|
466
480
|
width: t.width,
|
|
467
481
|
height: t.height,
|
|
468
482
|
devicePixelRatio: this.surface.getDevicePixelRatio(),
|
|
469
483
|
textMetrics: this.textMetrics,
|
|
470
|
-
getRasterizer: () => (n || (n = new
|
|
484
|
+
getRasterizer: () => (n || (n = new H(this.surface.getPickingBuffer()), this.pickingRasterizer = n), r ||= (n.resetClip(), n.resetStatistics(), !0), n),
|
|
471
485
|
xIndexManager: this.xIndexManager
|
|
472
|
-
}), a =
|
|
486
|
+
}), a = l();
|
|
473
487
|
a?.beginFrame("canvas", "picking");
|
|
474
488
|
try {
|
|
475
|
-
|
|
489
|
+
u("picking", () => e.collectRenderCommands(i)), this.dirtyPickingBuffer = !1, r && xe(n, a);
|
|
476
490
|
} finally {
|
|
477
491
|
a?.endFrame();
|
|
478
492
|
}
|
|
@@ -482,20 +496,20 @@ var ge = class {
|
|
|
482
496
|
}
|
|
483
497
|
#e() {
|
|
484
498
|
let e = this.surface.getLogicalCanvasSize();
|
|
485
|
-
if (!(isNaN(e.width) || isNaN(e.height))) return
|
|
499
|
+
if (!(isNaN(e.width) || isNaN(e.height))) return p(this.viewRoot, c.create(0, 0, e.width, e.height), {
|
|
486
500
|
devicePixelRatio: this.surface.getDevicePixelRatio(),
|
|
487
501
|
renderingOptions: { firstFacet: !0 }
|
|
488
502
|
});
|
|
489
503
|
}
|
|
490
504
|
};
|
|
491
|
-
function
|
|
505
|
+
function xe(e, t) {
|
|
492
506
|
if (!t) return;
|
|
493
507
|
let n = e.getStatistics();
|
|
494
508
|
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
509
|
}
|
|
496
510
|
//#endregion
|
|
497
511
|
//#region ../core/src/rendering/canvas2d/picking/softwarePickingBuffer.js
|
|
498
|
-
var Q = /* @__PURE__ */ new Uint32Array(),
|
|
512
|
+
var Q = /* @__PURE__ */ new Uint32Array(), Se = class {
|
|
499
513
|
#e = Q;
|
|
500
514
|
width = 0;
|
|
501
515
|
height = 0;
|
|
@@ -530,7 +544,7 @@ function $(e, t) {
|
|
|
530
544
|
}
|
|
531
545
|
//#endregion
|
|
532
546
|
//#region ../core/src/rendering/canvas2d/canvas2DSurface.js
|
|
533
|
-
var
|
|
547
|
+
var Ce = class {
|
|
534
548
|
#e;
|
|
535
549
|
#t;
|
|
536
550
|
#n;
|
|
@@ -540,7 +554,7 @@ var be = class {
|
|
|
540
554
|
if (!n) throw Error("Unable to initialize a Canvas2D rendering context.");
|
|
541
555
|
this.canvas = t, this.context = n, e.container.appendChild(t);
|
|
542
556
|
try {
|
|
543
|
-
this.#e = new
|
|
557
|
+
this.#e = new I(e.container, t, e.sizeSource, () => {
|
|
544
558
|
this.#i() && e.onCanvasResize();
|
|
545
559
|
}), this.#i();
|
|
546
560
|
} catch (e) {
|
|
@@ -568,7 +582,7 @@ var be = class {
|
|
|
568
582
|
getPickingBuffer() {
|
|
569
583
|
if (this.#r) throw Error("Canvas2D surface has been finalized.");
|
|
570
584
|
let e = this.getLogicalCanvasSize();
|
|
571
|
-
return this.#n ??= new
|
|
585
|
+
return this.#n ??= new Se(e.width, e.height), this.#n;
|
|
572
586
|
}
|
|
573
587
|
clearPickingBuffer() {
|
|
574
588
|
this.#n?.clear();
|
|
@@ -602,32 +616,32 @@ var be = class {
|
|
|
602
616
|
};
|
|
603
617
|
//#endregion
|
|
604
618
|
//#region ../core/src/rendering/canvas2d/index.js
|
|
605
|
-
function
|
|
606
|
-
let t = new
|
|
619
|
+
function we(e) {
|
|
620
|
+
let t = new Ce(e), n = re(e.container.ownerDocument);
|
|
607
621
|
return {
|
|
608
622
|
surface: t,
|
|
609
623
|
textMetrics: n,
|
|
610
|
-
createRenderCoordinator: (e) => new
|
|
624
|
+
createRenderCoordinator: (e) => new be({
|
|
611
625
|
...e,
|
|
612
626
|
surface: t,
|
|
613
627
|
context: t.context,
|
|
614
628
|
textMetrics: n
|
|
615
629
|
}),
|
|
616
|
-
exportCanvas: (e) =>
|
|
630
|
+
exportCanvas: (e) => L({
|
|
617
631
|
...e,
|
|
618
632
|
liveSize: t.getLogicalCanvasSize(),
|
|
619
633
|
liveDevicePixelRatio: t.getDevicePixelRatio(),
|
|
620
634
|
textMetrics: n
|
|
621
635
|
}),
|
|
622
|
-
exportRaster: (e) =>
|
|
636
|
+
exportRaster: (e) => R({
|
|
623
637
|
...e,
|
|
624
638
|
liveSize: t.getLogicalCanvasSize(),
|
|
625
639
|
liveDevicePixelRatio: t.getDevicePixelRatio(),
|
|
626
640
|
textMetrics: n
|
|
627
641
|
}),
|
|
628
|
-
rasterizeSvgRuns: (e) =>
|
|
642
|
+
rasterizeSvgRuns: (e) => z()(e),
|
|
629
643
|
readPickingId: (e, n) => t.readPickingId(e, n)
|
|
630
644
|
};
|
|
631
645
|
}
|
|
632
646
|
//#endregion
|
|
633
|
-
export {
|
|
647
|
+
export { we as createCanvas2DRenderingBackend };
|