@genome-spy/core 0.78.0 → 0.79.1
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/bundle/{browser-KWU9rWZT.js → browser-CETrb2cm.js} +53 -33
- package/dist/bundle/esm-BdLYkz-m.js +248 -0
- package/dist/bundle/esm-BwiDsqSb.js +1367 -0
- package/dist/bundle/esm-CDFd1cjk.js +441 -0
- package/dist/bundle/{esm-DVOHLB1e.js → esm-CTUHLDbv.js} +30 -30
- package/dist/bundle/{esm-NIYEaYkc.js → esm-Cx-EbkOj.js} +13 -13
- package/dist/bundle/esm-DlYGqi79.js +128 -0
- package/dist/bundle/{esm-BygJiwh0.js → esm-k9p3oHkt.js} +133 -158
- package/dist/bundle/{esm-CT3ygiMq.js → esm-zAZJQO6D.js} +226 -212
- package/dist/bundle/index.es.js +14879 -11656
- package/dist/bundle/index.js +119 -108
- package/dist/bundle/{parquetRead-DG_-F5j5.js → parquetRead-Cad1SOVV.js} +473 -399
- package/dist/schema.json +18940 -6914
- package/dist/src/config/axisConfig.d.ts +2 -2
- package/dist/src/config/axisConfig.d.ts.map +1 -1
- package/dist/src/config/axisConfig.js +28 -44
- package/dist/src/config/configLayers.d.ts +45 -0
- package/dist/src/config/configLayers.d.ts.map +1 -0
- package/dist/src/config/configLayers.js +110 -0
- package/dist/src/config/defaultConfig.d.ts.map +1 -1
- package/dist/src/config/defaultConfig.js +8 -1
- package/dist/src/config/defaults/legendDefaults.d.ts +14 -0
- package/dist/src/config/defaults/legendDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/legendDefaults.js +46 -0
- package/dist/src/config/defaults/titleDefaults.d.ts.map +1 -1
- package/dist/src/config/defaults/titleDefaults.js +26 -18
- package/dist/src/config/legendConfig.d.ts +11 -0
- package/dist/src/config/legendConfig.d.ts.map +1 -0
- package/dist/src/config/legendConfig.js +63 -0
- package/dist/src/config/styleUtils.d.ts +8 -2
- package/dist/src/config/styleUtils.d.ts.map +1 -1
- package/dist/src/config/styleUtils.js +25 -1
- package/dist/src/config/themes.d.ts.map +1 -1
- package/dist/src/config/themes.js +21 -2
- package/dist/src/config/titleConfig.d.ts.map +1 -1
- package/dist/src/config/titleConfig.js +2 -18
- package/dist/src/data/collector.d.ts.map +1 -1
- package/dist/src/data/collector.js +40 -18
- package/dist/src/data/flowInit.d.ts +6 -0
- package/dist/src/data/flowInit.d.ts.map +1 -1
- package/dist/src/data/flowInit.js +1 -1
- package/dist/src/data/flowNode.d.ts +32 -0
- package/dist/src/data/flowNode.d.ts.map +1 -1
- package/dist/src/data/flowNode.js +59 -0
- package/dist/src/data/sources/lazy/bamSource.d.ts +0 -1
- package/dist/src/data/sources/lazy/bamSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bamSource.js +39 -30
- package/dist/src/data/sources/lazy/bigBedSource.d.ts +0 -10
- package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigBedSource.js +127 -62
- package/dist/src/data/sources/lazy/bigWigSource.d.ts +2 -2
- package/dist/src/data/sources/lazy/bigWigSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigWigSource.js +234 -81
- package/dist/src/data/sources/lazy/gff3Source.d.ts +7 -3
- package/dist/src/data/sources/lazy/gff3Source.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/gff3Source.js +7 -8
- package/dist/src/data/sources/lazy/indexedFastaSource.d.ts +1 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.js +28 -19
- package/dist/src/data/sources/lazy/legendEntriesSource.d.ts +24 -0
- package/dist/src/data/sources/lazy/legendEntriesSource.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/legendEntriesSource.js +218 -0
- package/dist/src/data/sources/lazy/legendGradientSource.d.ts +30 -0
- package/dist/src/data/sources/lazy/legendGradientSource.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/legendGradientSource.js +388 -0
- package/dist/src/data/sources/lazy/mockLazySource.d.ts +4 -1
- package/dist/src/data/sources/lazy/mockLazySource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/mockLazySource.js +49 -4
- package/dist/src/data/sources/lazy/registerCoreLazySources.js +2 -0
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +3 -4
- package/dist/src/data/sources/lazy/tabixSource.d.ts +9 -4
- package/dist/src/data/sources/lazy/tabixSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/tabixSource.js +201 -70
- package/dist/src/data/sources/lazy/tabixTsvSource.d.ts +2 -3
- package/dist/src/data/sources/lazy/tabixTsvSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/tabixTsvSource.js +14 -12
- package/dist/src/data/sources/lazy/vcfSource.d.ts +7 -3
- package/dist/src/data/sources/lazy/vcfSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/vcfSource.js +7 -8
- package/dist/src/data/sources/urlDescriptor.d.ts +165 -0
- package/dist/src/data/sources/urlDescriptor.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptor.js +473 -0
- package/dist/src/data/sources/urlDescriptorController.d.ts +25 -0
- package/dist/src/data/sources/urlDescriptorController.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptorController.js +72 -0
- package/dist/src/data/sources/urlDescriptorState.d.ts +47 -0
- package/dist/src/data/sources/urlDescriptorState.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptorState.js +129 -0
- package/dist/src/data/sources/urlSource.d.ts.map +1 -1
- package/dist/src/data/sources/urlSource.js +101 -61
- package/dist/src/data/transforms/packLegendLabels.d.ts +21 -0
- package/dist/src/data/transforms/packLegendLabels.d.ts.map +1 -0
- package/dist/src/data/transforms/packLegendLabels.js +189 -0
- package/dist/src/data/transforms/transformFactory.d.ts.map +1 -1
- package/dist/src/data/transforms/transformFactory.js +4 -0
- package/dist/src/data/transforms/truncateText.d.ts +27 -0
- package/dist/src/data/transforms/truncateText.d.ts.map +1 -0
- package/dist/src/data/transforms/truncateText.js +94 -0
- package/dist/src/debug/dataflowDebugSnapshot.d.ts +58 -0
- package/dist/src/debug/dataflowDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/dataflowDebugSnapshot.js +159 -0
- package/dist/src/debug/markDebugSnapshot.d.ts +54 -0
- package/dist/src/debug/markDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/markDebugSnapshot.js +100 -0
- package/dist/src/debug/paramDebugSnapshot.d.ts +53 -0
- package/dist/src/debug/paramDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/paramDebugSnapshot.js +86 -0
- package/dist/src/debug/resolutionDebugSnapshot.d.ts +155 -0
- package/dist/src/debug/resolutionDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/resolutionDebugSnapshot.js +291 -0
- package/dist/src/debug/valuePreview.d.ts +9 -0
- package/dist/src/debug/valuePreview.d.ts.map +1 -0
- package/dist/src/debug/valuePreview.js +57 -0
- package/dist/src/debug/viewDebugSnapshot.d.ts +131 -0
- package/dist/src/debug/viewDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/viewDebugSnapshot.js +390 -0
- package/dist/src/embedFactory.d.ts.map +1 -1
- package/dist/src/embedFactory.js +6 -1
- package/dist/src/encoder/encoder.d.ts +2 -2
- package/dist/src/encoder/encoder.d.ts.map +1 -1
- package/dist/src/encoder/encoder.js +5 -4
- package/dist/src/fonts/bmFontManager.d.ts +1 -1
- package/dist/src/fonts/bmFontManager.d.ts.map +1 -1
- package/dist/src/fonts/bmFontManager.js +45 -10
- package/dist/src/fonts/textMetrics.d.ts +69 -0
- package/dist/src/fonts/textMetrics.d.ts.map +1 -0
- package/dist/src/fonts/textMetrics.js +73 -0
- package/dist/src/genomeSpy/headlessBootstrap.d.ts.map +1 -1
- package/dist/src/genomeSpy/headlessBootstrap.js +6 -0
- package/dist/src/genomeSpy/renderCoordinator.d.ts.map +1 -1
- package/dist/src/genomeSpy/renderCoordinator.js +25 -3
- package/dist/src/genomeSpy/viewDataInit.d.ts +14 -0
- package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -1
- package/dist/src/genomeSpy/viewDataInit.js +45 -8
- package/dist/src/genomeSpyBase.d.ts +6 -0
- package/dist/src/genomeSpyBase.d.ts.map +1 -1
- package/dist/src/genomeSpyBase.js +20 -3
- package/dist/src/gl/glslScaleGenerator.d.ts +17 -0
- package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
- package/dist/src/gl/glslScaleGenerator.js +39 -2
- package/dist/src/gl/includes/common.glsl.js +1 -1
- package/dist/src/gl/vertexRangeIndex.d.ts.map +1 -1
- package/dist/src/gl/vertexRangeIndex.js +4 -2
- package/dist/src/gl/webGLHelper.d.ts +1 -1
- package/dist/src/gl/webGLHelper.d.ts.map +1 -1
- package/dist/src/gl/webGLHelper.js +13 -8
- package/dist/src/marks/__snapshots__/shaderSnapshot.test.js.snap +140 -3
- package/dist/src/marks/mark.d.ts +47 -4
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +158 -54
- package/dist/src/marks/point.d.ts.map +1 -1
- package/dist/src/marks/point.js +4 -0
- package/dist/src/marks/point.vertex.glsl.js +1 -1
- package/dist/src/marks/text.d.ts +1 -1
- package/dist/src/marks/text.d.ts.map +1 -1
- package/dist/src/marks/text.js +2 -7
- package/dist/src/marks/text.vertex.glsl.js +1 -1
- package/dist/src/paramRuntime/paramUtils.d.ts +43 -9
- package/dist/src/paramRuntime/paramUtils.d.ts.map +1 -1
- package/dist/src/paramRuntime/paramUtils.js +61 -1
- package/dist/src/paramRuntime/viewParamRuntime.d.ts +32 -0
- package/dist/src/paramRuntime/viewParamRuntime.d.ts.map +1 -1
- package/dist/src/paramRuntime/viewParamRuntime.js +63 -0
- package/dist/src/scales/axisResolution.d.ts +35 -0
- package/dist/src/scales/axisResolution.d.ts.map +1 -1
- package/dist/src/scales/axisResolution.js +115 -7
- package/dist/src/scales/legendResolution.d.ts +83 -0
- package/dist/src/scales/legendResolution.d.ts.map +1 -0
- package/dist/src/scales/legendResolution.js +461 -0
- package/dist/src/scales/scaleResolution.d.ts +36 -0
- package/dist/src/scales/scaleResolution.d.ts.map +1 -1
- package/dist/src/scales/scaleResolution.js +59 -0
- package/dist/src/scales/viewLevelGuideConfig.d.ts +53 -0
- package/dist/src/scales/viewLevelGuideConfig.d.ts.map +1 -0
- package/dist/src/scales/viewLevelGuideConfig.js +224 -0
- package/dist/src/scales/viewLevelScaleConfig.d.ts.map +1 -1
- package/dist/src/scales/viewLevelScaleConfig.js +13 -2
- package/dist/src/spec/axis.d.ts +109 -3
- package/dist/src/spec/channel.d.ts +23 -4
- package/dist/src/spec/config.d.ts +59 -4
- package/dist/src/spec/data.d.ts +177 -17
- package/dist/src/spec/legend.d.ts +246 -0
- package/dist/src/spec/mark.d.ts +16 -4
- package/dist/src/spec/title.d.ts +58 -1
- package/dist/src/spec/transform.d.ts +149 -0
- package/dist/src/spec/view.d.ts +39 -6
- package/dist/src/types/embedApi.d.ts +262 -6
- package/dist/src/types/rendering.d.ts +19 -3
- package/dist/src/types/viewContext.d.ts +18 -2
- package/dist/src/utils/arrayUtils.d.ts +11 -0
- package/dist/src/utils/arrayUtils.d.ts.map +1 -1
- package/dist/src/utils/arrayUtils.js +23 -0
- package/dist/src/utils/suspension.d.ts +17 -0
- package/dist/src/utils/suspension.d.ts.map +1 -0
- package/dist/src/utils/suspension.js +41 -0
- package/dist/src/view/axisGridView.d.ts.map +1 -1
- package/dist/src/view/axisGridView.js +1 -4
- package/dist/src/view/axisView.d.ts +18 -2
- package/dist/src/view/axisView.d.ts.map +1 -1
- package/dist/src/view/axisView.js +180 -75
- package/dist/src/view/concatView.d.ts +10 -2
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +46 -9
- package/dist/src/view/containerMutationHelper.d.ts +20 -1
- package/dist/src/view/containerMutationHelper.d.ts.map +1 -1
- package/dist/src/view/containerMutationHelper.js +196 -33
- package/dist/src/view/facetView.d.ts +1 -1
- package/dist/src/view/gridView/gridChild.d.ts +54 -4
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +301 -120
- package/dist/src/view/gridView/gridChildLegends.d.ts +57 -0
- package/dist/src/view/gridView/gridChildLegends.d.ts.map +1 -0
- package/dist/src/view/gridView/gridChildLegends.js +503 -0
- package/dist/src/view/gridView/gridView.d.ts +25 -0
- package/dist/src/view/gridView/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView/gridView.js +490 -78
- package/dist/src/view/gridView/legendLayout.d.ts +30 -0
- package/dist/src/view/gridView/legendLayout.d.ts.map +1 -0
- package/dist/src/view/gridView/legendLayout.js +115 -0
- package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
- package/dist/src/view/gridView/scrollbar.js +1 -4
- package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
- package/dist/src/view/gridView/selectionRect.js +1 -4
- package/dist/src/view/gridView/separatorView.d.ts.map +1 -1
- package/dist/src/view/gridView/separatorView.js +1 -4
- package/dist/src/view/layerView.d.ts +9 -2
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +18 -1
- package/dist/src/view/layout/flexLayout.d.ts +20 -4
- package/dist/src/view/layout/flexLayout.d.ts.map +1 -1
- package/dist/src/view/layout/flexLayout.js +331 -31
- package/dist/src/view/layout/rectangle.d.ts +14 -0
- package/dist/src/view/layout/rectangle.d.ts.map +1 -1
- package/dist/src/view/layout/rectangle.js +40 -0
- package/dist/src/view/legend/legendEntries.d.ts +20 -0
- package/dist/src/view/legend/legendEntries.d.ts.map +1 -0
- package/dist/src/view/legend/legendEntries.js +21 -0
- package/dist/src/view/legendView.d.ts +137 -0
- package/dist/src/view/legendView.d.ts.map +1 -0
- package/dist/src/view/legendView.js +1654 -0
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.js +26 -4
- package/dist/src/view/renderingContext/clipOptions.d.ts +44 -0
- package/dist/src/view/renderingContext/clipOptions.d.ts.map +1 -0
- package/dist/src/view/renderingContext/clipOptions.js +140 -0
- package/dist/src/view/renderingContext/simpleViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/simpleViewRenderingContext.js +12 -1
- package/dist/src/view/resolutionPlanner.d.ts +2 -1
- package/dist/src/view/resolutionPlanner.d.ts.map +1 -1
- package/dist/src/view/resolutionPlanner.js +89 -25
- package/dist/src/view/testUtils.d.ts +4 -2
- package/dist/src/view/testUtils.d.ts.map +1 -1
- package/dist/src/view/testUtils.js +60 -7
- package/dist/src/view/titleView.d.ts +37 -0
- package/dist/src/view/titleView.d.ts.map +1 -0
- package/dist/src/view/titleView.js +584 -0
- package/dist/src/view/unitView.d.ts +3 -3
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +3 -2
- package/dist/src/view/view.d.ts +25 -24
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +126 -16
- package/dist/src/view/viewChrome.d.ts +33 -0
- package/dist/src/view/viewChrome.d.ts.map +1 -0
- package/dist/src/view/viewChrome.js +64 -0
- package/dist/src/view/viewFactory.d.ts +2 -5
- package/dist/src/view/viewFactory.d.ts.map +1 -1
- package/dist/src/view/viewFactory.js +1 -2
- package/dist/src/view/viewIdentityRegistry.d.ts +37 -0
- package/dist/src/view/viewIdentityRegistry.d.ts.map +1 -0
- package/dist/src/view/viewIdentityRegistry.js +71 -0
- package/dist/src/view/viewMutationAcidTestUtils.d.ts +112 -0
- package/dist/src/view/viewMutationAcidTestUtils.d.ts.map +1 -0
- package/dist/src/view/viewMutationAcidTestUtils.js +234 -0
- package/dist/src/view/viewMutationApi.d.ts +42 -0
- package/dist/src/view/viewMutationApi.d.ts.map +1 -0
- package/dist/src/view/viewMutationApi.js +811 -0
- package/dist/src/view/viewSelectors.d.ts +11 -9
- package/dist/src/view/viewSelectors.d.ts.map +1 -1
- package/dist/src/view/viewSelectors.js +28 -17
- package/package.json +4 -4
- package/dist/bundle/esm-CuMSzCHy.js +0 -298
- package/dist/bundle/esm-DAnOffpD.js +0 -1426
- package/dist/bundle/esm-DMXpJXM4.js +0 -369
- package/dist/bundle/esm-DNtC3H80.js +0 -121
- package/dist/src/view/title.d.ts +0 -13
- package/dist/src/view/title.d.ts.map +0 -1
- package/dist/src/view/title.js +0 -154
- /package/dist/bundle/{AbortablePromiseCache-3gHJdF3E.js → AbortablePromiseCache-BTmAcN-t.js} +0 -0
- /package/dist/bundle/{esm-CuVa5T98.js → esm-VvpZ9hsq.js} +0 -0
- /package/dist/bundle/{chunk-DmhlhrBa.js → rolldown-runtime-Dy4uBu1J.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bufferedViewRenderingContext.d.ts","sourceRoot":"","sources":["../../../../src/view/renderingContext/bufferedViewRenderingContext.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bufferedViewRenderingContext.d.ts","sourceRoot":"","sources":["../../../../src/view/renderingContext/bufferedViewRenderingContext.js"],"names":[],"mappings":"AAUA;;;;;;;;GAQG;AAEH;;;GAGG;AACH;IA2BI;;;OAGG;IACH,2BAHW,OAAO,0BAA0B,EAAE,sBAAsB,mBACzD,4BAA4B,EActC;IA+CD;;;OAGG;IACH,eAmCC;;CAuFJ;;iBApOS,OAAO,yBAAyB,EAAE,OAAO;;;;gBACzC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC;sBAC/B,MAAM;sBACN,OAAO,SAAS,EAAE,eAAe;;;;;iBACjC,MAAM;;iCAdiB,2BAA2B"}
|
|
@@ -2,6 +2,11 @@ import { group } from "d3-array";
|
|
|
2
2
|
|
|
3
3
|
import ViewRenderingContext from "./viewRenderingContext.js";
|
|
4
4
|
import { color } from "d3-color";
|
|
5
|
+
import {
|
|
6
|
+
clipOptionsEqual,
|
|
7
|
+
normalizeClipOptions,
|
|
8
|
+
prepareMarkClipOptionsFromClip,
|
|
9
|
+
} from "./clipOptions.js";
|
|
5
10
|
|
|
6
11
|
/**
|
|
7
12
|
* @typedef {object} BufferedViewRenderingOptions
|
|
@@ -92,11 +97,17 @@ export default class BufferedViewRenderingContext extends ViewRenderingContext {
|
|
|
92
97
|
|
|
93
98
|
const callback = mark.render(options);
|
|
94
99
|
if (callback) {
|
|
100
|
+
const inheritedClip = normalizeClipOptions(options);
|
|
95
101
|
this.#buffer.push({
|
|
96
102
|
mark,
|
|
97
103
|
callback,
|
|
98
104
|
coords: this.#coords,
|
|
99
|
-
|
|
105
|
+
clip: prepareMarkClipOptionsFromClip(
|
|
106
|
+
inheritedClip,
|
|
107
|
+
mark.properties.clip,
|
|
108
|
+
this.#coords
|
|
109
|
+
),
|
|
110
|
+
cullClip: inheritedClip,
|
|
100
111
|
});
|
|
101
112
|
}
|
|
102
113
|
}
|
|
@@ -195,24 +206,35 @@ export default class BufferedViewRenderingContext extends ViewRenderingContext {
|
|
|
195
206
|
|
|
196
207
|
/** @type {import("../layout/rectangle.js").default} */
|
|
197
208
|
let previousCoords;
|
|
209
|
+
/** @type {import("../../types/rendering.js").ClipOptions | undefined} */
|
|
210
|
+
let previousClip;
|
|
211
|
+
/** @type {import("../../types/rendering.js").ClipOptions | undefined} */
|
|
212
|
+
let previousCullClip;
|
|
198
213
|
for (const request of requests) {
|
|
199
214
|
const coords = request.coords;
|
|
200
215
|
// Render each facet
|
|
201
|
-
if (
|
|
216
|
+
if (
|
|
217
|
+
!coords.equals(previousCoords) ||
|
|
218
|
+
!clipOptionsEqual(request.clip, previousClip) ||
|
|
219
|
+
!clipOptionsEqual(request.cullClip, previousCullClip)
|
|
220
|
+
) {
|
|
202
221
|
this.#batch.push(
|
|
203
222
|
ifEnabled(() => {
|
|
204
|
-
// Suppress rendering if viewport is outside the
|
|
223
|
+
// Suppress rendering if viewport is outside the clip.
|
|
205
224
|
viewportVisible = mark.setViewport(
|
|
206
225
|
this.#canvasSize,
|
|
207
226
|
this.#dpr,
|
|
208
227
|
coords,
|
|
209
|
-
request.
|
|
228
|
+
request.clip,
|
|
229
|
+
request.cullClip
|
|
210
230
|
);
|
|
211
231
|
})
|
|
212
232
|
);
|
|
213
233
|
}
|
|
214
234
|
this.#batch.push(ifEnabledAndVisible(request.callback));
|
|
215
235
|
previousCoords = request.coords;
|
|
236
|
+
previousClip = request.clip;
|
|
237
|
+
previousCullClip = request.cullClip;
|
|
216
238
|
}
|
|
217
239
|
}
|
|
218
240
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("../../types/rendering.js").RenderingOptions} options
|
|
3
|
+
* @returns {import("../../types/rendering.js").ClipOptions | undefined}
|
|
4
|
+
*/
|
|
5
|
+
export function normalizeClipOptions(options: import("../../types/rendering.js").RenderingOptions): import("../../types/rendering.js").ClipOptions | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} a
|
|
8
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} b
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
export function clipOptionsEqual(a: import("../../types/rendering.js").ClipOptions | undefined, b: import("../../types/rendering.js").ClipOptions | undefined): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* @param {import("../layout/rectangle.js").default} rect
|
|
14
|
+
* @param {boolean} clipX
|
|
15
|
+
* @param {boolean} clipY
|
|
16
|
+
* @returns {import("../../types/rendering.js").ClipOptions | undefined}
|
|
17
|
+
*/
|
|
18
|
+
export function createClipOptions(rect: import("../layout/rectangle.js").default, clipX: boolean, clipY: boolean): import("../../types/rendering.js").ClipOptions | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* @param {import("../layout/rectangle.js").default} coords
|
|
21
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} clip
|
|
22
|
+
* @returns {import("../layout/rectangle.js").default}
|
|
23
|
+
*/
|
|
24
|
+
export function clipCoords(coords: import("../layout/rectangle.js").default, clip: import("../../types/rendering.js").ClipOptions | undefined): import("../layout/rectangle.js").default;
|
|
25
|
+
/**
|
|
26
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} current
|
|
27
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} next
|
|
28
|
+
* @returns {import("../../types/rendering.js").ClipOptions | undefined}
|
|
29
|
+
*/
|
|
30
|
+
export function combineClipOptions(current: import("../../types/rendering.js").ClipOptions | undefined, next: import("../../types/rendering.js").ClipOptions | undefined): import("../../types/rendering.js").ClipOptions | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* @param {import("../../spec/mark.js").MarkProps["clip"]} clip
|
|
33
|
+
* @param {import("../layout/rectangle.js").default} coords
|
|
34
|
+
* @returns {import("../../types/rendering.js").ClipOptions | undefined}
|
|
35
|
+
*/
|
|
36
|
+
export function createSelfClipOptions(clip: import("../../spec/mark.js").MarkProps["clip"], coords: import("../layout/rectangle.js").default): import("../../types/rendering.js").ClipOptions | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} inheritedClip
|
|
39
|
+
* @param {import("../../spec/mark.js").MarkProps["clip"]} markClip
|
|
40
|
+
* @param {import("../layout/rectangle.js").default} coords
|
|
41
|
+
* @returns {import("../../types/rendering.js").ClipOptions | undefined}
|
|
42
|
+
*/
|
|
43
|
+
export function prepareMarkClipOptionsFromClip(inheritedClip: import("../../types/rendering.js").ClipOptions | undefined, markClip: import("../../spec/mark.js").MarkProps["clip"], coords: import("../layout/rectangle.js").default): import("../../types/rendering.js").ClipOptions | undefined;
|
|
44
|
+
//# sourceMappingURL=clipOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipOptions.d.ts","sourceRoot":"","sources":["../../../../src/view/renderingContext/clipOptions.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,8CAHW,OAAO,0BAA0B,EAAE,gBAAgB,GACjD,OAAO,0BAA0B,EAAE,WAAW,GAAG,SAAS,CActE;AAED;;;;GAIG;AACH,oCAJW,OAAO,0BAA0B,EAAE,WAAW,GAAG,SAAS,KAC1D,OAAO,0BAA0B,EAAE,WAAW,GAAG,SAAS,GACxD,OAAO,CAYnB;AAED;;;;;GAKG;AACH,wCALW,OAAO,wBAAwB,EAAE,OAAO,SACxC,OAAO,SACP,OAAO,GACL,OAAO,0BAA0B,EAAE,WAAW,GAAG,SAAS,CAItE;AAED;;;;GAIG;AACH,mCAJW,OAAO,wBAAwB,EAAE,OAAO,QACxC,OAAO,0BAA0B,EAAE,WAAW,GAAG,SAAS,GACxD,OAAO,wBAAwB,EAAE,OAAO,CAcpD;AAED;;;;GAIG;AACH,4CAJW,OAAO,0BAA0B,EAAE,WAAW,GAAG,SAAS,QAC1D,OAAO,0BAA0B,EAAE,WAAW,GAAG,SAAS,GACxD,OAAO,0BAA0B,EAAE,WAAW,GAAG,SAAS,CAkCtE;AAED;;;;GAIG;AACH,4CAJW,OAAO,oBAAoB,EAAE,SAAS,CAAC,MAAM,CAAC,UAC9C,OAAO,wBAAwB,EAAE,OAAO,GACtC,OAAO,0BAA0B,EAAE,WAAW,GAAG,SAAS,CAYtE;AAED;;;;;GAKG;AACH,8DALW,OAAO,0BAA0B,EAAE,WAAW,GAAG,SAAS,YAC1D,OAAO,oBAAoB,EAAE,SAAS,CAAC,MAAM,CAAC,UAC9C,OAAO,wBAAwB,EAAE,OAAO,GACtC,OAAO,0BAA0B,EAAE,WAAW,GAAG,SAAS,CAetE"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("../../types/rendering.js").RenderingOptions} options
|
|
3
|
+
* @returns {import("../../types/rendering.js").ClipOptions | undefined}
|
|
4
|
+
*/
|
|
5
|
+
export function normalizeClipOptions(options) {
|
|
6
|
+
if (options.clip) {
|
|
7
|
+
return options.clip;
|
|
8
|
+
} else if (options.clipRect) {
|
|
9
|
+
return {
|
|
10
|
+
rect: options.clipRect,
|
|
11
|
+
clipX: true,
|
|
12
|
+
clipY: true,
|
|
13
|
+
};
|
|
14
|
+
} else {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} a
|
|
21
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} b
|
|
22
|
+
* @returns {boolean}
|
|
23
|
+
*/
|
|
24
|
+
export function clipOptionsEqual(a, b) {
|
|
25
|
+
if (a === b) {
|
|
26
|
+
return true;
|
|
27
|
+
} else if (!a || !b) {
|
|
28
|
+
return false;
|
|
29
|
+
} else {
|
|
30
|
+
return (
|
|
31
|
+
a.clipX === b.clipX && a.clipY === b.clipY && a.rect.equals(b.rect)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {import("../layout/rectangle.js").default} rect
|
|
38
|
+
* @param {boolean} clipX
|
|
39
|
+
* @param {boolean} clipY
|
|
40
|
+
* @returns {import("../../types/rendering.js").ClipOptions | undefined}
|
|
41
|
+
*/
|
|
42
|
+
export function createClipOptions(rect, clipX, clipY) {
|
|
43
|
+
return clipX || clipY ? { rect, clipX, clipY } : undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {import("../layout/rectangle.js").default} coords
|
|
48
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} clip
|
|
49
|
+
* @returns {import("../layout/rectangle.js").default}
|
|
50
|
+
*/
|
|
51
|
+
export function clipCoords(coords, clip) {
|
|
52
|
+
if (!clip) {
|
|
53
|
+
return coords;
|
|
54
|
+
} else if (clip.clipX && clip.clipY) {
|
|
55
|
+
return coords.intersect(clip.rect);
|
|
56
|
+
} else if (clip.clipX) {
|
|
57
|
+
return coords.intersectX(clip.rect);
|
|
58
|
+
} else if (clip.clipY) {
|
|
59
|
+
return coords.intersectY(clip.rect);
|
|
60
|
+
} else {
|
|
61
|
+
return coords;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} current
|
|
67
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} next
|
|
68
|
+
* @returns {import("../../types/rendering.js").ClipOptions | undefined}
|
|
69
|
+
*/
|
|
70
|
+
export function combineClipOptions(current, next) {
|
|
71
|
+
if (!current) {
|
|
72
|
+
return next;
|
|
73
|
+
} else if (!next) {
|
|
74
|
+
return current;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const clipX = current.clipX || next.clipX;
|
|
78
|
+
const clipY = current.clipY || next.clipY;
|
|
79
|
+
const xRect =
|
|
80
|
+
current.clipX && next.clipX
|
|
81
|
+
? current.rect.intersectX(next.rect)
|
|
82
|
+
: next.clipX
|
|
83
|
+
? next.rect
|
|
84
|
+
: current.rect;
|
|
85
|
+
const yRect =
|
|
86
|
+
current.clipY && next.clipY
|
|
87
|
+
? current.rect.intersectY(next.rect)
|
|
88
|
+
: next.clipY
|
|
89
|
+
? next.rect
|
|
90
|
+
: current.rect;
|
|
91
|
+
|
|
92
|
+
return createClipOptions(
|
|
93
|
+
current.rect.modify({
|
|
94
|
+
x: () => xRect.x,
|
|
95
|
+
y: () => yRect.y,
|
|
96
|
+
width: () => xRect.width,
|
|
97
|
+
height: () => yRect.height,
|
|
98
|
+
}),
|
|
99
|
+
clipX,
|
|
100
|
+
clipY
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @param {import("../../spec/mark.js").MarkProps["clip"]} clip
|
|
106
|
+
* @param {import("../layout/rectangle.js").default} coords
|
|
107
|
+
* @returns {import("../../types/rendering.js").ClipOptions | undefined}
|
|
108
|
+
*/
|
|
109
|
+
export function createSelfClipOptions(clip, coords) {
|
|
110
|
+
if (clip === true) {
|
|
111
|
+
return createClipOptions(coords, true, true);
|
|
112
|
+
} else if (clip === "x") {
|
|
113
|
+
return createClipOptions(coords, true, false);
|
|
114
|
+
} else if (clip === "y") {
|
|
115
|
+
return createClipOptions(coords, false, true);
|
|
116
|
+
} else {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @param {import("../../types/rendering.js").ClipOptions | undefined} inheritedClip
|
|
123
|
+
* @param {import("../../spec/mark.js").MarkProps["clip"]} markClip
|
|
124
|
+
* @param {import("../layout/rectangle.js").default} coords
|
|
125
|
+
* @returns {import("../../types/rendering.js").ClipOptions | undefined}
|
|
126
|
+
*/
|
|
127
|
+
export function prepareMarkClipOptionsFromClip(
|
|
128
|
+
inheritedClip,
|
|
129
|
+
markClip,
|
|
130
|
+
coords
|
|
131
|
+
) {
|
|
132
|
+
if (markClip === "never") {
|
|
133
|
+
return undefined;
|
|
134
|
+
} else {
|
|
135
|
+
return combineClipOptions(
|
|
136
|
+
inheritedClip,
|
|
137
|
+
createSelfClipOptions(markClip, coords)
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleViewRenderingContext.d.ts","sourceRoot":"","sources":["../../../../src/view/renderingContext/simpleViewRenderingContext.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simpleViewRenderingContext.d.ts","sourceRoot":"","sources":["../../../../src/view/renderingContext/simpleViewRenderingContext.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH;IAMQ,uDAAuD;IACvD,QADW,OAAO,wBAAwB,EAAE,OAAO,CAC5B;IAEvB,gDAAgD;IAChD,OADW,GAAG,CAAC,OAAO,YAAY,EAAE,OAAO,CAAC,CACtB;CAwD7B;;;;;mBApEY,OAAO,YAAY,EAAE,OAAO;iCAVR,2BAA2B"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import ViewRenderingContext from "./viewRenderingContext.js";
|
|
2
|
+
import {
|
|
3
|
+
normalizeClipOptions,
|
|
4
|
+
prepareMarkClipOptionsFromClip,
|
|
5
|
+
} from "./clipOptions.js";
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
8
|
* This class is mainly for illustrative purpose, i.e., how the rendering
|
|
@@ -62,7 +66,14 @@ export default class SimpleViewRenderingContext extends ViewRenderingContext {
|
|
|
62
66
|
const canvasSize = { width: 100, height: 100 }; // Placeholder, should be replaced with actual canvas size
|
|
63
67
|
const dpr = this.getDevicePixelRatio();
|
|
64
68
|
|
|
65
|
-
|
|
69
|
+
const inheritedClip = normalizeClipOptions(options);
|
|
70
|
+
const markClip = prepareMarkClipOptionsFromClip(
|
|
71
|
+
inheritedClip,
|
|
72
|
+
mark.properties.clip,
|
|
73
|
+
this.coords
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
mark.setViewport(canvasSize, dpr, this.coords, markClip, inheritedClip);
|
|
66
77
|
mark.render(options)();
|
|
67
78
|
}
|
|
68
79
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function resolveViewResolutions(view: import("./unitView.js").default, type?:
|
|
1
|
+
export function resolveViewResolutions(view: import("./unitView.js").default, type?: ResolutionPlannerTarget): void;
|
|
2
2
|
export type ResolutionMember = {
|
|
3
3
|
view: import("./unitView.js").default;
|
|
4
4
|
channel: import("../spec/channel.js").Channel;
|
|
@@ -6,4 +6,5 @@ export type ResolutionMember = {
|
|
|
6
6
|
targetChannel: import("../spec/channel.js").ChannelWithScale;
|
|
7
7
|
};
|
|
8
8
|
export type ScaleResolutionMemberMap = Map<import("../scales/scaleResolution.js").default, ResolutionMember[]>;
|
|
9
|
+
export type ResolutionPlannerTarget = import("../spec/view.js").ResolutionTarget;
|
|
9
10
|
//# sourceMappingURL=resolutionPlanner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolutionPlanner.d.ts","sourceRoot":"","sources":["../../../src/view/resolutionPlanner.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolutionPlanner.d.ts","sourceRoot":"","sources":["../../../src/view/resolutionPlanner.js"],"names":[],"mappings":"AAyVO,6CAHI,OAAO,eAAe,EAAE,OAAO,SAC/B,uBAAuB,QAsBjC;;UAhWS,OAAO,eAAe,EAAE,OAAO;aAC/B,OAAO,oBAAoB,EAAE,OAAO;gBACpC,OAAO,oBAAoB,EAAE,mBAAmB;mBAChD,OAAO,oBAAoB,EAAE,gBAAgB;;uCAI1C,GAAG,CAAC,OAAO,8BAA8B,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;sCACvE,OAAO,iBAAiB,EAAE,gBAAgB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import ScaleResolution from "../scales/scaleResolution.js";
|
|
2
2
|
import AxisResolution from "../scales/axisResolution.js";
|
|
3
|
+
import LegendResolution from "../scales/legendResolution.js";
|
|
3
4
|
import {
|
|
4
5
|
isPositionalChannel,
|
|
5
|
-
|
|
6
|
+
findChannelDefWithScale,
|
|
6
7
|
getPrimaryChannel,
|
|
7
8
|
isChannelWithScale,
|
|
8
9
|
isPrimaryPositionalChannel,
|
|
9
|
-
isValueDefWithCondition,
|
|
10
10
|
} from "../encoder/encoder.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -19,30 +19,12 @@ import {
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @typedef {Map<import("../scales/scaleResolution.js").default, ResolutionMember[]>} ScaleResolutionMemberMap
|
|
22
|
+
* @typedef {import("../spec/view.js").ResolutionTarget} ResolutionPlannerTarget
|
|
22
23
|
*/
|
|
23
24
|
|
|
24
|
-
/**
|
|
25
|
-
* @param {unknown} channelDef
|
|
26
|
-
* @returns {import("../spec/channel.js").ChannelDefWithScale | undefined}
|
|
27
|
-
*/
|
|
28
|
-
const getChannelDefWithScale = (channelDef) => {
|
|
29
|
-
if (isChannelDefWithScale(channelDef)) {
|
|
30
|
-
return channelDef;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (isValueDefWithCondition(channelDef)) {
|
|
34
|
-
const condition = channelDef.condition;
|
|
35
|
-
if (!Array.isArray(condition) && isChannelDefWithScale(condition)) {
|
|
36
|
-
return condition;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return undefined;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
25
|
/**
|
|
44
26
|
* @param {import("./unitView.js").default} view
|
|
45
|
-
* @param {
|
|
27
|
+
* @param {ResolutionPlannerTarget} type
|
|
46
28
|
* @param {import("../spec/channel.js").ChannelWithScale} targetChannel
|
|
47
29
|
* @returns {import("./unitView.js").default}
|
|
48
30
|
*/
|
|
@@ -100,13 +82,13 @@ const ensureScaleResolution = (ownerView, resolutionView, targetChannel) => {
|
|
|
100
82
|
|
|
101
83
|
/**
|
|
102
84
|
* @param {import("./unitView.js").default} view
|
|
103
|
-
* @param {
|
|
85
|
+
* @param {ResolutionPlannerTarget} type
|
|
104
86
|
* @param {import("../spec/channel.js").Channel} channel
|
|
105
87
|
* @param {unknown} channelDef
|
|
106
88
|
* @returns {ResolutionMember | undefined}
|
|
107
89
|
*/
|
|
108
90
|
const getResolutionMember = (view, type, channel, channelDef) => {
|
|
109
|
-
const channelDefWithScale =
|
|
91
|
+
const channelDefWithScale = findChannelDefWithScale(channelDef);
|
|
110
92
|
if (!channelDefWithScale) {
|
|
111
93
|
return undefined;
|
|
112
94
|
}
|
|
@@ -121,6 +103,18 @@ const getResolutionMember = (view, type, channel, channelDef) => {
|
|
|
121
103
|
if (type == "axis" && !isPositionalChannel(targetChannel)) {
|
|
122
104
|
return undefined;
|
|
123
105
|
}
|
|
106
|
+
if (type == "legend" && isPositionalChannel(targetChannel)) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
if (
|
|
110
|
+
type == "legend" &&
|
|
111
|
+
view.getConfiguredOrDefaultResolution(
|
|
112
|
+
targetChannel,
|
|
113
|
+
/** @type {any} */ (type)
|
|
114
|
+
) == "excluded"
|
|
115
|
+
) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
124
118
|
|
|
125
119
|
return {
|
|
126
120
|
view: getResolutionView(view, type, targetChannel),
|
|
@@ -164,6 +158,29 @@ const collectAxisResolutionMembers = (view) => {
|
|
|
164
158
|
return axisMembers;
|
|
165
159
|
};
|
|
166
160
|
|
|
161
|
+
/**
|
|
162
|
+
* @param {import("./unitView.js").default} view
|
|
163
|
+
* @returns {ResolutionMember[]}
|
|
164
|
+
*/
|
|
165
|
+
const collectLegendResolutionMembers = (view) => {
|
|
166
|
+
/** @type {ResolutionMember[]} */
|
|
167
|
+
const legendMembers = [];
|
|
168
|
+
for (const [channel, channelDef] of Object.entries(
|
|
169
|
+
view.spec.encoding ?? {}
|
|
170
|
+
)) {
|
|
171
|
+
if (!channelDef || Array.isArray(channelDef)) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const member = getResolutionMember(view, "legend", channel, channelDef);
|
|
176
|
+
if (member && !isPositionalChannel(member.channel)) {
|
|
177
|
+
legendMembers.push(member);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return legendMembers;
|
|
182
|
+
};
|
|
183
|
+
|
|
167
184
|
/**
|
|
168
185
|
* @param {import("./unitView.js").default} view
|
|
169
186
|
* @returns {ScaleResolutionMemberMap}
|
|
@@ -234,6 +251,48 @@ const registerAxisResolutionMembers = (view, axisMembers) => {
|
|
|
234
251
|
}
|
|
235
252
|
};
|
|
236
253
|
|
|
254
|
+
/**
|
|
255
|
+
* @param {import("./unitView.js").default} view
|
|
256
|
+
* @param {ResolutionMember[]} legendMembers
|
|
257
|
+
*/
|
|
258
|
+
const registerLegendResolutionMembers = (view, legendMembers) => {
|
|
259
|
+
for (const {
|
|
260
|
+
view: resolutionView,
|
|
261
|
+
channel,
|
|
262
|
+
targetChannel,
|
|
263
|
+
} of legendMembers) {
|
|
264
|
+
if (isPositionalChannel(channel)) {
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const legendChannel =
|
|
269
|
+
/** @type {import("../spec/channel.js").ChannelWithScale} */ (
|
|
270
|
+
targetChannel
|
|
271
|
+
);
|
|
272
|
+
if (!resolutionView.resolutions.legend[legendChannel]) {
|
|
273
|
+
resolutionView.resolutions.legend[legendChannel] =
|
|
274
|
+
new LegendResolution(legendChannel);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const resolution = resolutionView.resolutions.legend[legendChannel];
|
|
278
|
+
const unregister = resolution.registerMember({
|
|
279
|
+
view,
|
|
280
|
+
channel:
|
|
281
|
+
/** @type {import("../spec/channel.js").ChannelWithScale} */ (
|
|
282
|
+
channel
|
|
283
|
+
),
|
|
284
|
+
});
|
|
285
|
+
view.registerDisposer(() => {
|
|
286
|
+
if (
|
|
287
|
+
unregister() &&
|
|
288
|
+
resolutionView.resolutions.legend[legendChannel] === resolution
|
|
289
|
+
) {
|
|
290
|
+
delete resolutionView.resolutions.legend[legendChannel];
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
237
296
|
/**
|
|
238
297
|
* @param {import("./unitView.js").default} view
|
|
239
298
|
* @param {ScaleResolutionMemberMap} scaleMembersByResolution
|
|
@@ -282,7 +341,7 @@ const registerScaleResolutionMembers = (view, scaleMembersByResolution) => {
|
|
|
282
341
|
* Resolves scale and axis members for a view.
|
|
283
342
|
*
|
|
284
343
|
* @param {import("./unitView.js").default} view
|
|
285
|
-
* @param {
|
|
344
|
+
* @param {ResolutionPlannerTarget} [type]
|
|
286
345
|
*/
|
|
287
346
|
export const resolveViewResolutions = (view, type) => {
|
|
288
347
|
if (!type) {
|
|
@@ -293,6 +352,11 @@ export const resolveViewResolutions = (view, type) => {
|
|
|
293
352
|
|
|
294
353
|
if (type == "axis") {
|
|
295
354
|
registerAxisResolutionMembers(view, collectAxisResolutionMembers(view));
|
|
355
|
+
} else if (type == "legend") {
|
|
356
|
+
registerLegendResolutionMembers(
|
|
357
|
+
view,
|
|
358
|
+
collectLegendResolutionMembers(view)
|
|
359
|
+
);
|
|
296
360
|
} else {
|
|
297
361
|
registerScaleResolutionMembers(
|
|
298
362
|
view,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {import("./viewFactory.js").ViewFactoryOptions} [viewFactoryOptions]
|
|
3
|
+
* @param {Parameters<typeof createHeadlessViewContext>[0]} [contextOptions]
|
|
3
4
|
* @returns
|
|
4
5
|
*/
|
|
5
|
-
export function createTestViewContext(viewFactoryOptions?: import("./viewFactory.js").ViewFactoryOptions): import("../types/viewContext.js").default;
|
|
6
|
+
export function createTestViewContext(viewFactoryOptions?: import("./viewFactory.js").ViewFactoryOptions, contextOptions?: Parameters<typeof createHeadlessViewContext>[0]): import("../types/viewContext.js").default;
|
|
6
7
|
/**
|
|
7
8
|
* @param {import("./viewFactory.js").ViewFactoryOptions} [viewFactoryOptions]
|
|
8
9
|
* @returns {BroadcastingViewContext}
|
|
@@ -10,7 +11,7 @@ export function createTestViewContext(viewFactoryOptions?: import("./viewFactory
|
|
|
10
11
|
export function createBroadcastingTestViewContext(viewFactoryOptions?: import("./viewFactory.js").ViewFactoryOptions): BroadcastingViewContext;
|
|
11
12
|
export function create<V extends import("./view.js").default>(spec: RootSpec, viewClass: {
|
|
12
13
|
new (...args: any[]): V;
|
|
13
|
-
}, ViewFactoryOptions?: import("./viewFactory.js").ViewFactoryOptions): Promise<V>;
|
|
14
|
+
}, ViewFactoryOptions?: import("./viewFactory.js").ViewFactoryOptions, contextOptions?: Parameters<typeof createHeadlessViewContext>[0]): Promise<V>;
|
|
14
15
|
export function createAndInitialize<V extends import("./view.js").default>(spec: RootSpec, viewClass: {
|
|
15
16
|
new (...args: any[]): V;
|
|
16
17
|
}, context?: ViewContext, options?: {
|
|
@@ -61,6 +62,7 @@ export type ViewContext = import("../types/viewContext.js").default;
|
|
|
61
62
|
export type BroadcastingViewContext = ViewContext & {
|
|
62
63
|
emitBroadcast: (root: import("./view.js").default, type: import("../genomeSpy.js").BroadcastEventType, payload?: any) => void;
|
|
63
64
|
};
|
|
65
|
+
import { createHeadlessViewContext } from "../genomeSpy/headlessBootstrap.js";
|
|
64
66
|
import View from "./view.js";
|
|
65
67
|
import { createHeadlessEngine } from "../genomeSpy/headlessBootstrap.js";
|
|
66
68
|
//# sourceMappingURL=testUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../../../src/view/testUtils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../../../src/view/testUtils.js"],"names":[],"mappings":"AAkEA;;;;GAIG;AACH,2DAJW,OAAO,kBAAkB,EAAE,kBAAkB,mBAC7C,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,6CAQzD;AAED;;;GAGG;AACH,uEAHW,OAAO,kBAAkB,EAAE,kBAAkB,GAC3C,uBAAuB,CAmCnC;AAGS,uBAAC,CAAC,SAAS,OAAO,WAAW,EAAE,OAAO,QAAQ,QAAQ,aAAa;IAAE,KAAI,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;CAAE,uBAAuB,OAAO,kBAAkB,EAAE,kBAAkB,mBAAmB,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,GAAK,OAAO,CAAC,CAAC,CAAC,CAAA;AA0BlP,oCAAC,CAAC,SAAS,OAAO,WAAW,EAAE,OAAO,QAAQ,QAAQ,aAAa;IAAE,KAAI,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;CAAE,YAAY,WAAW,YAAY;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAC,GAAK,OAAO,CAAC,CAAC,CAAC,CAAA;AAqBjM;;;;;;GAMG;AACH,qCAHW,IAAI,WACJ,OAAO,uBAAuB,EAAE,OAAO;;;;;EAoBjD;AAED;;;;;;GAMG;AACH,mCAJW,QAAQ,uBACR,OAAO,kBAAkB,EAAE,kBAAkB,WAC7C,OAAO,uBAAuB,EAAE,OAAO;;;;;GAuBjD;;;;;;uBAxNY,OAAO,iBAAiB,EAAE,QAAQ;;;;;0BAClC,OAAO,yBAAyB,EAAE,OAAO;;;;;sCACzC,WAAW,GAAG;IACtB,aAAa,EAAE,CACb,IAAI,EAAE,OAAO,WAAW,EAAE,OAAO,EACjC,IAAI,EAAE,OAAO,iBAAiB,EAAE,kBAAkB,EAClD,OAAO,CAAC,EAAE,GAAG,KACV,IAAI,CAAA;CACV;0CAoBG,mCAAmC;iBANzB,WAAW;qCAMrB,mCAAmC"}
|
|
@@ -31,13 +31,47 @@ import {
|
|
|
31
31
|
createHeadlessEngine,
|
|
32
32
|
createHeadlessViewContext,
|
|
33
33
|
} from "../genomeSpy/headlessBootstrap.js";
|
|
34
|
+
import { INTERNAL_DEFAULT_CONFIG } from "../config/defaultConfig.js";
|
|
35
|
+
import { mergeConfigScopes } from "../config/mergeConfig.js";
|
|
36
|
+
import { resolveBaseConfig } from "../config/resolveConfig.js";
|
|
37
|
+
import { DEFAULT_THEME_NAME, resolveThemeSelection } from "../config/themes.js";
|
|
38
|
+
import BmFontManager from "../fonts/bmFontManager.js";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Uses the embedded default font for every font request. Layout snapshots
|
|
42
|
+
* should be stable and independent of asynchronously loaded font variants.
|
|
43
|
+
*/
|
|
44
|
+
class LayoutSnapshotFontManager {
|
|
45
|
+
#fontManager = new BmFontManager();
|
|
46
|
+
|
|
47
|
+
getDefaultFont() {
|
|
48
|
+
return this.#fontManager.getDefaultFont();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getFont() {
|
|
52
|
+
return this.getDefaultFont();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** @returns {Promise<void>} */
|
|
56
|
+
async waitUntilReady() {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function createLayoutSnapshotFontManager() {
|
|
62
|
+
return /** @type {BmFontManager} */ (
|
|
63
|
+
/** @type {unknown} */ (new LayoutSnapshotFontManager())
|
|
64
|
+
);
|
|
65
|
+
}
|
|
34
66
|
|
|
35
67
|
/**
|
|
36
68
|
* @param {import("./viewFactory.js").ViewFactoryOptions} [viewFactoryOptions]
|
|
69
|
+
* @param {Parameters<typeof createHeadlessViewContext>[0]} [contextOptions]
|
|
37
70
|
* @returns
|
|
38
71
|
*/
|
|
39
|
-
export function createTestViewContext(viewFactoryOptions = {}) {
|
|
72
|
+
export function createTestViewContext(viewFactoryOptions = {}, contextOptions) {
|
|
40
73
|
return createHeadlessViewContext({
|
|
74
|
+
...contextOptions,
|
|
41
75
|
viewFactoryOptions,
|
|
42
76
|
});
|
|
43
77
|
}
|
|
@@ -82,10 +116,15 @@ export function createBroadcastingTestViewContext(viewFactoryOptions = {}) {
|
|
|
82
116
|
}
|
|
83
117
|
|
|
84
118
|
/**
|
|
85
|
-
* @type {<V extends import("./view.js").default>(spec: RootSpec, viewClass: { new(...args: any[]): V }, ViewFactoryOptions?: import("./viewFactory.js").ViewFactoryOptions) => Promise<V>}
|
|
119
|
+
* @type {<V extends import("./view.js").default>(spec: RootSpec, viewClass: { new(...args: any[]): V }, ViewFactoryOptions?: import("./viewFactory.js").ViewFactoryOptions, contextOptions?: Parameters<typeof createHeadlessViewContext>[0]) => Promise<V>}
|
|
86
120
|
*/
|
|
87
|
-
export async function create(
|
|
88
|
-
|
|
121
|
+
export async function create(
|
|
122
|
+
spec,
|
|
123
|
+
viewClass,
|
|
124
|
+
viewFactoryOptions = {},
|
|
125
|
+
contextOptions
|
|
126
|
+
) {
|
|
127
|
+
const c = createTestViewContext(viewFactoryOptions, contextOptions);
|
|
89
128
|
const view = await c.createOrImportView(
|
|
90
129
|
/** @type {import("../spec/view.js").ViewSpec} */ (spec),
|
|
91
130
|
null,
|
|
@@ -159,11 +198,25 @@ export function renderToLayout(view, coords) {
|
|
|
159
198
|
* @param {import("./layout/rectangle.js").default} [coords]
|
|
160
199
|
*/
|
|
161
200
|
export async function specToLayout(spec, viewFactoryOptions = {}, coords) {
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
201
|
+
const baseConfig = resolveBaseConfig({
|
|
202
|
+
defaultConfig: INTERNAL_DEFAULT_CONFIG,
|
|
203
|
+
builtInTheme: resolveThemeSelection(DEFAULT_THEME_NAME),
|
|
204
|
+
theme: mergeConfigScopes([resolveThemeSelection(spec.theme)]),
|
|
165
205
|
});
|
|
166
206
|
|
|
207
|
+
const view = await create(
|
|
208
|
+
/** @type {any} */ (spec),
|
|
209
|
+
View,
|
|
210
|
+
{
|
|
211
|
+
wrapRoot: true,
|
|
212
|
+
...viewFactoryOptions,
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
baseConfig,
|
|
216
|
+
fontManager: createLayoutSnapshotFontManager(),
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
|
|
167
220
|
return renderToLayout(view, coords);
|
|
168
221
|
}
|
|
169
222
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated chrome view for view titles.
|
|
3
|
+
*
|
|
4
|
+
* @extends {ContainerView<import("../spec/view.js").LayerSpec>}
|
|
5
|
+
*/
|
|
6
|
+
export default class TitleView extends ContainerView<import("../spec/view.js").LayerSpec> {
|
|
7
|
+
/**
|
|
8
|
+
* @param {string | import("../spec/title.js").Title} title
|
|
9
|
+
* @param {import("../spec/config.js").GenomeSpyConfig[]} configScopes
|
|
10
|
+
* @param {import("../types/viewContext.js").default} context
|
|
11
|
+
* @param {ContainerView} layoutParent
|
|
12
|
+
* @param {import("./view.js").default} dataParent
|
|
13
|
+
* @param {string} name
|
|
14
|
+
* @param {import("./view.js").ViewOptions} [options]
|
|
15
|
+
* @returns {TitleView | undefined}
|
|
16
|
+
*/
|
|
17
|
+
static create(title: string | import("../spec/title.js").Title, configScopes: import("../spec/config.js").GenomeSpyConfig[], context: import("../types/viewContext.js").default, layoutParent: ContainerView, dataParent: import("./view.js").default, name: string, options?: import("./view.js").ViewOptions): TitleView | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* @param {import("../spec/title.js").Title} titleSpec
|
|
20
|
+
* @param {import("../types/viewContext.js").default} context
|
|
21
|
+
* @param {ContainerView} layoutParent
|
|
22
|
+
* @param {import("./view.js").default} dataParent
|
|
23
|
+
* @param {string} name
|
|
24
|
+
* @param {import("./view.js").ViewOptions} [options]
|
|
25
|
+
*/
|
|
26
|
+
constructor(titleSpec: import("../spec/title.js").Title, context: import("../types/viewContext.js").default, layoutParent: ContainerView, dataParent: import("./view.js").default, name: string, options?: import("./view.js").ViewOptions);
|
|
27
|
+
/** @type {import("../spec/title.js").Title} */
|
|
28
|
+
titleSpec: import("../spec/title.js").Title;
|
|
29
|
+
/**
|
|
30
|
+
* @returns {IterableIterator<UnitView>}
|
|
31
|
+
*/
|
|
32
|
+
[Symbol.iterator](): IterableIterator<UnitView>;
|
|
33
|
+
#private;
|
|
34
|
+
}
|
|
35
|
+
import ContainerView from "./containerView.js";
|
|
36
|
+
import UnitView from "./unitView.js";
|
|
37
|
+
//# sourceMappingURL=titleView.d.ts.map
|