@jbrowse/plugin-linear-genome-view 2.2.0 → 2.2.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 (225) hide show
  1. package/dist/BaseLinearDisplay/components/Tooltip.d.ts +1 -1
  2. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +3 -3
  3. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +2 -2
  4. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -1
  5. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
  6. package/dist/BasicTrack/index.d.ts +1 -1
  7. package/dist/BasicTrack/index.js +4 -4
  8. package/dist/BasicTrack/index.js.map +1 -1
  9. package/dist/LaunchLinearGenomeView/index.d.ts +3 -0
  10. package/dist/LaunchLinearGenomeView/index.js +44 -0
  11. package/dist/LaunchLinearGenomeView/index.js.map +1 -0
  12. package/dist/LinearBareDisplay/index.d.ts +6 -2
  13. package/dist/LinearBareDisplay/index.js +17 -2
  14. package/dist/LinearBareDisplay/index.js.map +1 -1
  15. package/dist/LinearBasicDisplay/components/SetMaxHeight.js +2 -15
  16. package/dist/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -1
  17. package/dist/LinearBasicDisplay/index.d.ts +6 -2
  18. package/dist/LinearBasicDisplay/index.js +20 -4
  19. package/dist/LinearBasicDisplay/index.js.map +1 -1
  20. package/dist/LinearBasicDisplay/model.d.ts +21 -14
  21. package/dist/LinearBasicDisplay/model.js +2 -1
  22. package/dist/LinearBasicDisplay/model.js.map +1 -1
  23. package/dist/LinearGenomeView/components/CenterLine.d.ts +1 -1
  24. package/dist/LinearGenomeView/components/ExportSvgDialog.js +1 -19
  25. package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +1 -1
  26. package/dist/LinearGenomeView/components/GetSequenceDialog.d.ts +1 -1
  27. package/dist/LinearGenomeView/components/GetSequenceDialog.js +7 -18
  28. package/dist/LinearGenomeView/components/GetSequenceDialog.js.map +1 -1
  29. package/dist/LinearGenomeView/components/Gridlines.d.ts +1 -1
  30. package/dist/LinearGenomeView/components/Header.d.ts +1 -1
  31. package/dist/LinearGenomeView/components/Header.js +2 -2
  32. package/dist/LinearGenomeView/components/HelpDialog.js +2 -17
  33. package/dist/LinearGenomeView/components/HelpDialog.js.map +1 -1
  34. package/dist/LinearGenomeView/components/ImportForm.d.ts +1 -1
  35. package/dist/LinearGenomeView/components/ImportForm.js +18 -16
  36. package/dist/LinearGenomeView/components/ImportForm.js.map +1 -1
  37. package/dist/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
  38. package/dist/LinearGenomeView/components/LinearGenomeView.js +1 -3
  39. package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
  40. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +1 -1
  41. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +5 -5
  42. package/dist/LinearGenomeView/components/{OverviewRubberBand.d.ts → OverviewRubberband.d.ts} +3 -3
  43. package/dist/LinearGenomeView/components/{OverviewRubberBand.js → OverviewRubberband.js} +27 -79
  44. package/dist/LinearGenomeView/components/OverviewRubberband.js.map +1 -0
  45. package/{esm/LinearGenomeView/components/OverviewScaleBar.d.ts → dist/LinearGenomeView/components/OverviewScalebar.d.ts} +3 -3
  46. package/dist/LinearGenomeView/components/{OverviewScaleBar.js → OverviewScalebar.js} +25 -24
  47. package/dist/LinearGenomeView/components/OverviewScalebar.js.map +1 -0
  48. package/dist/LinearGenomeView/components/RefNameAutocomplete.js +1 -1
  49. package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
  50. package/dist/LinearGenomeView/components/{RubberBand.d.ts → Rubberband.d.ts} +3 -3
  51. package/dist/LinearGenomeView/components/Rubberband.js +57 -0
  52. package/dist/LinearGenomeView/components/Rubberband.js.map +1 -0
  53. package/dist/LinearGenomeView/components/RubberbandSpan.d.ts +14 -0
  54. package/dist/LinearGenomeView/components/RubberbandSpan.js +90 -0
  55. package/dist/LinearGenomeView/components/RubberbandSpan.js.map +1 -0
  56. package/dist/LinearGenomeView/components/{ScaleBar.d.ts → Scalebar.d.ts} +3 -3
  57. package/dist/LinearGenomeView/components/{ScaleBar.js → Scalebar.js} +11 -11
  58. package/dist/LinearGenomeView/components/{ScaleBar.js.map → Scalebar.js.map} +1 -1
  59. package/dist/LinearGenomeView/components/SearchBox.js +6 -6
  60. package/dist/LinearGenomeView/components/SearchBox.js.map +1 -1
  61. package/dist/LinearGenomeView/components/SearchResultsDialog.js +17 -31
  62. package/dist/LinearGenomeView/components/SearchResultsDialog.js.map +1 -1
  63. package/dist/LinearGenomeView/components/SequenceSearchDialog.js +4 -19
  64. package/dist/LinearGenomeView/components/SequenceSearchDialog.js.map +1 -1
  65. package/dist/LinearGenomeView/components/TrackContainer.d.ts +1 -1
  66. package/dist/LinearGenomeView/components/TrackContainer.js +13 -10
  67. package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -1
  68. package/dist/LinearGenomeView/components/TrackLabel.js +9 -1
  69. package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -1
  70. package/dist/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  71. package/dist/LinearGenomeView/components/TracksContainer.js +21 -118
  72. package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -1
  73. package/dist/LinearGenomeView/components/VerticalGuide.d.ts +9 -0
  74. package/dist/LinearGenomeView/components/VerticalGuide.js +29 -0
  75. package/dist/LinearGenomeView/components/VerticalGuide.js.map +1 -0
  76. package/dist/LinearGenomeView/components/hooks.d.ts +65 -0
  77. package/dist/LinearGenomeView/components/hooks.js +264 -0
  78. package/dist/LinearGenomeView/components/hooks.js.map +1 -0
  79. package/dist/LinearGenomeView/components/util.d.ts +5 -2
  80. package/dist/LinearGenomeView/components/util.js +7 -6
  81. package/dist/LinearGenomeView/components/util.js.map +1 -1
  82. package/dist/LinearGenomeView/index.d.ts +3 -453
  83. package/dist/LinearGenomeView/index.js +11 -1247
  84. package/dist/LinearGenomeView/index.js.map +1 -1
  85. package/dist/LinearGenomeView/model.d.ts +535 -0
  86. package/dist/LinearGenomeView/model.js +1357 -0
  87. package/dist/LinearGenomeView/model.js.map +1 -0
  88. package/dist/index.d.ts +20 -8
  89. package/dist/index.js +9 -72
  90. package/dist/index.js.map +1 -1
  91. package/esm/BaseLinearDisplay/components/Tooltip.d.ts +1 -1
  92. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +3 -3
  93. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +2 -2
  94. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -1
  95. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
  96. package/esm/BasicTrack/index.d.ts +1 -1
  97. package/esm/BasicTrack/index.js +4 -4
  98. package/esm/BasicTrack/index.js.map +1 -1
  99. package/esm/LaunchLinearGenomeView/index.d.ts +3 -0
  100. package/esm/LaunchLinearGenomeView/index.js +42 -0
  101. package/esm/LaunchLinearGenomeView/index.js.map +1 -0
  102. package/esm/LinearBareDisplay/index.d.ts +6 -2
  103. package/esm/LinearBareDisplay/index.js +18 -2
  104. package/esm/LinearBareDisplay/index.js.map +1 -1
  105. package/esm/LinearBasicDisplay/components/SetMaxHeight.js +3 -13
  106. package/esm/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -1
  107. package/esm/LinearBasicDisplay/index.d.ts +6 -2
  108. package/esm/LinearBasicDisplay/index.js +19 -2
  109. package/esm/LinearBasicDisplay/index.js.map +1 -1
  110. package/esm/LinearBasicDisplay/model.d.ts +21 -14
  111. package/esm/LinearBasicDisplay/model.js +2 -1
  112. package/esm/LinearBasicDisplay/model.js.map +1 -1
  113. package/esm/LinearGenomeView/components/CenterLine.d.ts +1 -1
  114. package/esm/LinearGenomeView/components/ExportSvgDialog.js +3 -18
  115. package/esm/LinearGenomeView/components/ExportSvgDialog.js.map +1 -1
  116. package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +1 -1
  117. package/esm/LinearGenomeView/components/GetSequenceDialog.js +8 -19
  118. package/esm/LinearGenomeView/components/GetSequenceDialog.js.map +1 -1
  119. package/esm/LinearGenomeView/components/Gridlines.d.ts +1 -1
  120. package/esm/LinearGenomeView/components/Header.d.ts +1 -1
  121. package/esm/LinearGenomeView/components/Header.js +2 -2
  122. package/esm/LinearGenomeView/components/HelpDialog.js +3 -18
  123. package/esm/LinearGenomeView/components/HelpDialog.js.map +1 -1
  124. package/esm/LinearGenomeView/components/ImportForm.d.ts +1 -1
  125. package/esm/LinearGenomeView/components/ImportForm.js +18 -16
  126. package/esm/LinearGenomeView/components/ImportForm.js.map +1 -1
  127. package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
  128. package/esm/LinearGenomeView/components/LinearGenomeView.js +2 -4
  129. package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
  130. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +1 -1
  131. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +3 -3
  132. package/esm/LinearGenomeView/components/{OverviewRubberBand.d.ts → OverviewRubberband.d.ts} +3 -3
  133. package/esm/LinearGenomeView/components/{OverviewRubberBand.js → OverviewRubberband.js} +25 -80
  134. package/esm/LinearGenomeView/components/OverviewRubberband.js.map +1 -0
  135. package/{dist/LinearGenomeView/components/OverviewScaleBar.d.ts → esm/LinearGenomeView/components/OverviewScalebar.d.ts} +3 -3
  136. package/esm/LinearGenomeView/components/{OverviewScaleBar.js → OverviewScalebar.js} +25 -24
  137. package/esm/LinearGenomeView/components/OverviewScalebar.js.map +1 -0
  138. package/esm/LinearGenomeView/components/RefNameAutocomplete.js +1 -1
  139. package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
  140. package/esm/LinearGenomeView/components/{RubberBand.d.ts → Rubberband.d.ts} +3 -3
  141. package/esm/LinearGenomeView/components/Rubberband.js +29 -0
  142. package/esm/LinearGenomeView/components/Rubberband.js.map +1 -0
  143. package/esm/LinearGenomeView/components/RubberbandSpan.d.ts +14 -0
  144. package/esm/LinearGenomeView/components/RubberbandSpan.js +65 -0
  145. package/esm/LinearGenomeView/components/RubberbandSpan.js.map +1 -0
  146. package/esm/LinearGenomeView/components/{ScaleBar.d.ts → Scalebar.d.ts} +3 -3
  147. package/esm/LinearGenomeView/components/{ScaleBar.js → Scalebar.js} +11 -11
  148. package/esm/LinearGenomeView/components/{ScaleBar.js.map → Scalebar.js.map} +1 -1
  149. package/esm/LinearGenomeView/components/SearchBox.js +6 -6
  150. package/esm/LinearGenomeView/components/SearchBox.js.map +1 -1
  151. package/esm/LinearGenomeView/components/SearchResultsDialog.js +18 -32
  152. package/esm/LinearGenomeView/components/SearchResultsDialog.js.map +1 -1
  153. package/esm/LinearGenomeView/components/SequenceSearchDialog.js +5 -17
  154. package/esm/LinearGenomeView/components/SequenceSearchDialog.js.map +1 -1
  155. package/esm/LinearGenomeView/components/TrackContainer.d.ts +1 -1
  156. package/esm/LinearGenomeView/components/TrackContainer.js +14 -11
  157. package/esm/LinearGenomeView/components/TrackContainer.js.map +1 -1
  158. package/esm/LinearGenomeView/components/TrackLabel.js +9 -1
  159. package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -1
  160. package/esm/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  161. package/esm/LinearGenomeView/components/TracksContainer.js +22 -119
  162. package/esm/LinearGenomeView/components/TracksContainer.js.map +1 -1
  163. package/esm/LinearGenomeView/components/VerticalGuide.d.ts +9 -0
  164. package/esm/LinearGenomeView/components/VerticalGuide.js +24 -0
  165. package/esm/LinearGenomeView/components/VerticalGuide.js.map +1 -0
  166. package/esm/LinearGenomeView/components/hooks.d.ts +65 -0
  167. package/esm/LinearGenomeView/components/hooks.js +255 -0
  168. package/esm/LinearGenomeView/components/hooks.js.map +1 -0
  169. package/esm/LinearGenomeView/components/util.d.ts +5 -2
  170. package/esm/LinearGenomeView/components/util.js +4 -3
  171. package/esm/LinearGenomeView/components/util.js.map +1 -1
  172. package/esm/LinearGenomeView/index.d.ts +3 -453
  173. package/esm/LinearGenomeView/index.js +9 -1238
  174. package/esm/LinearGenomeView/index.js.map +1 -1
  175. package/esm/LinearGenomeView/model.d.ts +535 -0
  176. package/esm/LinearGenomeView/model.js +1322 -0
  177. package/esm/LinearGenomeView/model.js.map +1 -0
  178. package/esm/index.d.ts +20 -8
  179. package/esm/index.js +9 -72
  180. package/esm/index.js.map +1 -1
  181. package/package.json +3 -3
  182. package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +1 -1
  183. package/src/BasicTrack/index.ts +4 -8
  184. package/src/LaunchLinearGenomeView/index.ts +66 -0
  185. package/src/LinearBareDisplay/index.ts +21 -2
  186. package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +3 -28
  187. package/src/LinearBasicDisplay/index.ts +23 -2
  188. package/src/LinearBasicDisplay/model.ts +2 -1
  189. package/src/LinearGenomeView/components/ExportSvgDialog.tsx +2 -23
  190. package/src/LinearGenomeView/components/GetSequenceDialog.tsx +13 -31
  191. package/src/LinearGenomeView/components/Header.tsx +3 -3
  192. package/src/LinearGenomeView/components/HelpDialog.tsx +8 -34
  193. package/src/LinearGenomeView/components/ImportForm.tsx +19 -16
  194. package/src/LinearGenomeView/components/LinearGenomeView.tsx +2 -8
  195. package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +3 -3
  196. package/src/LinearGenomeView/components/{OverviewRubberBand.tsx → OverviewRubberband.tsx} +32 -114
  197. package/src/LinearGenomeView/components/{OverviewScaleBar.tsx → OverviewScalebar.tsx} +26 -25
  198. package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +2 -1
  199. package/src/LinearGenomeView/components/Rubberband.tsx +89 -0
  200. package/src/LinearGenomeView/components/RubberbandSpan.tsx +116 -0
  201. package/src/LinearGenomeView/components/{ScaleBar.test.tsx → Scalebar.test.tsx} +5 -5
  202. package/src/LinearGenomeView/components/{ScaleBar.tsx → Scalebar.tsx} +11 -11
  203. package/src/LinearGenomeView/components/SearchBox.tsx +6 -6
  204. package/src/LinearGenomeView/components/SearchResultsDialog.tsx +17 -44
  205. package/src/LinearGenomeView/components/SequenceSearchDialog.tsx +4 -30
  206. package/src/LinearGenomeView/components/TrackContainer.tsx +41 -28
  207. package/src/LinearGenomeView/components/TrackLabel.tsx +10 -1
  208. package/src/LinearGenomeView/components/TracksContainer.tsx +59 -136
  209. package/src/LinearGenomeView/components/VerticalGuide.tsx +37 -0
  210. package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +37 -39
  211. package/src/LinearGenomeView/components/hooks.ts +300 -0
  212. package/src/LinearGenomeView/components/util.ts +8 -11
  213. package/src/LinearGenomeView/index.test.ts +6 -7
  214. package/src/LinearGenomeView/index.ts +17 -0
  215. package/src/LinearGenomeView/{index.tsx → model.ts} +159 -75
  216. package/src/index.ts +13 -108
  217. package/dist/LinearGenomeView/components/OverviewRubberBand.js.map +0 -1
  218. package/dist/LinearGenomeView/components/OverviewScaleBar.js.map +0 -1
  219. package/dist/LinearGenomeView/components/RubberBand.js +0 -221
  220. package/dist/LinearGenomeView/components/RubberBand.js.map +0 -1
  221. package/esm/LinearGenomeView/components/OverviewRubberBand.js.map +0 -1
  222. package/esm/LinearGenomeView/components/OverviewScaleBar.js.map +0 -1
  223. package/esm/LinearGenomeView/components/RubberBand.js +0 -196
  224. package/esm/LinearGenomeView/components/RubberBand.js.map +0 -1
  225. package/src/LinearGenomeView/components/RubberBand.tsx +0 -308
