@genome-spy/app 0.88.0 → 0.89.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-BYFBKiRQ.js → agentApi-BUcXm-JC.js} +5544 -6449
- package/dist/agentApi.es.js +3328 -4255
- package/dist/agentShared.es.js +9 -9
- package/dist/{canvas2d-BVQ7-2eJ.js → canvas2d-CGuVGvQk.js} +117 -106
- package/dist/{canvas2d-D7SZK3xv.js → canvas2d-DgF0kstG.js} +99 -88
- package/dist/{canvasSizeHelper-7h_8rOcx.js → canvasSizeHelper-foL2YvGL.js} +15 -8
- package/dist/{clipOptions-DTMcB_9z.js → clipOptions-8BPf0WMZ.js} +1013 -755
- package/dist/{clipOptions-BWHr3aTa.js → clipOptions-DBJX_W31.js} +1033 -775
- package/dist/{debug-CVpoEOWx.js → debug-BEWbYuZD.js} +2 -2
- package/dist/{debug-DYAMZZKl.js → debug-DQj_7mFm.js} +2 -2
- package/dist/index.es.js +65 -65
- package/dist/index.js +406 -364
- package/dist/{indexer-DAH_ruVn.js → indexer-Cdt_U05k.js} +1 -1
- package/dist/{indexer-CXjZDo2Q.js → indexer-D8Bgkkb8.js} +1 -1
- package/dist/order-BPOzLe80.js +1056 -0
- package/dist/order-DIxlclRN.js +1056 -0
- package/dist/rasterExport-Bl6w9t3J.js +51 -0
- package/dist/rasterExport-DRvNAH-r.js +51 -0
- package/dist/rasterization-D0tOoKu_.js +62 -0
- package/dist/rectangle-DE98gIxF.js +108 -0
- package/dist/{renderCanvas2D-DxturTEW.js → renderCanvas2D-Ct95auF3.js} +60 -59
- package/dist/{renderCanvas2D-DtcJjqpB.js → renderCanvas2D-LdEYFnRo.js} +71 -70
- package/dist/schema.json +588 -116
- package/dist/{svg-CyrLfa9e.js → svg-Ag36-h_I.js} +394 -382
- package/dist/{svg-SDJMzL--.js → svg-pkTPD4bv.js} +368 -356
- package/dist/{svgRasterizer-f7DJ3UO0.js → svgRasterizer-CksK4QTB.js} +6 -5
- package/dist/{svgRasterizer-mWK7HTkx.js → svgRasterizer-DrtJ9nLk.js} +6 -5
- package/dist/{vega-scale-CypF85iS.js → vega-scale-BJaDSHBJ.js} +891 -959
- package/dist/{vega-scale-DLKCwWRs.js → vega-scale-BWBFykuI.js} +692 -760
- package/dist/{viewIdentityRegistry-DIDo44XQ.js → viewIdentityRegistry-B-snqI3y.js} +1 -1
- package/dist/{viewIdentityRegistry-Dl-vMN9I.js → viewIdentityRegistry-BvCJajXG.js} +1 -1
- package/dist/{viewSelectors-CymbZyE6.js → viewSelectors-BlvzvG-z.js} +445 -380
- package/dist/{viewSelectors-DNiDip5e.js → viewSelectors-C5q3qBiR.js} +364 -299
- package/dist/{viewUtils-BrJLIj2o.js → viewUtils-C3vBtSvE.js} +1714 -1689
- package/dist/{webgl-CqTDifWM.js → webgl-CZX2pe5v.js} +2322 -971
- package/dist/{webgl-jaC2m0Zr.js → webgl-CexXSw_I.js} +2374 -1023
- package/package.json +5 -5
- package/dist/order-C5CzA37O.js +0 -918
- package/dist/order-DvY7KNcu.js +0 -918
- package/dist/rasterExport-BgZ98e6U.js +0 -44
- package/dist/rasterExport-DEr8fOLm.js +0 -44
- package/dist/rasterization-CFogVB3B.js +0 -50
- package/dist/rectangle-DKnrAmKs.js +0 -142
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { t as e } from "./rasterization-D0tOoKu_.js";
|
|
2
|
+
import { t } from "./rectangle-DE98gIxF.js";
|
|
3
|
+
import { t as n } from "./layoutResult-D50MSHXR.js";
|
|
4
|
+
import { r } from "./order-DIxlclRN.js";
|
|
5
|
+
import { t as i } from "./renderCanvas2D-LdEYFnRo.js";
|
|
6
|
+
//#region ../core/src/rendering/canvas2d/rasterExport.js
|
|
7
|
+
async function a(e) {
|
|
8
|
+
let t = e.mimeType ?? "image/png";
|
|
9
|
+
if (t != "image/png") throw Error(`Unsupported raster export MIME type: ${t}`);
|
|
10
|
+
let n = e.textMetrics ?? e.viewRoot.context.textMetrics;
|
|
11
|
+
await r(n, e.viewRoot);
|
|
12
|
+
let i = s({
|
|
13
|
+
...e,
|
|
14
|
+
textMetrics: n
|
|
15
|
+
});
|
|
16
|
+
return new Promise((e, n) => {
|
|
17
|
+
i.toBlob((t) => {
|
|
18
|
+
t ? e(t) : n(/* @__PURE__ */ Error("Canvas2D could not encode the raster export."));
|
|
19
|
+
}, t);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function o(e) {
|
|
23
|
+
return s({
|
|
24
|
+
...e,
|
|
25
|
+
pixelRatio: e.devicePixelRatio ?? e.pixelRatio
|
|
26
|
+
}).toDataURL("image/png");
|
|
27
|
+
}
|
|
28
|
+
function s(r) {
|
|
29
|
+
let a = r.logicalWidth ?? r.liveSize.width, o = r.logicalHeight ?? r.liveSize.height, s = r.pixelRatio ?? r.liveDevicePixelRatio, c, l;
|
|
30
|
+
try {
|
|
31
|
+
c = document.createElement("canvas"), c.width = Math.floor(a * s), c.height = Math.floor(o * s), l = c.getContext("2d");
|
|
32
|
+
} catch (t) {
|
|
33
|
+
throw new e("Unable to initialize a Canvas2D export context.", { cause: t });
|
|
34
|
+
}
|
|
35
|
+
if (!l) throw new e("Unable to initialize a Canvas2D export context.");
|
|
36
|
+
return i({
|
|
37
|
+
layoutResult: n(r.viewRoot, t.create(0, 0, a, o), {
|
|
38
|
+
devicePixelRatio: s,
|
|
39
|
+
renderingOptions: { firstFacet: !0 }
|
|
40
|
+
}),
|
|
41
|
+
context: l,
|
|
42
|
+
width: a,
|
|
43
|
+
height: o,
|
|
44
|
+
devicePixelRatio: s,
|
|
45
|
+
background: r.clearColor ?? null,
|
|
46
|
+
paint: !0,
|
|
47
|
+
textMetrics: r.textMetrics ?? r.viewRoot.context.textMetrics
|
|
48
|
+
}), c;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { o as exportCanvas, a as exportRaster };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { t as e } from "./rasterization-D0tOoKu_.js";
|
|
2
|
+
import { t } from "./rectangle-DE98gIxF.js";
|
|
3
|
+
import { t as n } from "./layoutResult-D50MSHXR.js";
|
|
4
|
+
import { r } from "./order-BPOzLe80.js";
|
|
5
|
+
import { t as i } from "./renderCanvas2D-Ct95auF3.js";
|
|
6
|
+
//#region ../core/src/rendering/canvas2d/rasterExport.js
|
|
7
|
+
async function a(e) {
|
|
8
|
+
let t = e.mimeType ?? "image/png";
|
|
9
|
+
if (t != "image/png") throw Error(`Unsupported raster export MIME type: ${t}`);
|
|
10
|
+
let n = e.textMetrics ?? e.viewRoot.context.textMetrics;
|
|
11
|
+
await r(n, e.viewRoot);
|
|
12
|
+
let i = s({
|
|
13
|
+
...e,
|
|
14
|
+
textMetrics: n
|
|
15
|
+
});
|
|
16
|
+
return new Promise((e, n) => {
|
|
17
|
+
i.toBlob((t) => {
|
|
18
|
+
t ? e(t) : n(/* @__PURE__ */ Error("Canvas2D could not encode the raster export."));
|
|
19
|
+
}, t);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function o(e) {
|
|
23
|
+
return s({
|
|
24
|
+
...e,
|
|
25
|
+
pixelRatio: e.devicePixelRatio ?? e.pixelRatio
|
|
26
|
+
}).toDataURL("image/png");
|
|
27
|
+
}
|
|
28
|
+
function s(r) {
|
|
29
|
+
let a = r.logicalWidth ?? r.liveSize.width, o = r.logicalHeight ?? r.liveSize.height, s = r.pixelRatio ?? r.liveDevicePixelRatio, c, l;
|
|
30
|
+
try {
|
|
31
|
+
c = document.createElement("canvas"), c.width = Math.floor(a * s), c.height = Math.floor(o * s), l = c.getContext("2d");
|
|
32
|
+
} catch (t) {
|
|
33
|
+
throw new e("Unable to initialize a Canvas2D export context.", { cause: t });
|
|
34
|
+
}
|
|
35
|
+
if (!l) throw new e("Unable to initialize a Canvas2D export context.");
|
|
36
|
+
return i({
|
|
37
|
+
layoutResult: n(r.viewRoot, t.create(0, 0, a, o), {
|
|
38
|
+
devicePixelRatio: s,
|
|
39
|
+
renderingOptions: { firstFacet: !0 }
|
|
40
|
+
}),
|
|
41
|
+
context: l,
|
|
42
|
+
width: a,
|
|
43
|
+
height: o,
|
|
44
|
+
devicePixelRatio: s,
|
|
45
|
+
background: r.clearColor ?? null,
|
|
46
|
+
paint: !0,
|
|
47
|
+
textMetrics: r.textMetrics ?? r.viewRoot.context.textMetrics
|
|
48
|
+
}), c;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { o as exportCanvas, a as exportRaster };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//#region ../core/src/rendering/renderingModuleRegistry.js
|
|
2
|
+
var e = {};
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region ../core/src/scales/scalePosition.js
|
|
5
|
+
function t(e, t = .5) {
|
|
6
|
+
if (e.type == "band" || e.type == "point") return e.bandwidth() * t;
|
|
7
|
+
if (e.type == "index" || e.type == "locus") {
|
|
8
|
+
let n = e;
|
|
9
|
+
return Math.sign(n.step()) * n.bandwidth() * (t - n.align());
|
|
10
|
+
} else return 0;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region ../core/src/rendering/rasterization.js
|
|
14
|
+
var n = class extends Error {
|
|
15
|
+
constructor(e, t) {
|
|
16
|
+
super(e, t), this.name = "RasterizationUnavailableError";
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
async function r(t, r) {
|
|
20
|
+
if (t.exportRaster) try {
|
|
21
|
+
return await t.exportRaster(r);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
if (!(e instanceof n)) throw e;
|
|
24
|
+
}
|
|
25
|
+
if (!e.canvasRasterExport) throw a();
|
|
26
|
+
let i;
|
|
27
|
+
try {
|
|
28
|
+
i = await e.canvasRasterExport();
|
|
29
|
+
} catch (e) {
|
|
30
|
+
throw a(e);
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
return await i.exportRaster({
|
|
34
|
+
...r,
|
|
35
|
+
liveSize: t.surface.getLogicalCanvasSize(),
|
|
36
|
+
liveDevicePixelRatio: t.surface.getDevicePixelRatio()
|
|
37
|
+
});
|
|
38
|
+
} catch (e) {
|
|
39
|
+
throw e instanceof n ? a(e) : e;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function i(t, r) {
|
|
43
|
+
if (t.rasterizeSvgRuns) try {
|
|
44
|
+
await t.rasterizeSvgRuns(r);
|
|
45
|
+
return;
|
|
46
|
+
} catch (e) {
|
|
47
|
+
if (!(e instanceof n)) throw e;
|
|
48
|
+
}
|
|
49
|
+
if (!e.canvasSvgRasterizer) throw new n("No raster backend supports selective SVG rasterization. Import \"@genome-spy/core/rendering/canvas.js\" to enable the Canvas2D fallback.");
|
|
50
|
+
let i;
|
|
51
|
+
try {
|
|
52
|
+
i = await e.canvasSvgRasterizer();
|
|
53
|
+
} catch (e) {
|
|
54
|
+
throw new n("No raster backend supports selective SVG rasterization.", { cause: e });
|
|
55
|
+
}
|
|
56
|
+
await i.createCanvas2DSvgRasterizer()(r);
|
|
57
|
+
}
|
|
58
|
+
function a(e) {
|
|
59
|
+
return new n("Raster export is unsupported because no raster rendering backend is available. Import \"@genome-spy/core/rendering/canvas.js\" to enable the Canvas2D fallback.", { cause: e });
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { e as a, t as i, r as n, i as r, n as t };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
//#region ../core/src/view/layout/rectangle.js
|
|
2
|
+
function e(e) {
|
|
3
|
+
return () => e;
|
|
4
|
+
}
|
|
5
|
+
var t = class t {
|
|
6
|
+
static create(n, r, i, a) {
|
|
7
|
+
return new t(e(n), e(r), e(i), e(a));
|
|
8
|
+
}
|
|
9
|
+
static ZERO = t.create(0, 0, 0, 0);
|
|
10
|
+
_offset(e, t) {
|
|
11
|
+
let n = this["_" + e];
|
|
12
|
+
if (t === 0) return n;
|
|
13
|
+
switch (typeof t) {
|
|
14
|
+
case "number": return () => n() + t;
|
|
15
|
+
case "function": return () => n() + t();
|
|
16
|
+
default: throw Error("Not a number of function");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
_passThrough(e) {
|
|
20
|
+
return this._offset(e, 0);
|
|
21
|
+
}
|
|
22
|
+
constructor(e, t, n, r) {
|
|
23
|
+
this._x = e, this._y = t, this._width = n, this._height = r;
|
|
24
|
+
}
|
|
25
|
+
get x() {
|
|
26
|
+
return this._x();
|
|
27
|
+
}
|
|
28
|
+
get y() {
|
|
29
|
+
return this._y();
|
|
30
|
+
}
|
|
31
|
+
get width() {
|
|
32
|
+
return this._width();
|
|
33
|
+
}
|
|
34
|
+
get height() {
|
|
35
|
+
return this._height();
|
|
36
|
+
}
|
|
37
|
+
get x2() {
|
|
38
|
+
return this._x() + this._width();
|
|
39
|
+
}
|
|
40
|
+
get y2() {
|
|
41
|
+
return this._y() + this._height();
|
|
42
|
+
}
|
|
43
|
+
equals(e) {
|
|
44
|
+
return e ? this === e || this.x === e.x && this.y === e.y && this.width === e.width && this.height === e.height : !1;
|
|
45
|
+
}
|
|
46
|
+
modify(n) {
|
|
47
|
+
if (!Object.keys(n).length) return this;
|
|
48
|
+
let r = (t) => {
|
|
49
|
+
let r = n[t];
|
|
50
|
+
return typeof r == "number" ? e(r) : typeof r == "function" ? r : this._passThrough(t);
|
|
51
|
+
};
|
|
52
|
+
return new t(r("x"), r("y"), r("width"), r("height"));
|
|
53
|
+
}
|
|
54
|
+
translate(e, n) {
|
|
55
|
+
return e === 0 && n === 0 ? this : new t(this._offset("x", e), this._offset("y", n), this._passThrough("width"), this._passThrough("height"));
|
|
56
|
+
}
|
|
57
|
+
translateBy(e) {
|
|
58
|
+
return this.translate(e.x, e.y);
|
|
59
|
+
}
|
|
60
|
+
expand(e, n = 1) {
|
|
61
|
+
return e.left == 0 && e.top == 0 && e.right == 0 && e.bottom == 0 ? this : new t(e.left ? this._offset("x", -e.left * n) : this._passThrough("x"), e.top ? this._offset("y", -e.top * n) : this._passThrough("y"), e.width ? this._offset("width", e.width * n) : this._passThrough("width"), e.height ? this._offset("height", e.height * n) : this._passThrough("height"));
|
|
62
|
+
}
|
|
63
|
+
shrink(e) {
|
|
64
|
+
return this.expand(e, -1);
|
|
65
|
+
}
|
|
66
|
+
intersect(e) {
|
|
67
|
+
return this === e || e == null ? this : new t(() => Math.max(this.x, e.x), () => Math.max(this.y, e.y), () => Math.min(this.x2, e.x2) - Math.max(this.x, e.x), () => Math.min(this.y2, e.y2) - Math.max(this.y, e.y));
|
|
68
|
+
}
|
|
69
|
+
intersectX(e) {
|
|
70
|
+
return this === e || e == null ? this : new t(() => Math.max(this.x, e.x), this._passThrough("y"), () => Math.min(this.x2, e.x2) - Math.max(this.x, e.x), this._passThrough("height"));
|
|
71
|
+
}
|
|
72
|
+
intersectY(e) {
|
|
73
|
+
return this === e || e == null ? this : new t(this._passThrough("x"), () => Math.max(this.y, e.y), this._passThrough("width"), () => Math.min(this.y2, e.y2) - Math.max(this.y, e.y));
|
|
74
|
+
}
|
|
75
|
+
union(e) {
|
|
76
|
+
return this === e || e == null ? this : new t(() => Math.min(this.x, e.x), () => Math.min(this.y, e.y), () => Math.max(this.x2, e.x2) - Math.min(this.x, e.x), () => Math.max(this.y2, e.y2) - Math.min(this.y, e.y));
|
|
77
|
+
}
|
|
78
|
+
isDefined() {
|
|
79
|
+
return this.width >= 0 && this.height >= 0;
|
|
80
|
+
}
|
|
81
|
+
flatten() {
|
|
82
|
+
return new t(e(this.x), e(this.y), e(this.width), e(this.height));
|
|
83
|
+
}
|
|
84
|
+
containsPoint(e, t) {
|
|
85
|
+
return e >= this.x && e < this.x2 && t >= this.y && t < this.y2;
|
|
86
|
+
}
|
|
87
|
+
normalizePoint(e, t, n = !1) {
|
|
88
|
+
let r = {
|
|
89
|
+
x: (e - this.x) / this.width,
|
|
90
|
+
y: (t - this.y) / this.height
|
|
91
|
+
};
|
|
92
|
+
return n && (r.y = 1 - r.y), r;
|
|
93
|
+
}
|
|
94
|
+
denormalizePoint(e, t, n = !1) {
|
|
95
|
+
return n && (t = 1 - t), {
|
|
96
|
+
x: this.x + e * this.width,
|
|
97
|
+
y: this.y + t * this.height
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
toString() {
|
|
101
|
+
return `Rectangle: x: ${this.x}, y: ${this.y}, width: ${this.width}, height: ${this.height}`;
|
|
102
|
+
}
|
|
103
|
+
toRoundedString() {
|
|
104
|
+
return `Rectangle: x: ${Math.round(this.x)}, y: ${Math.round(this.y)}, width: ${Math.round(this.width)}, height: ${Math.round(this.height)}`;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
//#endregion
|
|
108
|
+
export { t };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as e,
|
|
1
|
+
import { a as e, nn as t, o as n, s as r, u as i } from "./clipOptions-8BPf0WMZ.js";
|
|
2
2
|
import { t as a } from "./warning-CpIIpk8e.js";
|
|
3
|
-
import { n as o } from "./
|
|
4
|
-
import { n as s } from "./
|
|
5
|
-
import { A as c,
|
|
3
|
+
import { n as o } from "./layoutResult-D50MSHXR.js";
|
|
4
|
+
import { n as s } from "./performanceProfiler-CPLEjApa.js";
|
|
5
|
+
import { A as c, E as l, F as u, I as d, M as f, N as p, S as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as C, j as w, k as T, l as ee, m as E, p as D, s as O, t as k, u as A, v as j, w as M, x as N, y as P } from "./order-BPOzLe80.js";
|
|
6
6
|
//#region ../core/src/rendering/canvas2d/renderers/arrow.js
|
|
7
7
|
function F(e, t) {
|
|
8
|
-
let n = e, r = t.context, i = n.encoders, a =
|
|
8
|
+
let n = e, r = t.context, i = n.encoders, a = m(n);
|
|
9
9
|
r.lineJoin = "miter";
|
|
10
10
|
let o, s;
|
|
11
|
-
return
|
|
11
|
+
return M(n, a, t, (e) => {
|
|
12
12
|
e.headShapeFallback && t.warn(`Canvas2D rendered unsupported arrow headShape "${a.headShape}" as a triangle.`), r.beginPath();
|
|
13
13
|
for (let t of e.boundaryLoops) {
|
|
14
14
|
let e = t[0];
|
|
@@ -16,41 +16,41 @@ function F(e, t) {
|
|
|
16
16
|
for (let e = 1; e < t.length; e++) r.lineTo(t[e].x, t[e].y);
|
|
17
17
|
r.closePath();
|
|
18
18
|
}
|
|
19
|
-
let n =
|
|
20
|
-
n != "none" &&
|
|
21
|
-
let d =
|
|
19
|
+
let n = c(i.fill(e.datum)), u = l(i.fillOpacity, e.datum) * t.viewOpacity;
|
|
20
|
+
n != "none" && u > 0 && (o != n && (r.fillStyle = n, o = n), r.globalAlpha = u, r.fill());
|
|
21
|
+
let d = c(i.stroke(e.datum)), f = l(i.strokeOpacity, e.datum) * t.viewOpacity;
|
|
22
22
|
d != "none" && f > 0 && e.strokeWidth > 0 && (s != d && (r.strokeStyle = d, s = d), r.globalAlpha = f, r.lineWidth = e.strokeWidth, r.stroke());
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
//#endregion
|
|
26
26
|
//#region ../core/src/rendering/canvas2d/renderers/link.js
|
|
27
27
|
function I(e, n) {
|
|
28
|
-
let r = e, i = n.context, a = r.encoders, o =
|
|
28
|
+
let r = e, i = n.context, a = r.encoders, o = h(r), s = N(r, o.shape, n.secondOrderPass);
|
|
29
29
|
i.lineCap = "butt";
|
|
30
|
-
let
|
|
31
|
-
return
|
|
32
|
-
let r =
|
|
30
|
+
let u;
|
|
31
|
+
return j(r, o, n, (e) => {
|
|
32
|
+
let r = c(a.color(e.datum)), o = l(a.opacity, e.datum) * n.viewOpacity;
|
|
33
33
|
if (r == "none" || o <= 0 || e.strokeWidth <= 0) return;
|
|
34
|
-
let d = s &&
|
|
34
|
+
let d = s && _(e.points[0], e.points[3], s);
|
|
35
35
|
if (d) {
|
|
36
|
-
let { normalX: e, normalY: n, offset: a, start: o, end: s } = d,
|
|
37
|
-
for (let e of
|
|
38
|
-
i.strokeStyle =
|
|
39
|
-
} else
|
|
36
|
+
let { normalX: e, normalY: n, offset: a, start: o, end: s } = d, c = i.createLinearGradient(e * (a - s), n * (a - s), e * (a + s), n * (a + s)), l = t(r), f = l.opacity;
|
|
37
|
+
for (let e of P(o, s)) l.opacity = f * e.opacity, c.addColorStop(e.offset, l.formatRgb());
|
|
38
|
+
i.strokeStyle = c, u = void 0;
|
|
39
|
+
} else u != r && (i.strokeStyle = r, u = r);
|
|
40
40
|
i.globalAlpha = o, i.lineWidth = e.strokeWidth;
|
|
41
|
-
let [f, p, m,
|
|
42
|
-
i.beginPath(), i.moveTo(f[0], f[1]), i.bezierCurveTo(p[0], p[1], m[0], m[1],
|
|
41
|
+
let [f, p, m, h] = e.points;
|
|
42
|
+
i.beginPath(), i.moveTo(f[0], f[1]), i.bezierCurveTo(p[0], p[1], m[0], m[1], h[0], h[1]), i.stroke();
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region ../core/src/rendering/canvas2d/renderers/point.js
|
|
47
47
|
function L(e, t) {
|
|
48
48
|
let n = e;
|
|
49
|
-
|
|
50
|
-
let r =
|
|
51
|
-
return
|
|
52
|
-
let n = e.datum, r = e.lineShape,
|
|
53
|
-
r && (f == "none" || p <= 0) && (f =
|
|
49
|
+
T(n, n.properties.fillGradientStrength) && t.warn("Canvas2D ignored unsupported point property fillGradientStrength."), n.properties.geometricZoomBound && t.warn("Canvas2D ignored unsupported point property geometricZoomBound.");
|
|
50
|
+
let r = S(n), i = t.context, a = n.encoders, o, s;
|
|
51
|
+
return x(n, r, t, (e) => {
|
|
52
|
+
let n = e.datum, r = e.lineShape, u = c(a.fill(n)), d = l(a.fillOpacity, n) * t.viewOpacity, f = c(a.stroke(n)), p = l(a.strokeOpacity, n) * t.viewOpacity;
|
|
53
|
+
r && (f == "none" || p <= 0) && (f = u, p = d), i.beginPath();
|
|
54
54
|
let m = e.angle != 0 && e.shape != "circle";
|
|
55
55
|
m && (i.save(), i.translate(e.x, e.y), i.rotate(e.angle * Math.PI / 180));
|
|
56
56
|
let h = m ? 0 : e.x, g = m ? 0 : e.y, _ = !0;
|
|
@@ -58,8 +58,8 @@ function L(e, t) {
|
|
|
58
58
|
else if (e.shape == "square") {
|
|
59
59
|
let t = e.geometryRadius * 2;
|
|
60
60
|
i.rect(h - e.geometryRadius, g - e.geometryRadius, t, t);
|
|
61
|
-
} else _ =
|
|
62
|
-
m && i.restore(), _ || (t.warn(`Canvas2D rendered unsupported point shape "${e.shape}" as a circle.`), i.arc(e.x, e.y, e.geometryRadius, 0, Math.PI * 2)), !r &&
|
|
61
|
+
} else _ = E(e.shape, h, g, e.geometryRadius, i);
|
|
62
|
+
m && i.restore(), _ || (t.warn(`Canvas2D rendered unsupported point shape "${e.shape}" as a circle.`), i.arc(e.x, e.y, e.geometryRadius, 0, Math.PI * 2)), !r && u != "none" && d > 0 && (o != u && (i.fillStyle = u, o = u), R(i, d), i.fill()), f != "none" && p > 0 && e.strokeWidth > 0 && (r && i.lineCap != "butt" && (i.lineCap = "butt"), s != f && (i.strokeStyle = f, s = f), R(i, p), z(i, e.strokeWidth), i.stroke());
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
function R(e, t) {
|
|
@@ -71,20 +71,20 @@ function z(e, t) {
|
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region ../core/src/rendering/canvas2d/renderers/rect.js
|
|
73
73
|
function B(e, t) {
|
|
74
|
-
let n = e, r =
|
|
74
|
+
let n = e, r = b(n);
|
|
75
75
|
r.hatch != "none" && t.warn("Canvas2D ignored unsupported rect hatch.");
|
|
76
76
|
let i = t.start ?? 0;
|
|
77
77
|
if (i === (t.end ?? t.data.length)) return 0;
|
|
78
|
-
let a = t.context, o = n.encoders, s,
|
|
78
|
+
let a = t.context, o = n.encoders, s, u, d = [
|
|
79
79
|
0,
|
|
80
80
|
0,
|
|
81
81
|
0,
|
|
82
82
|
0
|
|
83
|
-
], f = o.stroke.constant, p = o.strokeOpacity.constant, m = f ?
|
|
84
|
-
return
|
|
83
|
+
], f = o.stroke.constant, p = o.strokeOpacity.constant, m = f ? c(o.stroke(t.data[i])) : "none", h = f && m == "none", g = !h && p ? l(o.strokeOpacity, t.data[i]) : 0;
|
|
84
|
+
return D(n, r, t, (e) => {
|
|
85
85
|
r.shadow.opacity > 0 && V(e, r.shadow, t, d);
|
|
86
|
-
let n = e.opacityFactor, i = e.fill != "none" && e.fillOpacity > 0, _ = f ? m :
|
|
87
|
-
b && (i || y) && (d[0] = e.radii.topLeft, d[1] = e.radii.topRight, d[2] = e.radii.bottomRight, d[3] = e.radii.bottomLeft, a.beginPath(), a.roundRect(e.x, e.y, e.width, e.height, d)), i && (s != e.fill && (a.fillStyle = e.fill, s = e.fill), H(a, e.fillOpacity * n), b ? a.fill() : a.fillRect(e.x, e.y, e.width, e.height)), y && (
|
|
86
|
+
let n = e.opacityFactor, i = e.fill != "none" && e.fillOpacity > 0, _ = f ? m : c(o.stroke(e.datum)), v = (p ? g : l(o.strokeOpacity, e.datum)) * t.viewOpacity * n, y = !h && _ != "none" && v > 0 && e.strokeWidth > 0, b = r.hasCornerRadii && (e.radii.topLeft != 0 || e.radii.topRight != 0 || e.radii.bottomRight != 0 || e.radii.bottomLeft != 0);
|
|
87
|
+
b && (i || y) && (d[0] = e.radii.topLeft, d[1] = e.radii.topRight, d[2] = e.radii.bottomRight, d[3] = e.radii.bottomLeft, a.beginPath(), a.roundRect(e.x, e.y, e.width, e.height, d)), i && (s != e.fill && (a.fillStyle = e.fill, s = e.fill), H(a, e.fillOpacity * n), b ? a.fill() : a.fillRect(e.x, e.y, e.width, e.height)), y && (u != _ && (a.strokeStyle = _, u = _), H(a, v), U(a, e.strokeWidth), b ? a.stroke() : a.strokeRect(e.x, e.y, e.width, e.height));
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
function V(e, t, n, r) {
|
|
@@ -106,32 +106,32 @@ function U(e, t) {
|
|
|
106
106
|
//#region ../core/src/rendering/canvas2d/renderers/rule.js
|
|
107
107
|
function W(e, t) {
|
|
108
108
|
let n = e, r = t.context, i = n.encoders;
|
|
109
|
-
r.lineCap =
|
|
109
|
+
r.lineCap = T(n, n.properties.strokeCap), r.setLineDash(T(n, n.properties.strokeDash) ?? []), r.lineDashOffset = T(n, n.properties.strokeDashOffset);
|
|
110
110
|
let a;
|
|
111
|
-
return
|
|
112
|
-
let n =
|
|
111
|
+
return y(n, A(n), t, (e) => {
|
|
112
|
+
let n = c(i.color(e.datum)), o = l(i.opacity, e.datum) * t.viewOpacity;
|
|
113
113
|
n == "none" || o <= 0 || e.strokeWidth <= 0 || (a != n && (r.strokeStyle = n, a = n), r.globalAlpha = o, r.lineWidth = e.strokeWidth, r.beginPath(), r.moveTo(e.x1, e.y1), r.lineTo(e.x2, e.y2), r.stroke());
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
//#endregion
|
|
117
117
|
//#region ../core/src/rendering/canvas2d/renderers/text.js
|
|
118
118
|
function G(e, t) {
|
|
119
|
-
let n = e, r = n.properties, i =
|
|
119
|
+
let n = e, r = n.properties, i = t.textMetrics ?? n.unitView.context.textMetrics, a = i.requestFont(r), o = C(i, r), s = v(n), u = t.context, d = n.encoders, f = g(r.font), p = `${r.fontStyle ?? "normal"} ${O(r.fontWeight ?? "normal")} `, m = s.baseline == "baseline" ? "alphabetic" : s.baseline;
|
|
120
120
|
[
|
|
121
121
|
r.viewportEdgeFadeWidthTop,
|
|
122
122
|
r.viewportEdgeFadeWidthRight,
|
|
123
123
|
r.viewportEdgeFadeWidthBottom,
|
|
124
124
|
r.viewportEdgeFadeWidthLeft
|
|
125
|
-
].some((e) =>
|
|
126
|
-
let
|
|
127
|
-
return
|
|
125
|
+
].some((e) => T(n, e) > 0) && t.warn("Canvas2D ignored unsupported text viewport edge fading.");
|
|
126
|
+
let h, _;
|
|
127
|
+
return s.logoLetters || (u.textAlign = s.align, u.textBaseline = m), ee(n, s, {
|
|
128
|
+
...t,
|
|
129
|
+
fontMeasurement: a,
|
|
130
|
+
measureLogoInkBounds: o
|
|
131
|
+
}, (e) => {
|
|
128
132
|
e.multiCharacterLogo && t.warn("Canvas2D stretches multi-character logo text as a single glyph cell.");
|
|
129
|
-
let n =
|
|
130
|
-
|
|
131
|
-
a.save(), a.translate(e.x, e.y), a.rotate(e.angle * Math.PI / 180), a.translate(e.dx, e.dy);
|
|
132
|
-
let t = a.measureText(e.text).width;
|
|
133
|
-
a.scale(e.logoScale.width / t, e.logoScale.heightScale), a.textAlign = "center", a.textBaseline = "alphabetic", a.fillText(e.text, 0, O("middle", 1)), a.restore();
|
|
134
|
-
} else e.angle ? (a.save(), a.translate(e.x, e.y), a.rotate(e.angle * Math.PI / 180), a.fillText(e.text, e.dx, e.dy, e.width), a.restore()) : a.fillText(e.text, e.x + e.dx, e.y + e.dy, e.width);
|
|
133
|
+
let n = c(d.color(e.datum)), r = l(d.opacity, e.datum) * t.viewOpacity * e.fadeOpacity;
|
|
134
|
+
n == "none" || r <= 0 || (h != n && (u.fillStyle = n, h = n), u.globalAlpha = r, _ != e.size && (u.font = `${p}${e.size}px ${f}`, _ = e.size), e.logoTransform ? (u.save(), u.translate(e.x, e.y), u.rotate(e.angle * Math.PI / 180), u.translate(e.dx, e.dy), u.scale(e.logoTransform.scaleX, e.logoTransform.scaleY), u.translate(-e.logoTransform.originX, -e.logoTransform.originY), u.textAlign = "left", u.textBaseline = "alphabetic", u.fillText(e.text, 0, 0), u.restore()) : e.angle || e.scale != 1 ? (u.save(), u.translate(e.x, e.y), u.rotate(e.angle * Math.PI / 180), u.translate(e.dx, e.dy), u.scale(e.scale, e.scale), u.fillText(e.text, 0, 0), u.restore()) : u.fillText(e.text, e.x + e.dx, e.y + e.dy));
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
//#endregion
|
|
@@ -147,20 +147,20 @@ function q(e) {
|
|
|
147
147
|
}
|
|
148
148
|
//#endregion
|
|
149
149
|
//#region ../core/src/rendering/canvas2d/canvas2DViewRenderingContext.js
|
|
150
|
-
var J = 8, Y = 16777216, X = class extends
|
|
150
|
+
var J = 8, Y = 16777216, X = class extends o {
|
|
151
151
|
#e = [];
|
|
152
152
|
#t = /* @__PURE__ */ new WeakSet();
|
|
153
153
|
#n = /* @__PURE__ */ new WeakMap();
|
|
154
154
|
#r;
|
|
155
155
|
#i;
|
|
156
|
-
#a = new
|
|
156
|
+
#a = new u();
|
|
157
157
|
#o;
|
|
158
158
|
#s = [0, 0];
|
|
159
159
|
#c;
|
|
160
160
|
#l;
|
|
161
161
|
#u = [];
|
|
162
162
|
constructor(e, t) {
|
|
163
|
-
if (super(e), this.context = t.context, this.width = t.width, this.height = t.height, this.devicePixelRatio = t.devicePixelRatio, this.paint = t.paint, this.#r = t.markPredicate ?? (() => !0), this.#i =
|
|
163
|
+
if (super(e), this.context = t.context, this.width = t.width, this.height = t.height, this.devicePixelRatio = t.devicePixelRatio, this.paint = t.paint, this.textMetrics = t.textMetrics, this.#r = t.markPredicate ?? (() => !0), this.#i = s(), this.#o = t.xIndexManager, this.#l = t.opacityLayers ?? [], this.#c = {
|
|
164
164
|
x: 0,
|
|
165
165
|
y: 0,
|
|
166
166
|
width: this.context.canvas.width,
|
|
@@ -214,16 +214,16 @@ var J = 8, Y = 16777216, X = class extends s {
|
|
|
214
214
|
this.#i?.addCount("canvasCulledSampleFacetOccurrences");
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
|
-
let s = this.currentCoords,
|
|
218
|
-
if (!
|
|
219
|
-
let
|
|
220
|
-
if (g.save(),
|
|
221
|
-
let e =
|
|
217
|
+
let s = this.currentCoords, c = n(t), l = r(c, e.properties.clip, s), u = f(this.width, this.height, l);
|
|
218
|
+
if (!p(u)) return;
|
|
219
|
+
let m = w(s, c, e.properties.cullByVisibleRange), h = this.#o?.prepare(e) ?? !1, g = this.context;
|
|
220
|
+
if (g.save(), l) {
|
|
221
|
+
let e = l.rect.flatten(), t = l.clipX ? e.x : 0, n = l.clipY ? e.y : 0, r = l.clipX ? e.width : this.width, i = l.clipY ? e.height : this.height;
|
|
222
222
|
g.beginPath(), g.rect(t, n, r, i), g.clip();
|
|
223
223
|
}
|
|
224
224
|
try {
|
|
225
225
|
let n = e.getOrder?.(), r = n && n.isActive();
|
|
226
|
-
|
|
226
|
+
d(e, t, s, this.#a, (t, i) => {
|
|
227
227
|
let o = 0, s = i.length;
|
|
228
228
|
h && this.#o.query(i, this.#s) && (o = this.#s[0], s = this.#s[1]);
|
|
229
229
|
let c = (n, r, i, o = !1) => K(e, {
|
|
@@ -234,14 +234,15 @@ var J = 8, Y = 16777216, X = class extends s {
|
|
|
234
234
|
secondOrderPass: o,
|
|
235
235
|
start: r,
|
|
236
236
|
end: i,
|
|
237
|
-
visibleBounds:
|
|
238
|
-
anchorCullBounds:
|
|
237
|
+
visibleBounds: u,
|
|
238
|
+
anchorCullBounds: m,
|
|
239
239
|
viewOpacity: 1,
|
|
240
|
+
textMetrics: this.textMetrics,
|
|
240
241
|
warn: (t) => a(`${t} View: ${e.unitView.getPathString()}`)
|
|
241
242
|
});
|
|
242
243
|
if (!r) return c(i, o, s);
|
|
243
|
-
let l = 0,
|
|
244
|
-
for (let [e, t] of
|
|
244
|
+
let l = 0, d = k(i, o, s, n.predicate, n.passes);
|
|
245
|
+
for (let [e, t] of d.entries()) t.length > 0 && (l += c(t, 0, t.length, e === 1));
|
|
245
246
|
return l;
|
|
246
247
|
}, (t) => a(`Canvas2D could not resolve sample facet index ${t}. View: ${e.unitView.getPathString()}`));
|
|
247
248
|
} finally {
|