@genome-spy/core 0.72.0 → 0.73.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/LICENSE +1 -1
- package/dist/bundle/index.es.js +6779 -5393
- package/dist/bundle/index.js +133 -121
- package/dist/schema.json +281 -17
- package/dist/src/data/formats/bed.d.ts +8 -0
- package/dist/src/data/formats/bed.d.ts.map +1 -0
- package/dist/src/data/formats/bed.js +53 -0
- package/dist/src/data/formats/bedpe.d.ts +8 -0
- package/dist/src/data/formats/bedpe.d.ts.map +1 -0
- package/dist/src/data/formats/bedpe.js +160 -0
- package/dist/src/data/sources/dataUtils.d.ts +16 -0
- package/dist/src/data/sources/dataUtils.d.ts.map +1 -1
- package/dist/src/data/sources/dataUtils.js +53 -3
- package/dist/src/data/sources/urlSource.d.ts +4 -0
- package/dist/src/data/sources/urlSource.d.ts.map +1 -1
- package/dist/src/data/sources/urlSource.js +133 -14
- package/dist/src/genome/assemblyPreflight.d.ts +31 -0
- package/dist/src/genome/assemblyPreflight.d.ts.map +1 -0
- package/dist/src/genome/assemblyPreflight.js +99 -0
- package/dist/src/genome/genome.d.ts +2 -2
- package/dist/src/genome/genome.d.ts.map +1 -1
- package/dist/src/genome/genome.js +4 -0
- package/dist/src/genome/genomeStore.d.ts +34 -3
- package/dist/src/genome/genomeStore.d.ts.map +1 -1
- package/dist/src/genome/genomeStore.js +409 -18
- package/dist/src/genome/rootGenomeConfig.d.ts +26 -0
- package/dist/src/genome/rootGenomeConfig.d.ts.map +1 -0
- package/dist/src/genome/rootGenomeConfig.js +94 -0
- package/dist/src/genomeSpy/interactionController.d.ts +5 -1
- package/dist/src/genomeSpy/interactionController.d.ts.map +1 -1
- package/dist/src/genomeSpy/interactionController.js +244 -29
- package/dist/src/genomeSpy/renderCoordinator.js +1 -1
- package/dist/src/genomeSpy.d.ts +13 -3
- package/dist/src/genomeSpy.d.ts.map +1 -1
- package/dist/src/genomeSpy.js +81 -7
- package/dist/src/gl/canvasSizeHelper.d.ts +74 -0
- package/dist/src/gl/canvasSizeHelper.d.ts.map +1 -0
- package/dist/src/gl/canvasSizeHelper.js +203 -0
- package/dist/src/gl/webGLHelper.d.ts +25 -11
- package/dist/src/gl/webGLHelper.d.ts.map +1 -1
- package/dist/src/gl/webGLHelper.js +59 -33
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -2
- package/dist/src/marks/link.d.ts.map +1 -1
- package/dist/src/marks/link.js +5 -3
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +6 -1
- package/dist/src/scales/domainPlanner.d.ts +34 -3
- package/dist/src/scales/domainPlanner.d.ts.map +1 -1
- package/dist/src/scales/domainPlanner.js +247 -26
- package/dist/src/scales/scaleInstanceManager.d.ts +2 -1
- package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -1
- package/dist/src/scales/scaleInstanceManager.js +10 -11
- package/dist/src/scales/scaleInteractionController.d.ts.map +1 -1
- package/dist/src/scales/scaleInteractionController.js +16 -14
- package/dist/src/scales/scaleResolution.d.ts +16 -0
- package/dist/src/scales/scaleResolution.d.ts.map +1 -1
- package/dist/src/scales/scaleResolution.js +314 -54
- package/dist/src/scales/scaleResolutionTestUtils.d.ts +21 -0
- package/dist/src/scales/scaleResolutionTestUtils.d.ts.map +1 -0
- package/dist/src/scales/scaleResolutionTestUtils.js +33 -0
- package/dist/src/scales/selectionDomainUtils.d.ts +22 -0
- package/dist/src/scales/selectionDomainUtils.d.ts.map +1 -0
- package/dist/src/scales/selectionDomainUtils.js +79 -0
- package/dist/src/scales/zoomDomainUtils.d.ts +18 -0
- package/dist/src/scales/zoomDomainUtils.d.ts.map +1 -0
- package/dist/src/scales/zoomDomainUtils.js +69 -0
- package/dist/src/screenshotHarness.d.ts +16 -0
- package/dist/src/screenshotHarness.d.ts.map +1 -0
- package/dist/src/screenshotHarness.js +242 -0
- package/dist/src/singlePageApp.js +1 -1
- package/dist/src/spec/data.d.ts +23 -3
- package/dist/src/spec/genome.d.ts +22 -2
- package/dist/src/spec/parameter.d.ts +39 -2
- package/dist/src/spec/root.d.ts +20 -1
- package/dist/src/spec/scale.d.ts +41 -5
- package/dist/src/styles/genome-spy.css +8 -0
- package/dist/src/styles/genome-spy.css.d.ts +1 -1
- package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
- package/dist/src/styles/genome-spy.css.js +8 -0
- package/dist/src/tooltip/dataTooltipHandler.js +59 -10
- package/dist/src/types/embedApi.d.ts +19 -0
- package/dist/src/utils/inferSpecBaseUrl.d.ts +14 -0
- package/dist/src/utils/inferSpecBaseUrl.d.ts.map +1 -0
- package/dist/src/utils/inferSpecBaseUrl.js +73 -0
- package/dist/src/utils/interactionEvent.d.ts +53 -3
- package/dist/src/utils/interactionEvent.d.ts.map +1 -1
- package/dist/src/utils/interactionEvent.js +62 -1
- package/dist/src/view/containerMutationHelper.d.ts.map +1 -1
- package/dist/src/view/containerMutationHelper.js +8 -0
- package/dist/src/view/dataReadiness.d.ts +2 -2
- package/dist/src/view/dataReadiness.d.ts.map +1 -1
- package/dist/src/view/dataReadiness.js +63 -58
- package/dist/src/view/facetView.js +1 -1
- package/dist/src/view/gridView/gridChild.d.ts +7 -0
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +180 -11
- package/dist/src/view/gridView/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView/gridView.js +60 -17
- package/dist/src/view/zoom.d.ts +14 -2
- package/dist/src/view/zoom.d.ts.map +1 -1
- package/dist/src/view/zoom.js +373 -76
- package/package.json +4 -2
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handles logical/physical canvas size calculations and optional
|
|
3
|
+
* device-pixel-content-box observation.
|
|
4
|
+
*/
|
|
5
|
+
export default class CanvasSizeHelper {
|
|
6
|
+
/**
|
|
7
|
+
* @param {HTMLElement} container
|
|
8
|
+
* @param {HTMLCanvasElement} canvas
|
|
9
|
+
* @param {() => {width: number, height: number}} sizeSource
|
|
10
|
+
* @param {() => void} [onPhysicalSizeChange]
|
|
11
|
+
*/
|
|
12
|
+
constructor(container, canvas, sizeSource, onPhysicalSizeChange) {
|
|
13
|
+
this._container = container;
|
|
14
|
+
this._canvas = canvas;
|
|
15
|
+
this._sizeSource = sizeSource;
|
|
16
|
+
this._onPhysicalSizeChange = onPhysicalSizeChange ?? (() => {});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {{ width: number, height: number } | undefined}
|
|
20
|
+
*/
|
|
21
|
+
this._logicalCanvasSize = undefined;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @type {{ width: number, height: number } | undefined}
|
|
25
|
+
*/
|
|
26
|
+
this._devicePixelContentBoxSize = undefined;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @type {ResizeObserver | undefined}
|
|
30
|
+
*/
|
|
31
|
+
this._devicePixelContentBoxObserver = undefined;
|
|
32
|
+
|
|
33
|
+
this._observeDevicePixelContentBox();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
invalidate() {
|
|
37
|
+
this._logicalCanvasSize = undefined;
|
|
38
|
+
this._devicePixelContentBoxSize = undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
finalize() {
|
|
42
|
+
if (this._devicePixelContentBoxObserver) {
|
|
43
|
+
this._devicePixelContentBoxObserver.disconnect();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Returns the canvas size in true display pixels
|
|
49
|
+
*
|
|
50
|
+
* @param {{ width: number, height: number }} [logicalSize]
|
|
51
|
+
*/
|
|
52
|
+
getPhysicalCanvasSize(logicalSize) {
|
|
53
|
+
// devicePixelContentBox gives the actual backing-store pixel size.
|
|
54
|
+
// Prefer it whenever available to avoid fractional DPR drift.
|
|
55
|
+
// https://web.dev/articles/device-pixel-content-box
|
|
56
|
+
if (this._devicePixelContentBoxSize) {
|
|
57
|
+
return this._devicePixelContentBoxSize;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const dpr = window.devicePixelRatio ?? 1;
|
|
61
|
+
logicalSize = logicalSize || this.getLogicalCanvasSize();
|
|
62
|
+
return {
|
|
63
|
+
width: Math.round(logicalSize.width * dpr),
|
|
64
|
+
height: Math.round(logicalSize.height * dpr),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Returns the ratio between true display pixels and logical pixels.
|
|
70
|
+
*
|
|
71
|
+
* @param {{ width: number, height: number }} [logicalSize]
|
|
72
|
+
*/
|
|
73
|
+
getDevicePixelRatio(logicalSize) {
|
|
74
|
+
logicalSize = logicalSize || this.getLogicalCanvasSize();
|
|
75
|
+
const physicalSize = this.getPhysicalCanvasSize(logicalSize);
|
|
76
|
+
const widthRatio =
|
|
77
|
+
logicalSize.width > 0
|
|
78
|
+
? physicalSize.width / logicalSize.width
|
|
79
|
+
: undefined;
|
|
80
|
+
const heightRatio =
|
|
81
|
+
logicalSize.height > 0
|
|
82
|
+
? physicalSize.height / logicalSize.height
|
|
83
|
+
: undefined;
|
|
84
|
+
|
|
85
|
+
if (widthRatio !== undefined && heightRatio !== undefined) {
|
|
86
|
+
// Width and height can differ slightly because backing-store dimensions
|
|
87
|
+
// are integers. Averaging keeps snapping stable in both directions.
|
|
88
|
+
return (widthRatio + heightRatio) / 2;
|
|
89
|
+
} else if (widthRatio !== undefined) {
|
|
90
|
+
// During transient layout states one logical dimension may be zero.
|
|
91
|
+
// Use the non-zero dimension instead of falling back to window DPR.
|
|
92
|
+
return widthRatio;
|
|
93
|
+
} else if (heightRatio !== undefined) {
|
|
94
|
+
return heightRatio;
|
|
95
|
+
} else {
|
|
96
|
+
return window.devicePixelRatio ?? 1;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Returns the size of the canvas canvas container size in logical pixels,
|
|
102
|
+
* without devicePixelRatio correction.
|
|
103
|
+
*/
|
|
104
|
+
getLogicalCanvasSize() {
|
|
105
|
+
if (this._logicalCanvasSize) {
|
|
106
|
+
return this._logicalCanvasSize;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// TODO: The size should never be smaller than the minimum content size!
|
|
110
|
+
const contentSize = this._sizeSource();
|
|
111
|
+
|
|
112
|
+
const cs = window.getComputedStyle(this._container, null);
|
|
113
|
+
// clientWidth/clientHeight are integer CSS pixels, which causes subtle
|
|
114
|
+
// blur at fractional DPR. getBoundingClientRect preserves fractions.
|
|
115
|
+
const containerRect = this._container.getBoundingClientRect();
|
|
116
|
+
|
|
117
|
+
const paddingLeft = parseFloat(cs.paddingLeft);
|
|
118
|
+
const paddingRight = parseFloat(cs.paddingRight);
|
|
119
|
+
const paddingTop = parseFloat(cs.paddingTop);
|
|
120
|
+
const paddingBottom = parseFloat(cs.paddingBottom);
|
|
121
|
+
|
|
122
|
+
const borderLeft = parseFloat(cs.borderLeftWidth);
|
|
123
|
+
const borderRight = parseFloat(cs.borderRightWidth);
|
|
124
|
+
const borderTop = parseFloat(cs.borderTopWidth);
|
|
125
|
+
const borderBottom = parseFloat(cs.borderBottomWidth);
|
|
126
|
+
|
|
127
|
+
const width =
|
|
128
|
+
contentSize.width ??
|
|
129
|
+
containerRect.width -
|
|
130
|
+
paddingLeft -
|
|
131
|
+
paddingRight -
|
|
132
|
+
borderLeft -
|
|
133
|
+
borderRight;
|
|
134
|
+
|
|
135
|
+
const height =
|
|
136
|
+
contentSize.height ??
|
|
137
|
+
containerRect.height -
|
|
138
|
+
paddingTop -
|
|
139
|
+
paddingBottom -
|
|
140
|
+
borderTop -
|
|
141
|
+
borderBottom;
|
|
142
|
+
|
|
143
|
+
this._logicalCanvasSize = { width, height };
|
|
144
|
+
return this._logicalCanvasSize;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
_observeDevicePixelContentBox() {
|
|
148
|
+
if (typeof ResizeObserver != "function") {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const observer = new ResizeObserver((entries) => {
|
|
153
|
+
const entry = entries.find(
|
|
154
|
+
(candidate) => candidate.target == this._canvas
|
|
155
|
+
);
|
|
156
|
+
if (!entry) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const boxSize = entry.devicePixelContentBoxSize;
|
|
161
|
+
if (!boxSize) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const contentBoxSize = Array.isArray(boxSize)
|
|
166
|
+
? boxSize[0]
|
|
167
|
+
: boxSize;
|
|
168
|
+
if (!contentBoxSize) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// ResizeObserver reports device pixels directly, which is exactly what
|
|
173
|
+
// canvas width/height expect.
|
|
174
|
+
const nextPhysicalSize = {
|
|
175
|
+
width: contentBoxSize.inlineSize,
|
|
176
|
+
height: contentBoxSize.blockSize,
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
if (
|
|
180
|
+
this._devicePixelContentBoxSize &&
|
|
181
|
+
this._devicePixelContentBoxSize.width ==
|
|
182
|
+
nextPhysicalSize.width &&
|
|
183
|
+
this._devicePixelContentBoxSize.height ==
|
|
184
|
+
nextPhysicalSize.height
|
|
185
|
+
) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
this._devicePixelContentBoxSize = nextPhysicalSize;
|
|
190
|
+
this._onPhysicalSizeChange();
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
// Fails in browsers that do not support device-pixel-content-box.
|
|
195
|
+
observer.observe(this._canvas, {
|
|
196
|
+
box: "device-pixel-content-box",
|
|
197
|
+
});
|
|
198
|
+
this._devicePixelContentBoxObserver = observer;
|
|
199
|
+
} catch {
|
|
200
|
+
observer.disconnect();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
@@ -45,11 +45,19 @@ export default class WebGLHelper {
|
|
|
45
45
|
width: number;
|
|
46
46
|
height: number;
|
|
47
47
|
}, webglContextAttributes?: WebGLContextAttributes);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
/**
|
|
49
|
+
* @type {CanvasSizeHelper}
|
|
50
|
+
*/
|
|
51
|
+
_canvasSizeHelper: CanvasSizeHelper;
|
|
52
|
+
/**
|
|
53
|
+
* @type {{ logicalWidth: number, logicalHeight: number, physicalWidth: number, physicalHeight: number } | undefined}
|
|
54
|
+
*/
|
|
55
|
+
_appliedCanvasSize: {
|
|
56
|
+
logicalWidth: number;
|
|
57
|
+
logicalHeight: number;
|
|
58
|
+
physicalWidth: number;
|
|
59
|
+
physicalHeight: number;
|
|
60
|
+
} | undefined;
|
|
53
61
|
/** @type {Map<string, WebGLShader>} */
|
|
54
62
|
_shaderCache: Map<string, WebGLShader>;
|
|
55
63
|
/** @type {WeakMap<import("../types/encoder.js").VegaScale, WebGLTexture>} */
|
|
@@ -64,10 +72,6 @@ export default class WebGLHelper {
|
|
|
64
72
|
_pickingAttachmentOptions: import("twgl.js").AttachmentOptions[];
|
|
65
73
|
_pickingBufferInfo: import("twgl.js").FramebufferInfo;
|
|
66
74
|
invalidateSize(): void;
|
|
67
|
-
_logicalCanvasSize: {
|
|
68
|
-
width: any;
|
|
69
|
-
height: any;
|
|
70
|
-
};
|
|
71
75
|
/**
|
|
72
76
|
* Compiles and caches a shader. The shader source is used as a cache key.
|
|
73
77
|
*
|
|
@@ -89,13 +93,22 @@ export default class WebGLHelper {
|
|
|
89
93
|
width: number;
|
|
90
94
|
height: number;
|
|
91
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* Returns the ratio between true display pixels and logical pixels.
|
|
98
|
+
*
|
|
99
|
+
* @param {{ width: number, height: number }} [logicalSize]
|
|
100
|
+
*/
|
|
101
|
+
getDevicePixelRatio(logicalSize?: {
|
|
102
|
+
width: number;
|
|
103
|
+
height: number;
|
|
104
|
+
}): number;
|
|
92
105
|
/**
|
|
93
106
|
* Returns the size of the canvas canvas container size in logical pixels,
|
|
94
107
|
* without devicePixelRatio correction.
|
|
95
108
|
*/
|
|
96
109
|
getLogicalCanvasSize(): {
|
|
97
|
-
width:
|
|
98
|
-
height:
|
|
110
|
+
width: number;
|
|
111
|
+
height: number;
|
|
99
112
|
};
|
|
100
113
|
/**
|
|
101
114
|
* Creates textures for color schemes and discrete/discretizing ranges.
|
|
@@ -113,4 +126,5 @@ export default class WebGLHelper {
|
|
|
113
126
|
*/
|
|
114
127
|
createSelectionTexture(selection: import("../types/selectionTypes.js").MultiPointSelection, update?: boolean): void;
|
|
115
128
|
}
|
|
129
|
+
import CanvasSizeHelper from "./canvasSizeHelper.js";
|
|
116
130
|
//# sourceMappingURL=webGLHelper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webGLHelper.d.ts","sourceRoot":"","sources":["../../../src/gl/webGLHelper.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webGLHelper.d.ts","sourceRoot":"","sources":["../../../src/gl/webGLHelper.js"],"names":[],"mappings":"AAybA;;;;GAIG;AACH,kCAJW,sBAAsB,gBACtB,WAAW,kBACX,WAAW;;;;;;EA8CrB;AAED;;;;;GAKG;AACH,0CALW,qBAAqB,WACrB,IAAI,CAAC,OAAO,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC,OAC7C,MAAM,EAAE,GAAG,eAAe,YAC1B,YAAY,gBAYtB;AAED;;;;;;GAMG;AACH,qCALW,sBAAsB,mBACtB,OAAO,SAAS,EAAE,eAAe,KACjC,MAAM,KACN,MAAM,2BAWhB;AAED;;;;;GAKG;AACH,yCAJW,sBAAsB,mBACtB,OAAO,SAAS,EAAE,eAAe,SACjC,MAAM,UA4BhB;AA7gBD;IACI;;;;;;;OAOG;IACH,uBANW,WAAW,eACX,MAAM;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,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hashTable.js";
|
|
34
|
+
import CanvasSizeHelper from "./canvasSizeHelper.js";
|
|
34
35
|
|
|
35
36
|
export default class WebGLHelper {
|
|
36
37
|
/**
|
|
@@ -42,14 +43,23 @@ export default class WebGLHelper {
|
|
|
42
43
|
* @param {WebGLContextAttributes} [webglContextAttributes]
|
|
43
44
|
*/
|
|
44
45
|
constructor(container, sizeSource, webglContextAttributes = {}) {
|
|
45
|
-
|
|
46
|
-
this._sizeSource =
|
|
46
|
+
const resolvedSizeSource =
|
|
47
47
|
sizeSource ??
|
|
48
48
|
(() => ({
|
|
49
49
|
width: undefined,
|
|
50
50
|
height: undefined,
|
|
51
51
|
}));
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* @type {CanvasSizeHelper}
|
|
55
|
+
*/
|
|
56
|
+
this._canvasSizeHelper = undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @type {{ logicalWidth: number, logicalHeight: number, physicalWidth: number, physicalHeight: number } | undefined}
|
|
60
|
+
*/
|
|
61
|
+
this._appliedCanvasSize = undefined;
|
|
62
|
+
|
|
53
63
|
/** @type {Map<string, WebGLShader>} */
|
|
54
64
|
this._shaderCache = new Map();
|
|
55
65
|
|
|
@@ -124,11 +134,18 @@ export default class WebGLHelper {
|
|
|
124
134
|
);
|
|
125
135
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
126
136
|
|
|
137
|
+
this._canvasSizeHelper = new CanvasSizeHelper(
|
|
138
|
+
container,
|
|
139
|
+
canvas,
|
|
140
|
+
resolvedSizeSource,
|
|
141
|
+
() => this.adjustGl()
|
|
142
|
+
);
|
|
143
|
+
|
|
127
144
|
this.adjustGl();
|
|
128
145
|
}
|
|
129
146
|
|
|
130
147
|
invalidateSize() {
|
|
131
|
-
this.
|
|
148
|
+
this._canvasSizeHelper.invalidate();
|
|
132
149
|
this.adjustGl();
|
|
133
150
|
}
|
|
134
151
|
|
|
@@ -167,10 +184,21 @@ export default class WebGLHelper {
|
|
|
167
184
|
|
|
168
185
|
adjustGl() {
|
|
169
186
|
const logicalSize = this.getLogicalCanvasSize();
|
|
187
|
+
const physicalSize = this.getPhysicalCanvasSize(logicalSize);
|
|
188
|
+
|
|
189
|
+
if (
|
|
190
|
+
this._appliedCanvasSize &&
|
|
191
|
+
this._appliedCanvasSize.logicalWidth == logicalSize.width &&
|
|
192
|
+
this._appliedCanvasSize.logicalHeight == logicalSize.height &&
|
|
193
|
+
this._appliedCanvasSize.physicalWidth == physicalSize.width &&
|
|
194
|
+
this._appliedCanvasSize.physicalHeight == physicalSize.height
|
|
195
|
+
) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
170
199
|
this.canvas.style.width = `${logicalSize.width}px`;
|
|
171
200
|
this.canvas.style.height = `${logicalSize.height}px`;
|
|
172
201
|
|
|
173
|
-
const physicalSize = this.getPhysicalCanvasSize(logicalSize);
|
|
174
202
|
this.canvas.width = physicalSize.width;
|
|
175
203
|
this.canvas.height = physicalSize.height;
|
|
176
204
|
|
|
@@ -179,9 +207,17 @@ export default class WebGLHelper {
|
|
|
179
207
|
this._pickingBufferInfo,
|
|
180
208
|
this._pickingAttachmentOptions
|
|
181
209
|
);
|
|
210
|
+
|
|
211
|
+
this._appliedCanvasSize = {
|
|
212
|
+
logicalWidth: logicalSize.width,
|
|
213
|
+
logicalHeight: logicalSize.height,
|
|
214
|
+
physicalWidth: physicalSize.width,
|
|
215
|
+
physicalHeight: physicalSize.height,
|
|
216
|
+
};
|
|
182
217
|
}
|
|
183
218
|
|
|
184
219
|
finalize() {
|
|
220
|
+
this._canvasSizeHelper.finalize();
|
|
185
221
|
this.canvas.remove();
|
|
186
222
|
}
|
|
187
223
|
|
|
@@ -191,12 +227,16 @@ export default class WebGLHelper {
|
|
|
191
227
|
* @param {{ width: number, height: number }} [logicalSize]
|
|
192
228
|
*/
|
|
193
229
|
getPhysicalCanvasSize(logicalSize) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
230
|
+
return this._canvasSizeHelper.getPhysicalCanvasSize(logicalSize);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Returns the ratio between true display pixels and logical pixels.
|
|
235
|
+
*
|
|
236
|
+
* @param {{ width: number, height: number }} [logicalSize]
|
|
237
|
+
*/
|
|
238
|
+
getDevicePixelRatio(logicalSize) {
|
|
239
|
+
return this._canvasSizeHelper.getDevicePixelRatio(logicalSize);
|
|
200
240
|
}
|
|
201
241
|
|
|
202
242
|
/**
|
|
@@ -204,28 +244,7 @@ export default class WebGLHelper {
|
|
|
204
244
|
* without devicePixelRatio correction.
|
|
205
245
|
*/
|
|
206
246
|
getLogicalCanvasSize() {
|
|
207
|
-
|
|
208
|
-
return this._logicalCanvasSize;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// TODO: The size should never be smaller than the minimum content size!
|
|
212
|
-
const contentSize = this._sizeSource();
|
|
213
|
-
|
|
214
|
-
const cs = window.getComputedStyle(this._container, null);
|
|
215
|
-
const width =
|
|
216
|
-
contentSize.width ??
|
|
217
|
-
this._container.clientWidth -
|
|
218
|
-
parseFloat(cs.paddingLeft) -
|
|
219
|
-
parseFloat(cs.paddingRight);
|
|
220
|
-
|
|
221
|
-
const height =
|
|
222
|
-
contentSize.height ??
|
|
223
|
-
this._container.clientHeight -
|
|
224
|
-
parseFloat(cs.paddingTop) -
|
|
225
|
-
parseFloat(cs.paddingBottom);
|
|
226
|
-
|
|
227
|
-
this._logicalCanvasSize = { width, height };
|
|
228
|
-
return this._logicalCanvasSize;
|
|
247
|
+
return this._canvasSizeHelper.getLogicalCanvasSize();
|
|
229
248
|
}
|
|
230
249
|
|
|
231
250
|
/**
|
|
@@ -367,8 +386,11 @@ export default class WebGLHelper {
|
|
|
367
386
|
const texture = createOrUpdateTexture(
|
|
368
387
|
this.gl,
|
|
369
388
|
{
|
|
389
|
+
// Hash textures are point-lookups and must remain single-level.
|
|
390
|
+
auto: false,
|
|
370
391
|
level: 0,
|
|
371
|
-
|
|
392
|
+
min: gl.NEAREST,
|
|
393
|
+
mag: gl.NEAREST,
|
|
372
394
|
format: gl.RED_INTEGER,
|
|
373
395
|
internalFormat: gl.R32UI,
|
|
374
396
|
width,
|
|
@@ -377,6 +399,10 @@ export default class WebGLHelper {
|
|
|
377
399
|
table,
|
|
378
400
|
update ? existingTexture : false
|
|
379
401
|
);
|
|
402
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
403
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_BASE_LEVEL, 0);
|
|
404
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAX_LEVEL, 0);
|
|
405
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
380
406
|
|
|
381
407
|
this.selectionTextures.set(selection, texture);
|
|
382
408
|
}
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";AAoGA;;;;;GAKG;AACH,8BAFW,MAAM,gBAkBhB;sBAvHqB,gBAAgB;qBAFjB,KAAK;iBAGT,kBAAkB;oBACf,6BAA6B"}
|
package/dist/src/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import GenomeSpy from "./genomeSpy.js";
|
|
|
5
5
|
import icon from "./img/bowtie.svg";
|
|
6
6
|
import favIcon from "./img/genomespy-favicon.svg";
|
|
7
7
|
import { fetchJson } from "./utils/fetchUtils.js";
|
|
8
|
+
import inferSpecBaseUrl from "./utils/inferSpecBaseUrl.js";
|
|
8
9
|
|
|
9
10
|
export { GenomeSpy, html, icon, favIcon };
|
|
10
11
|
|
|
@@ -78,7 +79,10 @@ export async function embed(el, spec, options = {}) {
|
|
|
78
79
|
return genomeSpy.getNamedScaleResolutions().get(name);
|
|
79
80
|
},
|
|
80
81
|
|
|
82
|
+
awaitVisibleLazyData: genomeSpy.awaitVisibleLazyData.bind(genomeSpy),
|
|
83
|
+
getRenderedBounds: genomeSpy.getRenderedBounds.bind(genomeSpy),
|
|
81
84
|
updateNamedData: genomeSpy.updateNamedData.bind(genomeSpy),
|
|
85
|
+
getLogicalCanvasSize: genomeSpy.getLogicalCanvasSize.bind(genomeSpy),
|
|
82
86
|
exportCanvas: genomeSpy.exportCanvas.bind(genomeSpy),
|
|
83
87
|
};
|
|
84
88
|
}
|
|
@@ -112,8 +116,7 @@ export async function loadSpec(url) {
|
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
if (!spec.baseUrl) {
|
|
115
|
-
|
|
116
|
-
spec.baseUrl = (m && m[0]) || "./";
|
|
119
|
+
spec.baseUrl = inferSpecBaseUrl(url);
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
return spec;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/marks/link.js"],"names":[],"mappings":"AAYA;;GAEG;AACH;IACI;;OAEG;IACH,sBAFW,OAAO,qBAAqB,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/marks/link.js"],"names":[],"mappings":"AAYA;;GAEG;AACH;IACI;;OAEG;IACH,sBAFW,OAAO,qBAAqB,EAAE,OAAO,EAkC/C;IAPG;;;;;OAKG;IACH,yBAAiC;IAkIjC;;kBAGiC,GAAG;;;;MAEnC;CA4FR;iBA/QgB,WAAW"}
|
package/dist/src/marks/link.js
CHANGED
|
@@ -48,9 +48,7 @@ export default class LinkMark extends Mark {
|
|
|
48
48
|
*
|
|
49
49
|
* @private
|
|
50
50
|
*/
|
|
51
|
-
this._baseInstanceExt =
|
|
52
|
-
"WEBGL_draw_instanced_base_vertex_base_instance"
|
|
53
|
-
);
|
|
51
|
+
this._baseInstanceExt = undefined;
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
/**
|
|
@@ -110,6 +108,10 @@ export default class LinkMark extends Mark {
|
|
|
110
108
|
async initializeGraphics() {
|
|
111
109
|
await super.initializeGraphics();
|
|
112
110
|
|
|
111
|
+
this._baseInstanceExt = this.gl.getExtension(
|
|
112
|
+
"WEBGL_draw_instanced_base_vertex_base_instance"
|
|
113
|
+
);
|
|
114
|
+
|
|
113
115
|
this.createAndLinkShaders(VERTEX_SHADER, FRAGMENT_SHADER, [
|
|
114
116
|
COMMON_SHADER,
|
|
115
117
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../../src/marks/mark.js"],"names":[],"mappings":"AA6DA,mCAAoC,sBAAsB,CAAC;AAC3D,mCAAoC,sBAAsB,CAAC;AAE3D,uCAAwC,oBAAoB,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AAEH;;GAEG;AACH,0BAF0B,CAAC,SAAd,mCAAW;IAkBpB;;OAEG;IACH,sBAFW,OAAO,qBAAqB,EAAE,OAAO,EA4G/C;IAzGG,oFAAwB;IAExB,8EAA8E;IAC9E,UADW,OAAO,CAAC,MAAM,uCAAU,OAAO,qBAAqB,EAAE,OAAO,CAAC,CAAC,CACjD;IAIzB;;;OAGG;IACH,sBAHU,OAAO,SAAS,EAAE,UAAU,GAAG;QAAE,iBAAiB,CAAC,EAAE,MAAM,CAAA;KAAE,CAG5C;IAE3B;;;;;;;OAOG;IACH,2BAHU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAGG;IAEhC;;;OAGG;IACH,uBAHU,OAAO,SAAS,EAAE,WAAW,CAGX;IAE5B;;;OAGG;IACH,2BAHU,OAAO,SAAS,EAAE,eAAe,CAGX;IAEhC;;;OAGG;IACH,2BAHU,OAAO,SAAS,EAAE,gBAAgB,CAGZ;IAEhC;;;;;OAKG;IACH,2BAHU,OAAO,SAAS,EAAE,gBAAgB,CAGZ;IAEhC;;;;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CAOC;IAED;;;;;;;;OAQG;IAEH,uBAJW,OAAO,uBAAuB,EAAE,sBAAsB,GACpD,CAAC,MAAM,IAAI,CAAC,EAAE,CA4E1B;IAED;;;;;;OAMG;IACH,qCAJW,oBAAoB,GAClB,OAAO,CAiCnB;IAED;;;;;;;OAOG;IACH,gBAJW,oBAAoB,GAClB,MAAW,IAAI,CAM3B;IAED;;;;OAIG;IACH,2BAJW,YAAY,WACZ,OAAO,WAAW,EAAE,oBAAoB,GACtC,MAAW,IAAI,CAmE3B;IAED;;;;;;;;OAQG;IACH,wBANW;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,OAC/B,MAAM,UACN,OAAO,6BAA6B,EAAE,OAAO,aAC7C,OAAO,6BAA6B,EAAE,OAAO,GAC3C,OAAO,CAoHnB;IAED;;;;;;;;;OASG;IACH,qBAJW,MAAM,KACN,OAAO,oBAAoB,EAAE,MAAM,GACjC,GAAG,CAIf;;CACJ;+BA57CY,OAAO,uBAAuB,EAAE,gBAAgB;;;;;;wBAEnD,OAAO;;mCAEJ,gBAAgB,GAAG,qBAAqB;oCAG1C,MAAM,SACN,MAAM;0BAEJ,YAAY,GAAG,UAAU,GAAG,WAAW;AAo7CpD;;;GAGG;AACH,uBAFa,CAAC;IAGV,cAEC;IAkBD;;;OAGG;IACH,2BAFW,GAAG,CAAC,CAAC,EAAE,OAAO,yBAAyB,EAAE,UAAU,CAAC,QAiB9D;CACJ;0BA//CyB,WAAW"}
|
package/dist/src/marks/mark.js
CHANGED
|
@@ -1488,7 +1488,12 @@ export default class Mark {
|
|
|
1488
1488
|
}
|
|
1489
1489
|
|
|
1490
1490
|
// Viewport comprises the full canvas
|
|
1491
|
-
gl.viewport(
|
|
1491
|
+
gl.viewport(
|
|
1492
|
+
0,
|
|
1493
|
+
0,
|
|
1494
|
+
Math.round(canvasSize.width * dpr),
|
|
1495
|
+
Math.round(canvasSize.height * dpr)
|
|
1496
|
+
);
|
|
1492
1497
|
gl.disable(gl.SCISSOR_TEST);
|
|
1493
1498
|
|
|
1494
1499
|
// Offset and scale all drawing to the view rectangle
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {any} domain
|
|
3
|
+
* @returns {domain is SelectionDomainRef}
|
|
4
|
+
*/
|
|
5
|
+
export function isSelectionDomainRef(domain: any): domain is SelectionDomainRef;
|
|
1
6
|
/**
|
|
2
7
|
* @typedef {import("../utils/domainArray.js").DomainArray} DomainArray
|
|
3
8
|
* @typedef {import("../spec/scale.js").ComplexDomain} ComplexDomain
|
|
4
9
|
* @typedef {import("../spec/scale.js").ScalarDomain} ScalarDomain
|
|
10
|
+
* @typedef {import("../spec/scale.js").SelectionDomainRef} SelectionDomainRef
|
|
5
11
|
* @typedef {import("./scaleResolution.js").ScaleResolutionMember} ScaleResolutionMember
|
|
12
|
+
* @typedef {{
|
|
13
|
+
* param: string,
|
|
14
|
+
* encoding: "x" | "y",
|
|
15
|
+
* sync: "auto" | "oneWay" | "twoWay",
|
|
16
|
+
* }} SelectionDomainLinkInfo
|
|
6
17
|
*/
|
|
7
18
|
export default class DomainPlanner {
|
|
8
19
|
/**
|
|
@@ -10,14 +21,14 @@ export default class DomainPlanner {
|
|
|
10
21
|
* @param {() => Set<ScaleResolutionMember>} options.getMembers
|
|
11
22
|
* @param {() => Set<ScaleResolutionMember>} [options.getDataMembers]
|
|
12
23
|
* @param {() => import("../spec/channel.js").Type} options.getType
|
|
13
|
-
* @param {() => number[]} options.getLocusExtent
|
|
24
|
+
* @param {(assembly: import("../spec/scale.js").Scale["assembly"] | undefined) => number[]} options.getLocusExtent
|
|
14
25
|
* @param {(interval: ScalarDomain | ComplexDomain) => number[]} options.fromComplexInterval
|
|
15
26
|
*/
|
|
16
27
|
constructor({ getMembers, getDataMembers, getType, getLocusExtent, fromComplexInterval, }: {
|
|
17
28
|
getMembers: () => Set<ScaleResolutionMember>;
|
|
18
29
|
getDataMembers?: () => Set<ScaleResolutionMember>;
|
|
19
30
|
getType: () => import("../spec/channel.js").Type;
|
|
20
|
-
getLocusExtent: () => number[];
|
|
31
|
+
getLocusExtent: (assembly: import("../spec/scale.js").Scale["assembly"] | undefined) => number[];
|
|
21
32
|
fromComplexInterval: (interval: ScalarDomain | ComplexDomain) => number[];
|
|
22
33
|
});
|
|
23
34
|
/**
|
|
@@ -25,14 +36,28 @@ export default class DomainPlanner {
|
|
|
25
36
|
*/
|
|
26
37
|
get initialDomainSnapshot(): any[];
|
|
27
38
|
hasConfiguredDomain(): boolean;
|
|
39
|
+
hasSelectionConfiguredDomain(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* @returns {SelectionDomainLinkInfo | undefined}
|
|
42
|
+
*/
|
|
43
|
+
getSelectionConfiguredDomainInfo(): SelectionDomainLinkInfo | undefined;
|
|
28
44
|
invalidateConfiguredDomain(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the default domain without considering configured domains.
|
|
47
|
+
*
|
|
48
|
+
* @param {boolean} [extractDataDomain]
|
|
49
|
+
* @param {import("../spec/scale.js").Scale["assembly"]} [locusAssembly]
|
|
50
|
+
* @returns {any[]}
|
|
51
|
+
*/
|
|
52
|
+
getDefaultDomain(extractDataDomain?: boolean, locusAssembly?: import("../spec/scale.js").Scale["assembly"]): any[];
|
|
29
53
|
/**
|
|
30
54
|
* Returns the configured domain or a data-derived/default domain.
|
|
31
55
|
*
|
|
32
56
|
* @param {boolean} [extractDataDomain]
|
|
57
|
+
* @param {import("../spec/scale.js").Scale["assembly"]} [locusAssembly]
|
|
33
58
|
* @returns {any[]}
|
|
34
59
|
*/
|
|
35
|
-
getConfiguredOrDefaultDomain(extractDataDomain?: boolean): any[];
|
|
60
|
+
getConfiguredOrDefaultDomain(extractDataDomain?: boolean, locusAssembly?: import("../spec/scale.js").Scale["assembly"]): any[];
|
|
36
61
|
/**
|
|
37
62
|
* Unions the configured domains of all participating views.
|
|
38
63
|
*
|
|
@@ -56,5 +81,11 @@ export default class DomainPlanner {
|
|
|
56
81
|
export type DomainArray = import("../utils/domainArray.js").DomainArray;
|
|
57
82
|
export type ComplexDomain = import("../spec/scale.js").ComplexDomain;
|
|
58
83
|
export type ScalarDomain = import("../spec/scale.js").ScalarDomain;
|
|
84
|
+
export type SelectionDomainRef = import("../spec/scale.js").SelectionDomainRef;
|
|
59
85
|
export type ScaleResolutionMember = import("./scaleResolution.js").ScaleResolutionMember;
|
|
86
|
+
export type SelectionDomainLinkInfo = {
|
|
87
|
+
param: string;
|
|
88
|
+
encoding: "x" | "y";
|
|
89
|
+
sync: "auto" | "oneWay" | "twoWay";
|
|
90
|
+
};
|
|
60
91
|
//# sourceMappingURL=domainPlanner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domainPlanner.d.ts","sourceRoot":"","sources":["../../../src/scales/domainPlanner.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"domainPlanner.d.ts","sourceRoot":"","sources":["../../../src/scales/domainPlanner.js"],"names":[],"mappings":"AA8ZA;;;GAGG;AACH,6CAHW,GAAG,GACD,MAAM,IAAI,kBAAkB,CASxC;AAhaD;;;;;;;;;;;GAWG;AAEH;IA8BI;;;;;;;OAOG;IACH,2FANG;QAAkD,UAAU,EAApD,MAAM,GAAG,CAAC,qBAAqB,CAAC;QACW,cAAc,GAAzD,MAAM,GAAG,CAAC,qBAAqB,CAAC;QACiB,OAAO,EAAxD,MAAM,OAAO,oBAAoB,EAAE,IAAI;QACmD,cAAc,EAAxG,CAAC,QAAQ,EAAE,OAAO,kBAAkB,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,SAAS,KAAK,MAAM,EAAE;QAClB,mBAAmB,EAAjF,CAAC,QAAQ,EAAE,YAAY,GAAG,aAAa,KAAK,MAAM,EAAE;KAC9D,EAaA;IAED;;OAEG;IACH,6BAFa,GAAG,EAAE,CAIjB;IAED,+BAEC;IAED,wCAGC;IAED;;OAEG;IACH,oCAFa,uBAAuB,GAAG,SAAS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