@@ -3,6 +3,7 @@ import { Typography, useTheme, alpha } from '@mui/material'
3
3
  import { makeStyles } from 'tss-react/mui'
4
4
  import { observer } from 'mobx-react'
5
5
 
6
+ // core
6
7
  import Base1DView, { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'
7
8
  import { getSession, getTickDisplayStr } from '@jbrowse/core/util'
8
9
  import { ContentBlock } from '@jbrowse/core/util/blockTypes'
@@ -15,46 +16,46 @@ import {
15
16
  HEADER_OVERVIEW_HEIGHT,
16
17
  } from '..'
17
18
  import { chooseGridPitch } from '../util'
18
- import OverviewRubberBand from './OverviewRubberBand'
19
+ import OverviewRubberband from './OverviewRubberband'
19
20
 
20
21
  const wholeSeqSpacer = 2
21
22
 
22
23
  const useStyles = makeStyles()(theme => ({
23
- scaleBar: {
24
+ scalebar: {
24
25
  height: HEADER_OVERVIEW_HEIGHT,
25
26
  },
26
- scaleBarBorder: {
27
+ scalebarBorder: {
27
28
  border: '1px solid',
28
29
  },
29
- scaleBarContig: {
30
+ scalebarContig: {
30
31
  backgroundColor: theme.palette.background.default,
31
32
  position: 'absolute',
32
33
  top: 0,
33
34
  height: HEADER_OVERVIEW_HEIGHT,
34
35
  },
35
- scaleBarContigForward: {
36
+ scalebarContigForward: {
36
37
  backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M-.1 0L6 4.5L-.1 9' fill='none' stroke='%23ddd'/%3E%3C/svg%3E")`,
37
38
  backgroundRepeat: 'repeat',
38
39
  },
39
- scaleBarContigReverse: {
40
+ scalebarContigReverse: {
40
41
  backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M6 0L0 4.5L6 9' fill='none' stroke='%23ddd'/%3E%3C/svg%3E")`,
41
42
  backgroundRepeat: 'repeat',
42
43
  },
43
44
 
44
- scaleBarRefName: {
45
+ scalebarRefName: {
45
46
  position: 'absolute',
46
47
  fontWeight: 'bold',
47
48
  pointerEvents: 'none',
48
49
  zIndex: 100,
49
50
  },
50
- scaleBarLabel: {
51
+ scalebarLabel: {
51
52
  height: HEADER_OVERVIEW_HEIGHT,
52
53
  position: 'absolute',
53
54
  display: 'flex',
54
55
  justifyContent: 'center',
55
56
  pointerEvents: 'none',
56
57
  },
57
- scaleBarVisibleRegion: {
58
+ scalebarVisibleRegion: {
58
59
  position: 'absolute',
59
60
  height: HEADER_OVERVIEW_HEIGHT,
60
61
  pointerEvents: 'none',
@@ -328,19 +329,19 @@ const OverviewBox = observer(
328
329
  left: block.offsetPx + 3,
329
330
  color: canDisplayCytobands ? 'black' : refNameColor,
330
331
  }}
331
- className={classes.scaleBarRefName}
332
+ className={classes.scalebarRefName}
332
333
  >
333
334
  {refName}
334
335
  </Typography>
335
336
  <div
336
337
  className={cx(
337
- classes.scaleBarContig,
338
+ classes.scalebarContig,
338
339
  canDisplayCytobands
339
340
  ? undefined
340
341
  : reversed
341
- ? classes.scaleBarContigReverse
342
- : classes.scaleBarContigForward,
343
- !canDisplayCytobands ? classes.scaleBarBorder : undefined,
342
+ ? classes.scalebarContigReverse
343
+ : classes.scalebarContigForward,
344
+ !canDisplayCytobands ? classes.scalebarBorder : undefined,
344
345
  )}
345
346
  style={{
346
347
  left: block.offsetPx + cytobandOffset,
@@ -352,7 +353,7 @@ const OverviewBox = observer(
352
353
  ? tickLabels.map((tickLabel, labelIdx) => (
353
354
  <Typography
354
355
  key={`${JSON.stringify(block)}-${tickLabel}-${labelIdx}`}
355
- className={classes.scaleBarLabel}
356
+ className={classes.scalebarLabel}
356
357
  variant="body2"
357
358
  style={{
358
359
  left: ((labelIdx + 1) * majorPitch) / scale,
@@ -380,7 +381,7 @@ const OverviewBox = observer(
380
381
  },
381
382
  )
382
383
 
383
- const ScaleBar = observer(
384
+ const Scalebar = observer(
384
385
  ({
385
386
  model,
386
387
  scale,
@@ -397,7 +398,7 @@ const ScaleBar = observer(
397
398
  const overviewVisibleRegions = overview.dynamicBlocks
398
399
 
399
400
  const { tertiary, primary } = theme.palette
400
- const scaleBarColor = tertiary ? tertiary.light : primary.light
401
+ const scalebarColor = tertiary ? tertiary.light : primary.light
401
402
 
402
403
  if (!visibleRegions.length) {
403
404
  return null
@@ -416,13 +417,13 @@ const ScaleBar = observer(
416
417
  coord: last.reversed ? last.start : last.end,
417
418
  }) || 0
418
419
 
419
- const color = showCytobands ? '#f00' : scaleBarColor
420
+ const color = showCytobands ? '#f00' : scalebarColor
420
421
  const transparency = showCytobands ? 0.1 : 0.3
421
422
 
422
423
  return (
423
- <div className={classes.scaleBar}>
424
+ <div className={classes.scalebar}>
424
425
  <div
425
- className={classes.scaleBarVisibleRegion}
426
+ className={classes.scalebarVisibleRegion}
426
427
  style={{
427
428
  width: lastOverviewPx - firstOverviewPx,
428
429
  left: firstOverviewPx + cytobandOffset,
@@ -435,7 +436,7 @@ const ScaleBar = observer(
435
436
  return !(block instanceof ContentBlock) ? (
436
437
  <div
437
438
  key={`${JSON.stringify(block)}-${idx}`}
438
- className={classes.scaleBarContig}
439
+ className={classes.scalebarContig}
439
440
  style={{
440
441
  width: block.widthPx,
441
442
  left: block.offsetPx,
@@ -459,7 +460,7 @@ const ScaleBar = observer(
459
460
  },
460
461
  )
461
462
 
462
- function OverviewScaleBar({
463
+ function OverviewScalebar({
463
464
  model,
464
465
  children,
465
466
  }: {
@@ -484,11 +485,11 @@ function OverviewScaleBar({
484
485
 
485
486
  return (
486
487
  <div>
487
- <OverviewRubberBand
488
+ <OverviewRubberband
488
489
  model={model}
489
490
  overview={overview}
490
491
  ControlComponent={
491
- <ScaleBar model={model} overview={overview} scale={scale} />
492
+ <Scalebar model={model} overview={overview} scale={scale} />
492
493
  }
493
494
  />
494
495
  <div className={classes.overview}>
@@ -501,6 +502,6 @@ function OverviewScaleBar({
501
502
  )
502
503
  }
503
504
 
504
- export default observer(OverviewScaleBar)
505
+ export default observer(OverviewScalebar)
505
506
 
506
507
  export { Cytobands, Polygon }
@@ -94,6 +94,7 @@ function RefNameAutocomplete({
94
94
  useEffect(() => {
95
95
  let active = true
96
96
 
97
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
97
98
  ;(async () => {
98
99
  try {
99
100
  if (debouncedSearch === '' || !assemblyName) {
@@ -146,7 +147,7 @@ function RefNameAutocomplete({
146
147
  const inputBoxVal = coarseVisibleLocStrings || value || ''
147
148
 
148
149
  // heuristic, text width + icon width
149
- // + 45 accomodates help icon and search icon
150
+ // + 45 accommodates help icon and search icon
150
151
  const width = Math.min(
151
152
  Math.max(measureText(inputBoxVal, 16) + 45, minWidth),
152
153
  550,
@@ -0,0 +1,89 @@
1
+ import React, { useRef } from 'react'
2
+ import { observer } from 'mobx-react'
3
+ import { makeStyles } from 'tss-react/mui'
4
+ import { Menu } from '@jbrowse/core/ui'
5
+
6
+ // locals
7
+ import VerticalGuide from './VerticalGuide'
8
+ import RubberbandSpan from './RubberbandSpan'
9
+ import { useRangeSelect } from './hooks'
10
+ import { LinearGenomeViewModel } from '..'
11
+
12
+ type LGV = LinearGenomeViewModel
13
+
14
+ const useStyles = makeStyles()({
15
+ rubberbandControl: {
16
+ cursor: 'crosshair',
17
+ width: '100%',
18
+ minHeight: 8,
19
+ },
20
+ })
21
+
22
+ function Rubberband({
23
+ model,
24
+ ControlComponent = <div />,
25
+ }: {
26
+ model: LGV
27
+ ControlComponent?: React.ReactElement
28
+ }) {
29
+ const ref = useRef<HTMLDivElement>(null)
30
+ const { classes } = useStyles()
31
+
32
+ const {
33
+ guideX,
34
+ rubberbandOn,
35
+ leftBpOffset,
36
+ rightBpOffset,
37
+ numOfBpSelected,
38
+ width,
39
+ left,
40
+ anchorPosition,
41
+ handleMenuItemClick,
42
+ open,
43
+ handleClose,
44
+ mouseMove,
45
+ mouseDown,
46
+ mouseOut,
47
+ } = useRangeSelect(ref, model)
48
+
49
+ return (
50
+ <>
51
+ {guideX !== undefined ? (
52
+ <VerticalGuide model={model} coordX={guideX} />
53
+ ) : rubberbandOn ? (
54
+ <RubberbandSpan
55
+ leftBpOffset={leftBpOffset}
56
+ rightBpOffset={rightBpOffset}
57
+ numOfBpSelected={numOfBpSelected}
58
+ width={width}
59
+ left={left}
60
+ />
61
+ ) : null}
62
+ {anchorPosition ? (
63
+ <Menu
64
+ anchorReference="anchorPosition"
65
+ anchorPosition={{
66
+ left: anchorPosition.clientX,
67
+ top: anchorPosition.clientY,
68
+ }}
69
+ onMenuItemClick={handleMenuItemClick}
70
+ open={open}
71
+ onClose={handleClose}
72
+ menuItems={model.rubberBandMenuItems()}
73
+ />
74
+ ) : null}
75
+ <div
76
+ data-testid="rubberband_controls"
77
+ className={classes.rubberbandControl}
78
+ ref={ref}
79
+ onMouseDown={mouseDown}
80
+ onMouseMove={mouseMove}
81
+ onMouseOut={mouseOut}
82
+ >
83
+ {ControlComponent}
84
+ </div>
85
+ </>
86
+ )
87
+ }
88
+
89
+ export default observer(Rubberband)
@@ -0,0 +1,116 @@
1
+ import React, { useRef } from 'react'
2
+ import { makeStyles } from 'tss-react/mui'
3
+
4
+ import { Popover, Typography, alpha } from '@mui/material'
5
+ import { stringify, toLocale } from '@jbrowse/core/util'
6
+
7
+ const useStyles = makeStyles()(theme => {
8
+ const { primary, tertiary } = theme.palette
9
+ const background = tertiary
10
+ ? alpha(tertiary.main, 0.7)
11
+ : alpha(primary.main, 0.7)
12
+ return {
13
+ rubberband: {
14
+ height: '100%',
15
+ background,
16
+ position: 'absolute',
17
+ zIndex: 10,
18
+ textAlign: 'center',
19
+ overflow: 'hidden',
20
+ },
21
+ rubberbandControl: {
22
+ cursor: 'crosshair',
23
+ width: '100%',
24
+ minHeight: 8,
25
+ },
26
+ rubberbandText: {
27
+ color: tertiary ? tertiary.contrastText : primary.contrastText,
28
+ },
29
+ popover: {
30
+ mouseEvents: 'none',
31
+ cursor: 'crosshair',
32
+ },
33
+ paper: {
34
+ paddingLeft: theme.spacing(1),
35
+ paddingRight: theme.spacing(1),
36
+ },
37
+ }
38
+ })
39
+
40
+ interface Offset {
41
+ coord: number
42
+ refName?: string
43
+ oob?: boolean
44
+ }
45
+
46
+ function RubberbandSpan({
47
+ leftBpOffset,
48
+ rightBpOffset,
49
+ numOfBpSelected,
50
+ left,
51
+ width,
52
+ }: {
53
+ leftBpOffset: Offset
54
+ rightBpOffset: Offset
55
+ numOfBpSelected?: number
56
+ left: number
57
+ width: number
58
+ }) {
59
+ const ref = useRef(null)
60
+ const { classes } = useStyles()
61
+ return (
62
+ <>
63
+ {ref.current ? (
64
+ <>
65
+ <Popover
66
+ className={classes.popover}
67
+ classes={{ paper: classes.paper }}
68
+ open
69
+ anchorEl={ref.current}
70
+ anchorOrigin={{
71
+ vertical: 'top',
72
+ horizontal: 'left',
73
+ }}
74
+ transformOrigin={{
75
+ vertical: 'bottom',
76
+ horizontal: 'right',
77
+ }}
78
+ keepMounted
79
+ disableRestoreFocus
80
+ >
81
+ <Typography>{stringify(leftBpOffset)}</Typography>
82
+ </Popover>
83
+ <Popover
84
+ className={classes.popover}
85
+ classes={{
86
+ paper: classes.paper,
87
+ }}
88
+ open
89
+ anchorEl={ref.current}
90
+ anchorOrigin={{
91
+ vertical: 'top',
92
+ horizontal: 'right',
93
+ }}
94
+ transformOrigin={{
95
+ vertical: 'bottom',
96
+ horizontal: 'left',
97
+ }}
98
+ keepMounted
99
+ disableRestoreFocus
100
+ >
101
+ <Typography>{stringify(rightBpOffset)}</Typography>
102
+ </Popover>
103
+ </>
104
+ ) : null}
105
+ <div ref={ref} className={classes.rubberband} style={{ left, width }}>
106
+ {numOfBpSelected ? (
107
+ <Typography variant="h6" className={classes.rubberbandText}>
108
+ {toLocale(numOfBpSelected)} bp
109
+ </Typography>
110
+ ) : null}
111
+ </div>
112
+ </>
113
+ )
114
+ }
115
+
116
+ export default RubberbandSpan
@@ -2,10 +2,10 @@
2
2
  import React from 'react'
3
3
  import { render } from '@testing-library/react'
4
4
  import { createTestSession } from '@jbrowse/web/src/rootModel'
5
- import ScaleBar from './ScaleBar'
5
+ import Scalebar from './Scalebar'
6
6
  jest.mock('@jbrowse/web/src/makeWorkerInstance', () => () => {})
7
7
 
8
- describe('ScaleBar genome view component', () => {
8
+ describe('Scalebar genome view component', () => {
9
9
  it('renders two regions', () => {
10
10
  const session = createTestSession({
11
11
  views: [
@@ -47,7 +47,7 @@ describe('ScaleBar genome view component', () => {
47
47
  },
48
48
  })
49
49
  const model = session.views[0]
50
- const { getByTestId } = render(<ScaleBar model={model} />)
50
+ const { getByTestId } = render(<Scalebar model={model} />)
51
51
  const ret1 = getByTestId('refLabel-ctgA')
52
52
  const ret2 = getByTestId('refLabel-ctgB')
53
53
  expect(ret1.style.left).toBe('-1px')
@@ -89,7 +89,7 @@ describe('ScaleBar genome view component', () => {
89
89
  },
90
90
  })
91
91
  const model = session.views[0]
92
- const { getByTestId } = render(<ScaleBar model={model} />)
92
+ const { getByTestId } = render(<Scalebar model={model} />)
93
93
  const ret1 = getByTestId('refLabel-ctgA')
94
94
  const ret2 = getByTestId('refLabel-ctgB')
95
95
  expect(ret1.style.left).toBe('99px')
@@ -134,7 +134,7 @@ describe('ScaleBar genome view component', () => {
134
134
  },
135
135
  })
136
136
  const model = session.views[0]
137
- const { queryByTestId } = render(<ScaleBar model={model} />)
137
+ const { queryByTestId } = render(<Scalebar model={model} />)
138
138
  const ret2 = queryByTestId('refLabel-ctgB')
139
139
  const ret3 = queryByTestId('refLabel-ctgC')
140
140
  const ret4 = queryByTestId('refLabel-ctgD')
@@ -19,15 +19,15 @@ import { getTickDisplayStr } from '@jbrowse/core/util'
19
19
  type LGV = LinearGenomeViewModel
20
20
 
21
21
  const useStyles = makeStyles()(theme => ({
22
- scaleBarContainer: {
22
+ scalebarContainer: {
23
23
  overflow: 'hidden',
24
24
  position: 'relative',
25
25
  },
26
- scaleBarZoomContainer: {
26
+ scalebarZoomContainer: {
27
27
  position: 'relative',
28
28
  zIndex: 1,
29
29
  },
30
- scaleBar: {
30
+ scalebar: {
31
31
  position: 'absolute',
32
32
  display: 'flex',
33
33
  pointerEvents: 'none',
@@ -94,7 +94,7 @@ const RenderedRefNameLabels = observer(({ model }: { model: LGV }) => {
94
94
  )
95
95
  })
96
96
 
97
- const RenderedScaleBarLabels = observer(({ model }: { model: LGV }) => {
97
+ const RenderedScalebarLabels = observer(({ model }: { model: LGV }) => {
98
98
  const { classes } = useStyles()
99
99
  const { bpPerPx, staticBlocks } = model
100
100
 
@@ -150,13 +150,13 @@ const RenderedScaleBarLabels = observer(({ model }: { model: LGV }) => {
150
150
  )
151
151
  })
152
152
 
153
- interface ScaleBarProps {
153
+ interface ScalebarProps {
154
154
  model: LGV
155
155
  style?: React.CSSProperties
156
156
  className?: string
157
157
  }
158
158
 
159
- const ScaleBar = React.forwardRef<HTMLDivElement, ScaleBarProps>(
159
+ const Scalebar = React.forwardRef<HTMLDivElement, ScalebarProps>(
160
160
  ({ model, style, className, ...other }, ref) => {
161
161
  const { classes, cx } = useStyles()
162
162
 
@@ -164,14 +164,14 @@ const ScaleBar = React.forwardRef<HTMLDivElement, ScaleBarProps>(
164
164
  return (
165
165
  <Paper
166
166
  data-resizer="true" // used to avoid click-and-drag scrolls on trackscontainer
167
- className={cx(classes.scaleBarContainer, className)}
167
+ className={cx(classes.scalebarContainer, className)}
168
168
  variant="outlined"
169
169
  ref={ref}
170
170
  style={style}
171
171
  {...other}
172
172
  >
173
173
  <div
174
- className={classes.scaleBarZoomContainer}
174
+ className={classes.scalebarZoomContainer}
175
175
  style={{
176
176
  transform:
177
177
  model.scaleFactor !== 1
@@ -180,14 +180,14 @@ const ScaleBar = React.forwardRef<HTMLDivElement, ScaleBarProps>(
180
180
  }}
181
181
  >
182
182
  <div
183
- className={classes.scaleBar}
183
+ className={classes.scalebar}
184
184
  style={{
185
185
  left: offsetLeft - 1,
186
186
  width: model.staticBlocks.totalWidthPx,
187
187
  ...style,
188
188
  }}
189
189
  >
190
- <RenderedScaleBarLabels model={model} />
190
+ <RenderedScalebarLabels model={model} />
191
191
  </div>
192
192
  </div>
193
193
  <RenderedRefNameLabels model={model} />
@@ -196,4 +196,4 @@ const ScaleBar = React.forwardRef<HTMLDivElement, ScaleBarProps>(
196
196
  },
197
197
  )
198
198
 
199
- export default observer(ScaleBar)
199
+ export default observer(Scalebar)
@@ -33,11 +33,11 @@ function SearchBox({
33
33
  const assembly = assemblyManager.get(assemblyName)
34
34
  const searchScope = model.searchScope(assemblyName)
35
35
 
36
- function navToOption(option: BaseResult) {
36
+ async function navToOption(option: BaseResult) {
37
37
  const location = option.getLocation()
38
38
  const trackId = option.getTrackId()
39
39
  if (location) {
40
- model.navToLocString(location, assemblyName)
40
+ await model.navToLocString(location, assemblyName)
41
41
  if (trackId) {
42
42
  model.showTrack(trackId)
43
43
  }
@@ -52,7 +52,7 @@ function SearchBox({
52
52
  async function handleSelectedRegion(option: BaseResult) {
53
53
  try {
54
54
  if (option.hasLocation()) {
55
- navToOption(option)
55
+ await navToOption(option)
56
56
  } else {
57
57
  const input = option.getLabel()
58
58
  const [ref, rest] = splitLast(input, ':')
@@ -61,7 +61,7 @@ function SearchBox({
61
61
  allRefs.includes(input) ||
62
62
  (allRefs.includes(ref) && !Number.isNaN(parseInt(rest, 10)))
63
63
  ) {
64
- model.navToLocString(input, assemblyName)
64
+ await model.navToLocString(input, assemblyName)
65
65
  } else {
66
66
  const results = await fetchResults({
67
67
  queryString: input,
@@ -75,9 +75,9 @@ function SearchBox({
75
75
  if (results.length > 1) {
76
76
  model.setSearchResults(results, input.toLowerCase())
77
77
  } else if (results.length === 1) {
78
- navToOption(results[0])
78
+ await navToOption(results[0])
79
79
  } else {
80
- model.navToLocString(input, assemblyName)
80
+ await model.navToLocString(input, assemblyName)
81
81
  }
82
82
  }
83
83
  }
@@ -1,15 +1,12 @@
1
1
  import React from 'react'
2
- import { makeStyles } from 'tss-react/mui'
3
2
  import { resolveIdentifier, getRoot } from 'mobx-state-tree'
4
3
  import { getSession, getEnv } from '@jbrowse/core/util'
4
+ import { Dialog } from '@jbrowse/core/ui'
5
5
  import {
6
6
  Button,
7
- Dialog,
8
7
  DialogActions,
9
8
  DialogContent,
10
- DialogTitle,
11
9
  Divider,
12
- IconButton,
13
10
  Paper,
14
11
  Table,
15
12
  TableBody,
@@ -19,20 +16,8 @@ import {
19
16
  TableRow,
20
17
  Typography,
21
18
  } from '@mui/material'
22
- import CloseIcon from '@mui/icons-material/Close'
23
- import { LinearGenomeViewModel } from '../..'
24
19
 
25
- const useStyles = makeStyles()(theme => ({
26
- dialogContent: {
27
- width: '80em',
28
- },
29
- closeButton: {
30
- position: 'absolute',
31
- right: theme.spacing(1),
32
- top: theme.spacing(1),
33
- color: theme.palette.grey[500],
34
- },
35
- }))
20
+ import { LinearGenomeViewModel } from '../..'
36
21
 
37
22
  export default function SearchResultsDialog({
38
23
  model,
@@ -43,7 +28,6 @@ export default function SearchResultsDialog({
43
28
  optAssemblyName?: string
44
29
  handleClose: () => void
45
30
  }) {
46
- const { classes } = useStyles()
47
31
  const session = getSession(model)
48
32
  const { pluginManager } = getEnv(session)
49
33
  const { assemblyManager } = session
@@ -63,7 +47,7 @@ export default function SearchResultsDialog({
63
47
  }
64
48
  const assemblyRegions = assembly.regions
65
49
 
66
- function handleClick(location: string) {
50
+ async function handleClick(location: string) {
67
51
  try {
68
52
  const newRegion = assemblyRegions.find(
69
53
  region => location === region.refName,
@@ -74,7 +58,7 @@ export default function SearchResultsDialog({
74
58
  // region visible, xref #1703
75
59
  model.showAllRegions()
76
60
  } else {
77
- model.navToLocString(location, assemblyName)
61
+ await model.navToLocString(location, assemblyName)
78
62
  }
79
63
  } catch (e) {
80
64
  console.warn(e)
@@ -92,23 +76,7 @@ export default function SearchResultsDialog({
92
76
  }
93
77
 
94
78
  return (
95
- <Dialog open maxWidth="xl" onClose={handleClose}>
96
- <DialogTitle>
97
- Search results
98
- {handleClose ? (
99
- <IconButton
100
- data-testid="close-resultsDialog"
101
- className={classes.closeButton}
102
- onClick={() => {
103
- handleClose()
104
- }}
105
- size="large"
106
- >
107
- <CloseIcon />
108
- </IconButton>
109
- ) : null}
110
- </DialogTitle>
111
- <Divider />
79
+ <Dialog open maxWidth="xl" onClose={handleClose} title="Search results">
112
80
  <DialogContent>
113
81
  {!model.searchResults?.length ? (
114
82
  <Typography>
@@ -143,14 +111,19 @@ export default function SearchResultsDialog({
143
111
  </TableCell>
144
112
  <TableCell align="right">
145
113
  <Button
146
- onClick={() => {
147
- const location = result.getLocation()
148
- if (location) {
149
- handleClick(location)
150
- const resultTrackId = result.getTrackId()
151
- if (resultTrackId) {
152
- model.showTrack(resultTrackId)
114
+ onClick={async () => {
115
+ try {
116
+ const location = result.getLocation()
117
+ if (location) {
118
+ await handleClick(location)
119
+ const resultTrackId = result.getTrackId()
120
+ if (resultTrackId) {
121
+ model.showTrack(resultTrackId)
122
+ }
153
123
  }
124
+ } catch (e) {
125
+ console.error(e)
126
+ session.notify(`${e}`, 'error')
154
127
  }
155
128
  handleClose()
156
129
  }}