react-msaview 3.1.11 → 3.2.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.
Files changed (191) hide show
  1. package/bundle/index.js +32 -31
  2. package/dist/colorSchemes.d.ts +2 -2
  3. package/dist/colorSchemes.js +3 -4
  4. package/dist/colorSchemes.js.map +1 -1
  5. package/dist/components/Loading.d.ts +1 -1
  6. package/dist/components/Loading.js +4 -4
  7. package/dist/components/Loading.js.map +1 -1
  8. package/dist/components/MSAView.d.ts +1 -1
  9. package/dist/components/MSAView.js +13 -9
  10. package/dist/components/MSAView.js.map +1 -1
  11. package/dist/components/ResizeHandles.d.ts +1 -1
  12. package/dist/components/ResizeHandles.js +2 -2
  13. package/dist/components/SequenceTextArea.js +4 -0
  14. package/dist/components/SequenceTextArea.js.map +1 -1
  15. package/dist/components/TextTrack.d.ts +1 -1
  16. package/dist/components/Track.d.ts +1 -1
  17. package/dist/components/VerticalScrollbar.d.ts +6 -0
  18. package/dist/components/VerticalScrollbar.js +65 -0
  19. package/dist/components/VerticalScrollbar.js.map +1 -0
  20. package/dist/components/dialogs/AddTrackDialog.d.ts +1 -1
  21. package/dist/components/dialogs/DomainDialog.d.ts +6 -0
  22. package/dist/components/dialogs/DomainDialog.js +19 -0
  23. package/dist/components/dialogs/DomainDialog.js.map +1 -0
  24. package/dist/components/dialogs/ExportSVGDialog.d.ts +1 -1
  25. package/dist/components/dialogs/FeatureDialog.d.ts +1 -1
  26. package/dist/components/dialogs/FeatureDialog.js.map +1 -1
  27. package/dist/components/dialogs/InterProScanDialog.d.ts +4 -4
  28. package/dist/components/dialogs/InterProScanDialog.js +37 -8
  29. package/dist/components/dialogs/InterProScanDialog.js.map +1 -1
  30. package/dist/components/dialogs/MetadataDialog.d.ts +1 -1
  31. package/dist/components/dialogs/SettingsDialog.d.ts +1 -1
  32. package/dist/components/dialogs/SettingsDialog.js +10 -1
  33. package/dist/components/dialogs/SettingsDialog.js.map +1 -1
  34. package/dist/components/dialogs/TabPanel.d.ts +6 -0
  35. package/dist/components/dialogs/TabPanel.js +6 -0
  36. package/dist/components/dialogs/TabPanel.js.map +1 -0
  37. package/dist/components/dialogs/TracklistDialog.d.ts +1 -1
  38. package/dist/components/dialogs/UserProvidedDomainsDialog.d.ts +7 -0
  39. package/dist/components/dialogs/UserProvidedDomainsDialog.js +58 -0
  40. package/dist/components/dialogs/UserProvidedDomainsDialog.js.map +1 -0
  41. package/dist/components/header/Header.d.ts +1 -1
  42. package/dist/components/header/Header.js +8 -5
  43. package/dist/components/header/Header.js.map +1 -1
  44. package/dist/components/header/HeaderInfoArea.d.ts +1 -1
  45. package/dist/components/header/HeaderMenu.d.ts +1 -1
  46. package/dist/components/header/HeaderMenuExtra.d.ts +1 -1
  47. package/dist/components/header/HeaderMenuExtra.js +54 -41
  48. package/dist/components/header/HeaderMenuExtra.js.map +1 -1
  49. package/dist/components/header/HeaderStatusArea.d.ts +1 -1
  50. package/dist/components/header/HeaderStatusArea.js +2 -1
  51. package/dist/components/header/HeaderStatusArea.js.map +1 -1
  52. package/dist/components/header/MultiAlignmentSelector.d.ts +1 -1
  53. package/dist/components/header/ZoomControls.js +31 -1
  54. package/dist/components/header/ZoomControls.js.map +1 -1
  55. package/dist/components/import/ImportForm.d.ts +1 -1
  56. package/dist/components/import/ImportForm.js +1 -1
  57. package/dist/components/import/ImportForm.js.map +1 -1
  58. package/dist/components/import/ImportFormExamples.d.ts +1 -1
  59. package/dist/components/import/ImportFormExamples.js +10 -8
  60. package/dist/components/import/ImportFormExamples.js.map +1 -1
  61. package/dist/components/import/util.d.ts +2 -2
  62. package/dist/components/minimap/Minimap.d.ts +1 -1
  63. package/dist/components/minimap/Minimap.js +14 -15
  64. package/dist/components/minimap/Minimap.js.map +1 -1
  65. package/dist/components/minimap/MinimapSVG.d.ts +1 -1
  66. package/dist/components/minimap/MinimapSVG.js +1 -1
  67. package/dist/components/minimap/MinimapSVG.js.map +1 -1
  68. package/dist/components/msa/MSACanvas.d.ts +1 -1
  69. package/dist/components/msa/MSACanvas.js +3 -3
  70. package/dist/components/msa/MSACanvas.js.map +1 -1
  71. package/dist/components/msa/MSACanvasBlock.d.ts +3 -3
  72. package/dist/components/msa/MSACanvasBlock.js +4 -3
  73. package/dist/components/msa/MSACanvasBlock.js.map +1 -1
  74. package/dist/components/msa/MSAMouseoverCanvas.d.ts +2 -2
  75. package/dist/components/msa/MSAMouseoverCanvas.js +1 -1
  76. package/dist/components/msa/MSAMouseoverCanvas.js.map +1 -1
  77. package/dist/components/msa/MSAPanel.d.ts +1 -1
  78. package/dist/components/msa/renderBoxFeatureCanvasBlock.d.ts +1 -1
  79. package/dist/components/msa/renderBoxFeatureCanvasBlock.js +2 -3
  80. package/dist/components/msa/renderBoxFeatureCanvasBlock.js.map +1 -1
  81. package/dist/components/msa/renderMSABlock.d.ts +2 -2
  82. package/dist/components/msa/renderMSABlock.js +12 -12
  83. package/dist/components/msa/renderMSABlock.js.map +1 -1
  84. package/dist/components/msa/renderMSAMouseover.d.ts +1 -1
  85. package/dist/components/tree/TreeBranchMenu.d.ts +1 -1
  86. package/dist/components/tree/TreeCanvas.d.ts +1 -1
  87. package/dist/components/tree/TreeCanvas.js +13 -12
  88. package/dist/components/tree/TreeCanvas.js.map +1 -1
  89. package/dist/components/tree/TreeCanvasBlock.d.ts +1 -1
  90. package/dist/components/tree/TreeCanvasBlock.js +2 -1
  91. package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
  92. package/dist/components/tree/TreeNodeMenu.d.ts +1 -1
  93. package/dist/components/tree/TreeNodeMenu.js +2 -2
  94. package/dist/components/tree/TreeNodeMenu.js.map +1 -1
  95. package/dist/components/tree/TreePanel.d.ts +1 -1
  96. package/dist/components/tree/TreeRuler.d.ts +1 -1
  97. package/dist/components/tree/dialogs/TreeNodeInfoDialog.d.ts +1 -1
  98. package/dist/components/tree/renderTreeCanvas.d.ts +3 -3
  99. package/dist/components/tree/renderTreeCanvas.js +25 -9
  100. package/dist/components/tree/renderTreeCanvas.js.map +1 -1
  101. package/dist/components/util.js +1 -1
  102. package/dist/components/util.js.map +1 -1
  103. package/dist/fetchUtils.d.ts +1 -1
  104. package/dist/fetchUtils.js.map +1 -1
  105. package/dist/launchInterProScan.d.ts +9 -3
  106. package/dist/launchInterProScan.js +57 -22
  107. package/dist/launchInterProScan.js.map +1 -1
  108. package/dist/model/DataModel.d.ts +5 -1
  109. package/dist/model/DataModel.js +10 -1
  110. package/dist/model/DataModel.js.map +1 -1
  111. package/dist/model/DialogQueue.d.ts +1 -1
  112. package/dist/model.d.ts +138 -43
  113. package/dist/model.js +235 -110
  114. package/dist/model.js.map +1 -1
  115. package/dist/parseNewick.js +1 -1
  116. package/dist/parseNewick.js.map +1 -1
  117. package/dist/parsers/ClustalMSA.d.ts +1 -1
  118. package/dist/parsers/FastaMSA.d.ts +1 -1
  119. package/dist/parsers/StockholmMSA.d.ts +1 -1
  120. package/dist/parsers/StockholmMSA.js.map +1 -1
  121. package/dist/renderToSvg.d.ts +2 -2
  122. package/dist/renderToSvg.js +3 -28
  123. package/dist/renderToSvg.js.map +1 -1
  124. package/dist/reparseTree.d.ts +1 -1
  125. package/dist/util.d.ts +2 -2
  126. package/dist/util.js +0 -2
  127. package/dist/util.js.map +1 -1
  128. package/dist/version.d.ts +1 -1
  129. package/dist/version.js +1 -1
  130. package/dist/version.js.map +1 -1
  131. package/package.json +5 -2
  132. package/src/colorSchemes.ts +3 -2
  133. package/src/components/Checkbox2.tsx +1 -1
  134. package/src/components/Loading.tsx +11 -5
  135. package/src/components/MSAView.tsx +27 -18
  136. package/src/components/ResizeHandles.tsx +3 -3
  137. package/src/components/SequenceTextArea.tsx +8 -0
  138. package/src/components/TextTrack.tsx +1 -1
  139. package/src/components/Track.tsx +1 -1
  140. package/src/components/VerticalScrollbar.tsx +85 -0
  141. package/src/components/dialogs/AddTrackDialog.tsx +2 -2
  142. package/src/components/dialogs/DomainDialog.tsx +38 -0
  143. package/src/components/dialogs/ExportSVGDialog.tsx +1 -1
  144. package/src/components/dialogs/FeatureDialog.tsx +3 -3
  145. package/src/components/dialogs/InterProScanDialog.tsx +49 -11
  146. package/src/components/dialogs/MetadataDialog.tsx +1 -1
  147. package/src/components/dialogs/SettingsDialog.tsx +38 -3
  148. package/src/components/dialogs/TabPanel.tsx +19 -0
  149. package/src/components/dialogs/TracklistDialog.tsx +1 -1
  150. package/src/components/dialogs/UserProvidedDomainsDialog.tsx +133 -0
  151. package/src/components/header/Header.tsx +9 -6
  152. package/src/components/header/HeaderInfoArea.tsx +1 -1
  153. package/src/components/header/HeaderMenu.tsx +1 -1
  154. package/src/components/header/HeaderMenuExtra.tsx +65 -48
  155. package/src/components/header/HeaderStatusArea.tsx +3 -2
  156. package/src/components/header/MultiAlignmentSelector.tsx +1 -1
  157. package/src/components/header/ZoomControls.tsx +34 -0
  158. package/src/components/import/ImportForm.tsx +3 -3
  159. package/src/components/import/ImportFormExamples.tsx +19 -17
  160. package/src/components/import/util.ts +2 -2
  161. package/src/components/minimap/Minimap.tsx +15 -22
  162. package/src/components/minimap/MinimapSVG.tsx +2 -2
  163. package/src/components/msa/MSACanvas.tsx +11 -4
  164. package/src/components/msa/MSACanvasBlock.tsx +5 -4
  165. package/src/components/msa/MSAMouseoverCanvas.tsx +2 -6
  166. package/src/components/msa/MSAPanel.tsx +1 -1
  167. package/src/components/msa/renderBoxFeatureCanvasBlock.ts +5 -6
  168. package/src/components/msa/renderMSABlock.ts +37 -17
  169. package/src/components/msa/renderMSAMouseover.ts +1 -1
  170. package/src/components/tree/TreeBranchMenu.tsx +1 -1
  171. package/src/components/tree/TreeCanvas.tsx +15 -16
  172. package/src/components/tree/TreeCanvasBlock.tsx +3 -2
  173. package/src/components/tree/TreeNodeMenu.tsx +3 -3
  174. package/src/components/tree/TreePanel.tsx +1 -1
  175. package/src/components/tree/TreeRuler.tsx +1 -1
  176. package/src/components/tree/dialogs/TreeNodeInfoDialog.tsx +1 -1
  177. package/src/components/tree/renderTreeCanvas.ts +32 -12
  178. package/src/components/util.ts +1 -1
  179. package/src/fetchUtils.ts +2 -2
  180. package/src/launchInterProScan.ts +69 -24
  181. package/src/model/DataModel.ts +10 -0
  182. package/src/model/DialogQueue.ts +1 -1
  183. package/src/model.ts +262 -143
  184. package/src/parseNewick.ts +1 -1
  185. package/src/parsers/ClustalMSA.ts +1 -1
  186. package/src/parsers/FastaMSA.ts +1 -1
  187. package/src/parsers/StockholmMSA.ts +1 -1
  188. package/src/renderToSvg.tsx +6 -30
  189. package/src/reparseTree.ts +1 -1
  190. package/src/util.ts +2 -4
  191. package/src/version.ts +1 -1
