@jbrowse/plugin-dotplot-view 2.6.1 → 2.6.2
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/ComparativeRenderer/index.js +0 -1
- package/dist/DotplotDisplay/components/DotplotDisplay.js +0 -1
- package/dist/DotplotDisplay/index.js +0 -1
- package/dist/DotplotDisplay/renderDotplotBlock.js +0 -1
- package/dist/DotplotDisplay/stateModelFactory.js +0 -1
- package/dist/DotplotReadVsRef/DotplotReadVsRef.js +0 -1
- package/dist/DotplotReadVsRef/index.js +0 -1
- package/dist/DotplotRenderer/ComparativeRenderRpc.js +0 -1
- package/dist/DotplotRenderer/DotplotRenderer.js +0 -1
- package/dist/DotplotRenderer/components/DotplotRendering.js +0 -1
- package/dist/DotplotRenderer/configSchema.js +0 -1
- package/dist/DotplotRenderer/index.js +0 -1
- package/dist/DotplotView/1dview.js +0 -1
- package/dist/DotplotView/blockTypes.js +0 -1
- package/dist/DotplotView/components/Axes.js +0 -1
- package/dist/DotplotView/components/CursorIcon.js +0 -1
- package/dist/DotplotView/components/DotplotTooltip.js +0 -1
- package/dist/DotplotView/components/DotplotView.js +0 -1
- package/dist/DotplotView/components/DotplotWarnings.js +0 -1
- package/dist/DotplotView/components/ExportSvgDialog.js +0 -1
- package/dist/DotplotView/components/Grid.js +0 -1
- package/dist/DotplotView/components/Header.js +0 -1
- package/dist/DotplotView/components/ImportCustomTrack.js +0 -1
- package/dist/DotplotView/components/ImportForm.js +0 -1
- package/dist/DotplotView/components/ImportSyntenyTrackSelector.js +0 -1
- package/dist/DotplotView/components/PanButtons.js +0 -1
- package/dist/DotplotView/components/WarningDialog.js +0 -1
- package/dist/DotplotView/components/util.js +0 -1
- package/dist/DotplotView/index.js +0 -1
- package/dist/DotplotView/model.js +0 -1
- package/dist/DotplotView/svgcomponents/SVGBackground.js +0 -1
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js +0 -1
- package/dist/LaunchDotplotView.js +0 -1
- package/dist/ServerSideRenderedBlockContent.js +0 -1
- package/dist/ServerSideSyntenyRendering.js +0 -1
- package/dist/index.js +0 -1
- package/dist/util.js +0 -1
- package/esm/ComparativeRenderer/index.js +0 -1
- package/esm/DotplotDisplay/components/DotplotDisplay.js +0 -1
- package/esm/DotplotDisplay/index.js +0 -1
- package/esm/DotplotDisplay/renderDotplotBlock.js +0 -1
- package/esm/DotplotDisplay/stateModelFactory.js +0 -1
- package/esm/DotplotReadVsRef/DotplotReadVsRef.js +0 -1
- package/esm/DotplotReadVsRef/index.js +0 -1
- package/esm/DotplotRenderer/ComparativeRenderRpc.js +0 -1
- package/esm/DotplotRenderer/DotplotRenderer.js +0 -1
- package/esm/DotplotRenderer/components/DotplotRendering.js +0 -1
- package/esm/DotplotRenderer/configSchema.js +0 -1
- package/esm/DotplotRenderer/index.js +0 -1
- package/esm/DotplotView/1dview.js +0 -1
- package/esm/DotplotView/blockTypes.js +0 -1
- package/esm/DotplotView/components/Axes.js +0 -1
- package/esm/DotplotView/components/CursorIcon.js +0 -1
- package/esm/DotplotView/components/DotplotTooltip.js +0 -1
- package/esm/DotplotView/components/DotplotView.js +0 -1
- package/esm/DotplotView/components/DotplotWarnings.js +0 -1
- package/esm/DotplotView/components/ExportSvgDialog.js +0 -1
- package/esm/DotplotView/components/Grid.js +0 -1
- package/esm/DotplotView/components/Header.js +0 -1
- package/esm/DotplotView/components/ImportCustomTrack.js +0 -1
- package/esm/DotplotView/components/ImportForm.js +0 -1
- package/esm/DotplotView/components/ImportSyntenyTrackSelector.js +0 -1
- package/esm/DotplotView/components/PanButtons.js +0 -1
- package/esm/DotplotView/components/WarningDialog.js +0 -1
- package/esm/DotplotView/components/util.js +0 -1
- package/esm/DotplotView/index.js +0 -1
- package/esm/DotplotView/model.js +0 -1
- package/esm/DotplotView/svgcomponents/SVGBackground.js +0 -1
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js +0 -1
- package/esm/LaunchDotplotView.js +0 -1
- package/esm/ServerSideRenderedBlockContent.js +0 -1
- package/esm/ServerSideSyntenyRendering.js +0 -1
- package/esm/index.js +0 -1
- package/esm/util.js +0 -1
- package/package.json +3 -4
- package/dist/ComparativeRenderer/index.js.map +0 -1
- package/dist/DotplotDisplay/components/DotplotDisplay.js.map +0 -1
- package/dist/DotplotDisplay/index.js.map +0 -1
- package/dist/DotplotDisplay/renderDotplotBlock.js.map +0 -1
- package/dist/DotplotDisplay/stateModelFactory.js.map +0 -1
- package/dist/DotplotReadVsRef/DotplotReadVsRef.js.map +0 -1
- package/dist/DotplotReadVsRef/index.js.map +0 -1
- package/dist/DotplotRenderer/ComparativeRenderRpc.js.map +0 -1
- package/dist/DotplotRenderer/DotplotRenderer.js.map +0 -1
- package/dist/DotplotRenderer/components/DotplotRendering.js.map +0 -1
- package/dist/DotplotRenderer/configSchema.js.map +0 -1
- package/dist/DotplotRenderer/index.js.map +0 -1
- package/dist/DotplotView/1dview.js.map +0 -1
- package/dist/DotplotView/blockTypes.js.map +0 -1
- package/dist/DotplotView/components/Axes.js.map +0 -1
- package/dist/DotplotView/components/CursorIcon.js.map +0 -1
- package/dist/DotplotView/components/DotplotTooltip.js.map +0 -1
- package/dist/DotplotView/components/DotplotView.js.map +0 -1
- package/dist/DotplotView/components/DotplotWarnings.js.map +0 -1
- package/dist/DotplotView/components/ExportSvgDialog.js.map +0 -1
- package/dist/DotplotView/components/Grid.js.map +0 -1
- package/dist/DotplotView/components/Header.js.map +0 -1
- package/dist/DotplotView/components/ImportCustomTrack.js.map +0 -1
- package/dist/DotplotView/components/ImportForm.js.map +0 -1
- package/dist/DotplotView/components/ImportSyntenyTrackSelector.js.map +0 -1
- package/dist/DotplotView/components/PanButtons.js.map +0 -1
- package/dist/DotplotView/components/WarningDialog.js.map +0 -1
- package/dist/DotplotView/components/util.js.map +0 -1
- package/dist/DotplotView/index.js.map +0 -1
- package/dist/DotplotView/model.js.map +0 -1
- package/dist/DotplotView/svgcomponents/SVGBackground.js.map +0 -1
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js.map +0 -1
- package/dist/LaunchDotplotView.js.map +0 -1
- package/dist/ServerSideRenderedBlockContent.js.map +0 -1
- package/dist/ServerSideSyntenyRendering.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/util.js.map +0 -1
- package/esm/ComparativeRenderer/index.js.map +0 -1
- package/esm/DotplotDisplay/components/DotplotDisplay.js.map +0 -1
- package/esm/DotplotDisplay/index.js.map +0 -1
- package/esm/DotplotDisplay/renderDotplotBlock.js.map +0 -1
- package/esm/DotplotDisplay/stateModelFactory.js.map +0 -1
- package/esm/DotplotReadVsRef/DotplotReadVsRef.js.map +0 -1
- package/esm/DotplotReadVsRef/index.js.map +0 -1
- package/esm/DotplotRenderer/ComparativeRenderRpc.js.map +0 -1
- package/esm/DotplotRenderer/DotplotRenderer.js.map +0 -1
- package/esm/DotplotRenderer/components/DotplotRendering.js.map +0 -1
- package/esm/DotplotRenderer/configSchema.js.map +0 -1
- package/esm/DotplotRenderer/index.js.map +0 -1
- package/esm/DotplotView/1dview.js.map +0 -1
- package/esm/DotplotView/blockTypes.js.map +0 -1
- package/esm/DotplotView/components/Axes.js.map +0 -1
- package/esm/DotplotView/components/CursorIcon.js.map +0 -1
- package/esm/DotplotView/components/DotplotTooltip.js.map +0 -1
- package/esm/DotplotView/components/DotplotView.js.map +0 -1
- package/esm/DotplotView/components/DotplotWarnings.js.map +0 -1
- package/esm/DotplotView/components/ExportSvgDialog.js.map +0 -1
- package/esm/DotplotView/components/Grid.js.map +0 -1
- package/esm/DotplotView/components/Header.js.map +0 -1
- package/esm/DotplotView/components/ImportCustomTrack.js.map +0 -1
- package/esm/DotplotView/components/ImportForm.js.map +0 -1
- package/esm/DotplotView/components/ImportSyntenyTrackSelector.js.map +0 -1
- package/esm/DotplotView/components/PanButtons.js.map +0 -1
- package/esm/DotplotView/components/WarningDialog.js.map +0 -1
- package/esm/DotplotView/components/util.js.map +0 -1
- package/esm/DotplotView/index.js.map +0 -1
- package/esm/DotplotView/model.js.map +0 -1
- package/esm/DotplotView/svgcomponents/SVGBackground.js.map +0 -1
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js.map +0 -1
- package/esm/LaunchDotplotView.js.map +0 -1
- package/esm/ServerSideRenderedBlockContent.js.map +0 -1
- package/esm/ServerSideSyntenyRendering.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/util.js.map +0 -1
- package/src/ComparativeRenderer/index.ts +0 -87
- package/src/DotplotDisplay/components/DotplotDisplay.tsx +0 -34
- package/src/DotplotDisplay/index.ts +0 -48
- package/src/DotplotDisplay/renderDotplotBlock.ts +0 -60
- package/src/DotplotDisplay/stateModelFactory.tsx +0 -196
- package/src/DotplotReadVsRef/DotplotReadVsRef.ts +0 -115
- package/src/DotplotReadVsRef/index.ts +0 -50
- package/src/DotplotRenderer/ComparativeRenderRpc.ts +0 -87
- package/src/DotplotRenderer/DotplotRenderer.ts +0 -328
- 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 +0 -12
- package/src/DotplotRenderer/configSchema.ts +0 -92
- package/src/DotplotRenderer/index.ts +0 -16
- package/src/DotplotView/1dview.ts +0 -98
- package/src/DotplotView/blockTypes.ts +0 -140
- package/src/DotplotView/components/Axes.tsx +0 -246
- package/src/DotplotView/components/CursorIcon.tsx +0 -24
- package/src/DotplotView/components/DotplotTooltip.tsx +0 -163
- package/src/DotplotView/components/DotplotView.tsx +0 -348
- package/src/DotplotView/components/DotplotWarnings.tsx +0 -26
- package/src/DotplotView/components/ExportSvgDialog.tsx +0 -129
- package/src/DotplotView/components/Grid.tsx +0 -112
- package/src/DotplotView/components/Header.tsx +0 -182
- package/src/DotplotView/components/ImportCustomTrack.tsx +0 -262
- package/src/DotplotView/components/ImportForm.tsx +0 -209
- package/src/DotplotView/components/ImportSyntenyTrackSelector.tsx +0 -90
- package/src/DotplotView/components/PanButtons.tsx +0 -93
- package/src/DotplotView/components/WarningDialog.tsx +0 -74
- package/src/DotplotView/components/util.ts +0 -118
- package/src/DotplotView/index.ts +0 -16
- package/src/DotplotView/model.test.ts +0 -17
- package/src/DotplotView/model.ts +0 -719
- package/src/DotplotView/svgcomponents/SVGBackground.tsx +0 -21
- package/src/DotplotView/svgcomponents/SVGDotplotView.tsx +0 -68
- package/src/LaunchDotplotView.ts +0 -63
- package/src/ServerSideRenderedBlockContent.tsx +0 -86
- package/src/ServerSideSyntenyRendering.tsx +0 -54
- package/src/index.ts +0 -41
- package/src/util.ts +0 -14
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
type Func<T> = (value: BaseBlock, index: number, array: BaseBlock[]) => T
|
|
2
|
-
|
|
3
|
-
export class BlockSet {
|
|
4
|
-
constructor(public blocks: BaseBlock[] = []) {}
|
|
5
|
-
|
|
6
|
-
push(block: BaseBlock) {
|
|
7
|
-
if (block instanceof ElidedBlock && this.blocks.length > 0) {
|
|
8
|
-
const lastBlock = this.blocks.at(-1)
|
|
9
|
-
if (lastBlock instanceof ElidedBlock) {
|
|
10
|
-
lastBlock.push(block)
|
|
11
|
-
return
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
this.blocks.push(block)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
getBlocks() {
|
|
19
|
-
return this.blocks
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
map<T, U = this>(func: Func<T>, thisarg?: U) {
|
|
23
|
-
// eslint-disable-next-line unicorn/no-array-method-this-argument
|
|
24
|
-
return this.blocks.map(func, thisarg)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
forEach<T, U = this>(func: Func<T>, thisarg?: U) {
|
|
28
|
-
// eslint-disable-next-line unicorn/no-array-method-this-argument
|
|
29
|
-
return this.blocks.forEach(func, thisarg)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
get length() {
|
|
33
|
-
return this.blocks.length
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get totalWidthPx() {
|
|
37
|
-
return this.blocks.length
|
|
38
|
-
? this.blocks.map(blocks => blocks.widthPx).reduce((a, b) => a + b)
|
|
39
|
-
: 0
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
get offsetPx() {
|
|
43
|
-
return this.blocks.length ? this.blocks[0].offsetPx : 0
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
get contentBlocks() {
|
|
47
|
-
return this.blocks.filter(block => block instanceof ContentBlock)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export class BaseBlock {
|
|
52
|
-
public reversed?: boolean
|
|
53
|
-
|
|
54
|
-
public refName: string
|
|
55
|
-
|
|
56
|
-
public start: number
|
|
57
|
-
|
|
58
|
-
public end: number
|
|
59
|
-
|
|
60
|
-
public assemblyName: string
|
|
61
|
-
|
|
62
|
-
public key: string
|
|
63
|
-
|
|
64
|
-
public widthPx = 0
|
|
65
|
-
|
|
66
|
-
public offsetPx = 0
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* a block that should be shown as filled with data
|
|
70
|
-
*/
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
|
-
constructor(data: any) {
|
|
73
|
-
Object.assign(this, data)
|
|
74
|
-
this.assemblyName = data.assemblyName
|
|
75
|
-
this.refName = data.refName
|
|
76
|
-
this.start = data.start
|
|
77
|
-
this.end = data.end
|
|
78
|
-
this.key = data.key
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* rename the reference sequence of this block and return a new one
|
|
83
|
-
*
|
|
84
|
-
* @param refName -
|
|
85
|
-
* @returns either a new block with a renamed reference sequence,
|
|
86
|
-
* or the same block, if the ref name is not actually different
|
|
87
|
-
*/
|
|
88
|
-
renameReference(refName: string) {
|
|
89
|
-
if (this.refName && refName !== this.refName) {
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
91
|
-
return new (this.constructor as any)({ ...this, refName })
|
|
92
|
-
}
|
|
93
|
-
return this
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
toRegion() {
|
|
97
|
-
return {
|
|
98
|
-
refName: this.refName,
|
|
99
|
-
start: this.start,
|
|
100
|
-
end: this.end,
|
|
101
|
-
assemblyName: this.assemblyName,
|
|
102
|
-
reversed: this.reversed,
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export class ContentBlock extends BaseBlock {}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* marker block representing one or more blocks that are
|
|
111
|
-
* too small to be shown at the current zoom level
|
|
112
|
-
*/
|
|
113
|
-
export class ElidedBlock extends BaseBlock {
|
|
114
|
-
public widthPx: number
|
|
115
|
-
|
|
116
|
-
public elidedBlockCount = 0
|
|
117
|
-
|
|
118
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
119
|
-
constructor(data: Record<string, any>) {
|
|
120
|
-
super(data)
|
|
121
|
-
this.widthPx = data.widthPx
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
push(otherBlock: ElidedBlock) {
|
|
125
|
-
this.elidedBlockCount += 1
|
|
126
|
-
|
|
127
|
-
if (otherBlock) {
|
|
128
|
-
this.refName = ''
|
|
129
|
-
this.start = 0
|
|
130
|
-
this.end = 0
|
|
131
|
-
this.widthPx += otherBlock.widthPx
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* marker block that sits between two different displayed regions
|
|
138
|
-
* and provides a thick border between them
|
|
139
|
-
*/
|
|
140
|
-
export class InterRegionPaddingBlock extends BaseBlock {}
|
|
@@ -1,246 +0,0 @@
|
|
|
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
|
-
})
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
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
|
-
})
|