@jbrowse/plugin-linear-genome-view 2.2.2 → 2.3.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/dist/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +2 -1
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js +4 -2
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -1
- package/dist/BaseLinearDisplay/components/Block.d.ts +1 -1
- package/dist/BaseLinearDisplay/components/Block.js +1 -1
- package/dist/BaseLinearDisplay/components/Block.js.map +1 -1
- package/dist/BaseLinearDisplay/components/BlockMsg.js +3 -2
- package/dist/BaseLinearDisplay/components/BlockMsg.js.map +1 -1
- package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +1 -1
- package/dist/BaseLinearDisplay/components/LinearBlocks.js +2 -2
- package/dist/BaseLinearDisplay/components/LinearBlocks.js.map +1 -1
- package/dist/BaseLinearDisplay/{models → components}/TooLargeMessage.d.ts +0 -0
- package/dist/BaseLinearDisplay/{models → components}/TooLargeMessage.js +0 -0
- package/dist/BaseLinearDisplay/components/TooLargeMessage.js.map +1 -0
- package/dist/BaseLinearDisplay/index.d.ts +2 -2
- package/dist/BaseLinearDisplay/index.js +4 -3
- package/dist/BaseLinearDisplay/index.js.map +1 -1
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +6 -14
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +3 -5
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/dist/BaseLinearDisplay/models/configSchema.d.ts +2 -0
- package/dist/BaseLinearDisplay/models/{baseLinearDisplayConfigSchema.js → configSchema.js} +5 -5
- package/dist/BaseLinearDisplay/models/configSchema.js.map +1 -0
- package/dist/BaseLinearDisplay/models/util.d.ts +18 -0
- package/dist/BaseLinearDisplay/models/util.js +18 -0
- package/dist/BaseLinearDisplay/models/util.js.map +1 -0
- package/dist/FeatureTrack/index.d.ts +1 -1
- package/dist/FeatureTrack/index.js +5 -4
- package/dist/FeatureTrack/index.js.map +1 -1
- package/dist/LinearBareDisplay/index.js +2 -1
- package/dist/LinearBareDisplay/index.js.map +1 -1
- package/dist/LinearBareDisplay/model.d.ts +1 -1
- package/dist/LinearBasicDisplay/index.js +1 -0
- package/dist/LinearBasicDisplay/index.js.map +1 -1
- package/dist/LinearBasicDisplay/model.d.ts +1 -4
- package/dist/LinearGenomeView/components/ImportForm.js +5 -1
- package/dist/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +1 -2
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -1
- package/dist/LinearGenomeView/components/Ruler.d.ts +2 -18
- package/dist/LinearGenomeView/components/Ruler.js +9 -25
- package/dist/LinearGenomeView/components/Ruler.js.map +1 -1
- package/dist/LinearGenomeView/components/SearchBox.js +4 -0
- package/dist/LinearGenomeView/components/SearchBox.js.map +1 -1
- package/dist/LinearGenomeView/index.js +1 -0
- package/dist/LinearGenomeView/index.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +2 -1
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +3 -2
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -1
- package/esm/BaseLinearDisplay/components/Block.d.ts +1 -1
- package/esm/BaseLinearDisplay/components/Block.js +1 -1
- package/esm/BaseLinearDisplay/components/Block.js.map +1 -1
- package/esm/BaseLinearDisplay/components/BlockMsg.js +3 -2
- package/esm/BaseLinearDisplay/components/BlockMsg.js.map +1 -1
- package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +1 -1
- package/esm/BaseLinearDisplay/components/LinearBlocks.js +2 -2
- package/esm/BaseLinearDisplay/components/LinearBlocks.js.map +1 -1
- package/esm/BaseLinearDisplay/{models → components}/TooLargeMessage.d.ts +0 -0
- package/esm/BaseLinearDisplay/{models → components}/TooLargeMessage.js +0 -0
- package/esm/BaseLinearDisplay/components/TooLargeMessage.js.map +1 -0
- package/esm/BaseLinearDisplay/index.d.ts +2 -2
- package/esm/BaseLinearDisplay/index.js +2 -2
- package/esm/BaseLinearDisplay/index.js.map +1 -1
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +6 -14
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +3 -5
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/esm/BaseLinearDisplay/models/configSchema.d.ts +2 -0
- package/esm/BaseLinearDisplay/models/{baseLinearDisplayConfigSchema.js → configSchema.js} +5 -4
- package/esm/BaseLinearDisplay/models/configSchema.js.map +1 -0
- package/esm/BaseLinearDisplay/models/util.d.ts +18 -0
- package/esm/BaseLinearDisplay/models/util.js +14 -0
- package/esm/BaseLinearDisplay/models/util.js.map +1 -0
- package/esm/FeatureTrack/index.d.ts +1 -1
- package/esm/FeatureTrack/index.js +5 -4
- package/esm/FeatureTrack/index.js.map +1 -1
- package/esm/LinearBareDisplay/index.js +2 -1
- package/esm/LinearBareDisplay/index.js.map +1 -1
- package/esm/LinearBareDisplay/model.d.ts +1 -1
- package/esm/LinearBasicDisplay/index.js +1 -0
- package/esm/LinearBasicDisplay/index.js.map +1 -1
- package/esm/LinearBasicDisplay/model.d.ts +1 -4
- package/esm/LinearGenomeView/components/ImportForm.js +5 -1
- package/esm/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +1 -2
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -1
- package/esm/LinearGenomeView/components/Ruler.d.ts +2 -18
- package/esm/LinearGenomeView/components/Ruler.js +6 -22
- package/esm/LinearGenomeView/components/Ruler.js.map +1 -1
- package/esm/LinearGenomeView/components/SearchBox.js +4 -0
- package/esm/LinearGenomeView/components/SearchBox.js.map +1 -1
- package/esm/LinearGenomeView/index.js +1 -0
- package/esm/LinearGenomeView/index.js.map +1 -1
- package/esm/index.d.ts +5 -5
- package/esm/index.js +3 -2
- package/esm/index.js.map +1 -1
- package/package.json +4 -5
- package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +86 -84
- package/src/BaseLinearDisplay/components/Block.tsx +15 -11
- package/src/BaseLinearDisplay/components/BlockMsg.tsx +9 -9
- package/src/BaseLinearDisplay/components/LinearBlocks.tsx +62 -58
- package/src/BaseLinearDisplay/{models → components}/TooLargeMessage.tsx +0 -0
- package/src/BaseLinearDisplay/index.ts +2 -1
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +4 -3
- package/src/BaseLinearDisplay/models/{baseLinearDisplayConfigSchema.ts → configSchema.ts} +5 -3
- package/src/BaseLinearDisplay/models/util.ts +24 -0
- package/src/FeatureTrack/index.ts +5 -8
- package/src/LinearBareDisplay/index.ts +4 -2
- package/src/LinearBasicDisplay/index.ts +1 -0
- package/src/LinearGenomeView/README.md +2 -1
- package/src/LinearGenomeView/components/ImportForm.tsx +3 -0
- package/src/LinearGenomeView/components/LinearGenomeView.test.tsx +132 -134
- package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +1 -2
- package/src/LinearGenomeView/components/Ruler.tsx +11 -28
- package/src/LinearGenomeView/components/SearchBox.tsx +2 -0
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +2 -5
- package/src/LinearGenomeView/index.ts +1 -0
- package/src/index.ts +3 -0
- package/dist/BaseLinearDisplay/models/TooLargeMessage.js.map +0 -1
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.d.ts +0 -1
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +0 -1
- package/esm/BaseLinearDisplay/models/TooLargeMessage.js.map +0 -1
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.d.ts +0 -1
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-linear-genome-view",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "JBrowse 2 linear genome view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"file-saver": "^2.0.0",
|
|
48
48
|
"material-ui-popup-state": "^3.0.0",
|
|
49
49
|
"normalize-wheel": "^1.0.1",
|
|
50
|
+
"react-error-boundary": "^3.0.0",
|
|
50
51
|
"react-popper": "^2.0.0"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
@@ -55,15 +56,13 @@
|
|
|
55
56
|
"mobx": "^6.0.0",
|
|
56
57
|
"mobx-react": "^7.0.0",
|
|
57
58
|
"mobx-state-tree": "^5.0.0",
|
|
58
|
-
"prop-types": "^15.0.0",
|
|
59
59
|
"react": ">=16.8.0",
|
|
60
60
|
"react-dom": ">=16.8.0",
|
|
61
|
-
"react
|
|
62
|
-
"tss-react": "^3.0.0"
|
|
61
|
+
"tss-react": "^4.0.0"
|
|
63
62
|
},
|
|
64
63
|
"publishConfig": {
|
|
65
64
|
"access": "public"
|
|
66
65
|
},
|
|
67
66
|
"module": "esm/index.js",
|
|
68
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "a85b280a8af4d1a11e81ab42913f5f6049e6e580"
|
|
69
68
|
}
|
|
@@ -7,6 +7,7 @@ import { Menu } from '@jbrowse/core/ui'
|
|
|
7
7
|
|
|
8
8
|
// locals
|
|
9
9
|
import Tooltip from './Tooltip'
|
|
10
|
+
import BlockMsg from './BlockMsg'
|
|
10
11
|
import LinearBlocks from './LinearBlocks'
|
|
11
12
|
import { BaseLinearDisplayModel } from '../models/BaseLinearDisplayModel'
|
|
12
13
|
|
|
@@ -21,94 +22,95 @@ const useStyles = makeStyles()({
|
|
|
21
22
|
})
|
|
22
23
|
|
|
23
24
|
type Coord = [number, number]
|
|
24
|
-
const BaseLinearDisplay = observer(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
const BaseLinearDisplay = observer(function (props: {
|
|
26
|
+
model: BaseLinearDisplayModel
|
|
27
|
+
children?: React.ReactNode
|
|
28
|
+
}) {
|
|
29
|
+
const { classes } = useStyles()
|
|
30
|
+
const theme = useTheme()
|
|
31
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
32
|
+
const [clientRect, setClientRect] = useState<DOMRect>()
|
|
33
|
+
const [offsetMouseCoord, setOffsetMouseCoord] = useState<Coord>([0, 0])
|
|
34
|
+
const [clientMouseCoord, setClientMouseCoord] = useState<Coord>([0, 0])
|
|
35
|
+
const [contextCoord, setContextCoord] = useState<Coord>()
|
|
36
|
+
const { model, children } = props
|
|
37
|
+
const {
|
|
38
|
+
TooltipComponent,
|
|
39
|
+
DisplayMessageComponent,
|
|
40
|
+
contextMenuItems,
|
|
41
|
+
height,
|
|
42
|
+
setContextMenuFeature,
|
|
43
|
+
} = model
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
ref={ref}
|
|
48
|
+
data-testid={`display-${getConf(model, 'displayId')}`}
|
|
49
|
+
className={classes.display}
|
|
50
|
+
onContextMenu={event => {
|
|
51
|
+
event.preventDefault()
|
|
52
|
+
if (contextCoord) {
|
|
53
|
+
// There's already a context menu open, so close it
|
|
54
|
+
setContextCoord(undefined)
|
|
55
|
+
} else if (ref.current) {
|
|
56
|
+
setContextCoord([event.clientX, event.clientY])
|
|
57
|
+
}
|
|
58
|
+
}}
|
|
59
|
+
onMouseMove={event => {
|
|
60
|
+
if (!ref.current) {
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
const rect = ref.current.getBoundingClientRect()
|
|
64
|
+
const { left, top } = rect
|
|
65
|
+
setOffsetMouseCoord([event.clientX - left, event.clientY - top])
|
|
66
|
+
setClientMouseCoord([event.clientX, event.clientY])
|
|
67
|
+
setClientRect(rect)
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
{DisplayMessageComponent ? (
|
|
71
|
+
<DisplayMessageComponent model={model} />
|
|
72
|
+
) : (
|
|
73
|
+
<LinearBlocks {...props} />
|
|
74
|
+
)}
|
|
75
|
+
{children}
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
<TooltipComponent
|
|
78
|
+
model={model}
|
|
79
|
+
height={height}
|
|
80
|
+
offsetMouseCoord={offsetMouseCoord}
|
|
81
|
+
clientMouseCoord={clientMouseCoord}
|
|
82
|
+
clientRect={clientRect}
|
|
83
|
+
mouseCoord={offsetMouseCoord}
|
|
84
|
+
/>
|
|
82
85
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
<Menu
|
|
87
|
+
open={Boolean(contextCoord) && Boolean(contextMenuItems().length)}
|
|
88
|
+
onMenuItemClick={(_, callback) => {
|
|
89
|
+
callback()
|
|
90
|
+
setContextCoord(undefined)
|
|
91
|
+
}}
|
|
92
|
+
onClose={() => {
|
|
93
|
+
setContextCoord(undefined)
|
|
94
|
+
setContextMenuFeature(undefined)
|
|
95
|
+
}}
|
|
96
|
+
TransitionProps={{
|
|
97
|
+
onExit: () => {
|
|
90
98
|
setContextCoord(undefined)
|
|
91
99
|
setContextMenuFeature(undefined)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
menuItems={contextMenuItems()}
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
109
|
-
)
|
|
110
|
-
},
|
|
111
|
-
)
|
|
100
|
+
},
|
|
101
|
+
}}
|
|
102
|
+
anchorReference="anchorPosition"
|
|
103
|
+
anchorPosition={
|
|
104
|
+
contextCoord
|
|
105
|
+
? { top: contextCoord[1], left: contextCoord[0] }
|
|
106
|
+
: undefined
|
|
107
|
+
}
|
|
108
|
+
style={{ zIndex: theme.zIndex.tooltip }}
|
|
109
|
+
menuItems={contextMenuItems()}
|
|
110
|
+
/>
|
|
111
|
+
</div>
|
|
112
|
+
)
|
|
113
|
+
})
|
|
112
114
|
|
|
113
115
|
export default BaseLinearDisplay
|
|
114
|
-
export { Tooltip }
|
|
116
|
+
export { Tooltip, BlockMsg }
|
|
@@ -28,17 +28,21 @@ const useStyles = makeStyles()(theme => ({
|
|
|
28
28
|
},
|
|
29
29
|
}))
|
|
30
30
|
|
|
31
|
-
const ContentBlock = observer(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
const ContentBlock = observer(function ({
|
|
32
|
+
block,
|
|
33
|
+
children,
|
|
34
|
+
}: {
|
|
35
|
+
block: BaseBlock
|
|
36
|
+
children: React.ReactNode
|
|
37
|
+
}) {
|
|
38
|
+
const { classes } = useStyles()
|
|
39
|
+
const { widthPx } = block
|
|
40
|
+
return (
|
|
41
|
+
<div style={{ width: widthPx }} className={classes.contentBlock}>
|
|
42
|
+
{children}
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
})
|
|
42
46
|
|
|
43
47
|
function ElidedBlock({ width }: { width: number }) {
|
|
44
48
|
const { classes } = useStyles()
|
|
@@ -29,14 +29,14 @@ export default function BlockMsg({
|
|
|
29
29
|
</Button>
|
|
30
30
|
) : null
|
|
31
31
|
return (
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
>
|
|
38
|
-
{message}
|
|
39
|
-
</
|
|
40
|
-
</
|
|
32
|
+
<Alert
|
|
33
|
+
severity={severity}
|
|
34
|
+
action={button}
|
|
35
|
+
classes={{ message: classes.ellipses }}
|
|
36
|
+
>
|
|
37
|
+
<Tooltip title={message}>
|
|
38
|
+
<div>{message}</div>
|
|
39
|
+
</Tooltip>
|
|
40
|
+
</Alert>
|
|
41
41
|
)
|
|
42
42
|
}
|
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
} from './Block'
|
|
17
17
|
import { LinearGenomeViewModel } from '../../LinearGenomeView'
|
|
18
18
|
|
|
19
|
+
type LGV = LinearGenomeViewModel
|
|
20
|
+
|
|
19
21
|
const useStyles = makeStyles()({
|
|
20
22
|
linearBlocks: {
|
|
21
23
|
whiteSpace: 'nowrap',
|
|
@@ -37,70 +39,72 @@ const useStyles = makeStyles()({
|
|
|
37
39
|
boxSizing: 'border-box',
|
|
38
40
|
},
|
|
39
41
|
})
|
|
40
|
-
const RenderedBlocks = observer(
|
|
41
|
-
({ model }: { model: BaseLinearDisplayModel }) => {
|
|
42
|
-
const { classes } = useStyles()
|
|
43
|
-
const { blockDefinitions, blockState } = model
|
|
44
|
-
return (
|
|
45
|
-
<>
|
|
46
|
-
{blockDefinitions.map(block => {
|
|
47
|
-
if (block instanceof ContentBlock) {
|
|
48
|
-
const state = blockState.get(block.key)
|
|
49
42
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
43
|
+
const RenderedBlocks = observer(function ({
|
|
44
|
+
model,
|
|
45
|
+
}: {
|
|
46
|
+
model: BaseLinearDisplayModel
|
|
47
|
+
}) {
|
|
48
|
+
const { classes } = useStyles()
|
|
49
|
+
const { blockDefinitions, blockState } = model
|
|
50
|
+
return (
|
|
51
|
+
<>
|
|
52
|
+
{blockDefinitions.map(block => {
|
|
53
|
+
if (block instanceof ContentBlock) {
|
|
54
|
+
const state = blockState.get(block.key)
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<ContentBlockComponent
|
|
58
|
+
block={block}
|
|
59
|
+
key={`${model.id}-${block.key}`}
|
|
60
|
+
>
|
|
61
|
+
{state && state.ReactComponent ? (
|
|
62
|
+
<state.ReactComponent model={state} />
|
|
63
|
+
) : null}
|
|
64
|
+
{state && state.maxHeightReached ? (
|
|
65
|
+
<div
|
|
66
|
+
className={classes.heightOverflowed}
|
|
67
|
+
style={{
|
|
68
|
+
top: state.layout.getTotalHeight() - 16,
|
|
69
|
+
pointerEvents: 'none',
|
|
70
|
+
height: 16,
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
Max height reached
|
|
74
|
+
</div>
|
|
75
|
+
) : null}
|
|
76
|
+
</ContentBlockComponent>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
if (block instanceof ElidedBlock) {
|
|
80
|
+
return (
|
|
81
|
+
<ElidedBlockComponent
|
|
82
|
+
key={`${model.id}-${block.key}`}
|
|
83
|
+
width={block.widthPx}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
if (block instanceof InterRegionPaddingBlock) {
|
|
88
|
+
return (
|
|
89
|
+
<InterRegionPaddingBlockComponent
|
|
90
|
+
key={block.key}
|
|
91
|
+
width={block.widthPx}
|
|
92
|
+
style={{ background: 'none' }}
|
|
93
|
+
boundary={block.variant === 'boundary'}
|
|
94
|
+
/>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
throw new Error(`invalid block type ${typeof block}`)
|
|
98
|
+
})}
|
|
99
|
+
</>
|
|
100
|
+
)
|
|
101
|
+
})
|
|
97
102
|
function LinearBlocks({ model }: { model: BaseLinearDisplayModel }) {
|
|
98
103
|
const { classes } = useStyles()
|
|
99
104
|
const { blockDefinitions } = model
|
|
100
|
-
const viewModel = getContainingView(model) as
|
|
105
|
+
const viewModel = getContainingView(model) as LGV
|
|
101
106
|
return (
|
|
102
107
|
<div
|
|
103
|
-
data-testid="Blockset"
|
|
104
108
|
className={classes.linearBlocks}
|
|
105
109
|
style={{
|
|
106
110
|
left: blockDefinitions.offsetPx - viewModel.offsetPx,
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { baseLinearDisplayConfigSchema } from './models/
|
|
1
|
+
export { default as baseLinearDisplayConfigSchema } from './models/configSchema'
|
|
2
2
|
export { BaseLinearDisplay } from './models/BaseLinearDisplayModel'
|
|
3
3
|
export type { BlockModel } from './models/serverSideRenderedBlock'
|
|
4
4
|
export type {
|
|
@@ -8,4 +8,5 @@ export type {
|
|
|
8
8
|
export {
|
|
9
9
|
default as BaseLinearDisplayComponent,
|
|
10
10
|
Tooltip,
|
|
11
|
+
BlockMsg,
|
|
11
12
|
} from './components/BaseLinearDisplay'
|
|
@@ -11,12 +11,13 @@ import {
|
|
|
11
11
|
getViewParams,
|
|
12
12
|
isSelectionContainer,
|
|
13
13
|
isSessionModelWithWidgets,
|
|
14
|
+
isFeature,
|
|
15
|
+
Feature,
|
|
14
16
|
} from '@jbrowse/core/util'
|
|
15
17
|
import { Stats } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
16
18
|
import { BaseBlock } from '@jbrowse/core/util/blockTypes'
|
|
17
19
|
import { Region } from '@jbrowse/core/util/types'
|
|
18
20
|
import CompositeMap from '@jbrowse/core/util/compositeMap'
|
|
19
|
-
import { Feature, isFeature } from '@jbrowse/core/util/simpleFeature'
|
|
20
21
|
import {
|
|
21
22
|
getParentRenderProps,
|
|
22
23
|
getRpcSessionId,
|
|
@@ -28,9 +29,9 @@ import { addDisposer, isAlive, types, Instance } from 'mobx-state-tree'
|
|
|
28
29
|
import MenuOpenIcon from '@mui/icons-material/MenuOpen'
|
|
29
30
|
|
|
30
31
|
// locals
|
|
31
|
-
import TooLargeMessage from './TooLargeMessage'
|
|
32
32
|
import { LinearGenomeViewModel, ExportSvgOptions } from '../../LinearGenomeView'
|
|
33
33
|
import { Tooltip } from '../components/BaseLinearDisplay'
|
|
34
|
+
import TooLargeMessage from '../components/TooLargeMessage'
|
|
34
35
|
import BlockState, { renderBlockData } from './serverSideRenderedBlock'
|
|
35
36
|
|
|
36
37
|
type LGV = LinearGenomeViewModel
|
|
@@ -104,10 +105,10 @@ function stateModelFactory() {
|
|
|
104
105
|
)
|
|
105
106
|
.volatile(() => ({
|
|
106
107
|
currBpPerPx: 0,
|
|
108
|
+
scrollTop: 0,
|
|
107
109
|
message: '',
|
|
108
110
|
featureIdUnderMouse: undefined as undefined | string,
|
|
109
111
|
contextMenuFeature: undefined as undefined | Feature,
|
|
110
|
-
scrollTop: 0,
|
|
111
112
|
estimatedRegionStatsP: undefined as undefined | Promise<Stats>,
|
|
112
113
|
estimatedRegionStats: undefined as undefined | Stats,
|
|
113
114
|
}))
|
|
@@ -2,13 +2,13 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* #config BaseLinearDisplay
|
|
5
|
-
* BaseLinearDisplay is a "base" config that is extended by classes like
|
|
6
|
-
*
|
|
5
|
+
* `BaseLinearDisplay` is a "base" config that is extended by classes like
|
|
6
|
+
* `LinearBasicDisplay` (used for feature tracks, etc) and `LinearBareDisplay`
|
|
7
7
|
* (more stripped down than even the basic display, not commonly used)
|
|
8
8
|
*/
|
|
9
9
|
function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const baseLinearDisplayConfigSchema = ConfigurationSchema(
|
|
12
12
|
'BaseLinearDisplay',
|
|
13
13
|
{
|
|
14
14
|
/**
|
|
@@ -37,3 +37,5 @@ export const baseLinearDisplayConfigSchema = ConfigurationSchema(
|
|
|
37
37
|
explicitIdentifier: 'displayId',
|
|
38
38
|
},
|
|
39
39
|
)
|
|
40
|
+
|
|
41
|
+
export default baseLinearDisplayConfigSchema
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface RenderProps {
|
|
2
|
+
rendererType: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3
|
+
renderArgs: { [key: string]: any } // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
4
|
+
renderProps: { [key: string]: any } // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
5
|
+
displayError: unknown
|
|
6
|
+
rpcManager: { call: Function }
|
|
7
|
+
cannotBeRenderedReason: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ErrorProps {
|
|
11
|
+
displayError: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function getDisplayStr(totalBytes: number) {
|
|
15
|
+
let displayBp
|
|
16
|
+
if (Math.floor(totalBytes / 1000000) > 0) {
|
|
17
|
+
displayBp = `${parseFloat((totalBytes / 1000000).toPrecision(3))} Mb`
|
|
18
|
+
} else if (Math.floor(totalBytes / 1000) > 0) {
|
|
19
|
+
displayBp = `${parseFloat((totalBytes / 1000).toPrecision(3))} Kb`
|
|
20
|
+
} else {
|
|
21
|
+
displayBp = `${Math.floor(totalBytes)} bytes`
|
|
22
|
+
}
|
|
23
|
+
return displayBp
|
|
24
|
+
}
|
|
@@ -5,17 +5,14 @@ import {
|
|
|
5
5
|
import PluginManager from '@jbrowse/core/PluginManager'
|
|
6
6
|
import configSchemaF from './configSchema'
|
|
7
7
|
|
|
8
|
-
export default (
|
|
9
|
-
|
|
10
|
-
const configSchema = configSchemaF(
|
|
8
|
+
export default (pm: PluginManager) => {
|
|
9
|
+
pm.addTrackType(() => {
|
|
10
|
+
const configSchema = configSchemaF(pm)
|
|
11
11
|
return new TrackType({
|
|
12
12
|
name: 'FeatureTrack',
|
|
13
|
+
displayName: 'Feature track',
|
|
13
14
|
configSchema,
|
|
14
|
-
stateModel: createBaseTrackModel(
|
|
15
|
-
pluginManager,
|
|
16
|
-
'FeatureTrack',
|
|
17
|
-
configSchema,
|
|
18
|
-
),
|
|
15
|
+
stateModel: createBaseTrackModel(pm, 'FeatureTrack', configSchema),
|
|
19
16
|
})
|
|
20
17
|
})
|
|
21
18
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { DisplayType } from '@jbrowse/core/pluggableElementTypes'
|
|
2
1
|
import PluginManager from '@jbrowse/core/PluginManager'
|
|
3
|
-
import {
|
|
2
|
+
import { DisplayType } from '@jbrowse/core/pluggableElementTypes'
|
|
3
|
+
|
|
4
|
+
// locals
|
|
4
5
|
import { configSchemaFactory } from './configSchema'
|
|
5
6
|
import { stateModelFactory } from './model'
|
|
7
|
+
import { BaseLinearDisplayComponent } from '../BaseLinearDisplay/'
|
|
6
8
|
|
|
7
9
|
export default (pluginManager: PluginManager) => {
|
|
8
10
|
pluginManager.addDisplayType(() => {
|
|
@@ -11,6 +11,7 @@ export default (pluginManager: PluginManager) => {
|
|
|
11
11
|
const config = configSchema(pluginManager)
|
|
12
12
|
return new DisplayType({
|
|
13
13
|
name: 'LinearBasicDisplay',
|
|
14
|
+
displayName: 'Basic deature display',
|
|
14
15
|
configSchema: config,
|
|
15
16
|
stateModel: modelFactory(config),
|
|
16
17
|
trackType: 'FeatureTrack',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Key LinearGenomeView state fields
|
|
2
2
|
|
|
3
|
-
- displayedRegions - array of { refName, start, end }, tiled in the display left
|
|
3
|
+
- displayedRegions - array of { refName, start, end }, tiled in the display left
|
|
4
|
+
to right
|
|
4
5
|
- offsetPx - the offset in px of the left edge of the view
|
|
5
6
|
- bpPerPx - ratio of basepairs to screen pixels
|
|
6
7
|
- width - width in px of the view
|
|
@@ -82,6 +82,8 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
|
|
|
82
82
|
try {
|
|
83
83
|
if (option?.getDisplayString() === input && option.hasLocation()) {
|
|
84
84
|
await navToOption(option)
|
|
85
|
+
} else if (option?.results?.length) {
|
|
86
|
+
model.setSearchResults(option.results, option.getLabel())
|
|
85
87
|
} else {
|
|
86
88
|
const [ref, rest] = splitLast(input, ':')
|
|
87
89
|
const allRefs = assembly?.allRefNamesWithLowerCase || []
|
|
@@ -144,6 +146,7 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
|
|
|
144
146
|
setSelectedAsm(val)
|
|
145
147
|
setValue('')
|
|
146
148
|
}}
|
|
149
|
+
localStorageKey="lgv"
|
|
147
150
|
session={session}
|
|
148
151
|
selected={selectedAsm}
|
|
149
152
|
/>
|