@jbrowse/plugin-linear-genome-view 2.2.1 → 2.3.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.
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +2 -1
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js +4 -2
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -1
- package/dist/BaseLinearDisplay/components/Block.d.ts +1 -1
- package/dist/BaseLinearDisplay/components/Block.js +1 -1
- package/dist/BaseLinearDisplay/components/Block.js.map +1 -1
- package/dist/BaseLinearDisplay/components/BlockMsg.js +3 -2
- package/dist/BaseLinearDisplay/components/BlockMsg.js.map +1 -1
- package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +1 -1
- package/dist/BaseLinearDisplay/components/LinearBlocks.js +2 -2
- package/dist/BaseLinearDisplay/components/LinearBlocks.js.map +1 -1
- package/dist/BaseLinearDisplay/{models → components}/TooLargeMessage.d.ts +0 -0
- package/dist/BaseLinearDisplay/{models → components}/TooLargeMessage.js +0 -0
- package/dist/BaseLinearDisplay/components/TooLargeMessage.js.map +1 -0
- package/dist/BaseLinearDisplay/index.d.ts +2 -2
- package/dist/BaseLinearDisplay/index.js +4 -3
- package/dist/BaseLinearDisplay/index.js.map +1 -1
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +6 -14
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +3 -5
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/dist/BaseLinearDisplay/models/configSchema.d.ts +2 -0
- package/dist/BaseLinearDisplay/models/{baseLinearDisplayConfigSchema.js → configSchema.js} +5 -5
- package/dist/BaseLinearDisplay/models/configSchema.js.map +1 -0
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -1
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/dist/BaseLinearDisplay/models/util.d.ts +18 -0
- package/dist/BaseLinearDisplay/models/util.js +18 -0
- package/dist/BaseLinearDisplay/models/util.js.map +1 -0
- package/dist/FeatureTrack/index.d.ts +1 -1
- package/dist/FeatureTrack/index.js +5 -4
- package/dist/FeatureTrack/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 +18 -2
- package/dist/LinearBareDisplay/index.js.map +1 -1
- package/dist/LinearBareDisplay/model.d.ts +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 +21 -4
- package/dist/LinearBasicDisplay/index.js.map +1 -1
- package/dist/LinearBasicDisplay/model.d.ts +17 -13
- package/dist/LinearBasicDisplay/model.js +2 -1
- package/dist/LinearBasicDisplay/model.js.map +1 -1
- package/dist/LinearGenomeView/components/ExportSvgDialog.js +1 -19
- package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/GetSequenceDialog.js +7 -18
- package/dist/LinearGenomeView/components/GetSequenceDialog.js.map +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.js +15 -10
- package/dist/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +6 -7
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -1
- package/{esm/LinearGenomeView/components/OverviewRubberBand.d.ts → dist/LinearGenomeView/components/OverviewRubberband.d.ts} +2 -2
- package/dist/LinearGenomeView/components/{OverviewRubberBand.js → OverviewRubberband.js} +27 -79
- package/dist/LinearGenomeView/components/OverviewRubberband.js.map +1 -0
- package/dist/LinearGenomeView/components/{OverviewScaleBar.d.ts → OverviewScalebar.d.ts} +2 -2
- 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} +2 -2
- 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/Ruler.d.ts +2 -18
- package/dist/LinearGenomeView/components/Ruler.js +9 -25
- package/dist/LinearGenomeView/components/Ruler.js.map +1 -1
- package/dist/LinearGenomeView/components/{ScaleBar.d.ts → Scalebar.d.ts} +2 -2
- 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 +10 -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.js +2 -2
- package/dist/LinearGenomeView/components/TrackContainer.js.map +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 -534
- package/dist/LinearGenomeView/index.js +12 -1327
- 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 +6 -6
- package/dist/index.js +12 -73
- package/dist/index.js.map +1 -1
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +2 -1
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +3 -2
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -1
- package/esm/BaseLinearDisplay/components/Block.d.ts +1 -1
- package/esm/BaseLinearDisplay/components/Block.js +1 -1
- package/esm/BaseLinearDisplay/components/Block.js.map +1 -1
- package/esm/BaseLinearDisplay/components/BlockMsg.js +3 -2
- package/esm/BaseLinearDisplay/components/BlockMsg.js.map +1 -1
- package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +1 -1
- package/esm/BaseLinearDisplay/components/LinearBlocks.js +2 -2
- package/esm/BaseLinearDisplay/components/LinearBlocks.js.map +1 -1
- package/esm/BaseLinearDisplay/{models → components}/TooLargeMessage.d.ts +0 -0
- package/esm/BaseLinearDisplay/{models → components}/TooLargeMessage.js +0 -0
- package/esm/BaseLinearDisplay/components/TooLargeMessage.js.map +1 -0
- package/esm/BaseLinearDisplay/index.d.ts +2 -2
- package/esm/BaseLinearDisplay/index.js +2 -2
- package/esm/BaseLinearDisplay/index.js.map +1 -1
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +6 -14
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +3 -5
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/esm/BaseLinearDisplay/models/configSchema.d.ts +2 -0
- package/esm/BaseLinearDisplay/models/{baseLinearDisplayConfigSchema.js → configSchema.js} +5 -4
- package/esm/BaseLinearDisplay/models/configSchema.js.map +1 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -1
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/esm/BaseLinearDisplay/models/util.d.ts +18 -0
- package/esm/BaseLinearDisplay/models/util.js +14 -0
- package/esm/BaseLinearDisplay/models/util.js.map +1 -0
- package/esm/FeatureTrack/index.d.ts +1 -1
- package/esm/FeatureTrack/index.js +5 -4
- package/esm/FeatureTrack/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 +19 -2
- package/esm/LinearBareDisplay/index.js.map +1 -1
- package/esm/LinearBareDisplay/model.d.ts +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 +20 -2
- package/esm/LinearBasicDisplay/index.js.map +1 -1
- package/esm/LinearBasicDisplay/model.d.ts +17 -13
- package/esm/LinearBasicDisplay/model.js +2 -1
- package/esm/LinearBasicDisplay/model.js.map +1 -1
- package/esm/LinearGenomeView/components/ExportSvgDialog.js +3 -18
- package/esm/LinearGenomeView/components/ExportSvgDialog.js.map +1 -1
- package/esm/LinearGenomeView/components/GetSequenceDialog.js +8 -19
- package/esm/LinearGenomeView/components/GetSequenceDialog.js.map +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.js +15 -10
- package/esm/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +4 -5
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -1
- package/{dist/LinearGenomeView/components/OverviewRubberBand.d.ts → esm/LinearGenomeView/components/OverviewRubberband.d.ts} +2 -2
- package/esm/LinearGenomeView/components/{OverviewRubberBand.js → OverviewRubberband.js} +25 -80
- package/esm/LinearGenomeView/components/OverviewRubberband.js.map +1 -0
- package/esm/LinearGenomeView/components/{OverviewScaleBar.d.ts → OverviewScalebar.d.ts} +2 -2
- 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} +2 -2
- 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/Ruler.d.ts +2 -18
- package/esm/LinearGenomeView/components/Ruler.js +6 -22
- package/esm/LinearGenomeView/components/Ruler.js.map +1 -1
- package/esm/LinearGenomeView/components/{ScaleBar.d.ts → Scalebar.d.ts} +2 -2
- 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 +10 -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.js +2 -2
- package/esm/LinearGenomeView/components/TrackContainer.js.map +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 -534
- package/esm/LinearGenomeView/index.js +10 -1318
- 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 +6 -6
- package/esm/index.js +12 -74
- package/esm/index.js.map +1 -1
- package/package.json +5 -6
- package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +86 -84
- package/src/BaseLinearDisplay/components/Block.tsx +15 -11
- package/src/BaseLinearDisplay/components/BlockMsg.tsx +9 -9
- package/src/BaseLinearDisplay/components/LinearBlocks.tsx +62 -58
- package/src/BaseLinearDisplay/{models → components}/TooLargeMessage.tsx +0 -0
- package/src/BaseLinearDisplay/index.ts +2 -1
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +4 -3
- package/src/BaseLinearDisplay/models/{baseLinearDisplayConfigSchema.ts → configSchema.ts} +5 -3
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +1 -1
- package/src/BaseLinearDisplay/models/util.ts +24 -0
- package/src/FeatureTrack/index.ts +5 -8
- package/src/LaunchLinearGenomeView/index.ts +66 -0
- package/src/LinearBareDisplay/index.ts +23 -2
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +3 -28
- package/src/LinearBasicDisplay/index.ts +24 -2
- package/src/LinearBasicDisplay/model.ts +2 -1
- package/src/LinearGenomeView/README.md +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 +13 -9
- package/src/LinearGenomeView/components/LinearGenomeView.test.tsx +132 -134
- package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +4 -5
- 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/Ruler.tsx +11 -28
- 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 +8 -6
- package/src/LinearGenomeView/components/SearchResultsDialog.tsx +17 -44
- package/src/LinearGenomeView/components/SequenceSearchDialog.tsx +4 -30
- package/src/LinearGenomeView/components/TrackContainer.tsx +4 -2
- 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 +39 -44
- 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 +18 -0
- package/src/LinearGenomeView/{index.tsx → model.ts} +7 -4
- package/src/index.ts +16 -108
- package/dist/BaseLinearDisplay/models/TooLargeMessage.js.map +0 -1
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.d.ts +0 -1
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +0 -1
- 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/BaseLinearDisplay/models/TooLargeMessage.js.map +0 -1
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.d.ts +0 -1
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[
|
|
3
|
+
exports[`renders one track, one region 1`] = `
|
|
4
4
|
<div
|
|
5
5
|
style="position: relative;"
|
|
6
6
|
>
|
|
@@ -9,57 +9,57 @@ exports[`<LinearGenomeView /> renders one track, one region 1`] = `
|
|
|
9
9
|
style="position: relative;"
|
|
10
10
|
>
|
|
11
11
|
<div
|
|
12
|
-
class="css-
|
|
12
|
+
class="css-dznme2-rubberbandControl"
|
|
13
13
|
role="presentation"
|
|
14
14
|
>
|
|
15
15
|
<div
|
|
16
|
-
class="css-
|
|
16
|
+
class="css-16vhz0m-scalebar"
|
|
17
17
|
>
|
|
18
18
|
<div
|
|
19
|
-
class="css-
|
|
19
|
+
class="css-den3n5-scalebarVisibleRegion"
|
|
20
20
|
style="width: 800px; left: 0px; background: rgba(66, 165, 245, 0.3); border-color: #42a5f5;"
|
|
21
21
|
/>
|
|
22
22
|
<div
|
|
23
|
-
class="css-
|
|
23
|
+
class="css-osn2dd-scalebarContig"
|
|
24
24
|
style="width: 0px; left: 0px; background-color: rgb(153, 153, 153);"
|
|
25
25
|
/>
|
|
26
26
|
<div>
|
|
27
27
|
<p
|
|
28
|
-
class="MuiTypography-root MuiTypography-body1 css-
|
|
28
|
+
class="MuiTypography-root MuiTypography-body1 css-1hokke9-MuiTypography-root-scalebarRefName"
|
|
29
29
|
style="left: 3px; color: rgb(153, 102, 0);"
|
|
30
30
|
>
|
|
31
31
|
ctgA
|
|
32
32
|
</p>
|
|
33
33
|
<div
|
|
34
|
-
class="css-
|
|
34
|
+
class="css-c4j89u-scalebarContig-scalebarContigForward-scalebarBorder"
|
|
35
35
|
style="left: 0px; width: 800px; border-color: rgb(153, 102, 0);"
|
|
36
36
|
>
|
|
37
37
|
<p
|
|
38
|
-
class="MuiTypography-root MuiTypography-body2 css-
|
|
38
|
+
class="MuiTypography-root MuiTypography-body2 css-7mggk8-MuiTypography-root-scalebarLabel"
|
|
39
39
|
style="left: 160px; pointer-events: none; color: rgb(153, 102, 0);"
|
|
40
40
|
>
|
|
41
41
|
20
|
|
42
42
|
</p>
|
|
43
43
|
<p
|
|
44
|
-
class="MuiTypography-root MuiTypography-body2 css-
|
|
44
|
+
class="MuiTypography-root MuiTypography-body2 css-7mggk8-MuiTypography-root-scalebarLabel"
|
|
45
45
|
style="left: 320px; pointer-events: none; color: rgb(153, 102, 0);"
|
|
46
46
|
>
|
|
47
47
|
40
|
|
48
48
|
</p>
|
|
49
49
|
<p
|
|
50
|
-
class="MuiTypography-root MuiTypography-body2 css-
|
|
50
|
+
class="MuiTypography-root MuiTypography-body2 css-7mggk8-MuiTypography-root-scalebarLabel"
|
|
51
51
|
style="left: 480px; pointer-events: none; color: rgb(153, 102, 0);"
|
|
52
52
|
>
|
|
53
53
|
60
|
|
54
54
|
</p>
|
|
55
55
|
<p
|
|
56
|
-
class="MuiTypography-root MuiTypography-body2 css-
|
|
56
|
+
class="MuiTypography-root MuiTypography-body2 css-7mggk8-MuiTypography-root-scalebarLabel"
|
|
57
57
|
style="left: 640px; pointer-events: none; color: rgb(153, 102, 0);"
|
|
58
58
|
>
|
|
59
59
|
80
|
|
60
60
|
</p>
|
|
61
61
|
<p
|
|
62
|
-
class="MuiTypography-root MuiTypography-body2 css-
|
|
62
|
+
class="MuiTypography-root MuiTypography-body2 css-7mggk8-MuiTypography-root-scalebarLabel"
|
|
63
63
|
style="left: 800px; pointer-events: none; color: rgb(153, 102, 0);"
|
|
64
64
|
>
|
|
65
65
|
100
|
|
@@ -67,7 +67,7 @@ exports[`<LinearGenomeView /> renders one track, one region 1`] = `
|
|
|
67
67
|
</div>
|
|
68
68
|
</div>
|
|
69
69
|
<div
|
|
70
|
-
class="css-
|
|
70
|
+
class="css-osn2dd-scalebarContig"
|
|
71
71
|
style="width: 0px; left: 800px; background-color: rgb(153, 153, 153);"
|
|
72
72
|
/>
|
|
73
73
|
</div>
|
|
@@ -381,20 +381,19 @@ exports[`<LinearGenomeView /> renders one track, one region 1`] = `
|
|
|
381
381
|
</div>
|
|
382
382
|
</div>
|
|
383
383
|
<div
|
|
384
|
-
class="css-
|
|
385
|
-
data-testid="
|
|
386
|
-
role="presentation"
|
|
384
|
+
class="css-dznme2-rubberbandControl"
|
|
385
|
+
data-testid="rubberband_controls"
|
|
387
386
|
>
|
|
388
387
|
<div
|
|
389
|
-
class="MuiPaper-root MuiPaper-outlined MuiPaper-rounded css-
|
|
388
|
+
class="MuiPaper-root MuiPaper-outlined MuiPaper-rounded css-1coqp07-MuiPaper-root-scalebarContainer"
|
|
390
389
|
data-resizer="true"
|
|
391
390
|
style="height: 17px; box-sizing: border-box;"
|
|
392
391
|
>
|
|
393
392
|
<div
|
|
394
|
-
class="css-
|
|
393
|
+
class="css-khofof-scalebarZoomContainer"
|
|
395
394
|
>
|
|
396
395
|
<div
|
|
397
|
-
class="css-
|
|
396
|
+
class="css-y3821b-scalebar"
|
|
398
397
|
style="left: -801px; width: 1700px; height: 17px; box-sizing: border-box;"
|
|
399
398
|
>
|
|
400
399
|
<div
|
|
@@ -512,7 +511,6 @@ exports[`<LinearGenomeView /> renders one track, one region 1`] = `
|
|
|
512
511
|
>
|
|
513
512
|
<div
|
|
514
513
|
class="css-d6gpow-linearBlocks"
|
|
515
|
-
data-testid="Blockset"
|
|
516
514
|
style="left: -800px;"
|
|
517
515
|
>
|
|
518
516
|
<div
|
|
@@ -545,7 +543,7 @@ exports[`<LinearGenomeView /> renders one track, one region 1`] = `
|
|
|
545
543
|
</div>
|
|
546
544
|
`;
|
|
547
545
|
|
|
548
|
-
exports[
|
|
546
|
+
exports[`renders two tracks, two regions 1`] = `
|
|
549
547
|
<div
|
|
550
548
|
style="position: relative;"
|
|
551
549
|
>
|
|
@@ -554,73 +552,73 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
|
|
|
554
552
|
style="position: relative;"
|
|
555
553
|
>
|
|
556
554
|
<div
|
|
557
|
-
class="css-
|
|
555
|
+
class="css-dznme2-rubberbandControl"
|
|
558
556
|
role="presentation"
|
|
559
557
|
>
|
|
560
558
|
<div
|
|
561
|
-
class="css-
|
|
559
|
+
class="css-16vhz0m-scalebar"
|
|
562
560
|
>
|
|
563
561
|
<div
|
|
564
|
-
class="css-
|
|
562
|
+
class="css-den3n5-scalebarVisibleRegion"
|
|
565
563
|
style="width: 580px; left: 0px; background: rgba(66, 165, 245, 0.3); border-color: #42a5f5;"
|
|
566
564
|
/>
|
|
567
565
|
<div
|
|
568
|
-
class="css-
|
|
566
|
+
class="css-osn2dd-scalebarContig"
|
|
569
567
|
style="width: 0px; left: 0px; background-color: rgb(153, 153, 153);"
|
|
570
568
|
/>
|
|
571
569
|
<div>
|
|
572
570
|
<p
|
|
573
|
-
class="MuiTypography-root MuiTypography-body1 css-
|
|
571
|
+
class="MuiTypography-root MuiTypography-body1 css-1hokke9-MuiTypography-root-scalebarRefName"
|
|
574
572
|
style="left: 3px; color: rgb(153, 102, 0);"
|
|
575
573
|
>
|
|
576
574
|
ctgA
|
|
577
575
|
</p>
|
|
578
576
|
<div
|
|
579
|
-
class="css-
|
|
577
|
+
class="css-c4j89u-scalebarContig-scalebarContigForward-scalebarBorder"
|
|
580
578
|
style="left: 0px; width: 72.72727272727273px; border-color: rgb(153, 102, 0);"
|
|
581
579
|
/>
|
|
582
580
|
</div>
|
|
583
581
|
<div
|
|
584
|
-
class="css-
|
|
582
|
+
class="css-osn2dd-scalebarContig"
|
|
585
583
|
style="width: 0px; left: 72.72727272727273px; background-color: rgb(153, 153, 153);"
|
|
586
584
|
/>
|
|
587
585
|
<div>
|
|
588
586
|
<p
|
|
589
|
-
class="MuiTypography-root MuiTypography-body1 css-
|
|
587
|
+
class="MuiTypography-root MuiTypography-body1 css-1hokke9-MuiTypography-root-scalebarRefName"
|
|
590
588
|
style="left: 75.72727272727273px;"
|
|
591
589
|
>
|
|
592
590
|
ctgB
|
|
593
591
|
</p>
|
|
594
592
|
<div
|
|
595
|
-
class="css-
|
|
593
|
+
class="css-c4j89u-scalebarContig-scalebarContigForward-scalebarBorder"
|
|
596
594
|
style="left: 72.72727272727273px; width: 727.2727272727273px;"
|
|
597
595
|
>
|
|
598
596
|
<p
|
|
599
|
-
class="MuiTypography-root MuiTypography-body2 css-
|
|
597
|
+
class="MuiTypography-root MuiTypography-body2 css-7mggk8-MuiTypography-root-scalebarLabel"
|
|
600
598
|
style="left: 145.0909090909091px; pointer-events: none;"
|
|
601
599
|
>
|
|
602
600
|
1,200
|
|
603
601
|
</p>
|
|
604
602
|
<p
|
|
605
|
-
class="MuiTypography-root MuiTypography-body2 css-
|
|
603
|
+
class="MuiTypography-root MuiTypography-body2 css-7mggk8-MuiTypography-root-scalebarLabel"
|
|
606
604
|
style="left: 290.1818181818182px; pointer-events: none;"
|
|
607
605
|
>
|
|
608
606
|
1,400
|
|
609
607
|
</p>
|
|
610
608
|
<p
|
|
611
|
-
class="MuiTypography-root MuiTypography-body2 css-
|
|
609
|
+
class="MuiTypography-root MuiTypography-body2 css-7mggk8-MuiTypography-root-scalebarLabel"
|
|
612
610
|
style="left: 435.27272727272725px; pointer-events: none;"
|
|
613
611
|
>
|
|
614
612
|
1,600
|
|
615
613
|
</p>
|
|
616
614
|
<p
|
|
617
|
-
class="MuiTypography-root MuiTypography-body2 css-
|
|
615
|
+
class="MuiTypography-root MuiTypography-body2 css-7mggk8-MuiTypography-root-scalebarLabel"
|
|
618
616
|
style="left: 580.3636363636364px; pointer-events: none;"
|
|
619
617
|
>
|
|
620
618
|
1,800
|
|
621
619
|
</p>
|
|
622
620
|
<p
|
|
623
|
-
class="MuiTypography-root MuiTypography-body2 css-
|
|
621
|
+
class="MuiTypography-root MuiTypography-body2 css-7mggk8-MuiTypography-root-scalebarLabel"
|
|
624
622
|
style="left: 725.4545454545454px; pointer-events: none;"
|
|
625
623
|
>
|
|
626
624
|
2,000
|
|
@@ -628,7 +626,7 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
|
|
|
628
626
|
</div>
|
|
629
627
|
</div>
|
|
630
628
|
<div
|
|
631
|
-
class="css-
|
|
629
|
+
class="css-osn2dd-scalebarContig"
|
|
632
630
|
style="width: 0px; left: 800px; background-color: rgb(153, 153, 153);"
|
|
633
631
|
/>
|
|
634
632
|
</div>
|
|
@@ -1117,20 +1115,19 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
|
|
|
1117
1115
|
</div>
|
|
1118
1116
|
</div>
|
|
1119
1117
|
<div
|
|
1120
|
-
class="css-
|
|
1121
|
-
data-testid="
|
|
1122
|
-
role="presentation"
|
|
1118
|
+
class="css-dznme2-rubberbandControl"
|
|
1119
|
+
data-testid="rubberband_controls"
|
|
1123
1120
|
>
|
|
1124
1121
|
<div
|
|
1125
|
-
class="MuiPaper-root MuiPaper-outlined MuiPaper-rounded css-
|
|
1122
|
+
class="MuiPaper-root MuiPaper-outlined MuiPaper-rounded css-1coqp07-MuiPaper-root-scalebarContainer"
|
|
1126
1123
|
data-resizer="true"
|
|
1127
1124
|
style="height: 17px; box-sizing: border-box;"
|
|
1128
1125
|
>
|
|
1129
1126
|
<div
|
|
1130
|
-
class="css-
|
|
1127
|
+
class="css-khofof-scalebarZoomContainer"
|
|
1131
1128
|
>
|
|
1132
1129
|
<div
|
|
1133
|
-
class="css-
|
|
1130
|
+
class="css-y3821b-scalebar"
|
|
1134
1131
|
style="left: -801px; width: 1702px; height: 17px; box-sizing: border-box;"
|
|
1135
1132
|
>
|
|
1136
1133
|
<div
|
|
@@ -1310,7 +1307,6 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
|
|
|
1310
1307
|
>
|
|
1311
1308
|
<div
|
|
1312
1309
|
class="css-d6gpow-linearBlocks"
|
|
1313
|
-
data-testid="Blockset"
|
|
1314
1310
|
style="left: -800px;"
|
|
1315
1311
|
>
|
|
1316
1312
|
<div
|
|
@@ -1442,7 +1438,6 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
|
|
|
1442
1438
|
>
|
|
1443
1439
|
<div
|
|
1444
1440
|
class="css-d6gpow-linearBlocks"
|
|
1445
|
-
data-testid="Blockset"
|
|
1446
1441
|
style="left: -800px;"
|
|
1447
1442
|
>
|
|
1448
1443
|
<div
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useState } from 'react'
|
|
2
|
+
import normalizeWheel from 'normalize-wheel'
|
|
3
|
+
|
|
4
|
+
// locals
|
|
5
|
+
import { LinearGenomeViewModel } from '..'
|
|
6
|
+
import { getRelativeX } from './util'
|
|
7
|
+
|
|
8
|
+
type LGV = LinearGenomeViewModel
|
|
9
|
+
type Timer = ReturnType<typeof setTimeout>
|
|
10
|
+
|
|
11
|
+
export function useSideScroll(model: LGV) {
|
|
12
|
+
const [mouseDragging, setMouseDragging] = useState(false)
|
|
13
|
+
// refs are to store these variables to avoid repeated rerenders associated
|
|
14
|
+
// with useState/setState
|
|
15
|
+
const scheduled = useRef(false)
|
|
16
|
+
|
|
17
|
+
const prevX = useRef<number>(0)
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
let cleanup = () => {}
|
|
21
|
+
|
|
22
|
+
function globalMouseMove(event: MouseEvent) {
|
|
23
|
+
event.preventDefault()
|
|
24
|
+
const currX = event.clientX
|
|
25
|
+
const distance = currX - prevX.current
|
|
26
|
+
if (distance) {
|
|
27
|
+
// use rAF to make it so multiple event handlers aren't fired per-frame
|
|
28
|
+
// see https://calendar.perfplanet.com/2013/the-runtime-performance-checklist/
|
|
29
|
+
if (!scheduled.current) {
|
|
30
|
+
scheduled.current = true
|
|
31
|
+
window.requestAnimationFrame(() => {
|
|
32
|
+
model.horizontalScroll(-distance)
|
|
33
|
+
scheduled.current = false
|
|
34
|
+
prevX.current = event.clientX
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function globalMouseUp() {
|
|
41
|
+
prevX.current = 0
|
|
42
|
+
if (mouseDragging) {
|
|
43
|
+
setMouseDragging(false)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (mouseDragging) {
|
|
48
|
+
window.addEventListener('mousemove', globalMouseMove, true)
|
|
49
|
+
window.addEventListener('mouseup', globalMouseUp, true)
|
|
50
|
+
cleanup = () => {
|
|
51
|
+
window.removeEventListener('mousemove', globalMouseMove, true)
|
|
52
|
+
window.removeEventListener('mouseup', globalMouseUp, true)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return cleanup
|
|
56
|
+
}, [model, mouseDragging, prevX])
|
|
57
|
+
|
|
58
|
+
function mouseDown(event: React.MouseEvent) {
|
|
59
|
+
if (event.shiftKey) {
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
// check if clicking a draggable element or a resize handle
|
|
63
|
+
const target = event.target as HTMLElement
|
|
64
|
+
if (target.draggable || target.dataset.resizer) {
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// otherwise do click and drag scroll
|
|
69
|
+
if (event.button === 0) {
|
|
70
|
+
prevX.current = event.clientX
|
|
71
|
+
setMouseDragging(true)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// this local mouseup is used in addition to the global because sometimes
|
|
76
|
+
// the global add/remove are not called in time, resulting in issue #533
|
|
77
|
+
function mouseUp(event: React.MouseEvent) {
|
|
78
|
+
event.preventDefault()
|
|
79
|
+
setMouseDragging(false)
|
|
80
|
+
}
|
|
81
|
+
return { mouseDown, mouseUp }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface AnchorPosition {
|
|
85
|
+
offsetX: number
|
|
86
|
+
clientX: number
|
|
87
|
+
clientY: number
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function useRangeSelect(
|
|
91
|
+
ref: React.RefObject<HTMLDivElement>,
|
|
92
|
+
model: LGV,
|
|
93
|
+
shiftOnly?: boolean,
|
|
94
|
+
) {
|
|
95
|
+
const [startX, setStartX] = useState<number>()
|
|
96
|
+
const [currentX, setCurrentX] = useState<number>()
|
|
97
|
+
|
|
98
|
+
// clientX and clientY used for anchorPosition for menu
|
|
99
|
+
// offsetX used for calculations about width of selection
|
|
100
|
+
const [anchorPosition, setAnchorPosition] = useState<AnchorPosition>()
|
|
101
|
+
const [guideX, setGuideX] = useState<number>()
|
|
102
|
+
const mouseDragging = startX !== undefined && anchorPosition === undefined
|
|
103
|
+
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
function computeOffsets(offsetX: number) {
|
|
106
|
+
if (startX === undefined) {
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
const leftPx = Math.min(startX, offsetX)
|
|
110
|
+
const rightPx = Math.max(startX, offsetX)
|
|
111
|
+
return {
|
|
112
|
+
leftOffset: model.pxToBp(leftPx),
|
|
113
|
+
rightOffset: model.pxToBp(rightPx),
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function globalMouseMove(event: MouseEvent) {
|
|
118
|
+
if (ref.current && mouseDragging) {
|
|
119
|
+
const relativeX = getRelativeX(event, ref.current)
|
|
120
|
+
setCurrentX(relativeX)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function globalMouseUp(event: MouseEvent) {
|
|
125
|
+
if (startX !== undefined && ref.current) {
|
|
126
|
+
const { clientX, clientY } = event
|
|
127
|
+
const offsetX = getRelativeX(event, ref.current)
|
|
128
|
+
// as stated above, store both clientX/Y and offsetX for different
|
|
129
|
+
// purposes
|
|
130
|
+
setAnchorPosition({
|
|
131
|
+
offsetX,
|
|
132
|
+
clientX,
|
|
133
|
+
clientY,
|
|
134
|
+
})
|
|
135
|
+
const args = computeOffsets(offsetX)
|
|
136
|
+
if (args) {
|
|
137
|
+
model.setOffsets(args.leftOffset, args.rightOffset)
|
|
138
|
+
}
|
|
139
|
+
setGuideX(undefined)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (mouseDragging) {
|
|
143
|
+
window.addEventListener('mousemove', globalMouseMove)
|
|
144
|
+
window.addEventListener('mouseup', globalMouseUp)
|
|
145
|
+
return () => {
|
|
146
|
+
window.removeEventListener('mousemove', globalMouseMove)
|
|
147
|
+
window.removeEventListener('mouseup', globalMouseUp)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return () => {}
|
|
151
|
+
}, [startX, mouseDragging, anchorPosition, model, ref])
|
|
152
|
+
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
if (
|
|
155
|
+
!mouseDragging &&
|
|
156
|
+
currentX !== undefined &&
|
|
157
|
+
startX !== undefined &&
|
|
158
|
+
Math.abs(currentX - startX) <= 3
|
|
159
|
+
) {
|
|
160
|
+
handleClose()
|
|
161
|
+
}
|
|
162
|
+
}, [mouseDragging, currentX, startX])
|
|
163
|
+
|
|
164
|
+
function mouseDown(event: React.MouseEvent<HTMLDivElement>) {
|
|
165
|
+
if (shiftOnly && !event.shiftKey) {
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
event.preventDefault()
|
|
170
|
+
event.stopPropagation()
|
|
171
|
+
const relativeX = getRelativeX(event, ref.current)
|
|
172
|
+
setStartX(relativeX)
|
|
173
|
+
setCurrentX(relativeX)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function mouseMove(event: React.MouseEvent<HTMLDivElement>) {
|
|
177
|
+
if (shiftOnly) {
|
|
178
|
+
if (event.shiftKey) {
|
|
179
|
+
setGuideX(getRelativeX(event, ref.current))
|
|
180
|
+
} else {
|
|
181
|
+
setGuideX(undefined)
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
setGuideX(getRelativeX(event, ref.current))
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function mouseOut() {
|
|
189
|
+
setGuideX(undefined)
|
|
190
|
+
model.setOffsets(undefined, undefined)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function handleClose() {
|
|
194
|
+
setAnchorPosition(undefined)
|
|
195
|
+
setStartX(undefined)
|
|
196
|
+
setCurrentX(undefined)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function handleMenuItemClick(_: unknown, callback: Function) {
|
|
200
|
+
callback()
|
|
201
|
+
handleClose()
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const open = Boolean(anchorPosition)
|
|
205
|
+
if (startX === undefined) {
|
|
206
|
+
return {
|
|
207
|
+
open,
|
|
208
|
+
guideX,
|
|
209
|
+
mouseDown,
|
|
210
|
+
mouseMove,
|
|
211
|
+
mouseOut,
|
|
212
|
+
handleMenuItemClick,
|
|
213
|
+
}
|
|
214
|
+
} else {
|
|
215
|
+
const right = anchorPosition ? anchorPosition.offsetX : currentX || 0
|
|
216
|
+
const left = right < startX ? right : startX
|
|
217
|
+
const width = Math.abs(right - startX)
|
|
218
|
+
const leftBpOffset = model.pxToBp(left)
|
|
219
|
+
const rightBpOffset = model.pxToBp(left + width)
|
|
220
|
+
const numOfBpSelected = Math.ceil(width * model.bpPerPx)
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
open,
|
|
224
|
+
rubberbandOn: true,
|
|
225
|
+
mouseDown,
|
|
226
|
+
mouseMove,
|
|
227
|
+
mouseOut,
|
|
228
|
+
handleClose,
|
|
229
|
+
handleMenuItemClick,
|
|
230
|
+
leftBpOffset,
|
|
231
|
+
rightBpOffset,
|
|
232
|
+
anchorPosition,
|
|
233
|
+
numOfBpSelected,
|
|
234
|
+
width,
|
|
235
|
+
left,
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function useWheelScroll(
|
|
241
|
+
ref: React.RefObject<HTMLDivElement>,
|
|
242
|
+
model: LGV,
|
|
243
|
+
) {
|
|
244
|
+
const delta = useRef(0)
|
|
245
|
+
const timeout = useRef<Timer>()
|
|
246
|
+
const scheduled = useRef(false)
|
|
247
|
+
useEffect(() => {
|
|
248
|
+
const curr = ref.current
|
|
249
|
+
|
|
250
|
+
// if ctrl is held down, zoom in with y-scroll
|
|
251
|
+
// else scroll horizontally with x-scroll
|
|
252
|
+
function onWheel(origEvent: WheelEvent) {
|
|
253
|
+
const event = normalizeWheel(origEvent)
|
|
254
|
+
if (origEvent.ctrlKey === true) {
|
|
255
|
+
origEvent.preventDefault()
|
|
256
|
+
delta.current += event.pixelY / 500
|
|
257
|
+
model.setScaleFactor(
|
|
258
|
+
delta.current < 0 ? 1 - delta.current : 1 / (1 + delta.current),
|
|
259
|
+
)
|
|
260
|
+
if (timeout.current) {
|
|
261
|
+
clearTimeout(timeout.current)
|
|
262
|
+
}
|
|
263
|
+
timeout.current = setTimeout(() => {
|
|
264
|
+
model.setScaleFactor(1)
|
|
265
|
+
model.zoomTo(
|
|
266
|
+
delta.current > 0
|
|
267
|
+
? model.bpPerPx * (1 + delta.current)
|
|
268
|
+
: model.bpPerPx / (1 - delta.current),
|
|
269
|
+
)
|
|
270
|
+
delta.current = 0
|
|
271
|
+
}, 300)
|
|
272
|
+
} else {
|
|
273
|
+
// this is needed to stop the event from triggering "back button
|
|
274
|
+
// action" on MacOSX etc. but is a heuristic to avoid preventing the
|
|
275
|
+
// inner-track scroll behavior
|
|
276
|
+
if (Math.abs(event.pixelX) > Math.abs(2 * event.pixelY)) {
|
|
277
|
+
origEvent.preventDefault()
|
|
278
|
+
}
|
|
279
|
+
delta.current += event.pixelX
|
|
280
|
+
if (!scheduled.current) {
|
|
281
|
+
// use rAF to make it so multiple event handlers aren't fired per-frame
|
|
282
|
+
// see https://calendar.perfplanet.com/2013/the-runtime-performance-checklist/
|
|
283
|
+
scheduled.current = true
|
|
284
|
+
window.requestAnimationFrame(() => {
|
|
285
|
+
model.horizontalScroll(delta.current)
|
|
286
|
+
delta.current = 0
|
|
287
|
+
scheduled.current = false
|
|
288
|
+
})
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (curr) {
|
|
293
|
+
curr.addEventListener('wheel', onWheel)
|
|
294
|
+
return () => {
|
|
295
|
+
curr.removeEventListener('wheel', onWheel)
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return () => {}
|
|
299
|
+
}, [model, ref])
|
|
300
|
+
}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import { Assembly } from '@jbrowse/core/assemblyManager/assembly'
|
|
2
2
|
import { SearchType } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
3
|
-
import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
|
|
4
3
|
import { SearchScope } from '@jbrowse/core/TextSearch/TextSearchManager'
|
|
5
|
-
import { TextSearchManager } from '@jbrowse/core/util'
|
|
6
|
-
|
|
7
|
-
export function dedupe(
|
|
8
|
-
results: BaseResult[] = [],
|
|
9
|
-
cb: (result: BaseResult) => string,
|
|
10
|
-
) {
|
|
11
|
-
return results.filter(
|
|
12
|
-
(elt, idx, self) => idx === self.findIndex(t => cb(t) === cb(elt)),
|
|
13
|
-
)
|
|
14
|
-
}
|
|
4
|
+
import { dedupe, TextSearchManager } from '@jbrowse/core/util'
|
|
5
|
+
import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
|
|
15
6
|
|
|
16
7
|
export async function fetchResults({
|
|
17
8
|
queryString,
|
|
@@ -63,3 +54,9 @@ export function splitLast(str: string, split: string): [string, string] {
|
|
|
63
54
|
return [before, after]
|
|
64
55
|
}
|
|
65
56
|
}
|
|
57
|
+
|
|
58
|
+
export function getRelativeX<
|
|
59
|
+
T extends { clientX: number; target: EventTarget | null },
|
|
60
|
+
>(event: T, element: HTMLElement | null) {
|
|
61
|
+
return event.clientX - (element?.getBoundingClientRect().left || 0)
|
|
62
|
+
}
|
|
@@ -947,16 +947,16 @@ test('navToLocString with human assembly', async () => {
|
|
|
947
947
|
view.setDisplayedRegions(hg38Regions.slice(0, 1))
|
|
948
948
|
const w = view.width
|
|
949
949
|
|
|
950
|
-
view.navToLocString('2')
|
|
950
|
+
await view.navToLocString('2')
|
|
951
951
|
await waitFor(() => expect(view.bpPerPx).toBe(hg38Regions[1].end / w))
|
|
952
952
|
|
|
953
|
-
view.navToLocString('chr3')
|
|
953
|
+
await view.navToLocString('chr3')
|
|
954
954
|
await waitFor(() => expect(view.bpPerPx).toBe(hg38Regions[2].end / w))
|
|
955
955
|
|
|
956
|
-
view.navToLocString('chr3:1,000,000,000-1,100,000,000')
|
|
956
|
+
await view.navToLocString('chr3:1,000,000,000-1,100,000,000')
|
|
957
957
|
await waitFor(() => expect(view.bpPerPx).toBe(0.02))
|
|
958
958
|
await waitFor(() => expect(view.offsetPx).toBe(9914777550))
|
|
959
|
-
view.navToLocString('chr3:-1,100,000,000..-1,000,000,000')
|
|
959
|
+
await view.navToLocString('chr3:-1,100,000,000..-1,000,000,000')
|
|
960
960
|
})
|
|
961
961
|
|
|
962
962
|
test('multi region', async () => {
|
|
@@ -972,7 +972,7 @@ test('multi region', async () => {
|
|
|
972
972
|
model.setWidth(800)
|
|
973
973
|
model.setDisplayedRegions(volvoxDisplayedRegions.slice(0, 1))
|
|
974
974
|
|
|
975
|
-
model.navToLocString('ctgA ctgB')
|
|
975
|
+
await model.navToLocString('ctgA ctgB')
|
|
976
976
|
await waitFor(() => expect(model.displayedRegions[0].refName).toBe('ctgA'))
|
|
977
977
|
await waitFor(() => expect(model.displayedRegions[1].refName).toBe('ctgB'))
|
|
978
978
|
})
|
|
@@ -990,8 +990,7 @@ test('space separated locstring', async () => {
|
|
|
990
990
|
model.setWidth(800)
|
|
991
991
|
model.setDisplayedRegions(volvoxDisplayedRegions.slice(0, 1))
|
|
992
992
|
|
|
993
|
-
model.navToLocString('ctgA 0 100')
|
|
994
|
-
|
|
993
|
+
await model.navToLocString('ctgA 0 100')
|
|
995
994
|
await waitFor(() => expect(model.offsetPx).toBe(0))
|
|
996
995
|
await waitFor(() => expect(model.bpPerPx).toBe(0.125))
|
|
997
996
|
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { lazy } from 'react'
|
|
2
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
3
|
+
import { ViewType } from '@jbrowse/core/pluggableElementTypes'
|
|
4
|
+
import { stateModelFactory } from './model'
|
|
5
|
+
|
|
6
|
+
export default (pluginManager: PluginManager) => {
|
|
7
|
+
pluginManager.addViewType(
|
|
8
|
+
() =>
|
|
9
|
+
new ViewType({
|
|
10
|
+
name: 'LinearGenomeView',
|
|
11
|
+
displayName: 'Linear genome view',
|
|
12
|
+
stateModel: stateModelFactory(pluginManager),
|
|
13
|
+
ReactComponent: lazy(() => import('./components/LinearGenomeView')),
|
|
14
|
+
}),
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export * from './model'
|