@genome-spy/core 0.72.0 → 0.74.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/AbortablePromiseCache-3gHJdF3E.js +96 -0
- package/dist/bundle/browser-BTgw5ieH.js +126 -0
- package/dist/bundle/chunk-DmhlhrBa.js +11 -0
- package/dist/bundle/esm-BDFRLEuD.js +1248 -0
- package/dist/bundle/esm-BygJiwh0.js +573 -0
- package/dist/bundle/esm-CGX-qz1d.js +155 -0
- package/dist/bundle/esm-CgfVIRJ-.js +121 -0
- package/dist/bundle/esm-CuMSzCHy.js +298 -0
- package/dist/bundle/esm-DMXpJXM4.js +369 -0
- package/dist/bundle/esm-DQiq2Zhd.js +1426 -0
- package/dist/bundle/esm-DtE8VqAv.js +1015 -0
- package/dist/bundle/esm-sIoQYZ21.js +461 -0
- package/dist/bundle/index.es.js +21078 -24556
- package/dist/bundle/index.js +379 -383
- package/dist/bundle/parquetRead-DG_-F5j5.js +1609 -0
- package/dist/schema.json +13349 -7082
- package/dist/src/config/axisConfig.d.ts +16 -0
- package/dist/src/config/axisConfig.d.ts.map +1 -0
- package/dist/src/config/axisConfig.js +84 -0
- package/dist/src/config/defaultConfig.d.ts +3 -0
- package/dist/src/config/defaultConfig.d.ts.map +1 -0
- package/dist/src/config/defaultConfig.js +38 -0
- package/dist/src/config/defaults/axisDefaults.d.ts +5 -0
- package/dist/src/config/defaults/axisDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/axisDefaults.js +72 -0
- package/dist/src/config/defaults/markDefaults.d.ts +15 -0
- package/dist/src/config/defaults/markDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/markDefaults.js +121 -0
- package/dist/src/config/defaults/scaleDefaults.d.ts +5 -0
- package/dist/src/config/defaults/scaleDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/scaleDefaults.js +18 -0
- package/dist/src/config/defaults/titleDefaults.d.ts +5 -0
- package/dist/src/config/defaults/titleDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/titleDefaults.js +47 -0
- package/dist/src/config/defaults/viewDefaults.d.ts +3 -0
- package/dist/src/config/defaults/viewDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/viewDefaults.js +2 -0
- package/dist/src/config/markConfig.d.ts +8 -0
- package/dist/src/config/markConfig.d.ts.map +1 -0
- package/dist/src/config/markConfig.js +27 -0
- package/dist/src/config/mergeConfig.d.ts +8 -0
- package/dist/src/config/mergeConfig.d.ts.map +1 -0
- package/dist/src/config/mergeConfig.js +81 -0
- package/dist/src/config/resolveConfig.d.ts +22 -0
- package/dist/src/config/resolveConfig.d.ts.map +1 -0
- package/dist/src/config/resolveConfig.js +32 -0
- package/dist/src/config/scaleConfig.d.ts +40 -0
- package/dist/src/config/scaleConfig.d.ts.map +1 -0
- package/dist/src/config/scaleConfig.js +220 -0
- package/dist/src/config/styleUtils.d.ts +6 -0
- package/dist/src/config/styleUtils.d.ts.map +1 -0
- package/dist/src/config/styleUtils.js +10 -0
- package/dist/src/config/themes.d.ts +15 -0
- package/dist/src/config/themes.d.ts.map +1 -0
- package/dist/src/config/themes.js +293 -0
- package/dist/src/config/titleConfig.d.ts +12 -0
- package/dist/src/config/titleConfig.d.ts.map +1 -0
- package/dist/src/config/titleConfig.js +42 -0
- package/dist/src/config/viewConfig.d.ts +7 -0
- package/dist/src/config/viewConfig.d.ts.map +1 -0
- package/dist/src/config/viewConfig.js +29 -0
- package/dist/src/data/flowNode.d.ts +22 -1
- package/dist/src/data/flowNode.d.ts.map +1 -1
- package/dist/src/data/flowNode.js +37 -1
- 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 +58 -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 +164 -0
- package/dist/src/data/formats/fasta.d.ts.map +1 -1
- package/dist/src/data/formats/fasta.js +4 -0
- package/dist/src/data/formats/parquet.d.ts.map +1 -1
- package/dist/src/data/formats/parquet.js +4 -0
- package/dist/src/data/sources/dataSourceFactory.d.ts +2 -13
- package/dist/src/data/sources/dataSourceFactory.d.ts.map +1 -1
- package/dist/src/data/sources/dataSourceFactory.js +5 -141
- 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/lazy/axisGenomeSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/axisGenomeSource.js +11 -0
- package/dist/src/data/sources/lazy/axisTickSource.d.ts +1 -1
- package/dist/src/data/sources/lazy/axisTickSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/axisTickSource.js +19 -8
- package/dist/src/data/sources/lazy/bamSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bamSource.js +11 -0
- package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigBedSource.js +12 -1
- package/dist/src/data/sources/lazy/bigWigSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigWigSource.js +11 -0
- package/dist/src/data/sources/lazy/gff3Source.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/gff3Source.js +12 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.js +11 -0
- package/dist/src/data/sources/lazy/lazyDataSourceRegistry.d.ts +27 -0
- package/dist/src/data/sources/lazy/lazyDataSourceRegistry.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/lazyDataSourceRegistry.js +65 -0
- package/dist/src/data/sources/lazy/registerBuiltInLazySources.d.ts +2 -0
- package/dist/src/data/sources/lazy/registerBuiltInLazySources.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/registerBuiltInLazySources.js +8 -0
- package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisLazySource.js +11 -2
- package/dist/src/data/sources/lazy/vcfSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/vcfSource.js +11 -0
- 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 +138 -16
- package/dist/src/data/transforms/aggregate.d.ts +1 -0
- package/dist/src/data/transforms/aggregate.d.ts.map +1 -1
- package/dist/src/data/transforms/aggregate.js +30 -8
- package/dist/src/data/transforms/aggregateOps.d.ts.map +1 -1
- package/dist/src/data/transforms/aggregateOps.js +12 -1
- package/dist/src/data/transforms/coverage.js +2 -2
- package/dist/src/data/transforms/filter.js +1 -1
- package/dist/src/data/transforms/filterScoredLabels.d.ts +6 -0
- package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
- package/dist/src/data/transforms/filterScoredLabels.js +9 -0
- package/dist/src/data/transforms/measureText.d.ts +1 -0
- package/dist/src/data/transforms/measureText.d.ts.map +1 -1
- package/dist/src/data/transforms/measureText.js +14 -5
- package/dist/src/data/transforms/pileup.d.ts.map +1 -1
- package/dist/src/data/transforms/pileup.js +1 -2
- package/dist/src/data/transforms/regexFold.d.ts.map +1 -1
- package/dist/src/data/transforms/regexFold.js +0 -1
- package/dist/src/embedFactory.d.ts +13 -0
- package/dist/src/embedFactory.d.ts.map +1 -0
- package/dist/src/embedFactory.js +127 -0
- package/dist/src/encoder/accessor.d.ts +3 -12
- package/dist/src/encoder/accessor.d.ts.map +1 -1
- package/dist/src/encoder/accessor.js +10 -65
- package/dist/src/encoder/encoder.d.ts +51 -8
- package/dist/src/encoder/encoder.d.ts.map +1 -1
- package/dist/src/encoder/encoder.js +179 -55
- package/dist/src/fonts/bmFontManager.js +1 -1
- package/dist/src/full.d.ts +2 -0
- package/dist/src/full.d.ts.map +1 -0
- package/dist/src/full.js +2 -0
- 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 +10 -2
- package/dist/src/genome/genome.d.ts.map +1 -1
- package/dist/src/genome/genome.js +20 -2
- 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 +98 -0
- package/dist/src/genome/scaleLocus.d.ts.map +1 -1
- package/dist/src/genome/scaleLocus.js +26 -7
- package/dist/src/genomeSpy/cursorManager.d.ts +69 -0
- package/dist/src/genomeSpy/cursorManager.d.ts.map +1 -0
- package/dist/src/genomeSpy/cursorManager.js +131 -0
- package/dist/src/genomeSpy/headlessBootstrap.d.ts +113 -0
- package/dist/src/genomeSpy/headlessBootstrap.d.ts.map +1 -0
- package/dist/src/genomeSpy/headlessBootstrap.js +246 -0
- package/dist/src/genomeSpy/interactionController.d.ts +10 -1
- package/dist/src/genomeSpy/interactionController.d.ts.map +1 -1
- package/dist/src/genomeSpy/interactionController.js +448 -40
- package/dist/src/genomeSpy/interactionDispatcher.d.ts +50 -0
- package/dist/src/genomeSpy/interactionDispatcher.d.ts.map +1 -0
- package/dist/src/genomeSpy/interactionDispatcher.js +203 -0
- package/dist/src/genomeSpy/renderCoordinator.js +1 -1
- package/dist/src/genomeSpy/viewContextFactory.d.ts +4 -2
- package/dist/src/genomeSpy/viewContextFactory.d.ts.map +1 -1
- package/dist/src/genomeSpy/viewContextFactory.js +12 -4
- package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -1
- package/dist/src/genomeSpy/viewDataInit.js +7 -3
- package/dist/src/genomeSpy.d.ts +1 -114
- package/dist/src/genomeSpy.d.ts.map +1 -1
- package/dist/src/genomeSpy.js +7 -614
- package/dist/src/genomeSpyBase.d.ts +133 -0
- package/dist/src/genomeSpyBase.d.ts.map +1 -0
- package/dist/src/genomeSpyBase.js +719 -0
- package/dist/src/gl/arrayBuilder.d.ts.map +1 -1
- package/dist/src/gl/arrayBuilder.js +0 -3
- 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/colorUtils.d.ts.map +1 -1
- package/dist/src/gl/colorUtils.js +3 -0
- package/dist/src/gl/dataToVertices.d.ts.map +1 -1
- package/dist/src/gl/dataToVertices.js +13 -8
- package/dist/src/gl/glslScaleGenerator.d.ts +2 -2
- package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
- package/dist/src/gl/glslScaleGenerator.js +5 -7
- 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 +3 -9
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -111
- package/dist/src/marks/__snapshots__/shaderSnapshot.test.js.snap +4462 -0
- package/dist/src/marks/link.d.ts.map +1 -1
- package/dist/src/marks/link.js +5 -26
- package/dist/src/marks/mark.d.ts +8 -1
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +67 -21
- package/dist/src/marks/markUtils.d.ts +18 -1
- package/dist/src/marks/markUtils.d.ts.map +1 -1
- package/dist/src/marks/markUtils.js +52 -4
- package/dist/src/marks/point.d.ts.map +1 -1
- package/dist/src/marks/point.js +6 -26
- package/dist/src/marks/rect.d.ts.map +1 -1
- package/dist/src/marks/rect.js +13 -21
- package/dist/src/marks/rule.d.ts +7 -2
- package/dist/src/marks/rule.d.ts.map +1 -1
- package/dist/src/marks/rule.js +125 -16
- package/dist/src/marks/text.d.ts.map +1 -1
- package/dist/src/marks/text.js +5 -47
- package/dist/src/minimal.d.ts +8 -0
- package/dist/src/minimal.d.ts.map +1 -0
- package/dist/src/minimal.js +21 -0
- package/dist/src/paramRuntime/viewParamRuntime.d.ts +19 -0
- package/dist/src/paramRuntime/viewParamRuntime.d.ts.map +1 -1
- package/dist/src/paramRuntime/viewParamRuntime.js +35 -0
- package/dist/src/scale/scale.d.ts.map +1 -1
- package/dist/src/scale/scale.js +13 -7
- package/dist/src/scales/axisResolution.d.ts.map +1 -1
- package/dist/src/scales/axisResolution.js +9 -5
- package/dist/src/scales/domainPlanner.d.ts +58 -7
- package/dist/src/scales/domainPlanner.d.ts.map +1 -1
- package/dist/src/scales/domainPlanner.js +395 -40
- package/dist/src/scales/indexLikeDomainUtils.d.ts +29 -0
- package/dist/src/scales/indexLikeDomainUtils.d.ts.map +1 -0
- package/dist/src/scales/indexLikeDomainUtils.js +67 -0
- package/dist/src/scales/resolutionMemberOrder.d.ts +15 -0
- package/dist/src/scales/resolutionMemberOrder.d.ts.map +1 -0
- package/dist/src/scales/resolutionMemberOrder.js +22 -0
- 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 +59 -18
- package/dist/src/scales/scalePropsResolver.d.ts +3 -1
- package/dist/src/scales/scalePropsResolver.d.ts.map +1 -1
- package/dist/src/scales/scalePropsResolver.js +83 -6
- package/dist/src/scales/scaleResolution.d.ts +39 -0
- package/dist/src/scales/scaleResolution.d.ts.map +1 -1
- package/dist/src/scales/scaleResolution.js +504 -82
- 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 +37 -0
- package/dist/src/scales/scaleRules.d.ts.map +1 -1
- package/dist/src/scales/scaleRules.js +16 -2
- package/dist/src/scales/selectionDomainUtils.d.ts +52 -0
- package/dist/src/scales/selectionDomainUtils.d.ts.map +1 -0
- package/dist/src/scales/selectionDomainUtils.js +194 -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 +241 -0
- package/dist/src/singlePageApp.js +1 -1
- package/dist/src/spec/axis.d.ts +41 -30
- package/dist/src/spec/channel.d.ts +15 -9
- package/dist/src/spec/config.d.ts +264 -0
- package/dist/src/spec/data.d.ts +30 -3
- package/dist/src/spec/decoration.d.ts +51 -0
- package/dist/src/spec/exampleFiles.d.ts +12 -0
- package/dist/src/spec/exampleFiles.d.ts.map +1 -0
- package/dist/src/spec/exampleFiles.js +52 -0
- package/dist/src/spec/font.d.ts +1 -1
- package/dist/src/spec/genome.d.ts +22 -2
- package/dist/src/spec/mark.d.ts +97 -13
- package/dist/src/spec/parameter.d.ts +62 -5
- package/dist/src/spec/root.d.ts +34 -1
- package/dist/src/spec/scale.d.ts +46 -5
- package/dist/src/spec/title.d.ts +13 -2
- package/dist/src/spec/tooltip.d.ts +1 -1
- package/dist/src/spec/transform.d.ts +39 -4
- package/dist/src/spec/view.d.ts +67 -19
- package/dist/src/styles/genome-spy.css +63 -55
- 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 +31 -22
- package/dist/src/testSetup.d.ts +2 -0
- package/dist/src/testSetup.d.ts.map +1 -0
- package/dist/src/testSetup.js +5 -0
- package/dist/src/tooltip/dataTooltipHandler.js +66 -11
- package/dist/src/tooltip/tooltipContext.d.ts.map +1 -1
- package/dist/src/tooltip/tooltipContext.js +3 -2
- package/dist/src/types/embedApi.d.ts +26 -0
- package/dist/src/types/encoder.d.ts +17 -15
- package/dist/src/types/scaleResolutionApi.d.ts +20 -0
- package/dist/src/types/viewContext.d.ts +23 -1
- package/dist/src/utils/expression.d.ts +2 -2
- package/dist/src/utils/expression.d.ts.map +1 -1
- package/dist/src/utils/expression.js +63 -8
- package/dist/src/utils/field.d.ts.map +1 -1
- package/dist/src/utils/field.js +0 -1
- package/dist/src/utils/inertia.d.ts.map +1 -1
- package/dist/src/utils/inertia.js +0 -1
- 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/inputBinding.d.ts +1 -1
- package/dist/src/utils/interaction.d.ts +109 -0
- package/dist/src/utils/interaction.d.ts.map +1 -0
- package/dist/src/utils/interaction.js +200 -0
- package/dist/src/utils/interactionEvent.d.ts +62 -33
- package/dist/src/utils/interactionEvent.d.ts.map +1 -1
- package/dist/src/utils/interactionEvent.js +86 -48
- package/dist/src/utils/kWayMerge.js +1 -1
- package/dist/src/utils/mergeObjects.d.ts.map +1 -1
- package/dist/src/utils/mergeObjects.js +0 -2
- package/dist/src/utils/radixSort.d.ts.map +1 -1
- package/dist/src/utils/radixSort.js +0 -2
- package/dist/src/utils/throttle.d.ts.map +1 -1
- package/dist/src/utils/throttle.js +0 -2
- package/dist/src/utils/ui/tooltip.d.ts +1 -0
- package/dist/src/utils/ui/tooltip.d.ts.map +1 -1
- package/dist/src/utils/ui/tooltip.js +1 -0
- package/dist/src/utils/url.js +1 -1
- package/dist/src/view/axisGridView.d.ts +1 -1
- package/dist/src/view/axisGridView.d.ts.map +1 -1
- package/dist/src/view/axisGridView.js +2 -47
- package/dist/src/view/axisView.d.ts +2 -3
- package/dist/src/view/axisView.d.ts.map +1 -1
- package/dist/src/view/axisView.js +251 -106
- package/dist/src/view/concatView.d.ts +2 -1
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +4 -2
- package/dist/src/view/containerMutationHelper.d.ts +3 -0
- package/dist/src/view/containerMutationHelper.d.ts.map +1 -1
- package/dist/src/view/containerMutationHelper.js +12 -1
- 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.d.ts +1 -1
- package/dist/src/view/facetView.js +4 -4
- package/dist/src/view/flowBuilder.js +2 -2
- package/dist/src/view/gridView/gridChild.d.ts +13 -0
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +247 -49
- package/dist/src/view/gridView/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView/gridView.js +296 -99
- package/dist/src/view/gridView/keyboardZoomController.d.ts +2 -2
- package/dist/src/view/gridView/keyboardZoomController.d.ts.map +1 -1
- package/dist/src/view/gridView/keyboardZoomController.js +1 -1
- package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
- package/dist/src/view/gridView/scrollbar.js +4 -2
- package/dist/src/view/gridView/selectionRect.d.ts +4 -0
- package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
- package/dist/src/view/gridView/selectionRect.js +20 -1
- package/dist/src/view/gridView/separatorView.d.ts +1 -0
- package/dist/src/view/gridView/separatorView.d.ts.map +1 -1
- package/dist/src/view/gridView/separatorView.js +9 -0
- package/dist/src/view/interactionRouting.d.ts +20 -0
- package/dist/src/view/interactionRouting.d.ts.map +1 -0
- package/dist/src/view/interactionRouting.js +53 -0
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +12 -9
- package/dist/src/view/layout/grid.js +1 -1
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.js +0 -2
- package/dist/src/view/testUtils.d.ts +17 -3
- package/dist/src/view/testUtils.d.ts.map +1 -1
- package/dist/src/view/testUtils.js +62 -69
- package/dist/src/view/title.d.ts +8 -1
- package/dist/src/view/title.d.ts.map +1 -1
- package/dist/src/view/title.js +66 -76
- package/dist/src/view/unitView.d.ts +1 -1
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +67 -17
- package/dist/src/view/view.d.ts +76 -30
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +136 -47
- package/dist/src/view/viewFactory.d.ts +11 -3
- package/dist/src/view/viewFactory.d.ts.map +1 -1
- package/dist/src/view/viewFactory.js +37 -11
- package/dist/src/view/viewUtils.d.ts.map +1 -1
- package/dist/src/view/viewUtils.js +41 -5
- package/dist/src/view/zoom.d.ts +15 -3
- package/dist/src/view/zoom.d.ts.map +1 -1
- package/dist/src/view/zoom.js +375 -80
- package/package.json +20 -10
- package/dist/bundle/AbortablePromiseCache-Dj0vzLnp.js +0 -149
- package/dist/bundle/browser-0iNU5Wit.js +0 -138
- package/dist/bundle/index-BYsZN7b0.js +0 -1597
- package/dist/bundle/index-C3kClAEN.js +0 -1771
- package/dist/bundle/index-C7wOh6y1.js +0 -657
- package/dist/bundle/index-CRaQAuki.js +0 -326
- package/dist/bundle/index-D9v1PCj9.js +0 -507
- package/dist/bundle/index-GDOuv_D5.js +0 -266
- package/dist/bundle/index-Gt44EOIH.js +0 -628
- package/dist/bundle/inflate-GtwLkvSP.js +0 -1048
- package/dist/bundle/parquetRead-BnAGCa4_.js +0 -1663
- package/dist/bundle/unzip-Bac01w6X.js +0 -1492
- package/dist/src/config/scaleDefaults.d.ts +0 -8
- package/dist/src/config/scaleDefaults.d.ts.map +0 -1
- package/dist/src/config/scaleDefaults.js +0 -45
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import UnitView from "../view/unitView.js";
|
|
2
2
|
import { VISIT_STOP } from "../view/view.js";
|
|
3
3
|
import { readPickingPixel } from "../gl/webGLHelper.js";
|
|
4
|
-
import InteractionEvent from "../utils/interactionEvent.js";
|
|
5
4
|
import Inertia, { makeEventTemplate } from "../utils/inertia.js";
|
|
6
5
|
import Point from "../view/layout/point.js";
|
|
7
6
|
import { isStillZooming } from "../view/zoom.js";
|
|
8
7
|
import createTooltipContext from "../tooltip/tooltipContext.js";
|
|
8
|
+
import { FREEZE_INTERACTION_CLASS_NAME } from "../utils/ui/tooltip.js";
|
|
9
|
+
import InteractionDispatcher from "./interactionDispatcher.js";
|
|
10
|
+
import CursorManager from "./cursorManager.js";
|
|
9
11
|
|
|
10
12
|
export default class InteractionController {
|
|
11
13
|
/** @type {import("../view/view.js").default} */
|
|
@@ -24,6 +26,10 @@ export default class InteractionController {
|
|
|
24
26
|
#renderPickingFramebuffer;
|
|
25
27
|
/** @type {() => number} */
|
|
26
28
|
#getDevicePixelRatio;
|
|
29
|
+
/** @type {InteractionDispatcher} */
|
|
30
|
+
#interactionDispatcher;
|
|
31
|
+
/** @type {CursorManager} */
|
|
32
|
+
#cursorManager;
|
|
27
33
|
/**
|
|
28
34
|
* @type {{ mark: import("../marks/mark.js").default, datum: import("../data/flowNode.js").Datum, uniqueId: number }}
|
|
29
35
|
*/
|
|
@@ -32,8 +38,14 @@ export default class InteractionController {
|
|
|
32
38
|
#wheelInertia;
|
|
33
39
|
/** @type {Point} */
|
|
34
40
|
#mouseDownCoords;
|
|
41
|
+
/** @type {Point | undefined} */
|
|
42
|
+
#lastPointerPoint;
|
|
35
43
|
/** @type {boolean} */
|
|
36
44
|
#tooltipUpdateRequested;
|
|
45
|
+
/** @type {number} */
|
|
46
|
+
#hoverTrackingSuspensionCount;
|
|
47
|
+
/** @type {boolean} */
|
|
48
|
+
#postRenderHoverRefreshRequested;
|
|
37
49
|
/**
|
|
38
50
|
* @param {object} options
|
|
39
51
|
* @param {import("../view/view.js").default} options.viewRoot
|
|
@@ -63,6 +75,8 @@ export default class InteractionController {
|
|
|
63
75
|
this.#tooltipHandlers = tooltipHandlers;
|
|
64
76
|
this.#renderPickingFramebuffer = renderPickingFramebuffer;
|
|
65
77
|
this.#getDevicePixelRatio = getDevicePixelRatio;
|
|
78
|
+
this.#interactionDispatcher = new InteractionDispatcher({ viewRoot });
|
|
79
|
+
this.#cursorManager = new CursorManager({ canvas: glHelper.canvas });
|
|
66
80
|
|
|
67
81
|
/**
|
|
68
82
|
* Currently hovered mark and datum
|
|
@@ -74,19 +88,104 @@ export default class InteractionController {
|
|
|
74
88
|
|
|
75
89
|
/** @type {Point} */
|
|
76
90
|
this.#mouseDownCoords = undefined;
|
|
91
|
+
this.#lastPointerPoint = undefined;
|
|
77
92
|
|
|
78
93
|
this.#tooltipUpdateRequested = false;
|
|
94
|
+
this.#hoverTrackingSuspensionCount = 0;
|
|
95
|
+
this.#postRenderHoverRefreshRequested = false;
|
|
79
96
|
}
|
|
80
97
|
|
|
81
98
|
getCurrentHover() {
|
|
82
99
|
return this.#currentHover;
|
|
83
100
|
}
|
|
84
101
|
|
|
85
|
-
|
|
102
|
+
suspendHoverTracking() {
|
|
103
|
+
this.#hoverTrackingSuspensionCount++;
|
|
104
|
+
this.#tooltip.clear();
|
|
105
|
+
this.#tooltipUpdateRequested = false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @param {MouseEvent} [mouseEvent]
|
|
110
|
+
*/
|
|
111
|
+
resumeHoverTracking(mouseEvent) {
|
|
112
|
+
if (this.#hoverTrackingSuspensionCount <= 0) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.#hoverTrackingSuspensionCount--;
|
|
117
|
+
if (this.#hoverTrackingSuspensionCount > 0) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
this.#tooltip.clear();
|
|
122
|
+
this.#tooltipUpdateRequested = false;
|
|
123
|
+
|
|
124
|
+
if (this.#isInteractionFrozen()) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (mouseEvent) {
|
|
129
|
+
const point = this.#toCanvasPoint(mouseEvent);
|
|
130
|
+
this.#lastPointerPoint = point;
|
|
131
|
+
if (this.#isInsideCanvas(point)) {
|
|
132
|
+
this.#refreshHover(point);
|
|
133
|
+
this.#cursorManager.update({
|
|
134
|
+
target: this.#interactionDispatcher.getCurrentTarget(),
|
|
135
|
+
hover: this.#currentHover,
|
|
136
|
+
});
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
this.#interactionDispatcher.handlePointerLeave(mouseEvent);
|
|
141
|
+
} else if (
|
|
142
|
+
this.#lastPointerPoint &&
|
|
143
|
+
this.#isInsideCanvas(this.#lastPointerPoint)
|
|
144
|
+
) {
|
|
145
|
+
this.#refreshHover(this.#lastPointerPoint);
|
|
146
|
+
this.#cursorManager.update({
|
|
147
|
+
target: this.#interactionDispatcher.getCurrentTarget(),
|
|
148
|
+
hover: this.#currentHover,
|
|
149
|
+
});
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
this.#currentHover = null;
|
|
154
|
+
this.#cursorManager.clear();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
registerInteractionEvents() {
|
|
86
158
|
const canvas = this.#glHelper.canvas;
|
|
87
159
|
|
|
88
160
|
let lastWheelEvent = performance.now();
|
|
89
161
|
let longPressTriggered = false;
|
|
162
|
+
/** @type {{ pointerCount: 1 | 2, centerX: number, centerY: number, distance: number } | undefined} */
|
|
163
|
+
let previousTouchGesture;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @param {Point} point
|
|
167
|
+
* @param {import("../utils/interactionEvent.js").InteractionUiEvent} uiEvent
|
|
168
|
+
* @returns {import("../utils/interaction.js").default}
|
|
169
|
+
*/
|
|
170
|
+
const dispatchInteraction = (point, uiEvent) => {
|
|
171
|
+
const interaction = this.#interactionDispatcher.dispatch(
|
|
172
|
+
point,
|
|
173
|
+
uiEvent
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
if (!this.#tooltipUpdateRequested) {
|
|
177
|
+
this.#tooltip.clear();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (uiEvent instanceof MouseEvent && uiEvent.type !== "mouseout") {
|
|
181
|
+
this.#cursorManager.update({
|
|
182
|
+
target: interaction.target,
|
|
183
|
+
hover: this.#currentHover,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return interaction;
|
|
188
|
+
};
|
|
90
189
|
|
|
91
190
|
/** @param {Event} event */
|
|
92
191
|
const listener = (event) => {
|
|
@@ -94,13 +193,21 @@ export default class InteractionController {
|
|
|
94
193
|
const wheeling = now - lastWheelEvent < 200;
|
|
95
194
|
|
|
96
195
|
if (event instanceof MouseEvent) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
196
|
+
if (
|
|
197
|
+
event.type !== "contextmenu" &&
|
|
198
|
+
this.#isInteractionFrozen()
|
|
199
|
+
) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const point = this.#toCanvasPoint(event);
|
|
204
|
+
this.#lastPointerPoint = point;
|
|
102
205
|
|
|
103
|
-
if (
|
|
206
|
+
if (
|
|
207
|
+
event.type == "mousemove" &&
|
|
208
|
+
!wheeling &&
|
|
209
|
+
this.#hoverTrackingSuspensionCount === 0
|
|
210
|
+
) {
|
|
104
211
|
this.#tooltip.handleMouseMove(event);
|
|
105
212
|
this.#tooltipUpdateRequested = false;
|
|
106
213
|
|
|
@@ -117,13 +224,7 @@ export default class InteractionController {
|
|
|
117
224
|
* @param {MouseEvent} dispatchedEvent
|
|
118
225
|
*/
|
|
119
226
|
const dispatchEvent = (dispatchedEvent) => {
|
|
120
|
-
|
|
121
|
-
new InteractionEvent(point, dispatchedEvent)
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
if (!this.#tooltipUpdateRequested) {
|
|
125
|
-
this.#tooltip.clear();
|
|
126
|
-
}
|
|
227
|
+
dispatchInteraction(point, dispatchedEvent);
|
|
127
228
|
};
|
|
128
229
|
|
|
129
230
|
if (event.type != "wheel") {
|
|
@@ -156,26 +257,41 @@ export default class InteractionController {
|
|
|
156
257
|
|
|
157
258
|
this.#wheelInertia.cancel();
|
|
158
259
|
} else {
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
260
|
+
// We must decide on the native wheel event whether to
|
|
261
|
+
// call preventDefault() (to block page scrolling).
|
|
262
|
+
// This probe asks the pointed view hierarchy to claim
|
|
263
|
+
// wheel ownership without running real wheel side
|
|
264
|
+
// effects first. Inertia is layered on top of that
|
|
265
|
+
// decision and is not the reason for the probe.
|
|
266
|
+
const probeEvent = dispatchInteraction(point, {
|
|
267
|
+
type: "wheelclaimprobe",
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
if (probeEvent.wheelClaimed) {
|
|
271
|
+
// Vertical wheeling zooms.
|
|
272
|
+
// We use inertia to generate fake wheel events for smoother zooming
|
|
273
|
+
|
|
274
|
+
const template = makeEventTemplate(wheelEvent);
|
|
275
|
+
|
|
276
|
+
this.#wheelInertia.setMomentum(
|
|
277
|
+
wheelEvent.deltaY *
|
|
278
|
+
(wheelEvent.deltaMode ? 80 : 1),
|
|
279
|
+
(delta) => {
|
|
280
|
+
const e = new WheelEvent("wheel", {
|
|
281
|
+
...template,
|
|
282
|
+
deltaMode: 0,
|
|
283
|
+
deltaX: 0,
|
|
284
|
+
deltaY: delta,
|
|
285
|
+
});
|
|
286
|
+
dispatchEvent(e);
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
|
|
290
|
+
wheelEvent.preventDefault();
|
|
291
|
+
return;
|
|
292
|
+
} else {
|
|
293
|
+
this.#wheelInertia.cancel();
|
|
294
|
+
}
|
|
179
295
|
}
|
|
180
296
|
}
|
|
181
297
|
|
|
@@ -212,7 +328,17 @@ export default class InteractionController {
|
|
|
212
328
|
this.#mouseDownCoords?.subtract(Point.fromMouseEvent(event))
|
|
213
329
|
.length < 3
|
|
214
330
|
) {
|
|
215
|
-
|
|
331
|
+
const interaction = dispatchInteraction(point, event);
|
|
332
|
+
|
|
333
|
+
if (
|
|
334
|
+
event.type == "dblclick" &&
|
|
335
|
+
this.#hoverTrackingSuspensionCount === 0 &&
|
|
336
|
+
this.#isInsideCanvas(point)
|
|
337
|
+
) {
|
|
338
|
+
this.#scheduleHoverRefreshAfterRender();
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return interaction;
|
|
216
342
|
}
|
|
217
343
|
}
|
|
218
344
|
};
|
|
@@ -223,11 +349,168 @@ export default class InteractionController {
|
|
|
223
349
|
"wheel",
|
|
224
350
|
"click",
|
|
225
351
|
"mousemove",
|
|
226
|
-
"gesturechange",
|
|
227
352
|
"contextmenu",
|
|
228
353
|
"dblclick",
|
|
229
354
|
].forEach((type) => canvas.addEventListener(type, listener));
|
|
230
355
|
|
|
356
|
+
/**
|
|
357
|
+
* @param {number} clientX
|
|
358
|
+
* @param {number} clientY
|
|
359
|
+
*/
|
|
360
|
+
const toCanvasPoint = (clientX, clientY) => {
|
|
361
|
+
const rect = canvas.getBoundingClientRect();
|
|
362
|
+
return new Point(
|
|
363
|
+
clientX - rect.left - canvas.clientLeft,
|
|
364
|
+
clientY - rect.top - canvas.clientTop
|
|
365
|
+
);
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* @param {TouchList} touches
|
|
370
|
+
*/
|
|
371
|
+
const readTouchGesture = (touches) => {
|
|
372
|
+
if (touches.length <= 0) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const first = touches[0];
|
|
377
|
+
|
|
378
|
+
if (touches.length === 1) {
|
|
379
|
+
return {
|
|
380
|
+
pointerCount: /** @type {1} */ (1),
|
|
381
|
+
centerX: first.clientX,
|
|
382
|
+
centerY: first.clientY,
|
|
383
|
+
distance: 0,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const second = touches[1];
|
|
388
|
+
return {
|
|
389
|
+
pointerCount: /** @type {2} */ (2),
|
|
390
|
+
centerX: (first.clientX + second.clientX) / 2,
|
|
391
|
+
centerY: (first.clientY + second.clientY) / 2,
|
|
392
|
+
distance: getClientDistance(first, second),
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* @param {number} x
|
|
398
|
+
* @param {number} y
|
|
399
|
+
* @param {"move" | "end"} phase
|
|
400
|
+
* @param {1 | 2} pointerCount
|
|
401
|
+
* @param {number} xDelta
|
|
402
|
+
* @param {number} yDelta
|
|
403
|
+
* @param {number} zDelta
|
|
404
|
+
*/
|
|
405
|
+
const dispatchTouchGestureEvent = (
|
|
406
|
+
x,
|
|
407
|
+
y,
|
|
408
|
+
phase,
|
|
409
|
+
pointerCount,
|
|
410
|
+
xDelta,
|
|
411
|
+
yDelta,
|
|
412
|
+
zDelta
|
|
413
|
+
) => {
|
|
414
|
+
const point = toCanvasPoint(x, y);
|
|
415
|
+
dispatchInteraction(point, {
|
|
416
|
+
type: "touchgesture",
|
|
417
|
+
phase,
|
|
418
|
+
pointerCount,
|
|
419
|
+
xDelta,
|
|
420
|
+
yDelta,
|
|
421
|
+
zDelta,
|
|
422
|
+
});
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* @param {TouchEvent} touchEvent
|
|
427
|
+
*/
|
|
428
|
+
const handleTouchStartOrMove = (touchEvent) => {
|
|
429
|
+
touchEvent.preventDefault();
|
|
430
|
+
this.#wheelInertia.cancel();
|
|
431
|
+
this.#tooltipUpdateRequested = false;
|
|
432
|
+
|
|
433
|
+
const currentGesture = readTouchGesture(touchEvent.touches);
|
|
434
|
+
if (!currentGesture) {
|
|
435
|
+
previousTouchGesture = undefined;
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (
|
|
440
|
+
!previousTouchGesture ||
|
|
441
|
+
previousTouchGesture.pointerCount !==
|
|
442
|
+
currentGesture.pointerCount
|
|
443
|
+
) {
|
|
444
|
+
previousTouchGesture = currentGesture;
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const xDelta =
|
|
449
|
+
currentGesture.centerX - previousTouchGesture.centerX;
|
|
450
|
+
const yDelta =
|
|
451
|
+
currentGesture.centerY - previousTouchGesture.centerY;
|
|
452
|
+
const zDelta =
|
|
453
|
+
currentGesture.pointerCount === 2
|
|
454
|
+
? pinchDistanceToZoomDelta(
|
|
455
|
+
previousTouchGesture.distance,
|
|
456
|
+
currentGesture.distance
|
|
457
|
+
)
|
|
458
|
+
: 0;
|
|
459
|
+
|
|
460
|
+
if (
|
|
461
|
+
(xDelta !== 0 || yDelta !== 0 || zDelta !== 0) &&
|
|
462
|
+
Number.isFinite(xDelta) &&
|
|
463
|
+
Number.isFinite(yDelta) &&
|
|
464
|
+
Number.isFinite(zDelta)
|
|
465
|
+
) {
|
|
466
|
+
dispatchTouchGestureEvent(
|
|
467
|
+
previousTouchGesture.centerX,
|
|
468
|
+
previousTouchGesture.centerY,
|
|
469
|
+
"move",
|
|
470
|
+
currentGesture.pointerCount,
|
|
471
|
+
xDelta,
|
|
472
|
+
yDelta,
|
|
473
|
+
zDelta
|
|
474
|
+
);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
previousTouchGesture = currentGesture;
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* @param {TouchEvent} touchEvent
|
|
482
|
+
*/
|
|
483
|
+
const handleTouchEndOrCancel = (touchEvent) => {
|
|
484
|
+
touchEvent.preventDefault();
|
|
485
|
+
this.#tooltipUpdateRequested = false;
|
|
486
|
+
if (previousTouchGesture && touchEvent.touches.length === 0) {
|
|
487
|
+
dispatchTouchGestureEvent(
|
|
488
|
+
previousTouchGesture.centerX,
|
|
489
|
+
previousTouchGesture.centerY,
|
|
490
|
+
"end",
|
|
491
|
+
previousTouchGesture.pointerCount,
|
|
492
|
+
0,
|
|
493
|
+
0,
|
|
494
|
+
0
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
previousTouchGesture = readTouchGesture(touchEvent.touches);
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
canvas.addEventListener("touchstart", handleTouchStartOrMove, {
|
|
502
|
+
passive: false,
|
|
503
|
+
});
|
|
504
|
+
canvas.addEventListener("touchmove", handleTouchStartOrMove, {
|
|
505
|
+
passive: false,
|
|
506
|
+
});
|
|
507
|
+
canvas.addEventListener("touchend", handleTouchEndOrCancel, {
|
|
508
|
+
passive: false,
|
|
509
|
+
});
|
|
510
|
+
canvas.addEventListener("touchcancel", handleTouchEndOrCancel, {
|
|
511
|
+
passive: false,
|
|
512
|
+
});
|
|
513
|
+
|
|
231
514
|
canvas.addEventListener("mousedown", (/** @type {MouseEvent} */ e) => {
|
|
232
515
|
this.#mouseDownCoords = Point.fromMouseEvent(e);
|
|
233
516
|
if (this.#tooltip.sticky) {
|
|
@@ -244,7 +527,10 @@ export default class InteractionController {
|
|
|
244
527
|
document.addEventListener(
|
|
245
528
|
"mouseup",
|
|
246
529
|
() => this.#tooltip.popEnabledState(),
|
|
247
|
-
{
|
|
530
|
+
{
|
|
531
|
+
once: true,
|
|
532
|
+
capture: true,
|
|
533
|
+
}
|
|
248
534
|
);
|
|
249
535
|
this.#tooltip.pushEnabledState(false);
|
|
250
536
|
};
|
|
@@ -270,12 +556,103 @@ export default class InteractionController {
|
|
|
270
556
|
event.stopPropagation()
|
|
271
557
|
);
|
|
272
558
|
|
|
273
|
-
canvas.addEventListener("mouseout", () => {
|
|
559
|
+
canvas.addEventListener("mouseout", (event) => {
|
|
560
|
+
if (this.#isInteractionFrozen()) {
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (this.#hoverTrackingSuspensionCount > 0) {
|
|
565
|
+
this.#tooltip.clear();
|
|
566
|
+
this.#tooltipUpdateRequested = false;
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
this.#interactionDispatcher.handlePointerLeave(
|
|
571
|
+
/** @type {MouseEvent} */ (event)
|
|
572
|
+
);
|
|
573
|
+
this.#cursorManager.clear();
|
|
274
574
|
this.#tooltip.clear();
|
|
275
575
|
this.#currentHover = null;
|
|
276
576
|
});
|
|
277
577
|
}
|
|
278
578
|
|
|
579
|
+
/**
|
|
580
|
+
* @param {MouseEvent} event
|
|
581
|
+
*/
|
|
582
|
+
#toCanvasPoint(event) {
|
|
583
|
+
const canvas = this.#glHelper.canvas;
|
|
584
|
+
const rect = canvas.getBoundingClientRect();
|
|
585
|
+
return new Point(
|
|
586
|
+
event.clientX - rect.left - canvas.clientLeft,
|
|
587
|
+
event.clientY - rect.top - canvas.clientTop
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* @param {Point} point
|
|
593
|
+
*/
|
|
594
|
+
#isInsideCanvas(point) {
|
|
595
|
+
const canvas = this.#glHelper.canvas;
|
|
596
|
+
return (
|
|
597
|
+
point.x >= 0 &&
|
|
598
|
+
point.y >= 0 &&
|
|
599
|
+
point.x <= canvas.clientWidth &&
|
|
600
|
+
point.y <= canvas.clientHeight
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* @param {Point} point
|
|
606
|
+
*/
|
|
607
|
+
#refreshHover(point) {
|
|
608
|
+
if (!isStillZooming()) {
|
|
609
|
+
this.#renderPickingFramebuffer();
|
|
610
|
+
this.#handlePicking(point.x, point.y);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
#scheduleHoverRefreshAfterRender() {
|
|
615
|
+
if (this.#postRenderHoverRefreshRequested) {
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
this.#postRenderHoverRefreshRequested = true;
|
|
620
|
+
this.#animator.requestRender();
|
|
621
|
+
window.requestAnimationFrame(() => {
|
|
622
|
+
this.#postRenderHoverRefreshRequested = false;
|
|
623
|
+
|
|
624
|
+
if (
|
|
625
|
+
this.#hoverTrackingSuspensionCount > 0 ||
|
|
626
|
+
this.#isInteractionFrozen()
|
|
627
|
+
) {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
const point = this.#lastPointerPoint;
|
|
632
|
+
if (!point || !this.#isInsideCanvas(point)) {
|
|
633
|
+
this.#currentHover = null;
|
|
634
|
+
this.#cursorManager.clear();
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
this.#tooltip.clear();
|
|
639
|
+
this.#tooltipUpdateRequested = false;
|
|
640
|
+
this.#refreshHover(point);
|
|
641
|
+
this.#cursorManager.update({
|
|
642
|
+
target: this.#interactionDispatcher.getCurrentTarget(),
|
|
643
|
+
hover: this.#currentHover,
|
|
644
|
+
});
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
#isInteractionFrozen() {
|
|
649
|
+
return (
|
|
650
|
+
typeof document !== "undefined" &&
|
|
651
|
+
!!document.body &&
|
|
652
|
+
document.body.classList.contains(FREEZE_INTERACTION_CLASS_NAME)
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
|
|
279
656
|
/**
|
|
280
657
|
* @param {number} x
|
|
281
658
|
* @param {number} y
|
|
@@ -336,7 +713,7 @@ export default class InteractionController {
|
|
|
336
713
|
|
|
337
714
|
const tooltipProps = mark.properties.tooltip;
|
|
338
715
|
|
|
339
|
-
if (tooltipProps !== null) {
|
|
716
|
+
if (tooltipProps !== null && tooltipProps !== false) {
|
|
340
717
|
const handlerName = tooltipProps?.handler ?? "default";
|
|
341
718
|
const handler = this.#tooltipHandlers[handlerName];
|
|
342
719
|
if (!handler) {
|
|
@@ -375,3 +752,34 @@ export default class InteractionController {
|
|
|
375
752
|
}
|
|
376
753
|
}
|
|
377
754
|
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* @typedef {{clientX: number, clientY: number}} ClientPointLike
|
|
758
|
+
*/
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Returns euclidean distance between two client-space points.
|
|
762
|
+
*
|
|
763
|
+
* @param {ClientPointLike} a
|
|
764
|
+
* @param {ClientPointLike} b
|
|
765
|
+
*/
|
|
766
|
+
function getClientDistance(a, b) {
|
|
767
|
+
const dx = b.clientX - a.clientX;
|
|
768
|
+
const dy = b.clientY - a.clientY;
|
|
769
|
+
return Math.hypot(dx, dy);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Converts a pinch distance ratio to a zDelta used by interactionToZoom:
|
|
774
|
+
* scaleFactor = 2 ** zDelta.
|
|
775
|
+
*
|
|
776
|
+
* @param {number} previousDistance
|
|
777
|
+
* @param {number} currentDistance
|
|
778
|
+
*/
|
|
779
|
+
function pinchDistanceToZoomDelta(previousDistance, currentDistance) {
|
|
780
|
+
if (previousDistance <= 0 || currentDistance <= 0) {
|
|
781
|
+
return 0;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
return Math.log2(previousDistance / currentDistance);
|
|
785
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispatches `Interaction` objects through the view hierarchy and synthesizes
|
|
3
|
+
* subtree-level pointer transition events.
|
|
4
|
+
*
|
|
5
|
+
* The dispatcher keeps track of the previously hovered target path and
|
|
6
|
+
* compares it with the current one on every `mousemove`. From that diff it
|
|
7
|
+
* emits:
|
|
8
|
+
* - `mouseleave` for views that are no longer in the pointed subtree
|
|
9
|
+
* - `mouseenter` for views that have newly entered the pointed subtree
|
|
10
|
+
*
|
|
11
|
+
* This is intentionally closer to `mouseenter` / `mouseleave` semantics than
|
|
12
|
+
* DOM `mouseover` / `mouseout`. Moving between descendants inside the same
|
|
13
|
+
* subtree does not cause the ancestor to leave and re-enter.
|
|
14
|
+
*
|
|
15
|
+
* `dispatch()` handles ordinary event propagation and updates the current
|
|
16
|
+
* pointed target. `handlePointerLeave()` is used when the pointer leaves the
|
|
17
|
+
* canvas entirely, in which case the dispatcher emits `mouseleave` for the
|
|
18
|
+
* whole previously hovered path and clears its tracked state.
|
|
19
|
+
*
|
|
20
|
+
* The dispatcher does not do hit testing itself. It relies on views to route
|
|
21
|
+
* the incoming interaction and set `interaction.target` during propagation.
|
|
22
|
+
*/
|
|
23
|
+
export default class InteractionDispatcher {
|
|
24
|
+
/**
|
|
25
|
+
* @param {object} options
|
|
26
|
+
* @param {import("../view/view.js").default} options.viewRoot
|
|
27
|
+
*/
|
|
28
|
+
constructor({ viewRoot }: {
|
|
29
|
+
viewRoot: import("../view/view.js").default;
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Dispatches an interaction through the view tree and updates the tracked
|
|
33
|
+
* hover path for transition synthesis.
|
|
34
|
+
*
|
|
35
|
+
* @param {import("../view/layout/point.js").default} point
|
|
36
|
+
* @param {import("../utils/interactionEvent.js").InteractionUiEvent} uiEvent
|
|
37
|
+
* @returns {Interaction}
|
|
38
|
+
*/
|
|
39
|
+
dispatch(point: import("../view/layout/point.js").default, uiEvent: import("../utils/interactionEvent.js").InteractionUiEvent): Interaction;
|
|
40
|
+
/**
|
|
41
|
+
* Dispatches mouseleave transitions when the pointer leaves the canvas.
|
|
42
|
+
*
|
|
43
|
+
* @param {import("../utils/interactionEvent.js").InteractionUiEvent} uiEvent
|
|
44
|
+
*/
|
|
45
|
+
handlePointerLeave(uiEvent: import("../utils/interactionEvent.js").InteractionUiEvent): void;
|
|
46
|
+
getCurrentTarget(): import("../view/view.js").default<import("../spec/view.js").ViewSpec>;
|
|
47
|
+
#private;
|
|
48
|
+
}
|
|
49
|
+
import Interaction from "../utils/interaction.js";
|
|
50
|
+
//# sourceMappingURL=interactionDispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactionDispatcher.d.ts","sourceRoot":"","sources":["../../../src/genomeSpy/interactionDispatcher.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAUI;;;OAGG;IACH,0BAFG;QAAmD,QAAQ,EAAnD,OAAO,iBAAiB,EAAE,OAAO;KAC3C,EAGA;IAED;;;;;;;OAOG;IACH,gBAJW,OAAO,yBAAyB,EAAE,OAAO,WACzC,OAAO,8BAA8B,EAAE,kBAAkB,GACvD,WAAW,CAavB;IAED;;;;OAIG;IACH,4BAFW,OAAO,8BAA8B,EAAE,kBAAkB,QAiBnE;IAED,0FAEC;;CAmHJ;wBA1MuB,yBAAyB"}
|