@genome-spy/app 0.83.1 → 0.84.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.
@@ -0,0 +1,19 @@
1
+ //#region ../core/src/encoder/metadataChannels.js
2
+ function e(e) {
3
+ return t(e?.search, "search");
4
+ }
5
+ function t(e, t) {
6
+ if (!e) return;
7
+ let n = Array.isArray(e) ? e : [e];
8
+ if (n.length === 0) throw Error("The " + t + " channel array must not be empty.");
9
+ let r = [];
10
+ for (let e of n) {
11
+ if (!e || typeof e != "object" || !("field" in e)) throw Error("The " + t + " channel must be a field definition or an array of field definitions.");
12
+ let n = e.field;
13
+ if (typeof n != "string") throw Error("The " + t + " channel field definition must include a string field name.");
14
+ r.push(n);
15
+ }
16
+ return r;
17
+ }
18
+ //#endregion
19
+ export { e as t };
@@ -0,0 +1,53 @@
1
+ import { n as e, r as t, s as n } from "./framebufferReadback-Bje9lHb7.js";
2
+ import { n as r } from "./viewRenderingContext-HtpqwS_x.js";
3
+ import { t as i } from "./svgNumber-C6aRPc8Z.js";
4
+ //#region ../core/src/svg/raster/index.js
5
+ function a({ runs: a, viewRoot: c, webGLHelper: l, logicalWidth: u, logicalHeight: d, pixelRatio: f }) {
6
+ let p = l.gl, m = Math.ceil(u * f), h = Math.ceil(d * f);
7
+ o(p, m, h);
8
+ let g = n(p, [{
9
+ format: p.RGBA,
10
+ type: p.UNSIGNED_BYTE,
11
+ minMag: p.LINEAR,
12
+ wrap: p.CLAMP_TO_EDGE
13
+ }], m, h);
14
+ try {
15
+ for (let n of a) {
16
+ let a = new t({ picking: !1 }, {
17
+ webGLHelper: l,
18
+ canvasSize: {
19
+ width: u,
20
+ height: d
21
+ },
22
+ devicePixelRatio: f,
23
+ framebufferInfo: g,
24
+ markPredicate: (e) => n.marks.has(e),
25
+ pixelOffset: 0
26
+ });
27
+ c.render(a, r.create(0, 0, u, d), { firstFacet: !0 }), a.render();
28
+ let o = s(n.bounds, f, m, h), _ = e(p, g, "image/png", {
29
+ ...o,
30
+ unpremultiplyAlpha: !0
31
+ }), v = n.image;
32
+ if (!v) throw Error("Raster run has no SVG image placeholder.");
33
+ v.setAttribute("x", "" + i(o.x / f)), v.setAttribute("y", "" + i(o.y / f)), v.setAttribute("width", "" + i(o.width / f)), v.setAttribute("height", "" + i(o.height / f)), v.setAttribute("href", _);
34
+ }
35
+ } finally {
36
+ p.bindFramebuffer(p.FRAMEBUFFER, null), p.deleteTexture(g.attachments[0]), p.deleteFramebuffer(g.framebuffer);
37
+ }
38
+ }
39
+ function o(e, t, n) {
40
+ let r = e.getParameter(e.MAX_RENDERBUFFER_SIZE), i = e.getParameter(e.MAX_TEXTURE_SIZE), a = Math.min(r, i);
41
+ if (t <= 0 || n <= 0 || t > a || n > a) throw RangeError(`SVG raster dimensions ${t} x ${n} exceed the WebGL limit ${a}.`);
42
+ }
43
+ function s(e, t, n, r) {
44
+ let i = Math.max(0, Math.floor(e.x1 * t)), a = Math.max(0, Math.floor(e.y1 * t)), o = Math.min(n, Math.ceil(e.x2 * t)), s = Math.min(r, Math.ceil(e.y2 * t));
45
+ return {
46
+ x: i,
47
+ y: a,
48
+ width: o - i,
49
+ height: s - a
50
+ };
51
+ }
52
+ //#endregion
53
+ export { a as rasterizeSvgRuns };
@@ -0,0 +1,54 @@
1
+ import { i as e } from "./twgl-full.module-BNEMlXRV.js";
2
+ import { n as t } from "./viewRenderingContext-HtpqwS_x.js";
3
+ import { n, r } from "./framebufferReadback-CC0D6Haw.js";
4
+ import { t as i } from "./svgNumber-C6aRPc8Z.js";
5
+ //#region ../core/src/svg/raster/index.js
6
+ function a({ runs: a, viewRoot: c, webGLHelper: l, logicalWidth: u, logicalHeight: d, pixelRatio: f }) {
7
+ let p = l.gl, m = Math.ceil(u * f), h = Math.ceil(d * f);
8
+ o(p, m, h);
9
+ let g = e(p, [{
10
+ format: p.RGBA,
11
+ type: p.UNSIGNED_BYTE,
12
+ minMag: p.LINEAR,
13
+ wrap: p.CLAMP_TO_EDGE
14
+ }], m, h);
15
+ try {
16
+ for (let e of a) {
17
+ let a = new r({ picking: !1 }, {
18
+ webGLHelper: l,
19
+ canvasSize: {
20
+ width: u,
21
+ height: d
22
+ },
23
+ devicePixelRatio: f,
24
+ framebufferInfo: g,
25
+ markPredicate: (t) => e.marks.has(t),
26
+ pixelOffset: 0
27
+ });
28
+ c.render(a, t.create(0, 0, u, d), { firstFacet: !0 }), a.render();
29
+ let o = s(e.bounds, f, m, h), _ = n(p, g, "image/png", {
30
+ ...o,
31
+ unpremultiplyAlpha: !0
32
+ }), v = e.image;
33
+ if (!v) throw Error("Raster run has no SVG image placeholder.");
34
+ v.setAttribute("x", "" + i(o.x / f)), v.setAttribute("y", "" + i(o.y / f)), v.setAttribute("width", "" + i(o.width / f)), v.setAttribute("height", "" + i(o.height / f)), v.setAttribute("href", _);
35
+ }
36
+ } finally {
37
+ p.bindFramebuffer(p.FRAMEBUFFER, null), p.deleteTexture(g.attachments[0]), p.deleteFramebuffer(g.framebuffer);
38
+ }
39
+ }
40
+ function o(e, t, n) {
41
+ let r = e.getParameter(e.MAX_RENDERBUFFER_SIZE), i = e.getParameter(e.MAX_TEXTURE_SIZE), a = Math.min(r, i);
42
+ if (t <= 0 || n <= 0 || t > a || n > a) throw RangeError(`SVG raster dimensions ${t} x ${n} exceed the WebGL limit ${a}.`);
43
+ }
44
+ function s(e, t, n, r) {
45
+ let i = Math.max(0, Math.floor(e.x1 * t)), a = Math.max(0, Math.floor(e.y1 * t)), o = Math.min(n, Math.ceil(e.x2 * t)), s = Math.min(r, Math.ceil(e.y2 * t));
46
+ return {
47
+ x: i,
48
+ y: a,
49
+ width: o - i,
50
+ height: s - a
51
+ };
52
+ }
53
+ //#endregion
54
+ export { a as rasterizeSvgRuns };