@jbrowse/plugin-linear-genome-view 1.6.6 → 1.6.9
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/LinearBareDisplay/model.d.ts +7 -7
- package/dist/LinearBasicDisplay/model.d.ts +7 -7
- package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +6 -6
- package/dist/LinearGenomeView/components/TrackContainer.d.ts +1 -2
- package/dist/index.d.ts +21 -21
- package/dist/plugin-linear-genome-view.cjs.development.js +64 -39
- package/dist/plugin-linear-genome-view.cjs.development.js.map +1 -1
- package/dist/plugin-linear-genome-view.cjs.production.min.js +1 -1
- package/dist/plugin-linear-genome-view.cjs.production.min.js.map +1 -1
- package/dist/plugin-linear-genome-view.esm.js +64 -39
- package/dist/plugin-linear-genome-view.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +9 -12
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +21 -12
- package/src/LinearGenomeView/components/TrackContainer.tsx +46 -27
- package/src/LinearGenomeView/components/TracksContainer.tsx +0 -1
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +222 -248
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-linear-genome-view",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.9",
|
|
4
4
|
"description": "JBrowse 2 linear genome view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "f6c3d4edfadc26f7ac635a2fa7259f50f0c7e5e3"
|
|
65
65
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useState, useRef, useMemo } from 'react'
|
|
2
|
+
import { observer } from 'mobx-react'
|
|
2
3
|
import { Portal, alpha, useTheme, makeStyles } from '@material-ui/core'
|
|
3
4
|
import { getConf } from '@jbrowse/core/configuration'
|
|
4
5
|
import { Menu } from '@jbrowse/core/ui'
|
|
5
|
-
import { observer } from 'mobx-react'
|
|
6
6
|
import { usePopper } from 'react-popper'
|
|
7
7
|
|
|
8
8
|
// locals
|
|
@@ -56,7 +56,6 @@ const Tooltip = observer(
|
|
|
56
56
|
const classes = useStyles()
|
|
57
57
|
const { featureUnderMouse } = model
|
|
58
58
|
const [width, setWidth] = useState(0)
|
|
59
|
-
|
|
60
59
|
const [popperElt, setPopperElt] = useState<HTMLDivElement | null>(null)
|
|
61
60
|
|
|
62
61
|
// must be memoized a la https://github.com/popperjs/react-popper/issues/391
|
|
@@ -111,7 +110,7 @@ const BaseLinearDisplay = observer(
|
|
|
111
110
|
const classes = useStyles()
|
|
112
111
|
const theme = useTheme()
|
|
113
112
|
const ref = useRef<HTMLDivElement>(null)
|
|
114
|
-
const [clientRect, setClientRect] = useState<
|
|
113
|
+
const [clientRect, setClientRect] = useState<DOMRect>()
|
|
115
114
|
const [offsetMouseCoord, setOffsetMouseCoord] = useState<Coord>([0, 0])
|
|
116
115
|
const [clientMouseCoord, setClientMouseCoord] = useState<Coord>([0, 0])
|
|
117
116
|
const [contextCoord, setContextCoord] = useState<Coord>()
|
|
@@ -139,17 +138,15 @@ const BaseLinearDisplay = observer(
|
|
|
139
138
|
}
|
|
140
139
|
}}
|
|
141
140
|
onMouseMove={event => {
|
|
142
|
-
if (ref.current) {
|
|
143
|
-
|
|
144
|
-
setOffsetMouseCoord([
|
|
145
|
-
event.clientX - rect.left,
|
|
146
|
-
event.clientY - rect.top,
|
|
147
|
-
])
|
|
148
|
-
setClientMouseCoord([event.clientX, event.clientY])
|
|
149
|
-
setClientRect(rect)
|
|
141
|
+
if (!ref.current) {
|
|
142
|
+
return
|
|
150
143
|
}
|
|
144
|
+
const rect = ref.current.getBoundingClientRect()
|
|
145
|
+
const { left, top } = rect
|
|
146
|
+
setOffsetMouseCoord([event.clientX - left, event.clientY - top])
|
|
147
|
+
setClientMouseCoord([event.clientX, event.clientY])
|
|
148
|
+
setClientRect(rect)
|
|
151
149
|
}}
|
|
152
|
-
role="presentation"
|
|
153
150
|
>
|
|
154
151
|
{DisplayMessageComponent ? (
|
|
155
152
|
<DisplayMessageComponent model={model} />
|
|
@@ -3,6 +3,7 @@ import { observer } from 'mobx-react'
|
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
5
|
Dialog,
|
|
6
|
+
DialogActions,
|
|
6
7
|
DialogContent,
|
|
7
8
|
DialogTitle,
|
|
8
9
|
IconButton,
|
|
@@ -57,21 +58,22 @@ function SetMaxHeightDlg(props: {
|
|
|
57
58
|
<CloseIcon />
|
|
58
59
|
</IconButton>
|
|
59
60
|
</DialogTitle>
|
|
60
|
-
<DialogContent>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
<DialogContent className={classes.root}>
|
|
62
|
+
<Typography>
|
|
63
|
+
Set max height for the track. For example, you can increase this if
|
|
64
|
+
the layout says "Max height reached"
|
|
65
|
+
</Typography>
|
|
66
|
+
<TextField
|
|
67
|
+
value={max}
|
|
68
|
+
onChange={event => setMax(event.target.value)}
|
|
69
|
+
placeholder="Enter max score"
|
|
70
|
+
/>
|
|
71
|
+
<DialogActions>
|
|
70
72
|
<Button
|
|
71
73
|
variant="contained"
|
|
72
74
|
color="primary"
|
|
73
75
|
type="submit"
|
|
74
|
-
|
|
76
|
+
autoFocus
|
|
75
77
|
onClick={() => {
|
|
76
78
|
model.setMaxHeight(
|
|
77
79
|
max !== '' && !Number.isNaN(+max) ? +max : undefined,
|
|
@@ -81,7 +83,14 @@ function SetMaxHeightDlg(props: {
|
|
|
81
83
|
>
|
|
82
84
|
Submit
|
|
83
85
|
</Button>
|
|
84
|
-
|
|
86
|
+
<Button
|
|
87
|
+
variant="contained"
|
|
88
|
+
color="secondary"
|
|
89
|
+
onClick={() => handleClose()}
|
|
90
|
+
>
|
|
91
|
+
Cancel
|
|
92
|
+
</Button>
|
|
93
|
+
</DialogActions>
|
|
85
94
|
</DialogContent>
|
|
86
95
|
</Dialog>
|
|
87
96
|
)
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react'
|
|
2
|
-
import { Paper, makeStyles } from '@material-ui/core'
|
|
3
2
|
import { observer } from 'mobx-react'
|
|
4
3
|
import { isAlive } from 'mobx-state-tree'
|
|
5
|
-
import { getConf } from '@jbrowse/core/configuration'
|
|
6
4
|
import { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'
|
|
5
|
+
import { getConf } from '@jbrowse/core/configuration'
|
|
7
6
|
import { ResizeHandle } from '@jbrowse/core/ui'
|
|
8
7
|
import { useDebouncedCallback } from '@jbrowse/core/util'
|
|
9
8
|
import clsx from 'clsx'
|
|
9
|
+
import Paper from '@material-ui/core/Paper'
|
|
10
|
+
import { makeStyles } from '@material-ui/core/styles'
|
|
10
11
|
|
|
11
12
|
import { LinearGenomeViewModel, RESIZE_HANDLE_HEIGHT } from '..'
|
|
12
13
|
import TrackLabel from './TrackLabel'
|
|
13
14
|
|
|
14
15
|
const useStyles = makeStyles(theme => ({
|
|
15
|
-
root: {},
|
|
16
|
+
root: { marginTop: 2 },
|
|
16
17
|
resizeHandle: {
|
|
17
18
|
height: RESIZE_HANDLE_HEIGHT,
|
|
19
|
+
boxSizing: 'border-box',
|
|
20
|
+
position: 'relative',
|
|
18
21
|
zIndex: 2,
|
|
19
22
|
},
|
|
20
23
|
overlay: {
|
|
@@ -28,7 +31,16 @@ const useStyles = makeStyles(theme => ({
|
|
|
28
31
|
},
|
|
29
32
|
trackLabel: {
|
|
30
33
|
zIndex: 3,
|
|
31
|
-
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
// aligns with block bounderies. check for example the breakpoint split view
|
|
37
|
+
// demo to see if features align if wanting to change things
|
|
38
|
+
renderingComponentContainer: {
|
|
39
|
+
position: 'absolute',
|
|
40
|
+
// -1 offset because of the 1px border of the Paper
|
|
41
|
+
left: -1,
|
|
42
|
+
height: '100%',
|
|
43
|
+
width: '100%',
|
|
32
44
|
},
|
|
33
45
|
trackLabelInline: {
|
|
34
46
|
position: 'relative',
|
|
@@ -49,20 +61,35 @@ const useStyles = makeStyles(theme => ({
|
|
|
49
61
|
|
|
50
62
|
type LGV = LinearGenomeViewModel
|
|
51
63
|
|
|
64
|
+
const TrackContainerLabel = observer(
|
|
65
|
+
({ model, view }: { model: BaseTrackModel; view: LGV }) => {
|
|
66
|
+
const classes = useStyles()
|
|
67
|
+
const labelStyle =
|
|
68
|
+
view.trackLabels === 'overlapping'
|
|
69
|
+
? classes.trackLabelOverlap
|
|
70
|
+
: classes.trackLabelInline
|
|
71
|
+
return view.trackLabels !== 'hidden' ? (
|
|
72
|
+
<TrackLabel
|
|
73
|
+
track={model}
|
|
74
|
+
className={clsx(classes.trackLabel, labelStyle)}
|
|
75
|
+
/>
|
|
76
|
+
) : null
|
|
77
|
+
},
|
|
78
|
+
)
|
|
79
|
+
|
|
52
80
|
function TrackContainer({
|
|
53
81
|
model,
|
|
54
82
|
track,
|
|
55
83
|
}: {
|
|
56
|
-
model:
|
|
84
|
+
model: LinearGenomeViewModel
|
|
57
85
|
track: BaseTrackModel
|
|
58
86
|
}) {
|
|
59
87
|
const classes = useStyles()
|
|
60
88
|
const display = track.displays[0]
|
|
61
|
-
const {
|
|
62
|
-
model
|
|
89
|
+
const { horizontalScroll, draggingTrackId, moveTrack } = model
|
|
63
90
|
const { height } = display
|
|
64
91
|
const trackId = getConf(track, 'trackId')
|
|
65
|
-
const ref = useRef
|
|
92
|
+
const ref = useRef(null)
|
|
66
93
|
|
|
67
94
|
useEffect(() => {
|
|
68
95
|
if (ref.current) {
|
|
@@ -86,9 +113,9 @@ function TrackContainer({
|
|
|
86
113
|
const dimmed = draggingTrackId !== undefined && draggingTrackId !== display.id
|
|
87
114
|
|
|
88
115
|
return (
|
|
89
|
-
<
|
|
90
|
-
<
|
|
91
|
-
|
|
116
|
+
<Paper className={classes.root} variant="outlined">
|
|
117
|
+
<TrackContainerLabel model={track} view={model} />
|
|
118
|
+
<div
|
|
92
119
|
className={classes.trackRenderingContainer}
|
|
93
120
|
style={{ height }}
|
|
94
121
|
onScroll={event => {
|
|
@@ -96,24 +123,16 @@ function TrackContainer({
|
|
|
96
123
|
display.setScrollTop(target.scrollTop)
|
|
97
124
|
}}
|
|
98
125
|
onDragEnter={debouncedOnDragEnter}
|
|
99
|
-
data-testid={`trackRenderingContainer-${id}-${trackId}`}
|
|
126
|
+
data-testid={`trackRenderingContainer-${model.id}-${trackId}`}
|
|
100
127
|
role="presentation"
|
|
101
128
|
>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
trackLabels === 'overlapping'
|
|
108
|
-
? classes.trackLabelOverlap
|
|
109
|
-
: classes.trackLabelInline,
|
|
110
|
-
)}
|
|
111
|
-
/>
|
|
112
|
-
) : null}
|
|
113
|
-
<div ref={ref} style={{ transform: `scaleX(${model.scaleFactor})` }}>
|
|
129
|
+
<div
|
|
130
|
+
ref={ref}
|
|
131
|
+
className={classes.renderingComponentContainer}
|
|
132
|
+
style={{ transform: `scaleX(${model.scaleFactor})` }}
|
|
133
|
+
>
|
|
114
134
|
<RenderingComponent
|
|
115
135
|
model={display}
|
|
116
|
-
blockState={{}}
|
|
117
136
|
onHorizontalScroll={horizontalScroll}
|
|
118
137
|
/>
|
|
119
138
|
</div>
|
|
@@ -129,7 +148,7 @@ function TrackContainer({
|
|
|
129
148
|
<DisplayBlurb model={display} />
|
|
130
149
|
</div>
|
|
131
150
|
) : null}
|
|
132
|
-
</
|
|
151
|
+
</div>
|
|
133
152
|
<div
|
|
134
153
|
className={classes.overlay}
|
|
135
154
|
style={{
|
|
@@ -142,7 +161,7 @@ function TrackContainer({
|
|
|
142
161
|
onDrag={display.resizeHeight}
|
|
143
162
|
className={classes.resizeHandle}
|
|
144
163
|
/>
|
|
145
|
-
</
|
|
164
|
+
</Paper>
|
|
146
165
|
)
|
|
147
166
|
}
|
|
148
167
|
|