@jbrowse/plugin-linear-comparative-view 2.6.1 → 2.6.3
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/LGVSyntenyDisplay/configSchemaF.d.ts +1 -3
- package/dist/LGVSyntenyDisplay/configSchemaF.js +0 -1
- package/dist/LGVSyntenyDisplay/index.js +0 -1
- package/dist/LGVSyntenyDisplay/model.d.ts +17 -76
- package/dist/LGVSyntenyDisplay/model.js +22 -4
- package/dist/LaunchLinearSyntenyView.js +0 -1
- package/dist/LinearComparativeDisplay/configSchemaF.js +0 -1
- package/dist/LinearComparativeDisplay/index.js +0 -1
- package/dist/LinearComparativeDisplay/stateModelFactory.js +0 -1
- package/dist/LinearComparativeView/components/Header.js +11 -2
- package/dist/LinearComparativeView/components/LinearComparativeView.js +0 -1
- package/dist/LinearComparativeView/components/Rubberband.js +11 -33
- package/dist/LinearComparativeView/components/VerticalGuide.d.ts +8 -0
- package/dist/LinearComparativeView/components/VerticalGuide.js +33 -0
- package/dist/LinearComparativeView/index.js +0 -1
- package/dist/LinearComparativeView/model.d.ts +9 -15
- package/dist/LinearComparativeView/model.js +0 -1
- package/dist/LinearReadVsRef/LinearReadVsRef.js +0 -1
- package/dist/LinearReadVsRef/index.js +0 -1
- package/dist/LinearSyntenyDisplay/afterAttach.js +0 -1
- package/dist/LinearSyntenyDisplay/components/Component.js +0 -1
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +0 -1
- package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js +0 -1
- package/dist/LinearSyntenyDisplay/components/util.js +0 -1
- package/dist/LinearSyntenyDisplay/configSchemaF.js +0 -1
- package/dist/LinearSyntenyDisplay/drawSynteny.js +0 -1
- package/dist/LinearSyntenyDisplay/index.js +0 -1
- package/dist/LinearSyntenyDisplay/model.js +0 -1
- package/dist/LinearSyntenyView/components/ExportSvgDialog.js +0 -1
- package/dist/LinearSyntenyView/components/Icons.js +0 -1
- package/dist/LinearSyntenyView/components/ImportCustomTrack.js +0 -1
- package/dist/LinearSyntenyView/components/ImportForm.js +0 -1
- package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +0 -1
- package/dist/LinearSyntenyView/components/LinearSyntenyView.js +0 -1
- package/dist/LinearSyntenyView/index.js +0 -1
- package/dist/LinearSyntenyView/model.d.ts +9 -9
- package/dist/LinearSyntenyView/model.js +0 -1
- package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js +2 -2
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +0 -1
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +0 -1
- package/dist/SyntenyFeatureDetail/index.js +0 -1
- package/dist/SyntenyTrack/configSchema.js +0 -1
- package/dist/SyntenyTrack/index.js +0 -1
- package/dist/index.js +0 -1
- package/dist/util.js +0 -1
- package/esm/LGVSyntenyDisplay/configSchemaF.d.ts +1 -3
- package/esm/LGVSyntenyDisplay/configSchemaF.js +0 -1
- package/esm/LGVSyntenyDisplay/index.js +0 -1
- package/esm/LGVSyntenyDisplay/model.d.ts +17 -76
- package/esm/LGVSyntenyDisplay/model.js +23 -5
- package/esm/LaunchLinearSyntenyView.js +0 -1
- package/esm/LinearComparativeDisplay/configSchemaF.js +0 -1
- package/esm/LinearComparativeDisplay/index.js +0 -1
- package/esm/LinearComparativeDisplay/stateModelFactory.js +0 -1
- package/esm/LinearComparativeView/components/Header.js +11 -2
- package/esm/LinearComparativeView/components/LinearComparativeView.js +0 -1
- package/esm/LinearComparativeView/components/Rubberband.js +8 -33
- package/esm/LinearComparativeView/components/VerticalGuide.d.ts +8 -0
- package/esm/LinearComparativeView/components/VerticalGuide.js +28 -0
- package/esm/LinearComparativeView/index.js +0 -1
- package/esm/LinearComparativeView/model.d.ts +9 -15
- package/esm/LinearComparativeView/model.js +0 -1
- package/esm/LinearReadVsRef/LinearReadVsRef.js +0 -1
- package/esm/LinearReadVsRef/index.js +0 -1
- package/esm/LinearSyntenyDisplay/afterAttach.js +0 -1
- package/esm/LinearSyntenyDisplay/components/Component.js +0 -1
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +0 -1
- package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js +0 -1
- package/esm/LinearSyntenyDisplay/components/util.js +0 -1
- package/esm/LinearSyntenyDisplay/configSchemaF.js +0 -1
- package/esm/LinearSyntenyDisplay/drawSynteny.js +0 -1
- package/esm/LinearSyntenyDisplay/index.js +0 -1
- package/esm/LinearSyntenyDisplay/model.js +0 -1
- package/esm/LinearSyntenyView/components/ExportSvgDialog.js +0 -1
- package/esm/LinearSyntenyView/components/Icons.js +0 -1
- package/esm/LinearSyntenyView/components/ImportCustomTrack.js +0 -1
- package/esm/LinearSyntenyView/components/ImportForm.js +0 -1
- package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +0 -1
- package/esm/LinearSyntenyView/components/LinearSyntenyView.js +0 -1
- package/esm/LinearSyntenyView/index.js +0 -1
- package/esm/LinearSyntenyView/model.d.ts +9 -9
- package/esm/LinearSyntenyView/model.js +0 -1
- package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js +2 -2
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +0 -1
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +0 -1
- package/esm/SyntenyFeatureDetail/index.js +0 -1
- package/esm/SyntenyTrack/configSchema.js +0 -1
- package/esm/SyntenyTrack/index.js +0 -1
- package/esm/index.js +0 -1
- package/esm/util.js +0 -1
- package/package.json +4 -4
- package/dist/LGVSyntenyDisplay/configSchemaF.js.map +0 -1
- package/dist/LGVSyntenyDisplay/index.js.map +0 -1
- package/dist/LGVSyntenyDisplay/model.js.map +0 -1
- package/dist/LaunchLinearSyntenyView.js.map +0 -1
- package/dist/LinearComparativeDisplay/configSchemaF.js.map +0 -1
- package/dist/LinearComparativeDisplay/index.js.map +0 -1
- package/dist/LinearComparativeDisplay/stateModelFactory.js.map +0 -1
- package/dist/LinearComparativeView/components/Header.js.map +0 -1
- package/dist/LinearComparativeView/components/LinearComparativeView.js.map +0 -1
- package/dist/LinearComparativeView/components/Rubberband.js.map +0 -1
- package/dist/LinearComparativeView/index.js.map +0 -1
- package/dist/LinearComparativeView/model.js.map +0 -1
- package/dist/LinearReadVsRef/LinearReadVsRef.js.map +0 -1
- package/dist/LinearReadVsRef/index.js.map +0 -1
- package/dist/LinearSyntenyDisplay/afterAttach.js.map +0 -1
- package/dist/LinearSyntenyDisplay/components/Component.js.map +0 -1
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +0 -1
- package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +0 -1
- package/dist/LinearSyntenyDisplay/components/util.js.map +0 -1
- package/dist/LinearSyntenyDisplay/configSchemaF.js.map +0 -1
- package/dist/LinearSyntenyDisplay/drawSynteny.js.map +0 -1
- package/dist/LinearSyntenyDisplay/index.js.map +0 -1
- package/dist/LinearSyntenyDisplay/model.js.map +0 -1
- package/dist/LinearSyntenyView/components/ExportSvgDialog.js.map +0 -1
- package/dist/LinearSyntenyView/components/Icons.js.map +0 -1
- package/dist/LinearSyntenyView/components/ImportCustomTrack.js.map +0 -1
- package/dist/LinearSyntenyView/components/ImportForm.js.map +0 -1
- package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +0 -1
- package/dist/LinearSyntenyView/components/LinearSyntenyView.js.map +0 -1
- package/dist/LinearSyntenyView/index.js.map +0 -1
- package/dist/LinearSyntenyView/model.js.map +0 -1
- package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js.map +0 -1
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +0 -1
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +0 -1
- package/dist/SyntenyFeatureDetail/index.js.map +0 -1
- package/dist/SyntenyTrack/configSchema.js.map +0 -1
- package/dist/SyntenyTrack/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/util.js.map +0 -1
- package/esm/LGVSyntenyDisplay/configSchemaF.js.map +0 -1
- package/esm/LGVSyntenyDisplay/index.js.map +0 -1
- package/esm/LGVSyntenyDisplay/model.js.map +0 -1
- package/esm/LaunchLinearSyntenyView.js.map +0 -1
- package/esm/LinearComparativeDisplay/configSchemaF.js.map +0 -1
- package/esm/LinearComparativeDisplay/index.js.map +0 -1
- package/esm/LinearComparativeDisplay/stateModelFactory.js.map +0 -1
- package/esm/LinearComparativeView/components/Header.js.map +0 -1
- package/esm/LinearComparativeView/components/LinearComparativeView.js.map +0 -1
- package/esm/LinearComparativeView/components/Rubberband.js.map +0 -1
- package/esm/LinearComparativeView/index.js.map +0 -1
- package/esm/LinearComparativeView/model.js.map +0 -1
- package/esm/LinearReadVsRef/LinearReadVsRef.js.map +0 -1
- package/esm/LinearReadVsRef/index.js.map +0 -1
- package/esm/LinearSyntenyDisplay/afterAttach.js.map +0 -1
- package/esm/LinearSyntenyDisplay/components/Component.js.map +0 -1
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +0 -1
- package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +0 -1
- package/esm/LinearSyntenyDisplay/components/util.js.map +0 -1
- package/esm/LinearSyntenyDisplay/configSchemaF.js.map +0 -1
- package/esm/LinearSyntenyDisplay/drawSynteny.js.map +0 -1
- package/esm/LinearSyntenyDisplay/index.js.map +0 -1
- package/esm/LinearSyntenyDisplay/model.js.map +0 -1
- package/esm/LinearSyntenyView/components/ExportSvgDialog.js.map +0 -1
- package/esm/LinearSyntenyView/components/Icons.js.map +0 -1
- package/esm/LinearSyntenyView/components/ImportCustomTrack.js.map +0 -1
- package/esm/LinearSyntenyView/components/ImportForm.js.map +0 -1
- package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +0 -1
- package/esm/LinearSyntenyView/components/LinearSyntenyView.js.map +0 -1
- package/esm/LinearSyntenyView/index.js.map +0 -1
- package/esm/LinearSyntenyView/model.js.map +0 -1
- package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js.map +0 -1
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +0 -1
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +0 -1
- package/esm/SyntenyFeatureDetail/index.js.map +0 -1
- package/esm/SyntenyTrack/configSchema.js.map +0 -1
- package/esm/SyntenyTrack/index.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/util.js.map +0 -1
- package/src/LGVSyntenyDisplay/configSchemaF.ts +0 -22
- package/src/LGVSyntenyDisplay/index.ts +0 -20
- package/src/LGVSyntenyDisplay/model.ts +0 -177
- package/src/LaunchLinearSyntenyView.ts +0 -86
- package/src/LinearComparativeDisplay/configSchemaF.ts +0 -22
- package/src/LinearComparativeDisplay/index.ts +0 -21
- package/src/LinearComparativeDisplay/stateModelFactory.ts +0 -212
- package/src/LinearComparativeView/components/Header.tsx +0 -103
- package/src/LinearComparativeView/components/LinearComparativeView.tsx +0 -152
- package/src/LinearComparativeView/components/Rubberband.tsx +0 -329
- package/src/LinearComparativeView/index.ts +0 -15
- package/src/LinearComparativeView/model.ts +0 -395
- package/src/LinearReadVsRef/LinearReadVsRef.tsx +0 -360
- package/src/LinearReadVsRef/index.ts +0 -58
- package/src/LinearSyntenyDisplay/afterAttach.ts +0 -149
- package/src/LinearSyntenyDisplay/components/Component.tsx +0 -75
- package/src/LinearSyntenyDisplay/components/LinearSyntenyRendering.tsx +0 -200
- package/src/LinearSyntenyDisplay/components/SyntenyTooltip.tsx +0 -82
- package/src/LinearSyntenyDisplay/components/util.ts +0 -142
- package/src/LinearSyntenyDisplay/configSchemaF.ts +0 -38
- package/src/LinearSyntenyDisplay/drawSynteny.ts +0 -266
- package/src/LinearSyntenyDisplay/index.ts +0 -21
- package/src/LinearSyntenyDisplay/model.ts +0 -187
- package/src/LinearSyntenyView/components/ExportSvgDialog.tsx +0 -148
- package/src/LinearSyntenyView/components/Icons.tsx +0 -24
- package/src/LinearSyntenyView/components/ImportCustomTrack.tsx +0 -262
- package/src/LinearSyntenyView/components/ImportForm.tsx +0 -221
- package/src/LinearSyntenyView/components/ImportSyntenyTrackSelector.tsx +0 -82
- package/src/LinearSyntenyView/components/LinearSyntenyView.tsx +0 -20
- package/src/LinearSyntenyView/index.ts +0 -15
- package/src/LinearSyntenyView/model.test.ts +0 -1605
- package/src/LinearSyntenyView/model.ts +0 -169
- package/src/LinearSyntenyView/svgcomponents/SVGBackground.tsx +0 -21
- package/src/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.tsx +0 -176
- package/src/SyntenyFeatureDetail/SyntenyFeatureDetail.tsx +0 -64
- package/src/SyntenyFeatureDetail/index.ts +0 -36
- package/src/SyntenyTrack/configSchema.ts +0 -23
- package/src/SyntenyTrack/index.tsx +0 -15
- package/src/index.tsx +0 -42
- package/src/util.ts +0 -124
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { makeStyles } from 'tss-react/mui'
|
|
3
|
-
import { observer } from 'mobx-react'
|
|
4
|
-
import { getConf, AnyConfigurationModel } from '@jbrowse/core/configuration'
|
|
5
|
-
import { getEnv } from '@jbrowse/core/util'
|
|
6
|
-
import { ResizeHandle } from '@jbrowse/core/ui'
|
|
7
|
-
|
|
8
|
-
// locals
|
|
9
|
-
import { LinearComparativeViewModel } from '../model'
|
|
10
|
-
import Rubberband from './Rubberband'
|
|
11
|
-
import Header from './Header'
|
|
12
|
-
|
|
13
|
-
const useStyles = makeStyles()(theme => ({
|
|
14
|
-
container: {
|
|
15
|
-
display: 'grid',
|
|
16
|
-
},
|
|
17
|
-
overlay: {
|
|
18
|
-
zIndex: 100,
|
|
19
|
-
gridArea: '1/1',
|
|
20
|
-
},
|
|
21
|
-
content: {
|
|
22
|
-
gridArea: '1/1',
|
|
23
|
-
position: 'relative',
|
|
24
|
-
},
|
|
25
|
-
grid: {
|
|
26
|
-
display: 'grid',
|
|
27
|
-
},
|
|
28
|
-
relative: {
|
|
29
|
-
position: 'relative',
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
// this helps keep the vertical guide inside the parent view container,
|
|
33
|
-
// similar style exists in the single LGV's trackscontainer
|
|
34
|
-
rubberbandContainer: {
|
|
35
|
-
position: 'relative',
|
|
36
|
-
overflow: 'hidden',
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
rubberbandDiv: {
|
|
40
|
-
width: '100%',
|
|
41
|
-
background: theme.palette.action.disabledBackground,
|
|
42
|
-
height: 15,
|
|
43
|
-
'&:hover': {
|
|
44
|
-
background: theme.palette.action.selected,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
}))
|
|
48
|
-
|
|
49
|
-
type LCV = LinearComparativeViewModel
|
|
50
|
-
|
|
51
|
-
const Overlays = observer(({ model }: { model: LCV }) => {
|
|
52
|
-
const { classes } = useStyles()
|
|
53
|
-
return (
|
|
54
|
-
<>
|
|
55
|
-
{model.tracks.map(track => {
|
|
56
|
-
const [display] = track.displays
|
|
57
|
-
const { RenderingComponent } = display
|
|
58
|
-
const trackId = getConf(track, 'trackId')
|
|
59
|
-
return RenderingComponent ? (
|
|
60
|
-
<div
|
|
61
|
-
className={classes.overlay}
|
|
62
|
-
key={trackId}
|
|
63
|
-
style={{
|
|
64
|
-
height: model.middleComparativeHeight,
|
|
65
|
-
overflow: 'hidden',
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
<RenderingComponent model={display} />
|
|
69
|
-
</div>
|
|
70
|
-
) : null
|
|
71
|
-
})}
|
|
72
|
-
</>
|
|
73
|
-
)
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
// The comparative is in the middle of the views
|
|
77
|
-
const MiddleComparativeView = observer(({ model }: { model: LCV }) => {
|
|
78
|
-
const { classes } = useStyles()
|
|
79
|
-
const { views } = model
|
|
80
|
-
const { pluginManager } = getEnv(model)
|
|
81
|
-
const { ReactComponent } = pluginManager.getViewType(views[0].type)
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<div className={classes.rubberbandContainer}>
|
|
85
|
-
<Header model={model} />
|
|
86
|
-
<Rubberband
|
|
87
|
-
model={model}
|
|
88
|
-
ControlComponent={<div className={classes.rubberbandDiv} />}
|
|
89
|
-
/>
|
|
90
|
-
<div className={classes.container}>
|
|
91
|
-
<ReactComponent model={views[0]} />
|
|
92
|
-
<div className={classes.grid}>
|
|
93
|
-
<Overlays model={model} />
|
|
94
|
-
</div>
|
|
95
|
-
<ResizeHandle
|
|
96
|
-
onDrag={n =>
|
|
97
|
-
model.setMiddleComparativeHeight(model.middleComparativeHeight + n)
|
|
98
|
-
}
|
|
99
|
-
style={{
|
|
100
|
-
height: 4,
|
|
101
|
-
background: '#ccc',
|
|
102
|
-
}}
|
|
103
|
-
/>
|
|
104
|
-
<ReactComponent model={views[1]} />
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
)
|
|
108
|
-
})
|
|
109
|
-
const OverlayComparativeView = observer(({ model }: { model: LCV }) => {
|
|
110
|
-
const { classes } = useStyles()
|
|
111
|
-
const { views } = model
|
|
112
|
-
const { pluginManager } = getEnv(model)
|
|
113
|
-
return (
|
|
114
|
-
<div className={classes.rubberbandContainer}>
|
|
115
|
-
<Header model={model} />
|
|
116
|
-
<Rubberband
|
|
117
|
-
model={model}
|
|
118
|
-
ControlComponent={<div className={classes.rubberbandDiv} />}
|
|
119
|
-
/>
|
|
120
|
-
|
|
121
|
-
<div className={classes.container}>
|
|
122
|
-
<div className={classes.content}>
|
|
123
|
-
<div className={classes.relative}>
|
|
124
|
-
{views.map(view => {
|
|
125
|
-
const { ReactComponent } = pluginManager.getViewType(view.type)
|
|
126
|
-
return <ReactComponent key={view.id} model={view} />
|
|
127
|
-
})}
|
|
128
|
-
</div>
|
|
129
|
-
<Overlays model={model} />
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
)
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
export default observer(function (props: {
|
|
137
|
-
ExtraButtons?: React.ReactNode
|
|
138
|
-
model: LCV
|
|
139
|
-
}) {
|
|
140
|
-
const { model } = props
|
|
141
|
-
|
|
142
|
-
const middle = model.tracks.some(({ displays }) =>
|
|
143
|
-
displays.some((d: { configuration: AnyConfigurationModel }) =>
|
|
144
|
-
getConf(d, 'middle'),
|
|
145
|
-
),
|
|
146
|
-
)
|
|
147
|
-
return middle ? (
|
|
148
|
-
<MiddleComparativeView {...props} />
|
|
149
|
-
) : (
|
|
150
|
-
<OverlayComparativeView {...props} />
|
|
151
|
-
)
|
|
152
|
-
})
|
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useState } from 'react'
|
|
2
|
-
import { observer } from 'mobx-react'
|
|
3
|
-
import { Popover, Tooltip, Typography, alpha } from '@mui/material'
|
|
4
|
-
import { makeStyles } from 'tss-react/mui'
|
|
5
|
-
import { stringify } from '@jbrowse/core/util'
|
|
6
|
-
import { Menu } from '@jbrowse/core/ui'
|
|
7
|
-
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
8
|
-
import { LinearComparativeViewModel } from '../model'
|
|
9
|
-
|
|
10
|
-
type LCV = LinearComparativeViewModel
|
|
11
|
-
type LGV = LinearGenomeViewModel
|
|
12
|
-
|
|
13
|
-
const useStyles = makeStyles()(theme => {
|
|
14
|
-
const { tertiary, primary } = theme.palette
|
|
15
|
-
const background = tertiary
|
|
16
|
-
? alpha(tertiary.main, 0.7)
|
|
17
|
-
: alpha(primary.main, 0.7)
|
|
18
|
-
return {
|
|
19
|
-
rubberband: {
|
|
20
|
-
height: '100%',
|
|
21
|
-
background,
|
|
22
|
-
position: 'absolute',
|
|
23
|
-
zIndex: 10,
|
|
24
|
-
textAlign: 'center',
|
|
25
|
-
overflow: 'hidden',
|
|
26
|
-
},
|
|
27
|
-
rubberbandControl: {
|
|
28
|
-
cursor: 'crosshair',
|
|
29
|
-
width: '100%',
|
|
30
|
-
minHeight: 8,
|
|
31
|
-
},
|
|
32
|
-
rubberbandText: {
|
|
33
|
-
color: tertiary ? tertiary.contrastText : primary.contrastText,
|
|
34
|
-
},
|
|
35
|
-
popover: {
|
|
36
|
-
mouseEvents: 'none',
|
|
37
|
-
cursor: 'crosshair',
|
|
38
|
-
},
|
|
39
|
-
paper: {
|
|
40
|
-
paddingLeft: theme.spacing(1),
|
|
41
|
-
paddingRight: theme.spacing(1),
|
|
42
|
-
},
|
|
43
|
-
guide: {
|
|
44
|
-
pointerEvents: 'none',
|
|
45
|
-
height: '100%',
|
|
46
|
-
width: 1,
|
|
47
|
-
position: 'absolute',
|
|
48
|
-
zIndex: 10,
|
|
49
|
-
},
|
|
50
|
-
sm: {
|
|
51
|
-
fontSize: 10,
|
|
52
|
-
},
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
const VerticalGuide = observer(
|
|
57
|
-
({ model, coordX }: { model: LCV; coordX: number }) => {
|
|
58
|
-
const { classes } = useStyles()
|
|
59
|
-
return (
|
|
60
|
-
<Tooltip
|
|
61
|
-
open
|
|
62
|
-
placement="top"
|
|
63
|
-
title={model.views
|
|
64
|
-
.map(view => view.pxToBp(coordX))
|
|
65
|
-
.map(elt => (
|
|
66
|
-
<Typography className={classes.sm} key={JSON.stringify(elt)}>
|
|
67
|
-
{stringify(elt)}
|
|
68
|
-
</Typography>
|
|
69
|
-
))}
|
|
70
|
-
arrow
|
|
71
|
-
>
|
|
72
|
-
<div
|
|
73
|
-
className={classes.guide}
|
|
74
|
-
style={{
|
|
75
|
-
left: coordX,
|
|
76
|
-
background: 'red',
|
|
77
|
-
}}
|
|
78
|
-
/>
|
|
79
|
-
</Tooltip>
|
|
80
|
-
)
|
|
81
|
-
},
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
function Rubberband({
|
|
85
|
-
model,
|
|
86
|
-
ControlComponent = <div />,
|
|
87
|
-
}: {
|
|
88
|
-
model: LCV
|
|
89
|
-
ControlComponent?: React.ReactElement
|
|
90
|
-
}) {
|
|
91
|
-
const [startX, setStartX] = useState<number>()
|
|
92
|
-
const [currentX, setCurrentX] = useState<number>()
|
|
93
|
-
|
|
94
|
-
// clientX and clientY used for anchorPosition for menu
|
|
95
|
-
// offsetX used for calculations about width of selection
|
|
96
|
-
const [anchorPosition, setAnchorPosition] = useState<{
|
|
97
|
-
offsetX: number
|
|
98
|
-
clientX: number
|
|
99
|
-
clientY: number
|
|
100
|
-
}>()
|
|
101
|
-
const [guideX, setGuideX] = useState<number>()
|
|
102
|
-
const controlsRef = useRef<HTMLDivElement>(null)
|
|
103
|
-
const rubberbandRef = useRef(null)
|
|
104
|
-
const { classes } = useStyles()
|
|
105
|
-
const mouseDragging = startX !== undefined && anchorPosition === undefined
|
|
106
|
-
|
|
107
|
-
useEffect(() => {
|
|
108
|
-
function computeOffsets(offsetX: number, view: LGV) {
|
|
109
|
-
if (startX === undefined) {
|
|
110
|
-
return
|
|
111
|
-
}
|
|
112
|
-
let leftPx = startX
|
|
113
|
-
let rightPx = offsetX
|
|
114
|
-
// handles clicking and dragging to the left
|
|
115
|
-
if (rightPx < leftPx) {
|
|
116
|
-
;[leftPx, rightPx] = [rightPx, leftPx]
|
|
117
|
-
}
|
|
118
|
-
const leftOffset = view.pxToBp(leftPx)
|
|
119
|
-
const rightOffset = view.pxToBp(rightPx)
|
|
120
|
-
|
|
121
|
-
return { leftOffset, rightOffset }
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function globalMouseMove(event: MouseEvent) {
|
|
125
|
-
if (controlsRef.current && mouseDragging) {
|
|
126
|
-
const relativeX =
|
|
127
|
-
event.clientX - controlsRef.current.getBoundingClientRect().left
|
|
128
|
-
setCurrentX(relativeX)
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function globalMouseUp(event: MouseEvent) {
|
|
133
|
-
if (startX !== undefined && controlsRef.current) {
|
|
134
|
-
const { clientX, clientY } = event
|
|
135
|
-
const ref = controlsRef.current
|
|
136
|
-
const offsetX = clientX - ref.getBoundingClientRect().left
|
|
137
|
-
// as stated above, store both clientX/Y and offsetX for different
|
|
138
|
-
// purposes
|
|
139
|
-
setAnchorPosition({
|
|
140
|
-
offsetX,
|
|
141
|
-
clientX,
|
|
142
|
-
clientY,
|
|
143
|
-
})
|
|
144
|
-
model.views.forEach(view => {
|
|
145
|
-
const args = computeOffsets(offsetX, view)
|
|
146
|
-
if (args) {
|
|
147
|
-
const { leftOffset, rightOffset } = args
|
|
148
|
-
view.setOffsets(leftOffset, rightOffset)
|
|
149
|
-
}
|
|
150
|
-
})
|
|
151
|
-
setGuideX(undefined)
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (mouseDragging) {
|
|
155
|
-
window.addEventListener('mousemove', globalMouseMove)
|
|
156
|
-
window.addEventListener('mouseup', globalMouseUp)
|
|
157
|
-
return () => {
|
|
158
|
-
window.removeEventListener('mousemove', globalMouseMove)
|
|
159
|
-
window.removeEventListener('mouseup', globalMouseUp)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return () => {}
|
|
163
|
-
}, [startX, mouseDragging, anchorPosition, model])
|
|
164
|
-
|
|
165
|
-
useEffect(() => {
|
|
166
|
-
if (
|
|
167
|
-
!mouseDragging &&
|
|
168
|
-
currentX !== undefined &&
|
|
169
|
-
startX !== undefined &&
|
|
170
|
-
Math.abs(currentX - startX) <= 3
|
|
171
|
-
) {
|
|
172
|
-
handleClose()
|
|
173
|
-
}
|
|
174
|
-
}, [mouseDragging, currentX, startX])
|
|
175
|
-
|
|
176
|
-
function mouseDown(event: React.MouseEvent<HTMLDivElement>) {
|
|
177
|
-
event.preventDefault()
|
|
178
|
-
event.stopPropagation()
|
|
179
|
-
const relativeX =
|
|
180
|
-
event.clientX -
|
|
181
|
-
(event.target as HTMLDivElement).getBoundingClientRect().left
|
|
182
|
-
setStartX(relativeX)
|
|
183
|
-
setCurrentX(relativeX)
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function mouseMove(event: React.MouseEvent<HTMLDivElement>) {
|
|
187
|
-
const target = event.target as HTMLDivElement
|
|
188
|
-
setGuideX(event.clientX - target.getBoundingClientRect().left)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function mouseOut() {
|
|
192
|
-
setGuideX(undefined)
|
|
193
|
-
model.views.forEach(view => view.setOffsets(undefined, undefined))
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function handleClose() {
|
|
197
|
-
setAnchorPosition(undefined)
|
|
198
|
-
setStartX(undefined)
|
|
199
|
-
setCurrentX(undefined)
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const open = Boolean(anchorPosition)
|
|
203
|
-
|
|
204
|
-
function handleMenuItemClick(_: unknown, callback: Function) {
|
|
205
|
-
callback()
|
|
206
|
-
handleClose()
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (startX === undefined) {
|
|
210
|
-
return (
|
|
211
|
-
<>
|
|
212
|
-
{guideX !== undefined ? (
|
|
213
|
-
<VerticalGuide model={model} coordX={guideX} />
|
|
214
|
-
) : null}
|
|
215
|
-
<div
|
|
216
|
-
data-testid="rubberband_controls"
|
|
217
|
-
className={classes.rubberbandControl}
|
|
218
|
-
role="presentation"
|
|
219
|
-
ref={controlsRef}
|
|
220
|
-
onMouseDown={mouseDown}
|
|
221
|
-
onMouseOut={mouseOut}
|
|
222
|
-
onMouseMove={mouseMove}
|
|
223
|
-
>
|
|
224
|
-
{ControlComponent}
|
|
225
|
-
</div>
|
|
226
|
-
</>
|
|
227
|
-
)
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/* Calculating Pixels for Mouse Dragging */
|
|
231
|
-
const right = anchorPosition ? anchorPosition.offsetX : currentX || 0
|
|
232
|
-
const left = right < startX ? right : startX
|
|
233
|
-
const width = Math.abs(right - startX)
|
|
234
|
-
const { views } = model
|
|
235
|
-
const leftBpOffset = views.map(view => view.pxToBp(left))
|
|
236
|
-
const rightBpOffset = views.map(view => view.pxToBp(left + width))
|
|
237
|
-
const numOfBpSelected = views.map(view => Math.ceil(width * view.bpPerPx))
|
|
238
|
-
return (
|
|
239
|
-
<>
|
|
240
|
-
{rubberbandRef.current ? (
|
|
241
|
-
<>
|
|
242
|
-
<Popover
|
|
243
|
-
className={classes.popover}
|
|
244
|
-
classes={{
|
|
245
|
-
paper: classes.paper,
|
|
246
|
-
}}
|
|
247
|
-
open
|
|
248
|
-
anchorEl={rubberbandRef.current}
|
|
249
|
-
anchorOrigin={{
|
|
250
|
-
vertical: 'top',
|
|
251
|
-
horizontal: 'left',
|
|
252
|
-
}}
|
|
253
|
-
transformOrigin={{
|
|
254
|
-
vertical: 'bottom',
|
|
255
|
-
horizontal: 'right',
|
|
256
|
-
}}
|
|
257
|
-
keepMounted
|
|
258
|
-
disableRestoreFocus
|
|
259
|
-
>
|
|
260
|
-
{leftBpOffset.map(l => (
|
|
261
|
-
<Typography key={JSON.stringify(l)}>{stringify(l)}</Typography>
|
|
262
|
-
))}
|
|
263
|
-
</Popover>
|
|
264
|
-
<Popover
|
|
265
|
-
className={classes.popover}
|
|
266
|
-
classes={{
|
|
267
|
-
paper: classes.paper,
|
|
268
|
-
}}
|
|
269
|
-
open
|
|
270
|
-
anchorEl={rubberbandRef.current}
|
|
271
|
-
anchorOrigin={{
|
|
272
|
-
vertical: 'top',
|
|
273
|
-
horizontal: 'right',
|
|
274
|
-
}}
|
|
275
|
-
transformOrigin={{
|
|
276
|
-
vertical: 'bottom',
|
|
277
|
-
horizontal: 'left',
|
|
278
|
-
}}
|
|
279
|
-
keepMounted
|
|
280
|
-
disableRestoreFocus
|
|
281
|
-
>
|
|
282
|
-
{rightBpOffset.map(l => (
|
|
283
|
-
<Typography key={JSON.stringify(l)}>{stringify(l)}</Typography>
|
|
284
|
-
))}
|
|
285
|
-
</Popover>
|
|
286
|
-
</>
|
|
287
|
-
) : null}
|
|
288
|
-
<div
|
|
289
|
-
ref={rubberbandRef}
|
|
290
|
-
className={classes.rubberband}
|
|
291
|
-
style={{ left, width }}
|
|
292
|
-
>
|
|
293
|
-
<Typography variant="h6" className={classes.rubberbandText}>
|
|
294
|
-
{numOfBpSelected.map((n, i) => (
|
|
295
|
-
<Typography key={`${n}_${i}`}>{`${n.toLocaleString(
|
|
296
|
-
'en-US',
|
|
297
|
-
)}bp`}</Typography>
|
|
298
|
-
))}
|
|
299
|
-
</Typography>
|
|
300
|
-
</div>
|
|
301
|
-
<div
|
|
302
|
-
data-testid="rubberband_controls"
|
|
303
|
-
className={classes.rubberbandControl}
|
|
304
|
-
role="presentation"
|
|
305
|
-
ref={controlsRef}
|
|
306
|
-
onMouseDown={mouseDown}
|
|
307
|
-
onMouseOut={mouseOut}
|
|
308
|
-
onMouseMove={mouseMove}
|
|
309
|
-
>
|
|
310
|
-
{ControlComponent}
|
|
311
|
-
</div>
|
|
312
|
-
{anchorPosition ? (
|
|
313
|
-
<Menu
|
|
314
|
-
anchorReference="anchorPosition"
|
|
315
|
-
anchorPosition={{
|
|
316
|
-
left: anchorPosition.clientX,
|
|
317
|
-
top: anchorPosition.clientY,
|
|
318
|
-
}}
|
|
319
|
-
onMenuItemClick={handleMenuItemClick}
|
|
320
|
-
open={open}
|
|
321
|
-
onClose={handleClose}
|
|
322
|
-
menuItems={model.rubberBandMenuItems()}
|
|
323
|
-
/>
|
|
324
|
-
) : null}
|
|
325
|
-
</>
|
|
326
|
-
)
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export default observer(Rubberband)
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { lazy } from 'react'
|
|
2
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
3
|
-
import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'
|
|
4
|
-
import modelFactory from './model'
|
|
5
|
-
|
|
6
|
-
export default (pluginManager: PluginManager) => {
|
|
7
|
-
pluginManager.addViewType(() => {
|
|
8
|
-
return new ViewType({
|
|
9
|
-
name: 'LinearComparativeView',
|
|
10
|
-
displayName: 'Linear comparative view',
|
|
11
|
-
stateModel: modelFactory(pluginManager),
|
|
12
|
-
ReactComponent: lazy(() => import('./components/LinearComparativeView')),
|
|
13
|
-
})
|
|
14
|
-
})
|
|
15
|
-
}
|