@jbrowse/plugin-linear-comparative-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.
Files changed (209) hide show
  1. package/dist/LGVSyntenyDisplay/configSchemaF.d.ts +1 -3
  2. package/dist/LGVSyntenyDisplay/configSchemaF.js +0 -1
  3. package/dist/LGVSyntenyDisplay/index.js +0 -1
  4. package/dist/LGVSyntenyDisplay/model.d.ts +4 -2
  5. package/dist/LGVSyntenyDisplay/model.js +0 -1
  6. package/dist/LaunchLinearSyntenyView.js +0 -1
  7. package/dist/LinearComparativeDisplay/configSchemaF.js +0 -1
  8. package/dist/LinearComparativeDisplay/index.js +0 -1
  9. package/dist/LinearComparativeDisplay/stateModelFactory.js +0 -1
  10. package/dist/LinearComparativeView/components/Header.js +11 -2
  11. package/dist/LinearComparativeView/components/LinearComparativeView.js +0 -1
  12. package/dist/LinearComparativeView/components/Rubberband.js +11 -33
  13. package/dist/LinearComparativeView/components/VerticalGuide.d.ts +8 -0
  14. package/dist/LinearComparativeView/components/VerticalGuide.js +33 -0
  15. package/dist/LinearComparativeView/index.js +0 -1
  16. package/dist/LinearComparativeView/model.d.ts +9 -15
  17. package/dist/LinearComparativeView/model.js +0 -1
  18. package/dist/LinearReadVsRef/LinearReadVsRef.js +0 -1
  19. package/dist/LinearReadVsRef/index.js +0 -1
  20. package/dist/LinearSyntenyDisplay/afterAttach.js +0 -1
  21. package/dist/LinearSyntenyDisplay/components/Component.js +0 -1
  22. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +0 -1
  23. package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js +0 -1
  24. package/dist/LinearSyntenyDisplay/components/util.js +0 -1
  25. package/dist/LinearSyntenyDisplay/configSchemaF.js +0 -1
  26. package/dist/LinearSyntenyDisplay/drawSynteny.js +0 -1
  27. package/dist/LinearSyntenyDisplay/index.js +0 -1
  28. package/dist/LinearSyntenyDisplay/model.js +0 -1
  29. package/dist/LinearSyntenyView/components/ExportSvgDialog.js +0 -1
  30. package/dist/LinearSyntenyView/components/Icons.js +0 -1
  31. package/dist/LinearSyntenyView/components/ImportCustomTrack.js +0 -1
  32. package/dist/LinearSyntenyView/components/ImportForm.js +0 -1
  33. package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +0 -1
  34. package/dist/LinearSyntenyView/components/LinearSyntenyView.js +0 -1
  35. package/dist/LinearSyntenyView/index.js +0 -1
  36. package/dist/LinearSyntenyView/model.d.ts +9 -9
  37. package/dist/LinearSyntenyView/model.js +0 -1
  38. package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js +0 -1
  39. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +0 -1
  40. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +0 -1
  41. package/dist/SyntenyFeatureDetail/index.js +0 -1
  42. package/dist/SyntenyTrack/configSchema.js +0 -1
  43. package/dist/SyntenyTrack/index.js +0 -1
  44. package/dist/index.js +0 -1
  45. package/dist/util.js +0 -1
  46. package/esm/LGVSyntenyDisplay/configSchemaF.d.ts +1 -3
  47. package/esm/LGVSyntenyDisplay/configSchemaF.js +0 -1
  48. package/esm/LGVSyntenyDisplay/index.js +0 -1
  49. package/esm/LGVSyntenyDisplay/model.d.ts +4 -2
  50. package/esm/LGVSyntenyDisplay/model.js +0 -1
  51. package/esm/LaunchLinearSyntenyView.js +0 -1
  52. package/esm/LinearComparativeDisplay/configSchemaF.js +0 -1
  53. package/esm/LinearComparativeDisplay/index.js +0 -1
  54. package/esm/LinearComparativeDisplay/stateModelFactory.js +0 -1
  55. package/esm/LinearComparativeView/components/Header.js +11 -2
  56. package/esm/LinearComparativeView/components/LinearComparativeView.js +0 -1
  57. package/esm/LinearComparativeView/components/Rubberband.js +8 -33
  58. package/esm/LinearComparativeView/components/VerticalGuide.d.ts +8 -0
  59. package/esm/LinearComparativeView/components/VerticalGuide.js +28 -0
  60. package/esm/LinearComparativeView/index.js +0 -1
  61. package/esm/LinearComparativeView/model.d.ts +9 -15
  62. package/esm/LinearComparativeView/model.js +0 -1
  63. package/esm/LinearReadVsRef/LinearReadVsRef.js +0 -1
  64. package/esm/LinearReadVsRef/index.js +0 -1
  65. package/esm/LinearSyntenyDisplay/afterAttach.js +0 -1
  66. package/esm/LinearSyntenyDisplay/components/Component.js +0 -1
  67. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +0 -1
  68. package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js +0 -1
  69. package/esm/LinearSyntenyDisplay/components/util.js +0 -1
  70. package/esm/LinearSyntenyDisplay/configSchemaF.js +0 -1
  71. package/esm/LinearSyntenyDisplay/drawSynteny.js +0 -1
  72. package/esm/LinearSyntenyDisplay/index.js +0 -1
  73. package/esm/LinearSyntenyDisplay/model.js +0 -1
  74. package/esm/LinearSyntenyView/components/ExportSvgDialog.js +0 -1
  75. package/esm/LinearSyntenyView/components/Icons.js +0 -1
  76. package/esm/LinearSyntenyView/components/ImportCustomTrack.js +0 -1
  77. package/esm/LinearSyntenyView/components/ImportForm.js +0 -1
  78. package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +0 -1
  79. package/esm/LinearSyntenyView/components/LinearSyntenyView.js +0 -1
  80. package/esm/LinearSyntenyView/index.js +0 -1
  81. package/esm/LinearSyntenyView/model.d.ts +9 -9
  82. package/esm/LinearSyntenyView/model.js +0 -1
  83. package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js +0 -1
  84. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +0 -1
  85. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +0 -1
  86. package/esm/SyntenyFeatureDetail/index.js +0 -1
  87. package/esm/SyntenyTrack/configSchema.js +0 -1
  88. package/esm/SyntenyTrack/index.js +0 -1
  89. package/esm/index.js +0 -1
  90. package/esm/util.js +0 -1
  91. package/package.json +3 -4
  92. package/dist/LGVSyntenyDisplay/configSchemaF.js.map +0 -1
  93. package/dist/LGVSyntenyDisplay/index.js.map +0 -1
  94. package/dist/LGVSyntenyDisplay/model.js.map +0 -1
  95. package/dist/LaunchLinearSyntenyView.js.map +0 -1
  96. package/dist/LinearComparativeDisplay/configSchemaF.js.map +0 -1
  97. package/dist/LinearComparativeDisplay/index.js.map +0 -1
  98. package/dist/LinearComparativeDisplay/stateModelFactory.js.map +0 -1
  99. package/dist/LinearComparativeView/components/Header.js.map +0 -1
  100. package/dist/LinearComparativeView/components/LinearComparativeView.js.map +0 -1
  101. package/dist/LinearComparativeView/components/Rubberband.js.map +0 -1
  102. package/dist/LinearComparativeView/index.js.map +0 -1
  103. package/dist/LinearComparativeView/model.js.map +0 -1
  104. package/dist/LinearReadVsRef/LinearReadVsRef.js.map +0 -1
  105. package/dist/LinearReadVsRef/index.js.map +0 -1
  106. package/dist/LinearSyntenyDisplay/afterAttach.js.map +0 -1
  107. package/dist/LinearSyntenyDisplay/components/Component.js.map +0 -1
  108. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +0 -1
  109. package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +0 -1
  110. package/dist/LinearSyntenyDisplay/components/util.js.map +0 -1
  111. package/dist/LinearSyntenyDisplay/configSchemaF.js.map +0 -1
  112. package/dist/LinearSyntenyDisplay/drawSynteny.js.map +0 -1
  113. package/dist/LinearSyntenyDisplay/index.js.map +0 -1
  114. package/dist/LinearSyntenyDisplay/model.js.map +0 -1
  115. package/dist/LinearSyntenyView/components/ExportSvgDialog.js.map +0 -1
  116. package/dist/LinearSyntenyView/components/Icons.js.map +0 -1
  117. package/dist/LinearSyntenyView/components/ImportCustomTrack.js.map +0 -1
  118. package/dist/LinearSyntenyView/components/ImportForm.js.map +0 -1
  119. package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +0 -1
  120. package/dist/LinearSyntenyView/components/LinearSyntenyView.js.map +0 -1
  121. package/dist/LinearSyntenyView/index.js.map +0 -1
  122. package/dist/LinearSyntenyView/model.js.map +0 -1
  123. package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js.map +0 -1
  124. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +0 -1
  125. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +0 -1
  126. package/dist/SyntenyFeatureDetail/index.js.map +0 -1
  127. package/dist/SyntenyTrack/configSchema.js.map +0 -1
  128. package/dist/SyntenyTrack/index.js.map +0 -1
  129. package/dist/index.js.map +0 -1
  130. package/dist/util.js.map +0 -1
  131. package/esm/LGVSyntenyDisplay/configSchemaF.js.map +0 -1
  132. package/esm/LGVSyntenyDisplay/index.js.map +0 -1
  133. package/esm/LGVSyntenyDisplay/model.js.map +0 -1
  134. package/esm/LaunchLinearSyntenyView.js.map +0 -1
  135. package/esm/LinearComparativeDisplay/configSchemaF.js.map +0 -1
  136. package/esm/LinearComparativeDisplay/index.js.map +0 -1
  137. package/esm/LinearComparativeDisplay/stateModelFactory.js.map +0 -1
  138. package/esm/LinearComparativeView/components/Header.js.map +0 -1
  139. package/esm/LinearComparativeView/components/LinearComparativeView.js.map +0 -1
  140. package/esm/LinearComparativeView/components/Rubberband.js.map +0 -1
  141. package/esm/LinearComparativeView/index.js.map +0 -1
  142. package/esm/LinearComparativeView/model.js.map +0 -1
  143. package/esm/LinearReadVsRef/LinearReadVsRef.js.map +0 -1
  144. package/esm/LinearReadVsRef/index.js.map +0 -1
  145. package/esm/LinearSyntenyDisplay/afterAttach.js.map +0 -1
  146. package/esm/LinearSyntenyDisplay/components/Component.js.map +0 -1
  147. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +0 -1
  148. package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +0 -1
  149. package/esm/LinearSyntenyDisplay/components/util.js.map +0 -1
  150. package/esm/LinearSyntenyDisplay/configSchemaF.js.map +0 -1
  151. package/esm/LinearSyntenyDisplay/drawSynteny.js.map +0 -1
  152. package/esm/LinearSyntenyDisplay/index.js.map +0 -1
  153. package/esm/LinearSyntenyDisplay/model.js.map +0 -1
  154. package/esm/LinearSyntenyView/components/ExportSvgDialog.js.map +0 -1
  155. package/esm/LinearSyntenyView/components/Icons.js.map +0 -1
  156. package/esm/LinearSyntenyView/components/ImportCustomTrack.js.map +0 -1
  157. package/esm/LinearSyntenyView/components/ImportForm.js.map +0 -1
  158. package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +0 -1
  159. package/esm/LinearSyntenyView/components/LinearSyntenyView.js.map +0 -1
  160. package/esm/LinearSyntenyView/index.js.map +0 -1
  161. package/esm/LinearSyntenyView/model.js.map +0 -1
  162. package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js.map +0 -1
  163. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +0 -1
  164. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +0 -1
  165. package/esm/SyntenyFeatureDetail/index.js.map +0 -1
  166. package/esm/SyntenyTrack/configSchema.js.map +0 -1
  167. package/esm/SyntenyTrack/index.js.map +0 -1
  168. package/esm/index.js.map +0 -1
  169. package/esm/util.js.map +0 -1
  170. package/src/LGVSyntenyDisplay/configSchemaF.ts +0 -22
  171. package/src/LGVSyntenyDisplay/index.ts +0 -20
  172. package/src/LGVSyntenyDisplay/model.ts +0 -177
  173. package/src/LaunchLinearSyntenyView.ts +0 -86
  174. package/src/LinearComparativeDisplay/configSchemaF.ts +0 -22
  175. package/src/LinearComparativeDisplay/index.ts +0 -21
  176. package/src/LinearComparativeDisplay/stateModelFactory.ts +0 -212
  177. package/src/LinearComparativeView/components/Header.tsx +0 -103
  178. package/src/LinearComparativeView/components/LinearComparativeView.tsx +0 -152
  179. package/src/LinearComparativeView/components/Rubberband.tsx +0 -329
  180. package/src/LinearComparativeView/index.ts +0 -15
  181. package/src/LinearComparativeView/model.ts +0 -395
  182. package/src/LinearReadVsRef/LinearReadVsRef.tsx +0 -360
  183. package/src/LinearReadVsRef/index.ts +0 -58
  184. package/src/LinearSyntenyDisplay/afterAttach.ts +0 -149
  185. package/src/LinearSyntenyDisplay/components/Component.tsx +0 -75
  186. package/src/LinearSyntenyDisplay/components/LinearSyntenyRendering.tsx +0 -200
  187. package/src/LinearSyntenyDisplay/components/SyntenyTooltip.tsx +0 -82
  188. package/src/LinearSyntenyDisplay/components/util.ts +0 -142
  189. package/src/LinearSyntenyDisplay/configSchemaF.ts +0 -38
  190. package/src/LinearSyntenyDisplay/drawSynteny.ts +0 -266
  191. package/src/LinearSyntenyDisplay/index.ts +0 -21
  192. package/src/LinearSyntenyDisplay/model.ts +0 -187
  193. package/src/LinearSyntenyView/components/ExportSvgDialog.tsx +0 -148
  194. package/src/LinearSyntenyView/components/Icons.tsx +0 -24
  195. package/src/LinearSyntenyView/components/ImportCustomTrack.tsx +0 -262
  196. package/src/LinearSyntenyView/components/ImportForm.tsx +0 -221
  197. package/src/LinearSyntenyView/components/ImportSyntenyTrackSelector.tsx +0 -82
  198. package/src/LinearSyntenyView/components/LinearSyntenyView.tsx +0 -20
  199. package/src/LinearSyntenyView/index.ts +0 -15
  200. package/src/LinearSyntenyView/model.test.ts +0 -1605
  201. package/src/LinearSyntenyView/model.ts +0 -169
  202. package/src/LinearSyntenyView/svgcomponents/SVGBackground.tsx +0 -21
  203. package/src/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.tsx +0 -176
  204. package/src/SyntenyFeatureDetail/SyntenyFeatureDetail.tsx +0 -64
  205. package/src/SyntenyFeatureDetail/index.ts +0 -36
  206. package/src/SyntenyTrack/configSchema.ts +0 -23
  207. package/src/SyntenyTrack/index.tsx +0 -15
  208. package/src/index.tsx +0 -42
  209. package/src/util.ts +0 -124