@@ -2,37 +2,61 @@ import React, { lazy } from 'react'
2
2
  import { observer } from 'mobx-react'
3
3
  import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton'
4
4
 
5
- // locals
6
- import { MsaViewModel } from '../../model'
7
-
8
5
  // icons
9
- import MoreVert from '@mui/icons-material/MoreVert'
6
+ import MoreVert from '@mui/icons-material/Menu'
10
7
  import Sort from '@mui/icons-material/Sort'
11
8
  import Visibility from '@mui/icons-material/Visibility'
12
9
  import FilterAlt from '@mui/icons-material/FilterAlt'
13
10
  import Search from '@mui/icons-material/Search'
14
11
  import PhotoCamera from '@mui/icons-material/PhotoCamera'
15
- import RestartAlt from '@mui/icons-material/RestartAlt'
12
+ import Settings from '@mui/icons-material/Settings'
13
+ import Assignment from '@mui/icons-material/Assignment'
14
+ import List from '@mui/icons-material/List'
15
+ import FolderOpen from '@mui/icons-material/FolderOpen'
16
+
17
+ // locals
18
+ import type { MsaViewModel } from '../../model'
16
19
 
17
20
  // lazies
21
+ const SettingsDialog = lazy(() => import('../dialogs/SettingsDialog'))
22
+ const MetadataDialog = lazy(() => import('../dialogs/MetadataDialog'))
23
+ const TracklistDialog = lazy(() => import('../dialogs/TracklistDialog'))
18
24
  const ExportSVGDialog = lazy(() => import('../dialogs/ExportSVGDialog'))
