@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.
- package/dist/BaseLinearDisplay/components/Tooltip.d.ts +1 -1
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +3 -3
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +2 -2
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -1
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/dist/BasicTrack/index.d.ts +1 -1
- package/dist/BasicTrack/index.js +4 -4
- package/dist/BasicTrack/index.js.map +1 -1
- package/dist/LaunchLinearGenomeView/index.d.ts +3 -0
- package/dist/LaunchLinearGenomeView/index.js +44 -0
- package/dist/LaunchLinearGenomeView/index.js.map +1 -0
- package/dist/LinearBareDisplay/index.d.ts +6 -2
- package/dist/LinearBareDisplay/index.js +17 -2
- package/dist/LinearBareDisplay/index.js.map +1 -1
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +2 -15
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -1
- package/dist/LinearBasicDisplay/index.d.ts +6 -2
- package/dist/LinearBasicDisplay/index.js +20 -4
- package/dist/LinearBasicDisplay/index.js.map +1 -1
- package/dist/LinearBasicDisplay/model.d.ts +21 -14
- package/dist/LinearBasicDisplay/model.js +2 -1
- package/dist/LinearBasicDisplay/model.js.map +1 -1
- package/dist/LinearGenomeView/components/CenterLine.d.ts +1 -1
- package/dist/LinearGenomeView/components/ExportSvgDialog.js +1 -19
- package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/GetSequenceDialog.d.ts +1 -1
- package/dist/LinearGenomeView/components/GetSequenceDialog.js +7 -18
- package/dist/LinearGenomeView/components/GetSequenceDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/Gridlines.d.ts +1 -1
- package/dist/LinearGenomeView/components/Header.d.ts +1 -1
- package/dist/LinearGenomeView/components/Header.js +2 -2
- package/dist/LinearGenomeView/components/HelpDialog.js +2 -17
- package/dist/LinearGenomeView/components/HelpDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/ImportForm.d.ts +1 -1
- package/dist/LinearGenomeView/components/ImportForm.js +18 -16
- package/dist/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/dist/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
- package/dist/LinearGenomeView/components/LinearGenomeView.js +1 -3
- package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +1 -1
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +5 -5
- package/dist/LinearGenomeView/components/{OverviewRubberBand.d.ts → OverviewRubberband.d.ts} +3 -3
- package/dist/LinearGenomeView/components/{OverviewRubberBand.js → OverviewRubberband.js} +27 -79
- package/dist/LinearGenomeView/components/OverviewRubberband.js.map +1 -0
- package/{esm/LinearGenomeView/components/OverviewScaleBar.d.ts → dist/LinearGenomeView/components/OverviewScalebar.d.ts} +3 -3
- package/dist/LinearGenomeView/components/{OverviewScaleBar.js → OverviewScalebar.js} +25 -24
- package/dist/LinearGenomeView/components/OverviewScalebar.js.map +1 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +1 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
- package/dist/LinearGenomeView/components/{RubberBand.d.ts → Rubberband.d.ts} +3 -3
- package/dist/LinearGenomeView/components/Rubberband.js +57 -0
- package/dist/LinearGenomeView/components/Rubberband.js.map +1 -0
- package/dist/LinearGenomeView/components/RubberbandSpan.d.ts +14 -0
- package/dist/LinearGenomeView/components/RubberbandSpan.js +90 -0
- package/dist/LinearGenomeView/components/RubberbandSpan.js.map +1 -0
- package/dist/LinearGenomeView/components/{ScaleBar.d.ts → Scalebar.d.ts} +3 -3
- package/dist/LinearGenomeView/components/{ScaleBar.js → Scalebar.js} +11 -11
- package/dist/LinearGenomeView/components/{ScaleBar.js.map → Scalebar.js.map} +1 -1
- package/dist/LinearGenomeView/components/SearchBox.js +6 -6
- package/dist/LinearGenomeView/components/SearchBox.js.map +1 -1
- package/dist/LinearGenomeView/components/SearchResultsDialog.js +17 -31
- package/dist/LinearGenomeView/components/SearchResultsDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/SequenceSearchDialog.js +4 -19
- package/dist/LinearGenomeView/components/SequenceSearchDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/TrackContainer.d.ts +1 -1
- package/dist/LinearGenomeView/components/TrackContainer.js +13 -10
- package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -1
- package/dist/LinearGenomeView/components/TrackLabel.js +9 -1
- package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -1
- package/dist/LinearGenomeView/components/TracksContainer.d.ts +1 -1
- package/dist/LinearGenomeView/components/TracksContainer.js +21 -118
- package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -1
- package/dist/LinearGenomeView/components/VerticalGuide.d.ts +9 -0
- package/dist/LinearGenomeView/components/VerticalGuide.js +29 -0
- package/dist/LinearGenomeView/components/VerticalGuide.js.map +1 -0
- package/dist/LinearGenomeView/components/hooks.d.ts +65 -0
- package/dist/LinearGenomeView/components/hooks.js +264 -0
- package/dist/LinearGenomeView/components/hooks.js.map +1 -0
- package/dist/LinearGenomeView/components/util.d.ts +5 -2
- package/dist/LinearGenomeView/components/util.js +7 -6
- package/dist/LinearGenomeView/components/util.js.map +1 -1
- package/dist/LinearGenomeView/index.d.ts +3 -453
- package/dist/LinearGenomeView/index.js +11 -1247
- package/dist/LinearGenomeView/index.js.map +1 -1
- package/dist/LinearGenomeView/model.d.ts +535 -0
- package/dist/LinearGenomeView/model.js +1357 -0
- package/dist/LinearGenomeView/model.js.map +1 -0
- package/dist/index.d.ts +20 -8
- package/dist/index.js +9 -72
- package/dist/index.js.map +1 -1
- package/esm/BaseLinearDisplay/components/Tooltip.d.ts +1 -1
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +3 -3
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +2 -2
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -1
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/esm/BasicTrack/index.d.ts +1 -1
- package/esm/BasicTrack/index.js +4 -4
- package/esm/BasicTrack/index.js.map +1 -1
- package/esm/LaunchLinearGenomeView/index.d.ts +3 -0
- package/esm/LaunchLinearGenomeView/index.js +42 -0
- package/esm/LaunchLinearGenomeView/index.js.map +1 -0
- package/esm/LinearBareDisplay/index.d.ts +6 -2
- package/esm/LinearBareDisplay/index.js +18 -2
- package/esm/LinearBareDisplay/index.js.map +1 -1
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js +3 -13
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -1
- package/esm/LinearBasicDisplay/index.d.ts +6 -2
- package/esm/LinearBasicDisplay/index.js +19 -2
- package/esm/LinearBasicDisplay/index.js.map +1 -1
- package/esm/LinearBasicDisplay/model.d.ts +21 -14
- package/esm/LinearBasicDisplay/model.js +2 -1
- package/esm/LinearBasicDisplay/model.js.map +1 -1
- package/esm/LinearGenomeView/components/CenterLine.d.ts +1 -1
- package/esm/LinearGenomeView/components/ExportSvgDialog.js +3 -18
- package/esm/LinearGenomeView/components/ExportSvgDialog.js.map +1 -1
- package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +1 -1
- package/esm/LinearGenomeView/components/GetSequenceDialog.js +8 -19
- package/esm/LinearGenomeView/components/GetSequenceDialog.js.map +1 -1
- package/esm/LinearGenomeView/components/Gridlines.d.ts +1 -1
- package/esm/LinearGenomeView/components/Header.d.ts +1 -1
- package/esm/LinearGenomeView/components/Header.js +2 -2
- package/esm/LinearGenomeView/components/HelpDialog.js +3 -18
- package/esm/LinearGenomeView/components/HelpDialog.js.map +1 -1
- package/esm/LinearGenomeView/components/ImportForm.d.ts +1 -1
- package/esm/LinearGenomeView/components/ImportForm.js +18 -16
- package/esm/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
- package/esm/LinearGenomeView/components/LinearGenomeView.js +2 -4
- package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +1 -1
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +3 -3
- package/esm/LinearGenomeView/components/{OverviewRubberBand.d.ts → OverviewRubberband.d.ts} +3 -3
- package/esm/LinearGenomeView/components/{OverviewRubberBand.js → OverviewRubberband.js} +25 -80
- package/esm/LinearGenomeView/components/OverviewRubberband.js.map +1 -0
- package/{dist/LinearGenomeView/components/OverviewScaleBar.d.ts → esm/LinearGenomeView/components/OverviewScalebar.d.ts} +3 -3
- package/esm/LinearGenomeView/components/{OverviewScaleBar.js → OverviewScalebar.js} +25 -24
- package/esm/LinearGenomeView/components/OverviewScalebar.js.map +1 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js +1 -1
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
- package/esm/LinearGenomeView/components/{RubberBand.d.ts → Rubberband.d.ts} +3 -3
- package/esm/LinearGenomeView/components/Rubberband.js +29 -0
- package/esm/LinearGenomeView/components/Rubberband.js.map +1 -0
- package/esm/LinearGenomeView/components/RubberbandSpan.d.ts +14 -0
- package/esm/LinearGenomeView/components/RubberbandSpan.js +65 -0
- package/esm/LinearGenomeView/components/RubberbandSpan.js.map +1 -0
- package/esm/LinearGenomeView/components/{ScaleBar.d.ts → Scalebar.d.ts} +3 -3
- package/esm/LinearGenomeView/components/{ScaleBar.js → Scalebar.js} +11 -11
- package/esm/LinearGenomeView/components/{ScaleBar.js.map → Scalebar.js.map} +1 -1
- package/esm/LinearGenomeView/components/SearchBox.js +6 -6
- package/esm/LinearGenomeView/components/SearchBox.js.map +1 -1
- package/esm/LinearGenomeView/components/SearchResultsDialog.js +18 -32
- package/esm/LinearGenomeView/components/SearchResultsDialog.js.map +1 -1
- package/esm/LinearGenomeView/components/SequenceSearchDialog.js +5 -17
- package/esm/LinearGenomeView/components/SequenceSearchDialog.js.map +1 -1
- package/esm/LinearGenomeView/components/TrackContainer.d.ts +1 -1
- package/esm/LinearGenomeView/components/TrackContainer.js +14 -11
- package/esm/LinearGenomeView/components/TrackContainer.js.map +1 -1
- package/esm/LinearGenomeView/components/TrackLabel.js +9 -1
- package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -1
- package/esm/LinearGenomeView/components/TracksContainer.d.ts +1 -1
- package/esm/LinearGenomeView/components/TracksContainer.js +22 -119
- package/esm/LinearGenomeView/components/TracksContainer.js.map +1 -1
- package/esm/LinearGenomeView/components/VerticalGuide.d.ts +9 -0
- package/esm/LinearGenomeView/components/VerticalGuide.js +24 -0
- package/esm/LinearGenomeView/components/VerticalGuide.js.map +1 -0
- package/esm/LinearGenomeView/components/hooks.d.ts +65 -0
- package/esm/LinearGenomeView/components/hooks.js +255 -0
- package/esm/LinearGenomeView/components/hooks.js.map +1 -0
- package/esm/LinearGenomeView/components/util.d.ts +5 -2
- package/esm/LinearGenomeView/components/util.js +4 -3
- package/esm/LinearGenomeView/components/util.js.map +1 -1
- package/esm/LinearGenomeView/index.d.ts +3 -453
- package/esm/LinearGenomeView/index.js +9 -1238
- package/esm/LinearGenomeView/index.js.map +1 -1
- package/esm/LinearGenomeView/model.d.ts +535 -0
- package/esm/LinearGenomeView/model.js +1322 -0
- package/esm/LinearGenomeView/model.js.map +1 -0
- package/esm/index.d.ts +20 -8
- package/esm/index.js +9 -72
- package/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +1 -1
- package/src/BasicTrack/index.ts +4 -8
- package/src/LaunchLinearGenomeView/index.ts +66 -0
- package/src/LinearBareDisplay/index.ts +21 -2
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +3 -28
- package/src/LinearBasicDisplay/index.ts +23 -2
- package/src/LinearBasicDisplay/model.ts +2 -1
- package/src/LinearGenomeView/components/ExportSvgDialog.tsx +2 -23
- package/src/LinearGenomeView/components/GetSequenceDialog.tsx +13 -31
- package/src/LinearGenomeView/components/Header.tsx +3 -3
- package/src/LinearGenomeView/components/HelpDialog.tsx +8 -34
- package/src/LinearGenomeView/components/ImportForm.tsx +19 -16
- package/src/LinearGenomeView/components/LinearGenomeView.tsx +2 -8
- package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +3 -3
- package/src/LinearGenomeView/components/{OverviewRubberBand.tsx → OverviewRubberband.tsx} +32 -114
- package/src/LinearGenomeView/components/{OverviewScaleBar.tsx → OverviewScalebar.tsx} +26 -25
- package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +2 -1
- package/src/LinearGenomeView/components/Rubberband.tsx +89 -0
- package/src/LinearGenomeView/components/RubberbandSpan.tsx +116 -0
- package/src/LinearGenomeView/components/{ScaleBar.test.tsx → Scalebar.test.tsx} +5 -5
- package/src/LinearGenomeView/components/{ScaleBar.tsx → Scalebar.tsx} +11 -11
- package/src/LinearGenomeView/components/SearchBox.tsx +6 -6
- package/src/LinearGenomeView/components/SearchResultsDialog.tsx +17 -44
- package/src/LinearGenomeView/components/SequenceSearchDialog.tsx +4 -30
- package/src/LinearGenomeView/components/TrackContainer.tsx +41 -28
- package/src/LinearGenomeView/components/TrackLabel.tsx +10 -1
- package/src/LinearGenomeView/components/TracksContainer.tsx +59 -136
- package/src/LinearGenomeView/components/VerticalGuide.tsx +37 -0
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +37 -39
- package/src/LinearGenomeView/components/hooks.ts +300 -0
- package/src/LinearGenomeView/components/util.ts +8 -11
- package/src/LinearGenomeView/index.test.ts +6 -7
- package/src/LinearGenomeView/index.ts +17 -0
- package/src/LinearGenomeView/{index.tsx → model.ts} +159 -75
- package/src/index.ts +13 -108
- package/dist/LinearGenomeView/components/OverviewRubberBand.js.map +0 -1
- package/dist/LinearGenomeView/components/OverviewScaleBar.js.map +0 -1
- package/dist/LinearGenomeView/components/RubberBand.js +0 -221
- package/dist/LinearGenomeView/components/RubberBand.js.map +0 -1
- package/esm/LinearGenomeView/components/OverviewRubberBand.js.map +0 -1
- package/esm/LinearGenomeView/components/OverviewScaleBar.js.map +0 -1
- package/esm/LinearGenomeView/components/RubberBand.js +0 -196
- package/esm/LinearGenomeView/components/RubberBand.js.map +0 -1
- 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
|
|
19
|
+
import OverviewRubberband from './OverviewRubberband'
|
|
19
20
|
|
|
20
21
|
const wholeSeqSpacer = 2
|
|
21
22
|
|
|
22
23
|
const useStyles = makeStyles()(theme => ({
|
|
23
|
-
|
|
24
|
+
scalebar: {
|
|
24
25
|
height: HEADER_OVERVIEW_HEIGHT,
|
|
25
26
|
},
|
|
26
|
-
|
|
27
|
+
scalebarBorder: {
|
|
27
28
|
border: '1px solid',
|
|
28
29
|
},
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
45
|
+
scalebarRefName: {
|
|
45
46
|
position: 'absolute',
|
|
46
47
|
fontWeight: 'bold',
|
|
47
48
|
pointerEvents: 'none',
|
|
48
49
|
zIndex: 100,
|
|
49
50
|
},
|
|
50
|
-
|
|
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
|
-
|
|
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.
|
|
332
|
+
className={classes.scalebarRefName}
|
|
332
333
|
>
|
|
333
334
|
{refName}
|
|
334
335
|
</Typography>
|
|
335
336
|
<div
|
|
336
337
|
className={cx(
|
|
337
|
-
classes.
|
|
338
|
+
classes.scalebarContig,
|
|
338
339
|
canDisplayCytobands
|
|
339
340
|
? undefined
|
|
340
341
|
: reversed
|
|
341
|
-
? classes.
|
|
342
|
-
: classes.
|
|
343
|
-
!canDisplayCytobands ? classes.
|
|
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.
|
|
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
|
|
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
|
|
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' :
|
|
420
|
+
const color = showCytobands ? '#f00' : scalebarColor
|
|
420
421
|
const transparency = showCytobands ? 0.1 : 0.3
|
|
421
422
|
|
|
422
423
|
return (
|
|
423
|
-
<div className={classes.
|
|
424
|
+
<div className={classes.scalebar}>
|
|
424
425
|
<div
|
|
425
|
-
className={classes.
|
|
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.
|
|
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
|
|
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
|
-
<
|
|
488
|
+
<OverviewRubberband
|
|
488
489
|
model={model}
|
|
489
490
|
overview={overview}
|
|
490
491
|
ControlComponent={
|
|
491
|
-
<
|
|
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(
|
|
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
|
|
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
|
|
5
|
+
import Scalebar from './Scalebar'
|
|
6
6
|
jest.mock('@jbrowse/web/src/makeWorkerInstance', () => () => {})
|
|
7
7
|
|
|
8
|
-
describe('
|
|
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(<
|
|
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(<
|
|
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(<
|
|
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
|
-
|
|
22
|
+
scalebarContainer: {
|
|
23
23
|
overflow: 'hidden',
|
|
24
24
|
position: 'relative',
|
|
25
25
|
},
|
|
26
|
-
|
|
26
|
+
scalebarZoomContainer: {
|
|
27
27
|
position: 'relative',
|
|
28
28
|
zIndex: 1,
|
|
29
29
|
},
|
|
30
|
-
|
|
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
|
|
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
|
|
153
|
+
interface ScalebarProps {
|
|
154
154
|
model: LGV
|
|
155
155
|
style?: React.CSSProperties
|
|
156
156
|
className?: string
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
const
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
<
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
}}
|