@@ -1,212 +0,0 @@
1
- import {
2
- readConfObject,
3
- ConfigurationReference,
4
- AnyConfigurationSchemaType,
5
- } from '@jbrowse/core/configuration'
6
- import { types, getSnapshot, Instance } from 'mobx-state-tree'
7
- import {
8
- dedupe,
9
- Feature,
10
- getContainingView,
11
- getSession,
12
- makeAbortableReaction,
13
- } from '@jbrowse/core/util'
14
- import { getRpcSessionId } from '@jbrowse/core/util/tracks'
15
- import { BaseDisplay } from '@jbrowse/core/pluggableElementTypes/models'
16
- import { LinearComparativeViewModel } from '../LinearComparativeView/model'
17
-
18
- /**
19
- * #stateModel LinearComparativeDisplay
20
- */
21
- function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
22
- return types
23
- .compose(
24
- 'LinearComparativeDisplay',
25
- BaseDisplay,
26
- types.model({
27
- /**
28
- * #property
29
- */
30
- type: types.literal('LinearComparativeDisplay'),
31
- /**
32
- * #property
33
- */
34
- configuration: ConfigurationReference(configSchema),
35
- /**
36
- * #property
37
- */
38
- height: 100,
39
- }),
40
- )
41
- .volatile((/* self */) => ({
42
- renderInProgress: undefined as AbortController | undefined,
43
- features: undefined as Feature[] | undefined,
44
- message: undefined as string | undefined,
45
- }))
46
- .views(self => ({
47
- /**
48
- * #getter
49
- */
50
- renderProps() {
51
- return {
52
- rpcDriverName: self.rpcDriverName,
53
- displayModel: self,
54
- highResolutionScaling: 2,
55
- }
56
- },
57
- }))
58
- .actions(self => {
59
- let renderInProgress: undefined | AbortController
60
-
61
- return {
62
- /**
63
- * #action
64
- * controlled by a reaction
65
- */
66
- setLoading(abortController: AbortController) {
67
- self.message = undefined
68
- self.error = undefined
69
- renderInProgress = abortController
70
- },
71
-
72
- /**
73
- * #action
74
- * controlled by a reaction
75
- */
76
- setMessage(messageText: string) {
77
- if (renderInProgress && !renderInProgress.signal.aborted) {
78
- renderInProgress.abort()
79
- }
80
- self.message = messageText
81
- self.error = undefined
82
- renderInProgress = undefined
83
- },
84
-
85
- /**
86
- * #action
87
- * controlled by a reaction
88
- */
89
- setRendered(args?: { features: Feature[] }) {
90
- if (!args) {
91
- return
92
- }
93
- const { features } = args
94
- const existingFeatures = self.features || []
95
-
96
- const featIds = new Set(existingFeatures.map(f => f.id()) || [])
97
- const newFeatIds = new Set(features?.map(f => f.id()) || [])
98
-
99
- let foundNewFeatureNotInExistingMap = false
100
- let foundExistingFeatureNotInNewMap = false
101
- for (let i = 0; i < features.length; i++) {
102
- if (!featIds.has(features[i].id())) {
103
- foundNewFeatureNotInExistingMap = true
104
- break
105
- }
106
- }
107
- for (let i = 0; i < existingFeatures.length; i++) {
108
- if (!newFeatIds.has(existingFeatures[i].id())) {
109
- foundExistingFeatureNotInNewMap = true
110
- break
111
- }
112
- }
113
-
114
- self.message = undefined
115
- self.error = undefined
116
- renderInProgress = undefined
117
-
118
- if (
119
- foundNewFeatureNotInExistingMap ||
120
- foundExistingFeatureNotInNewMap ||
121
- !self.features
122
- ) {
123
- self.features = features
124
- }
125
- },
126
-
127
- /**
128
- * #action
129
- * controlled by a reaction
130
- */
131
- setError(error: unknown) {
132
- console.error(error)
133
- if (renderInProgress && !renderInProgress.signal.aborted) {
134
- renderInProgress.abort()
135
- }
136
- // the rendering failed for some reason
137
- self.message = undefined
138
- self.error = error
139
- renderInProgress = undefined
140
- },
141
- }
142
- })
143
- .actions(self => ({
144
- afterAttach() {
145
- makeAbortableReaction(
146
- // @ts-expect-error
147
- self,
148
- renderBlockData,
149
- renderBlockEffect,
150
- {
151
- name: `${self.type} ${self.id} rendering`,
152
- delay: 1000,
153
- fireImmediately: true,
154
- },
155
- self.setLoading,
156
- self.setRendered,
157
- self.setError,
158
- )
159
- },
160
- }))
161
- }
162
- function renderBlockData(self: LinearComparativeDisplay) {
163
- const { rpcManager } = getSession(self)
164
- const display = self
165
-
166
- // Alternative to readConfObject(config) is below used because renderProps is
167
- // something under our control. Compare to serverSideRenderedBlock
168
- readConfObject(self.configuration)
169
-
170
- const { adapterConfig } = self
171
- const parent = getContainingView(self) as LinearComparativeViewModel
172
- const sessionId = getRpcSessionId(self)
173
- getSnapshot(parent)
174
-
175
- return parent.initialized
176
- ? {
177
- rpcManager,
178
- renderProps: {
179
- ...display.renderProps(),
180
- view: parent,
181
- adapterConfig,
182
- sessionId,
183
- timeout: 1000000,
184
- self,
185
- },
186
- }
187
- : undefined
188
- }
189
-
190
- async function renderBlockEffect(props: ReturnType<typeof renderBlockData>) {
191
- if (!props) {
192
- return
193
- }
194
-
195
- const { rpcManager, renderProps } = props
196
- const { adapterConfig } = renderProps
197
- const view0 = renderProps.view.views[0]
198
-
199
- const features = (await rpcManager.call('getFeats', 'CoreGetFeatures', {
200
- regions: view0.staticBlocks.contentBlocks,
201
- sessionId: 'getFeats',
202
- adapterConfig,
203
- })) as Feature[]
204
-
205
- return {
206
- features: dedupe(features, f => f.id()),
207
- }
208
- }
209
-
210
- export default stateModelFactory
211
- export type LinearComparativeDisplayModel = ReturnType<typeof stateModelFactory>
212
- export type LinearComparativeDisplay = Instance<LinearComparativeDisplayModel>
@@ -1,103 +0,0 @@
1
- import React, { useState } from 'react'
2
- import { IconButton, Typography } from '@mui/material'
3
- import { makeStyles } from 'tss-react/mui'
4
- import { SearchBox } from '@jbrowse/plugin-linear-genome-view'
5
- import { observer } from 'mobx-react'
6
- import { Menu } from '@jbrowse/core/ui'
7
-
8
- // icons
9
- import MoreVertIcon from '@mui/icons-material/MoreVert'
10
-
11
- // locals
12
- import { LinearComparativeViewModel } from '../model'
13
- import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
14
-
15
- type LCV = LinearComparativeViewModel
16
-
17
- const useStyles = makeStyles()(() => ({
18
- headerBar: {
19
- gridArea: '1/1/auto/span 2',
20
- display: 'flex',
21
- },
22
- spacer: {
23
- flexGrow: 1,
24
- },
25
- iconButton: {
26
- margin: 5,
27
- },
28
- bp: {
29
- display: 'flex',
30
- alignItems: 'center',
31
- marginLeft: 10,
32
- },
33
- searchContainer: {
34
- marginLeft: 5,
35
- },
36
- searchBox: {
37
- display: 'flex',
38
- },
39
- }))
40
-
41
- const TrackSelector = observer(({ model }: { model: LCV }) => {
42
- return (
43
- <IconButton
44
- onClick={model.activateTrackSelector}
45
- title="Open track selector"
46
- >
47
- <TrackSelectorIcon />
48
- </IconButton>
49
- )
50
- })
51
-
52
- const Header = observer(function ({ model }: { model: LCV }) {
53
- const { classes } = useStyles()
54
- const [menuAnchorEl, setMenuAnchorEl] = useState<HTMLElement>()
55
- const anyShowHeaders = model.views.some(view => !view.hideHeader)
56
- return (
57
- <div className={classes.headerBar}>
58
- <TrackSelector model={model} />
59
-
60
- <IconButton
61
- onClick={event => setMenuAnchorEl(event.currentTarget)}
62
- className={classes.iconButton}
63
- >
64
- <MoreVertIcon />
65
- </IconButton>
66
- {!anyShowHeaders
67
- ? model.views.map(view => (
68
- <div key={view.id} className={classes.searchBox}>
69
- <div className={classes.searchContainer}>
70
- <SearchBox model={view} showHelp={false} />
71
- </div>
72
- <div className={classes.bp}>
73
- <Typography
74
- variant="body2"
75
- color="textSecondary"
76
- className={classes.bp}
77
- >
78
- {Math.round(view.coarseTotalBp).toLocaleString('en-US')} bp
79
- </Typography>
80
- </div>
81
- </div>
82
- ))
83
- : null}
84
-
85
- <div className={classes.spacer} />
86
-
87
- {menuAnchorEl ? (
88
- <Menu
89
- anchorEl={menuAnchorEl}
90
- open
91
- onMenuItemClick={(_event, callback) => {
92
- callback()
93
- setMenuAnchorEl(undefined)
94
- }}
95
- menuItems={model.headerMenuItems()}
96
- onClose={() => setMenuAnchorEl(undefined)}
97
- />
98
- ) : null}
99
- </div>
100
- )
101
- })
102
-
103
- export default Header
@@ -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
- })