19
25
  const FeatureFilterDialog = lazy(() => import('../dialogs/FeatureDialog'))
26
+ const UserProvidedDomainsDialog = lazy(
27
+ () => import('../dialogs/UserProvidedDomainsDialog'),
28
+ )
20
29
  const InterProScanDialog = lazy(() => import('../dialogs/InterProScanDialog'))
21
30
 
22
- const HeaderMenuExtra = observer(function ({ model }: { model: MsaViewModel }) {
23
- const { featureMode, subFeatureRows, noAnnotations, interProScanJobIds } =
24
- model
31
+ const HeaderMenuExtra = observer(({ model }: { model: MsaViewModel }) => {
32
+ const { showDomains, actuallyShowDomains, subFeatureRows, noDomains } = model
25
33
  return (
26
34
  <CascadingMenuButton
27
35
  menuItems={[
28
36
  {
29
- label: 'Reset zoom to default',
30
- icon: RestartAlt,
31
- onClick: () => {
32
- model.setColWidth(16)
33
- model.setRowHeight(20)
34
- },
37
+ label: 'Return to import form',
38
+ icon: FolderOpen,
39
+ onClick: () => model.reset(),
40
+ },
41
+ {
42
+ label: 'Settings',
43
+ onClick: () =>
44
+ model.queueDialog(onClose => [SettingsDialog, { model, onClose }]),
45
+ icon: Settings,
46
+ },
47
+ {
48
+ label: 'Metadata',
49
+ onClick: () =>
50
+ model.queueDialog(onClose => [MetadataDialog, { model, onClose }]),
51
+ icon: Assignment,
35
52
  },
53
+ {
54
+ label: 'Extra tracks',
55
+ onClick: () =>
56
+ model.queueDialog(onClose => [TracklistDialog, { model, onClose }]),
57
+ icon: List,
58
+ },
59
+
36
60
  {
37
61
  label: 'Export SVG',
38
62
  icon: PhotoCamera,
@@ -44,23 +68,43 @@ const HeaderMenuExtra = observer(function ({ model }: { model: MsaViewModel }) {
44
68
  type: 'subMenu',
45
69
  subMenu: [
46
70
  {
47
- label:
48
- 'Show domains' + (noAnnotations ? ' (no domains loaded)' : ''),
71
+ label: 'Open domains...',
72
+ icon: FolderOpen,
73
+ onClick: () =>
74
+ model.queueDialog(handleClose => [
75
+ UserProvidedDomainsDialog,
76
+ { handleClose, model },
77
+ ]),
78
+ },
79
+ {
80
+ label: 'Query InterProScan for domains...',
81
+ icon: Search,
82
+ onClick: () =>
83
+ model.queueDialog(handleClose => [
84
+ InterProScanDialog,
85
+ { handleClose, model },
86
+ ]),
87
+ },
88
+ {
89
+ label: `Show domains${noDomains ? ' (no domains loaded)' : ''}`,
90
+ disabled: noDomains,
49
91
  icon: Visibility,
50
- checked: featureMode,
92
+ checked: actuallyShowDomains ? showDomains : false,
51
93
  type: 'checkbox',
52
- onClick: () => model.setFeatureMode(!featureMode),
94
+ onClick: () => model.setShowDomains(!showDomains),
53
95
  },
54
96
  {
55
- label: 'Use sub-row layout',
56
- checked: subFeatureRows,
97
+ label: `Use sub-row layout${noDomains ? ' (no domains loaded)' : ''}`,
98
+ disabled: noDomains,
99
+ checked: actuallyShowDomains ? subFeatureRows : false,
57
100
  icon: Sort,
58
101
  type: 'checkbox',
59
102
  onClick: () => model.setSubFeatureRows(!subFeatureRows),
60
103
  },
61
104
  {
62
- label: 'Filter domains',
105
+ label: `Filter domains${noDomains ? ' (no domains loaded)' : ''}`,
63
106
  icon: FilterAlt,
107
+ disabled: noDomains,
64
108
  onClick: () => {
65
109
  model.queueDialog(onClose => [
66
110
  FeatureFilterDialog,
@@ -68,33 +112,6 @@ const HeaderMenuExtra = observer(function ({ model }: { model: MsaViewModel }) {
68
112
  ])
69
113
  },
70
114
  },
71
- {
72
- label: 'Query InterProScan for domains...',
73
- icon: Search,
74
- onClick: () =>
75
- model.queueDialog(onClose => [
76
- InterProScanDialog,
77
- { onClose, model },
78
- ]),
79
- },
80
- {
81
- label: 'Load previous InterProScan results...',
82
- icon: Search,
83
- type: 'subMenu',
84
- subMenu: interProScanJobIds.length
85
- ? interProScanJobIds.map(({ jobId, date }) => ({
86
- label:
87
- new Date(date).toLocaleString('en-US') + ' - ' + jobId,
88
- onClick: () => model.loadInterProScanResults(jobId),
89
- }))
90
- : [
91
- {
92
- label: 'No previous searches',
93
- disabled: true,
94
- onClick: () => {},
95
- },
96
- ],
97
- },
98
115
  ],
99
116
  },
100
117
  ...(model.extraViewMenuItems?.() || []),
@@ -2,9 +2,10 @@ import React from 'react'
2
2
  import { Typography } from '@mui/material'
3
3
  import { observer } from 'mobx-react'
4
4
  import { makeStyles } from 'tss-react/mui'
5
+ import { LoadingEllipses } from '@jbrowse/core/ui'
5
6
 
6
7
  // locals
7
- import { MsaViewModel } from '../../model'
8
+ import type { MsaViewModel } from '../../model'
8
9
 
9
10
  const useStyles = makeStyles()({
10
11
  margin: {
@@ -18,7 +19,7 @@ const HeaderStatusArea = observer(({ model }: { model: MsaViewModel }) => {
18
19
  const { classes } = useStyles()
19
20
  return status ? (
20
21
  <Typography className={classes.margin}>
21
- {status.msg}{' '}
22
+ <LoadingEllipses message={status.msg} component="span" />{' '}
22
23
  {status.url ? (
23
24
  <a href={status.url} target="_blank" rel="noreferrer">
24
25
  (status)
@@ -3,7 +3,7 @@ import { observer } from 'mobx-react'
3
3
  import { Select } from '@mui/material'
4
4
 
5
5
  // locals
6
- import { MsaViewModel } from '../../model'
6
+ import type { MsaViewModel } from '../../model'
7
7
 
8
8
  const MultiAlignmentSelector = observer(function ({
9
9
  model,
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import { IconButton } from '@mui/material'
3
3
  import { observer } from 'mobx-react'
4
+ import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton'
4
5
 
5
6
  // locals
6
7
  import { MsaViewModel } from '../../model'
@@ -8,6 +9,8 @@ import { MsaViewModel } from '../../model'
8
9
  // icons
9
10
  import ZoomIn from '@mui/icons-material/ZoomIn'
10
11
  import ZoomOut from '@mui/icons-material/ZoomOut'
12
+ import MoreVert from '@mui/icons-material/MoreVert'
13
+ import RestartAlt from '@mui/icons-material/RestartAlt'
11
14
 
12
15
  const ZoomControls = observer(function ZoomControls({
13
16
  model,
@@ -22,6 +25,37 @@ const ZoomControls = observer(function ZoomControls({
22
25
  <IconButton onClick={() => model.zoomOut()}>
23
26
  <ZoomOut />
24
27
  </IconButton>
28
+ <CascadingMenuButton
29
+ menuItems={[
30
+ {
31
+ label: 'Zoom in horizontal',
32
+ onClick: () => model.zoomInHorizontal(),
33
+ },
34
+ {
35
+ label: 'Zoom in vertical',
36
+ onClick: () => model.zoomInVertical(),
37
+ },
38
+ {
39
+ label: 'Zoom out horizontal',
40
+ onClick: () => model.zoomOutHorizontal(),
41
+ },
42
+
43
+ {
44
+ label: 'Zoom out vertical',
45
+ onClick: () => model.zoomOutVertical(),
46
+ },
47
+ {
48
+ label: 'Reset zoom to default',
49
+ icon: RestartAlt,
50
+ onClick: () => {
51
+ model.setColWidth(16)
52
+ model.setRowHeight(20)
53
+ },
54
+ },
55
+ ]}
56
+ >
57
+ <MoreVert />
58
+ </CascadingMenuButton>
25
59
  </>
26
60
  )
27
61
  })
@@ -2,14 +2,14 @@ import React, { useState } from 'react'
2
2
  import { observer } from 'mobx-react'
3
3
  import { Button, Container, Grid, Typography } from '@mui/material'
4
4
  import { FileSelector } from '@jbrowse/core/ui'
5
- import { FileLocation } from '@jbrowse/core/util/types'
5
+ import type { FileLocation } from '@jbrowse/core/util/types'
6
6
 
7
7
  // locals
8
- import { MsaViewModel } from '../../model'
8
+ import type { MsaViewModel } from '../../model'
9
9
  import { load } from './util'
10
10
  import ImportFormExamples from './ImportFormExamples'
11
11
 
12
- export default observer(({ model }: { model: MsaViewModel }) => {
12
+ export default observer(function ({ model }: { model: MsaViewModel }) {
13
13
  const [msaFile, setMsaFile] = useState<FileLocation>()
14
14
  const [treeFile, setTreeFile] = useState<FileLocation>()
15
15
  const { error } = model
@@ -3,11 +3,11 @@ import { Typography, Link } from '@mui/material'
3
3
  import { observer } from 'mobx-react'
4
4
 
5
5
  // locals
6
- import { MsaViewModel } from '../../model'
6
+ import type { MsaViewModel } from '../../model'
7
7
  import { smallTree, smallMSA, smallMSAOnly } from './data/seq2'
8
8
  import { load } from './util'
9
9
 
10
- const ListItem = ({
10
+ function ListItem({
11
11
  onClick,
12
12
  model,
13
13
  children,
@@ -15,20 +15,22 @@ const ListItem = ({
15
15
  onClick: () => void
16
16
  model: MsaViewModel
17
17
  children: React.ReactNode
18
- }) => (
19
- <li>
20
- <Link
21
- onClick={event => {
22
- model.setError(undefined)
23
- event.preventDefault()
24
- onClick()
25
- }}
26
- href="#"
27
- >
28
- <Typography display="inline">{children}</Typography>
29
- </Link>
30
- </li>
31
- )
18
+ }) {
19
+ return (
20
+ <li>
21
+ <Link
22
+ onClick={event => {
23
+ model.setError(undefined)
24
+ event.preventDefault()
25
+ onClick()
26
+ }}
27
+ href="#"
28
+ >
29
+ <Typography display="inline">{children}</Typography>
30
+ </Link>
31
+ </li>
32
+ )
33
+ }
32
34
 
33
35
  const ImportFormExamples = observer(function ({
34
36
  model,
@@ -41,7 +43,7 @@ const ImportFormExamples = observer(function ({
41
43
  model={model}
42
44
  onClick={() =>
43
45
  load(model, undefined, {
44
- uri: 'https://jbrowse.org/genomes/newick_trees/sarscov2phylo.pub.ft.nh',
46
+ uri: 'https://jbrowse.org/genomes/newicktrees/sarscov2phylo.pub.ft.nh',
45
47
  locationType: 'UriLocation',
46
48
  })
47
49
  }
@@ -1,5 +1,5 @@
1
- import { FileLocation } from '@jbrowse/core/util'
2
- import { MsaViewModel } from '../../model'
1
+ import type { FileLocation } from '@jbrowse/core/util'
2
+ import type { MsaViewModel } from '../../model'
3
3
 
4
4
  export async function load(
5
5
  model: MsaViewModel,
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef, useState } from 'react'
2
2
  import { observer } from 'mobx-react'
3
- import { MsaViewModel } from '../../model'
3
+ import type { MsaViewModel } from '../../model'
4
4
 
5
5
  const Minimap = observer(function ({ model }: { model: MsaViewModel }) {
6
6
  const [mouseDown, setMouseDown] = useState<{
@@ -9,19 +9,14 @@ const Minimap = observer(function ({ model }: { model: MsaViewModel }) {
9
9
  }>()
10
10
  const scheduled = useRef(false)
11
11
  const [hovered, setHovered] = useState(false)
12
- const {
13
- scrollX,
14
- msaAreaWidth: W,
15
- minimapHeight: H,
16
- colWidth,
17
- numColumns,
18
- } = model
19
- const unit = W / numColumns / colWidth
12
+ const { scrollX, msaAreaWidth, minimapHeight, colWidth, numColumns } = model
13
+ const unit = msaAreaWidth / numColumns / colWidth
20
14
  const left = -scrollX
21
- const right = left + W
15
+ const right = left + msaAreaWidth
22
16
  const s = left * unit
23
17
  const e = right * unit
24
18
  const fill = 'rgba(66, 119, 127, 0.3)'
19
+ const w = Math.max(e - s, 20)
25
20
 
26
21
  useEffect(() => {
27
22
  function fn(event: MouseEvent) {
@@ -50,14 +45,14 @@ const Minimap = observer(function ({ model }: { model: MsaViewModel }) {
50
45
  }
51
46
  }, [model, unit, mouseDown])
52
47
 
53
- const BAR_HEIGHT = 12
54
- const H2 = H - 12
48
+ const barHeight = 12
49
+ const polygonHeight = minimapHeight - barHeight
55
50
  return (
56
- <div style={{ position: 'relative', height: H, width: '100%' }}>
51
+ <div style={{ position: 'relative', height: minimapHeight, width: '100%' }}>
57
52
  <div
58
53
  style={{
59
54
  boxSizing: 'border-box',
60
- height: BAR_HEIGHT,
55
+ height: barHeight,
61
56
  border: '1px solid #555',
62
57
  }}
63
58
  />
@@ -68,10 +63,8 @@ const Minimap = observer(function ({ model }: { model: MsaViewModel }) {
68
63
  left: Math.max(0, s),
69
64
  background: hovered ? 'rgba(66,119,127,0.6)' : fill,
70
65
  cursor: 'pointer',
71
- border: '1px solid #555',
72
- boxSizing: 'border-box',
73
- height: BAR_HEIGHT,
74
- width: e - s,
66
+ height: barHeight,
67
+ width: w,
75
68
  zIndex: 100,
76
69
  }}
77
70
  onMouseOver={() => setHovered(true)}
@@ -84,14 +77,14 @@ const Minimap = observer(function ({ model }: { model: MsaViewModel }) {
84
77
  }}
85
78
  />
86
79
 
87
- <svg height={H2} style={{ width: '100%' }}>
80
+ <svg height={polygonHeight} style={{ width: '100%' }}>
88
81
  <polygon
89
82
  fill={fill}
90
83
  points={[
91
- [e, 0],
84
+ [s + w, 0],
92
85
  [s, 0],
93
- [0, H2],
94
- [W, H2],
86
+ [0, polygonHeight],
87
+ [msaAreaWidth, polygonHeight],
95
88
  ].toString()}
96
89
  />
97
90
  </svg>
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { observer } from 'mobx-react'
3
- import { MsaViewModel } from '../../model'
3
+ import type { MsaViewModel } from '../../model'
4
4
 
5
- const MinimapSVG = observer(function ({ model }: { model: MsaViewModel }) {
5
+ const MinimapSVG = observer(({ model }: { model: MsaViewModel }) => {
6
6
  const {
7
7
  scrollX,
8
8
  msaAreaWidth: W,
@@ -2,12 +2,19 @@ import React, { useEffect, useState, useRef } from 'react'
2
2
  import { observer } from 'mobx-react'
3
3
 
4
4
  // locals
5
- import { MsaViewModel } from '../../model'
5
+ import type { MsaViewModel } from '../../model'
6
6
  import MSACanvasBlock from './MSACanvasBlock'
7
7
  import Loading from './Loading'
8
8
 
9
9
  const MSACanvas = observer(function ({ model }: { model: MsaViewModel }) {
10
- const { MSA, msaFilehandle, height, msaAreaWidth, blocks2d } = model
10
+ const {
11
+ MSA,
12
+ verticalScrollbarWidth,
13
+ msaFilehandle,
14
+ height,
15
+ msaAreaWidth,
16
+ blocks2d,
17
+ } = model
11
18
  const ref = useRef<HTMLDivElement>(null)
12
19
  // wheel
13
20
  const scheduled = useRef(false)
@@ -39,7 +46,7 @@ const MSACanvas = observer(function ({ model }: { model: MsaViewModel }) {
39
46
  event.preventDefault()
40
47
  event.stopPropagation()
41
48
  }
42
- curr.addEventListener('wheel', onWheel)
49
+ curr.addEventListener('wheel', onWheel, { passive: false })
43
50
  return () => {
44
51
  curr.removeEventListener('wheel', onWheel)
45
52
  }
@@ -115,7 +122,7 @@ const MSACanvas = observer(function ({ model }: { model: MsaViewModel }) {
115
122
  style={{
116
123
  position: 'relative',
117
124
  height,
118
- width: msaAreaWidth,
125
+ width: msaAreaWidth - verticalScrollbarWidth,
119
126
  overflow: 'hidden',
120
127
  }}
121
128
  >
@@ -5,11 +5,11 @@ import { observer } from 'mobx-react'
5
5
 
6
6
  // locals
7
7
  import { renderMSABlock } from './renderMSABlock'
8
- import { MsaViewModel } from '../../model'
8
+ import type { MsaViewModel } from '../../model'
9
9
  import { colorContrast } from '../../util'
10
10
  import { renderBoxFeatureCanvasBlock } from './renderBoxFeatureCanvasBlock'
11
11
 
12
- const MSABlock = observer(function ({
12
+ const MSACanvasBlock = observer(function ({
13
13
  model,
14
14
  offsetX,
15
15
  offsetY,
@@ -45,7 +45,8 @@ const MSABlock = observer(function ({
45
45
  return autorun(() => {
46
46
  ctx.resetTransform()
47
47
  ctx.clearRect(0, 0, blockSize, blockSize)
48
- if (model.featureMode) {
48
+ const { actuallyShowDomains } = model
49
+ if (actuallyShowDomains) {
49
50
  renderBoxFeatureCanvasBlock({
50
51
  ctx,
51
52
  offsetX,
@@ -107,4 +108,4 @@ const MSABlock = observer(function ({
107
108
  )
108
109
  })
109
110
 
110
- export default MSABlock
111
+ export default MSACanvasBlock
@@ -3,14 +3,10 @@ import { observer } from 'mobx-react'
3
3
  import { autorun } from 'mobx'
4
4
 
5
5
  // locals
6
- import { MsaViewModel } from '../../model'
6
+ import type { MsaViewModel } from '../../model'
7
7
  import { renderMouseover } from './renderMSAMouseover'
8
8
 
9
- const MSAMouseoverCanvas = observer(function ({
10
- model,
11
- }: {
12
- model: MsaViewModel
13
- }) {
9
+ const MSAMouseoverCanvas = observer(({ model }: { model: MsaViewModel }) => {
14
10
  const ref = useRef<HTMLCanvasElement>(null)
15
11
  const { height, width } = model
16
12
  useEffect(() => {
@@ -5,7 +5,7 @@ import { observer } from 'mobx-react'
5
5
  import MSACanvas from './MSACanvas'
6
6
  import MSAMouseoverCanvas from './MSAMouseoverCanvas'
7
7
  // types
8
- import { MsaViewModel } from '../../model'
8
+ import type { MsaViewModel } from '../../model'
9
9
 
10
10
  const MSAPanel = observer(function ({ model }: { model: MsaViewModel }) {
11
11
  return (
@@ -1,8 +1,8 @@
1
- import { HierarchyNode } from 'd3-hierarchy'
1
+ import type { HierarchyNode } from 'd3-hierarchy'
2
2
 
3
3
  // locals
4
- import { MsaViewModel } from '../../model'
5
- import { NodeWithIdsAndLength } from '../../util'
4
+ import type { MsaViewModel } from '../../model'
5
+ import type { NodeWithIdsAndLength } from '../../util'
6
6
 
7
7
  export function renderBoxFeatureCanvasBlock({
8
8
  model,
@@ -19,16 +19,15 @@ export function renderBoxFeatureCanvasBlock({
19
19
  highResScaleFactorOverride?: number
20
20
  blockSizeYOverride?: number
21
21
  }) {
22
- const { hierarchy, blockSize, rowHeight, highResScaleFactor, featureMode } =
22
+ const { leaves, blockSize, rowHeight, highResScaleFactor, showDomains } =
23
23
  model
24
- if (featureMode) {
24
+ if (showDomains) {
25
25
  const k = highResScaleFactorOverride || highResScaleFactor
26
26
  const by = blockSizeYOverride || blockSize
27
27
  ctx.resetTransform()
28
28
  ctx.scale(k, k)
29
29
  ctx.translate(-offsetX, rowHeight / 2 - offsetY)
30
30
 
31
- const leaves = hierarchy.leaves()
32
31
  const yStart = Math.max(0, Math.floor((offsetY - rowHeight) / rowHeight))
33
32
  const yEnd = Math.max(0, Math.ceil((offsetY + by + rowHeight) / rowHeight))
34
33
  const visibleLeaves = leaves.slice(yStart, yEnd)