@jbrowse/plugin-dotplot-view 2.6.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/LICENSE +201 -0
- package/dist/ComparativeRenderer/index.d.ts +27 -0
- package/dist/ComparativeRenderer/index.js +59 -0
- package/dist/ComparativeRenderer/index.js.map +1 -0
- package/dist/DotplotDisplay/components/DotplotDisplay.d.ts +8 -0
- package/dist/DotplotDisplay/components/DotplotDisplay.js +24 -0
- package/dist/DotplotDisplay/components/DotplotDisplay.js.map +1 -0
- package/dist/DotplotDisplay/index.d.ts +12 -0
- package/dist/DotplotDisplay/index.js +48 -0
- package/dist/DotplotDisplay/index.js.map +1 -0
- package/dist/DotplotDisplay/renderDotplotBlock.d.ts +11 -0
- package/dist/DotplotDisplay/renderDotplotBlock.js +57 -0
- package/dist/DotplotDisplay/renderDotplotBlock.js.map +1 -0
- package/dist/DotplotDisplay/stateModelFactory.d.ts +138 -0
- package/dist/DotplotDisplay/stateModelFactory.js +165 -0
- package/dist/DotplotDisplay/stateModelFactory.js.map +1 -0
- package/dist/DotplotReadVsRef/DotplotReadVsRef.d.ts +3 -0
- package/dist/DotplotReadVsRef/DotplotReadVsRef.js +102 -0
- package/dist/DotplotReadVsRef/DotplotReadVsRef.js.map +1 -0
- package/dist/DotplotReadVsRef/index.d.ts +2 -0
- package/dist/DotplotReadVsRef/index.js +42 -0
- package/dist/DotplotReadVsRef/index.js.map +1 -0
- package/dist/DotplotRenderer/ComparativeRenderRpc.d.ts +27 -0
- package/dist/DotplotRenderer/ComparativeRenderRpc.js +59 -0
- package/dist/DotplotRenderer/ComparativeRenderRpc.js.map +1 -0
- package/dist/DotplotRenderer/DotplotRenderer.d.ts +69 -0
- package/dist/DotplotRenderer/DotplotRenderer.js +274 -0
- package/dist/DotplotRenderer/DotplotRenderer.js.map +1 -0
- package/dist/DotplotRenderer/components/DotplotRendering.d.ts +5 -0
- package/dist/DotplotRenderer/components/DotplotRendering.js +13 -0
- package/dist/DotplotRenderer/components/DotplotRendering.js.map +1 -0
- package/dist/DotplotRenderer/configSchema.d.ts +61 -0
- package/dist/DotplotRenderer/configSchema.js +83 -0
- package/dist/DotplotRenderer/configSchema.js.map +1 -0
- package/dist/DotplotRenderer/index.d.ts +3 -0
- package/dist/DotplotRenderer/index.js +17 -0
- package/dist/DotplotRenderer/index.js.map +1 -0
- package/dist/DotplotView/1dview.d.ts +307 -0
- package/dist/DotplotView/1dview.js +95 -0
- package/dist/DotplotView/1dview.js.map +1 -0
- package/dist/DotplotView/blockTypes.d.ts +61 -0
- package/dist/DotplotView/blockTypes.js +117 -0
- package/dist/DotplotView/blockTypes.js.map +1 -0
- package/dist/DotplotView/components/Axes.d.ts +14 -0
- package/dist/DotplotView/components/Axes.js +127 -0
- package/dist/DotplotView/components/Axes.js.map +1 -0
- package/dist/DotplotView/components/CursorIcon.d.ts +4 -0
- package/dist/DotplotView/components/CursorIcon.js +19 -0
- package/dist/DotplotView/components/CursorIcon.js.map +1 -0
- package/dist/DotplotView/components/DotplotTooltip.d.ts +19 -0
- package/dist/DotplotView/components/DotplotTooltip.js +128 -0
- package/dist/DotplotView/components/DotplotTooltip.js.map +1 -0
- package/dist/DotplotView/components/DotplotView.d.ts +6 -0
- package/dist/DotplotView/components/DotplotView.js +272 -0
- package/dist/DotplotView/components/DotplotView.js.map +1 -0
- package/dist/DotplotView/components/DotplotWarnings.d.ts +6 -0
- package/dist/DotplotView/components/DotplotWarnings.js +40 -0
- package/dist/DotplotView/components/DotplotWarnings.js.map +1 -0
- package/dist/DotplotView/components/ExportSvgDialog.d.ts +8 -0
- package/dist/DotplotView/components/ExportSvgDialog.js +76 -0
- package/dist/DotplotView/components/ExportSvgDialog.js.map +1 -0
- package/dist/DotplotView/components/Grid.d.ts +10 -0
- package/dist/DotplotView/components/Grid.js +60 -0
- package/dist/DotplotView/components/Grid.js.map +1 -0
- package/dist/DotplotView/components/Header.d.ts +10 -0
- package/dist/DotplotView/components/Header.js +168 -0
- package/dist/DotplotView/components/Header.js.map +1 -0
- package/dist/DotplotView/components/ImportCustomTrack.d.ts +11 -0
- package/dist/DotplotView/components/ImportCustomTrack.js +180 -0
- package/dist/DotplotView/components/ImportCustomTrack.js.map +1 -0
- package/dist/DotplotView/components/ImportForm.d.ts +6 -0
- package/dist/DotplotView/components/ImportForm.js +121 -0
- package/dist/DotplotView/components/ImportForm.js.map +1 -0
- package/dist/DotplotView/components/ImportSyntenyTrackSelector.d.ts +9 -0
- package/dist/DotplotView/components/ImportSyntenyTrackSelector.js +69 -0
- package/dist/DotplotView/components/ImportSyntenyTrackSelector.js.map +1 -0
- package/dist/DotplotView/components/PanButtons.d.ts +6 -0
- package/dist/DotplotView/components/PanButtons.js +60 -0
- package/dist/DotplotView/components/PanButtons.js.map +1 -0
- package/dist/DotplotView/components/WarningDialog.d.ts +16 -0
- package/dist/DotplotView/components/WarningDialog.js +41 -0
- package/dist/DotplotView/components/WarningDialog.js.map +1 -0
- package/dist/DotplotView/components/util.d.ts +19 -0
- package/dist/DotplotView/components/util.js +90 -0
- package/dist/DotplotView/components/util.js.map +1 -0
- package/dist/DotplotView/index.d.ts +2 -0
- package/dist/DotplotView/index.js +44 -0
- package/dist/DotplotView/index.js.map +1 -0
- package/dist/DotplotView/model.d.ts +616 -0
- package/dist/DotplotView/model.js +647 -0
- package/dist/DotplotView/model.js.map +1 -0
- package/dist/DotplotView/svgcomponents/SVGBackground.d.ts +5 -0
- package/dist/DotplotView/svgcomponents/SVGBackground.js +13 -0
- package/dist/DotplotView/svgcomponents/SVGBackground.js.map +1 -0
- package/dist/DotplotView/svgcomponents/SVGDotplotView.d.ts +2 -0
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js +47 -0
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js.map +1 -0
- package/dist/LaunchDotplotView.d.ts +2 -0
- package/dist/LaunchDotplotView.js +45 -0
- package/dist/LaunchDotplotView.js.map +1 -0
- package/dist/ServerSideRenderedBlockContent.d.ts +12 -0
- package/dist/ServerSideRenderedBlockContent.js +87 -0
- package/dist/ServerSideRenderedBlockContent.js.map +1 -0
- package/dist/ServerSideSyntenyRendering.d.ts +23 -0
- package/dist/ServerSideSyntenyRendering.js +54 -0
- package/dist/ServerSideSyntenyRendering.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/util.d.ts +9 -0
- package/dist/util.js +9 -0
- package/dist/util.js.map +1 -0
- package/esm/ComparativeRenderer/index.d.ts +27 -0
- package/esm/ComparativeRenderer/index.js +53 -0
- package/esm/ComparativeRenderer/index.js.map +1 -0
- package/esm/DotplotDisplay/components/DotplotDisplay.d.ts +8 -0
- package/esm/DotplotDisplay/components/DotplotDisplay.js +19 -0
- package/esm/DotplotDisplay/components/DotplotDisplay.js.map +1 -0
- package/esm/DotplotDisplay/index.d.ts +12 -0
- package/esm/DotplotDisplay/index.js +41 -0
- package/esm/DotplotDisplay/index.js.map +1 -0
- package/esm/DotplotDisplay/renderDotplotBlock.d.ts +11 -0
- package/esm/DotplotDisplay/renderDotplotBlock.js +49 -0
- package/esm/DotplotDisplay/renderDotplotBlock.js.map +1 -0
- package/esm/DotplotDisplay/stateModelFactory.d.ts +138 -0
- package/esm/DotplotDisplay/stateModelFactory.js +158 -0
- package/esm/DotplotDisplay/stateModelFactory.js.map +1 -0
- package/esm/DotplotReadVsRef/DotplotReadVsRef.d.ts +3 -0
- package/esm/DotplotReadVsRef/DotplotReadVsRef.js +98 -0
- package/esm/DotplotReadVsRef/DotplotReadVsRef.js.map +1 -0
- package/esm/DotplotReadVsRef/index.d.ts +2 -0
- package/esm/DotplotReadVsRef/index.js +36 -0
- package/esm/DotplotReadVsRef/index.js.map +1 -0
- package/esm/DotplotRenderer/ComparativeRenderRpc.d.ts +27 -0
- package/esm/DotplotRenderer/ComparativeRenderRpc.js +53 -0
- package/esm/DotplotRenderer/ComparativeRenderRpc.js.map +1 -0
- package/esm/DotplotRenderer/DotplotRenderer.d.ts +69 -0
- package/esm/DotplotRenderer/DotplotRenderer.js +268 -0
- package/esm/DotplotRenderer/DotplotRenderer.js.map +1 -0
- package/esm/DotplotRenderer/components/DotplotRendering.d.ts +5 -0
- package/esm/DotplotRenderer/components/DotplotRendering.js +8 -0
- package/esm/DotplotRenderer/components/DotplotRendering.js.map +1 -0
- package/esm/DotplotRenderer/configSchema.d.ts +61 -0
- package/esm/DotplotRenderer/configSchema.js +81 -0
- package/esm/DotplotRenderer/configSchema.js.map +1 -0
- package/esm/DotplotRenderer/index.d.ts +3 -0
- package/esm/DotplotRenderer/index.js +12 -0
- package/esm/DotplotRenderer/index.js.map +1 -0
- package/esm/DotplotView/1dview.d.ts +307 -0
- package/esm/DotplotView/1dview.js +87 -0
- package/esm/DotplotView/1dview.js.map +1 -0
- package/esm/DotplotView/blockTypes.d.ts +61 -0
- package/esm/DotplotView/blockTypes.js +109 -0
- package/esm/DotplotView/blockTypes.js.map +1 -0
- package/esm/DotplotView/components/Axes.d.ts +14 -0
- package/esm/DotplotView/components/Axes.js +121 -0
- package/esm/DotplotView/components/Axes.js.map +1 -0
- package/esm/DotplotView/components/CursorIcon.d.ts +4 -0
- package/esm/DotplotView/components/CursorIcon.js +11 -0
- package/esm/DotplotView/components/CursorIcon.js.map +1 -0
- package/esm/DotplotView/components/DotplotTooltip.d.ts +19 -0
- package/esm/DotplotView/components/DotplotTooltip.js +101 -0
- package/esm/DotplotView/components/DotplotTooltip.js.map +1 -0
- package/esm/DotplotView/components/DotplotView.d.ts +6 -0
- package/esm/DotplotView/components/DotplotView.js +244 -0
- package/esm/DotplotView/components/DotplotView.js.map +1 -0
- package/esm/DotplotView/components/DotplotWarnings.d.ts +6 -0
- package/esm/DotplotView/components/DotplotWarnings.js +15 -0
- package/esm/DotplotView/components/DotplotWarnings.js.map +1 -0
- package/esm/DotplotView/components/ExportSvgDialog.d.ts +8 -0
- package/esm/DotplotView/components/ExportSvgDialog.js +50 -0
- package/esm/DotplotView/components/ExportSvgDialog.js.map +1 -0
- package/esm/DotplotView/components/Grid.d.ts +10 -0
- package/esm/DotplotView/components/Grid.js +53 -0
- package/esm/DotplotView/components/Grid.js.map +1 -0
- package/esm/DotplotView/components/Header.d.ts +10 -0
- package/esm/DotplotView/components/Header.js +140 -0
- package/esm/DotplotView/components/Header.js.map +1 -0
- package/esm/DotplotView/components/ImportCustomTrack.d.ts +11 -0
- package/esm/DotplotView/components/ImportCustomTrack.js +152 -0
- package/esm/DotplotView/components/ImportCustomTrack.js.map +1 -0
- package/esm/DotplotView/components/ImportForm.d.ts +6 -0
- package/esm/DotplotView/components/ImportForm.js +93 -0
- package/esm/DotplotView/components/ImportForm.js.map +1 -0
- package/esm/DotplotView/components/ImportSyntenyTrackSelector.d.ts +9 -0
- package/esm/DotplotView/components/ImportSyntenyTrackSelector.js +44 -0
- package/esm/DotplotView/components/ImportSyntenyTrackSelector.js.map +1 -0
- package/esm/DotplotView/components/PanButtons.d.ts +6 -0
- package/esm/DotplotView/components/PanButtons.js +55 -0
- package/esm/DotplotView/components/PanButtons.js.map +1 -0
- package/esm/DotplotView/components/WarningDialog.d.ts +16 -0
- package/esm/DotplotView/components/WarningDialog.js +36 -0
- package/esm/DotplotView/components/WarningDialog.js.map +1 -0
- package/esm/DotplotView/components/util.d.ts +19 -0
- package/esm/DotplotView/components/util.js +83 -0
- package/esm/DotplotView/components/util.js.map +1 -0
- package/esm/DotplotView/index.d.ts +2 -0
- package/esm/DotplotView/index.js +15 -0
- package/esm/DotplotView/index.js.map +1 -0
- package/esm/DotplotView/model.d.ts +616 -0
- package/esm/DotplotView/model.js +616 -0
- package/esm/DotplotView/model.js.map +1 -0
- package/esm/DotplotView/svgcomponents/SVGBackground.d.ts +5 -0
- package/esm/DotplotView/svgcomponents/SVGBackground.js +7 -0
- package/esm/DotplotView/svgcomponents/SVGBackground.js.map +1 -0
- package/esm/DotplotView/svgcomponents/SVGDotplotView.d.ts +2 -0
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js +40 -0
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js.map +1 -0
- package/esm/LaunchDotplotView.d.ts +2 -0
- package/esm/LaunchDotplotView.js +42 -0
- package/esm/LaunchDotplotView.js.map +1 -0
- package/esm/ServerSideRenderedBlockContent.d.ts +12 -0
- package/esm/ServerSideRenderedBlockContent.js +62 -0
- package/esm/ServerSideRenderedBlockContent.js.map +1 -0
- package/esm/ServerSideSyntenyRendering.d.ts +23 -0
- package/esm/ServerSideSyntenyRendering.js +29 -0
- package/esm/ServerSideSyntenyRendering.js.map +1 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +38 -0
- package/esm/index.js.map +1 -0
- package/esm/util.d.ts +9 -0
- package/esm/util.js +5 -0
- package/esm/util.js.map +1 -0
- package/package.json +69 -0
- package/src/ComparativeRenderer/index.ts +87 -0
- package/src/DotplotDisplay/components/DotplotDisplay.tsx +34 -0
- package/src/DotplotDisplay/index.ts +48 -0
- package/src/DotplotDisplay/renderDotplotBlock.ts +60 -0
- package/src/DotplotDisplay/stateModelFactory.tsx +196 -0
- package/src/DotplotReadVsRef/DotplotReadVsRef.ts +115 -0
- package/src/DotplotReadVsRef/index.ts +50 -0
- package/src/DotplotRenderer/ComparativeRenderRpc.ts +87 -0
- package/src/DotplotRenderer/DotplotRenderer.ts +328 -0
- package/src/DotplotRenderer/__image_snapshots__/linear-synteny-renderer-test-ts-test-rendering-a-simple-synteny-from-fake-data-1-snap.png +0 -0
- package/src/DotplotRenderer/components/DotplotRendering.tsx +12 -0
- package/src/DotplotRenderer/configSchema.ts +92 -0
- package/src/DotplotRenderer/index.ts +16 -0
- package/src/DotplotView/1dview.ts +98 -0
- package/src/DotplotView/blockTypes.ts +140 -0
- package/src/DotplotView/components/Axes.tsx +246 -0
- package/src/DotplotView/components/CursorIcon.tsx +24 -0
- package/src/DotplotView/components/DotplotTooltip.tsx +163 -0
- package/src/DotplotView/components/DotplotView.tsx +348 -0
- package/src/DotplotView/components/DotplotWarnings.tsx +26 -0
- package/src/DotplotView/components/ExportSvgDialog.tsx +129 -0
- package/src/DotplotView/components/Grid.tsx +112 -0
- package/src/DotplotView/components/Header.tsx +182 -0
- package/src/DotplotView/components/ImportCustomTrack.tsx +262 -0
- package/src/DotplotView/components/ImportForm.tsx +209 -0
- package/src/DotplotView/components/ImportSyntenyTrackSelector.tsx +90 -0
- package/src/DotplotView/components/PanButtons.tsx +93 -0
- package/src/DotplotView/components/WarningDialog.tsx +74 -0
- package/src/DotplotView/components/util.ts +118 -0
- package/src/DotplotView/index.ts +16 -0
- package/src/DotplotView/model.test.ts +17 -0
- package/src/DotplotView/model.ts +719 -0
- package/src/DotplotView/svgcomponents/SVGBackground.tsx +21 -0
- package/src/DotplotView/svgcomponents/SVGDotplotView.tsx +68 -0
- package/src/LaunchDotplotView.ts +63 -0
- package/src/ServerSideRenderedBlockContent.tsx +86 -0
- package/src/ServerSideSyntenyRendering.tsx +54 -0
- package/src/index.ts +41 -0
- package/src/util.ts +14 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { makeStyles } from 'tss-react/mui'
|
|
3
|
+
import { observer } from 'mobx-react'
|
|
4
|
+
import { getSnapshot } from 'mobx-state-tree'
|
|
5
|
+
import { getTickDisplayStr } from '@jbrowse/core/util'
|
|
6
|
+
import { bpToPx } from '@jbrowse/core/util/Base1DUtils'
|
|
7
|
+
import { useTheme } from '@mui/material'
|
|
8
|
+
|
|
9
|
+
// locals
|
|
10
|
+
import { getBlockLabelKeysToHide } from './util'
|
|
11
|
+
import { DotplotViewModel } from '../model'
|
|
12
|
+
|
|
13
|
+
const useStyles = makeStyles()(() => ({
|
|
14
|
+
vtext: {
|
|
15
|
+
gridColumn: '1/2',
|
|
16
|
+
gridRow: '1/2',
|
|
17
|
+
pointerEvents: 'none',
|
|
18
|
+
userSelect: 'none',
|
|
19
|
+
},
|
|
20
|
+
htext: {
|
|
21
|
+
gridColumn: '2/2',
|
|
22
|
+
gridRow: '2/2',
|
|
23
|
+
pointerEvents: 'none',
|
|
24
|
+
userSelect: 'none',
|
|
25
|
+
},
|
|
26
|
+
}))
|
|
27
|
+
|
|
28
|
+
export const HorizontalAxis = observer(function ({
|
|
29
|
+
model,
|
|
30
|
+
}: {
|
|
31
|
+
model: DotplotViewModel
|
|
32
|
+
}) {
|
|
33
|
+
const { viewWidth, borderY } = model
|
|
34
|
+
const { classes } = useStyles()
|
|
35
|
+
return (
|
|
36
|
+
<svg width={viewWidth} height={borderY} className={classes.htext}>
|
|
37
|
+
<HorizontalAxisRaw model={model} />
|
|
38
|
+
</svg>
|
|
39
|
+
)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
export const HorizontalAxisRaw = observer(function ({
|
|
43
|
+
model,
|
|
44
|
+
}: {
|
|
45
|
+
model: DotplotViewModel
|
|
46
|
+
}) {
|
|
47
|
+
const { viewWidth, borderX, borderY, hview, htextRotation, hticks } = model
|
|
48
|
+
const { offsetPx, width, dynamicBlocks, bpPerPx } = hview
|
|
49
|
+
const dblocks = dynamicBlocks.contentBlocks
|
|
50
|
+
const hide = getBlockLabelKeysToHide(dblocks, viewWidth, offsetPx)
|
|
51
|
+
const theme = useTheme()
|
|
52
|
+
const hviewSnap = {
|
|
53
|
+
...getSnapshot(hview),
|
|
54
|
+
width,
|
|
55
|
+
staticBlocks: hview.staticBlocks,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
{dblocks
|
|
61
|
+
.filter(region => !hide.has(region.key))
|
|
62
|
+
.map(region => {
|
|
63
|
+
const x = region.offsetPx
|
|
64
|
+
const y = 0
|
|
65
|
+
const xoff = Math.floor(x - hview.offsetPx)
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<text
|
|
69
|
+
transform={`rotate(${htextRotation},${xoff},${y})`}
|
|
70
|
+
key={JSON.stringify(region)}
|
|
71
|
+
x={xoff}
|
|
72
|
+
y={y + 1}
|
|
73
|
+
fill={theme.palette.text.primary}
|
|
74
|
+
fontSize={11}
|
|
75
|
+
dominantBaseline="hanging"
|
|
76
|
+
textAnchor="end"
|
|
77
|
+
>
|
|
78
|
+
{region.refName}
|
|
79
|
+
</text>
|
|
80
|
+
)
|
|
81
|
+
})}
|
|
82
|
+
{hticks.map(tick => {
|
|
83
|
+
const x =
|
|
84
|
+
(bpToPx({
|
|
85
|
+
refName: tick.refName,
|
|
86
|
+
coord: tick.base,
|
|
87
|
+
self: hviewSnap,
|
|
88
|
+
})?.offsetPx || 0) - offsetPx
|
|
89
|
+
return (
|
|
90
|
+
<line
|
|
91
|
+
key={`line-${JSON.stringify(tick)}`}
|
|
92
|
+
x1={x}
|
|
93
|
+
x2={x}
|
|
94
|
+
y1={0}
|
|
95
|
+
y2={tick.type === 'major' ? 6 : 4}
|
|
96
|
+
strokeWidth={1}
|
|
97
|
+
stroke={theme.palette.divider}
|
|
98
|
+
/>
|
|
99
|
+
)
|
|
100
|
+
})}
|
|
101
|
+
{hticks
|
|
102
|
+
.filter(tick => tick.type === 'major')
|
|
103
|
+
.map(tick => {
|
|
104
|
+
const x =
|
|
105
|
+
(bpToPx({
|
|
106
|
+
refName: tick.refName,
|
|
107
|
+
coord: tick.base,
|
|
108
|
+
self: hviewSnap,
|
|
109
|
+
})?.offsetPx || 0) - offsetPx
|
|
110
|
+
const y = 0
|
|
111
|
+
return x > 10 ? (
|
|
112
|
+
<text
|
|
113
|
+
x={x - 7}
|
|
114
|
+
y={y}
|
|
115
|
+
transform={`rotate(${htextRotation},${x},${y})`}
|
|
116
|
+
key={`text-${JSON.stringify(tick)}`}
|
|
117
|
+
fill={theme.palette.text.primary}
|
|
118
|
+
fontSize={11}
|
|
119
|
+
dominantBaseline="middle"
|
|
120
|
+
textAnchor="end"
|
|
121
|
+
>
|
|
122
|
+
{getTickDisplayStr(tick.base + 1, bpPerPx)}
|
|
123
|
+
</text>
|
|
124
|
+
) : null
|
|
125
|
+
})}
|
|
126
|
+
<text
|
|
127
|
+
y={borderY - 12}
|
|
128
|
+
x={(viewWidth - borderX) / 2}
|
|
129
|
+
fill={theme.palette.text.primary}
|
|
130
|
+
textAnchor="middle"
|
|
131
|
+
fontSize={11}
|
|
132
|
+
dominantBaseline="hanging"
|
|
133
|
+
>
|
|
134
|
+
{hview.assemblyNames.join(',')}
|
|
135
|
+
</text>
|
|
136
|
+
</>
|
|
137
|
+
)
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
export const VerticalAxis = observer(function ({
|
|
141
|
+
model,
|
|
142
|
+
}: {
|
|
143
|
+
model: DotplotViewModel
|
|
144
|
+
}) {
|
|
145
|
+
const { borderX, viewHeight } = model
|
|
146
|
+
const { classes } = useStyles()
|
|
147
|
+
return (
|
|
148
|
+
<svg className={classes.vtext} width={borderX} height={viewHeight}>
|
|
149
|
+
<VerticalAxisRaw model={model} />
|
|
150
|
+
</svg>
|
|
151
|
+
)
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
export const VerticalAxisRaw = observer(function ({
|
|
155
|
+
model,
|
|
156
|
+
}: {
|
|
157
|
+
model: DotplotViewModel
|
|
158
|
+
}) {
|
|
159
|
+
const { viewHeight, borderX, borderY, vview, vtextRotation, vticks } = model
|
|
160
|
+
const { offsetPx, width, dynamicBlocks, bpPerPx } = vview
|
|
161
|
+
const dblocks = dynamicBlocks.contentBlocks
|
|
162
|
+
const hide = getBlockLabelKeysToHide(dblocks, viewHeight, offsetPx)
|
|
163
|
+
const theme = useTheme()
|
|
164
|
+
const vviewSnap = {
|
|
165
|
+
...getSnapshot(vview),
|
|
166
|
+
width,
|
|
167
|
+
staticBlocks: vview.staticBlocks,
|
|
168
|
+
}
|
|
169
|
+
return (
|
|
170
|
+
<>
|
|
171
|
+
{dblocks
|
|
172
|
+
.filter(region => !hide.has(region.key))
|
|
173
|
+
.map(region => {
|
|
174
|
+
const y = region.offsetPx
|
|
175
|
+
const x = borderX
|
|
176
|
+
const yoff = Math.floor(viewHeight - y + offsetPx)
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<text
|
|
180
|
+
transform={`rotate(${vtextRotation},${x},${y})`}
|
|
181
|
+
key={JSON.stringify(region)}
|
|
182
|
+
x={x}
|
|
183
|
+
y={yoff}
|
|
184
|
+
fill={theme.palette.text.primary}
|
|
185
|
+
fontSize={11}
|
|
186
|
+
textAnchor="end"
|
|
187
|
+
>
|
|
188
|
+
{region.refName}
|
|
189
|
+
</text>
|
|
190
|
+
)
|
|
191
|
+
})}
|
|
192
|
+
{vticks.map(tick => {
|
|
193
|
+
const y =
|
|
194
|
+
(bpToPx({
|
|
195
|
+
refName: tick.refName,
|
|
196
|
+
coord: tick.base,
|
|
197
|
+
self: vviewSnap,
|
|
198
|
+
})?.offsetPx || 0) - offsetPx
|
|
199
|
+
return (
|
|
200
|
+
<line
|
|
201
|
+
key={`line-${JSON.stringify(tick)}`}
|
|
202
|
+
y1={viewHeight - y}
|
|
203
|
+
y2={viewHeight - y}
|
|
204
|
+
x1={borderX}
|
|
205
|
+
x2={borderX - (tick.type === 'major' ? 6 : 4)}
|
|
206
|
+
strokeWidth={1}
|
|
207
|
+
stroke={theme.palette.divider}
|
|
208
|
+
/>
|
|
209
|
+
)
|
|
210
|
+
})}
|
|
211
|
+
{vticks
|
|
212
|
+
.filter(tick => tick.type === 'major')
|
|
213
|
+
.map(tick => {
|
|
214
|
+
const y =
|
|
215
|
+
(bpToPx({
|
|
216
|
+
refName: tick.refName,
|
|
217
|
+
coord: tick.base,
|
|
218
|
+
self: vviewSnap,
|
|
219
|
+
})?.offsetPx || 0) - offsetPx
|
|
220
|
+
return y > 10 ? (
|
|
221
|
+
<text
|
|
222
|
+
y={viewHeight - y - 3}
|
|
223
|
+
x={borderX - 7}
|
|
224
|
+
key={`text-${JSON.stringify(tick)}`}
|
|
225
|
+
textAnchor="end"
|
|
226
|
+
fill={theme.palette.text.primary}
|
|
227
|
+
dominantBaseline="hanging"
|
|
228
|
+
fontSize={11}
|
|
229
|
+
>
|
|
230
|
+
{getTickDisplayStr(tick.base + 1, bpPerPx)}
|
|
231
|
+
</text>
|
|
232
|
+
) : null
|
|
233
|
+
})}
|
|
234
|
+
<text
|
|
235
|
+
y={(viewHeight - borderY) / 2}
|
|
236
|
+
x={12}
|
|
237
|
+
fill={theme.palette.text.primary}
|
|
238
|
+
transform={`rotate(-90,12,${(viewHeight - borderY) / 2})`}
|
|
239
|
+
textAnchor="middle"
|
|
240
|
+
fontSize={11}
|
|
241
|
+
>
|
|
242
|
+
{vview.assemblyNames.join(',')}
|
|
243
|
+
</text>
|
|
244
|
+
</>
|
|
245
|
+
)
|
|
246
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
export function CursorMove(props: SvgIconProps) {
|
|
5
|
+
return (
|
|
6
|
+
<SvgIcon {...props}>
|
|
7
|
+
<path
|
|
8
|
+
fill="currentColor"
|
|
9
|
+
d="M13,6V11H18V7.75L22.25,12L18,16.25V13H13V18H16.25L12,22.25L7.75,18H11V13H6V16.25L1.75,12L6,7.75V11H11V6H7.75L12,1.75L16.25,6H13Z"
|
|
10
|
+
/>
|
|
11
|
+
</SvgIcon>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function CursorMouse(props: SvgIconProps) {
|
|
16
|
+
return (
|
|
17
|
+
<SvgIcon {...props}>
|
|
18
|
+
<path
|
|
19
|
+
fill="currentColor"
|
|
20
|
+
d="M10.07,14.27C10.57,14.03 11.16,14.25 11.4,14.75L13.7,19.74L15.5,18.89L13.19,13.91C12.95,13.41 13.17,12.81 13.67,12.58L13.95,12.5L16.25,12.05L8,5.12V15.9L9.82,14.43L10.07,14.27M13.64,21.97C13.14,22.21 12.54,22 12.31,21.5L10.13,16.76L7.62,18.78C7.45,18.92 7.24,19 7,19A1,1 0 0,1 6,18V3A1,1 0 0,1 7,2C7.24,2 7.47,2.09 7.64,2.23L7.65,2.22L19.14,11.86C19.57,12.22 19.62,12.85 19.27,13.27C19.12,13.45 18.91,13.57 18.7,13.61L15.54,14.23L17.74,18.96C18,19.46 17.76,20.05 17.26,20.28L13.64,21.97Z"
|
|
21
|
+
/>
|
|
22
|
+
</SvgIcon>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import React, { useMemo, useRef, useState } from 'react'
|
|
2
|
+
import { observer } from 'mobx-react'
|
|
3
|
+
import { makeStyles } from 'tss-react/mui'
|
|
4
|
+
|
|
5
|
+
// locals
|
|
6
|
+
import { DotplotViewModel } from '../model'
|
|
7
|
+
import { locstr } from './util'
|
|
8
|
+
import { Portal, alpha } from '@mui/material'
|
|
9
|
+
import { usePopper } from 'react-popper'
|
|
10
|
+
|
|
11
|
+
export function round(value: number) {
|
|
12
|
+
return Math.round(value * 1e5) / 1e5
|
|
13
|
+
}
|
|
14
|
+
const useStyles = makeStyles()(theme => ({
|
|
15
|
+
// these styles come from
|
|
16
|
+
// https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Tooltip/Tooltip.js
|
|
17
|
+
tooltip: {
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
pointerEvents: 'none',
|
|
20
|
+
backgroundColor: alpha(theme.palette.grey[700], 0.9),
|
|
21
|
+
borderRadius: theme.shape.borderRadius,
|
|
22
|
+
color: theme.palette.common.white,
|
|
23
|
+
fontFamily: theme.typography.fontFamily,
|
|
24
|
+
padding: '4px 8px',
|
|
25
|
+
fontSize: theme.typography.pxToRem(12),
|
|
26
|
+
lineHeight: `${round(14 / 10)}em`,
|
|
27
|
+
maxWidth: 300,
|
|
28
|
+
wordWrap: 'break-word',
|
|
29
|
+
},
|
|
30
|
+
}))
|
|
31
|
+
|
|
32
|
+
type Coord = [number, number] | undefined
|
|
33
|
+
const blank = { left: 0, top: 0, width: 0, height: 0 }
|
|
34
|
+
|
|
35
|
+
export const TooltipWhereMouseovered = observer(function ({
|
|
36
|
+
model,
|
|
37
|
+
mouserect,
|
|
38
|
+
mouserectClient,
|
|
39
|
+
xdistance,
|
|
40
|
+
ydistance,
|
|
41
|
+
}: {
|
|
42
|
+
model: DotplotViewModel
|
|
43
|
+
mouserect: Coord
|
|
44
|
+
mouserectClient: Coord
|
|
45
|
+
xdistance: number
|
|
46
|
+
ydistance: number
|
|
47
|
+
}) {
|
|
48
|
+
const { classes } = useStyles()
|
|
49
|
+
const { hview, vview, viewHeight } = model
|
|
50
|
+
const [anchorEl, setAnchorEl] = useState<HTMLDivElement | null>(null)
|
|
51
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
52
|
+
const rect = ref.current?.getBoundingClientRect() || blank
|
|
53
|
+
const offset = 6
|
|
54
|
+
const w = rect.height + offset * 2
|
|
55
|
+
|
|
56
|
+
// must be memoized a la https://github.com/popperjs/react-popper/issues/391
|
|
57
|
+
const virtElement = useMemo(
|
|
58
|
+
() => ({
|
|
59
|
+
getBoundingClientRect: () => {
|
|
60
|
+
const x = offset + (mouserectClient?.[0] || 0) - (xdistance < 0 ? w : 0)
|
|
61
|
+
const y = offset + (mouserectClient?.[1] || 0) - (ydistance < 0 ? w : 0)
|
|
62
|
+
return {
|
|
63
|
+
top: y,
|
|
64
|
+
left: x,
|
|
65
|
+
bottom: y,
|
|
66
|
+
right: x,
|
|
67
|
+
width: 0,
|
|
68
|
+
height: 0,
|
|
69
|
+
x,
|
|
70
|
+
y,
|
|
71
|
+
toJSON() {},
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
[mouserectClient, xdistance, ydistance, w],
|
|
76
|
+
)
|
|
77
|
+
const { styles, attributes } = usePopper(virtElement, anchorEl, {
|
|
78
|
+
placement: xdistance < 0 ? 'left' : 'right',
|
|
79
|
+
})
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
{mouserect ? (
|
|
83
|
+
<Portal>
|
|
84
|
+
<div
|
|
85
|
+
ref={setAnchorEl}
|
|
86
|
+
className={classes.tooltip}
|
|
87
|
+
// zIndex needed to go over widget drawer
|
|
88
|
+
style={{ ...styles.popper, zIndex: 100000 }}
|
|
89
|
+
{...attributes.popper}
|
|
90
|
+
>
|
|
91
|
+
{`x - ${locstr(mouserect[0], hview)}`}
|
|
92
|
+
<br />
|
|
93
|
+
{`y - ${locstr(viewHeight - mouserect[1], vview)}`}
|
|
94
|
+
<br />
|
|
95
|
+
</div>
|
|
96
|
+
</Portal>
|
|
97
|
+
) : null}
|
|
98
|
+
</>
|
|
99
|
+
)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
export const TooltipWhereClicked = observer(function ({
|
|
103
|
+
model,
|
|
104
|
+
mousedown,
|
|
105
|
+
mousedownClient,
|
|
106
|
+
xdistance,
|
|
107
|
+
ydistance,
|
|
108
|
+
}: {
|
|
109
|
+
model: DotplotViewModel
|
|
110
|
+
mousedown: Coord
|
|
111
|
+
mousedownClient: Coord
|
|
112
|
+
xdistance: number
|
|
113
|
+
ydistance: number
|
|
114
|
+
}) {
|
|
115
|
+
const { classes } = useStyles()
|
|
116
|
+
const { hview, vview, viewHeight } = model
|
|
117
|
+
const [anchorEl, setAnchorEl] = useState<HTMLDivElement | null>(null)
|
|
118
|
+
|
|
119
|
+
// must be memoized a la https://github.com/popperjs/react-popper/issues/391
|
|
120
|
+
const virtElement = useMemo(
|
|
121
|
+
() => ({
|
|
122
|
+
getBoundingClientRect: () => {
|
|
123
|
+
const x = (mousedownClient?.[0] || 0) - (xdistance < 0 ? 0 : 0)
|
|
124
|
+
const y = (mousedownClient?.[1] || 0) - (ydistance < 0 ? 0 : 0)
|
|
125
|
+
return {
|
|
126
|
+
top: y,
|
|
127
|
+
left: x,
|
|
128
|
+
bottom: y,
|
|
129
|
+
right: x,
|
|
130
|
+
width: 0,
|
|
131
|
+
height: 0,
|
|
132
|
+
x,
|
|
133
|
+
y,
|
|
134
|
+
toJSON() {},
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
}),
|
|
138
|
+
[mousedownClient, xdistance, ydistance],
|
|
139
|
+
)
|
|
140
|
+
const { styles, attributes } = usePopper(virtElement, anchorEl, {
|
|
141
|
+
placement: xdistance < 0 ? 'right' : 'left',
|
|
142
|
+
})
|
|
143
|
+
return (
|
|
144
|
+
<>
|
|
145
|
+
{mousedown && Math.abs(xdistance) > 3 && Math.abs(ydistance) > 3 ? (
|
|
146
|
+
<Portal>
|
|
147
|
+
<div
|
|
148
|
+
ref={setAnchorEl}
|
|
149
|
+
className={classes.tooltip}
|
|
150
|
+
// zIndex needed to go over widget drawer
|
|
151
|
+
style={{ ...styles.popper, zIndex: 100000 }}
|
|
152
|
+
{...attributes.popper}
|
|
153
|
+
>
|
|
154
|
+
{`x - ${locstr(mousedown[0], hview)}`}
|
|
155
|
+
<br />
|
|
156
|
+
{`y - ${locstr(viewHeight - mousedown[1], vview)}`}
|
|
157
|
+
<br />
|
|
158
|
+
</div>
|
|
159
|
+
</Portal>
|
|
160
|
+
) : null}
|
|
161
|
+
</>
|
|
162
|
+
)
|
|
163
|
+
})
|