@jbrowse/plugin-linear-genome-view 2.5.0 → 2.6.1
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 +1 -1
- package/dist/BaseLinearDisplay/components/Block.d.ts +3 -3
- package/dist/BaseLinearDisplay/components/BlockMsg.d.ts +1 -1
- package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +3 -2
- package/dist/BaseLinearDisplay/components/TooLargeMessage.d.ts +2 -1
- package/dist/BaseLinearDisplay/components/Tooltip.d.ts +2 -1
- package/dist/BaseLinearDisplay/index.d.ts +5 -2
- package/dist/BaseLinearDisplay/index.js +7 -1
- package/dist/BaseLinearDisplay/index.js.map +1 -1
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +62 -142
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +34 -355
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/dist/BaseLinearDisplay/models/FeatureDensityMixin.d.ts +99 -0
- package/dist/BaseLinearDisplay/models/FeatureDensityMixin.js +190 -0
- package/dist/BaseLinearDisplay/models/FeatureDensityMixin.js.map +1 -0
- package/dist/BaseLinearDisplay/models/TrackHeightMixin.d.ts +30 -0
- package/dist/BaseLinearDisplay/models/TrackHeightMixin.js +56 -0
- package/dist/BaseLinearDisplay/models/TrackHeightMixin.js.map +1 -0
- package/dist/BaseLinearDisplay/models/autorunFeatureDensityStats.d.ts +2 -0
- package/dist/BaseLinearDisplay/models/autorunFeatureDensityStats.js +42 -0
- package/dist/BaseLinearDisplay/models/autorunFeatureDensityStats.js.map +1 -0
- package/dist/BaseLinearDisplay/models/configSchema.js +1 -0
- package/dist/BaseLinearDisplay/models/configSchema.js.map +1 -1
- package/dist/BaseLinearDisplay/models/renderSvg.d.ts +8 -0
- package/dist/BaseLinearDisplay/models/renderSvg.js +83 -0
- package/dist/BaseLinearDisplay/models/renderSvg.js.map +1 -0
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +20 -16
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/dist/BasicTrack/configSchema.js +1 -0
- package/dist/BasicTrack/configSchema.js.map +1 -1
- package/dist/FeatureTrack/configSchema.d.ts +1 -3
- package/dist/FeatureTrack/configSchema.js +1 -0
- package/dist/FeatureTrack/configSchema.js.map +1 -1
- package/dist/LinearBareDisplay/configSchema.d.ts +1 -0
- package/dist/LinearBareDisplay/configSchema.js +1 -0
- package/dist/LinearBareDisplay/configSchema.js.map +1 -1
- package/dist/LinearBareDisplay/model.d.ts +52 -39
- package/dist/LinearBareDisplay/model.js +1 -0
- package/dist/LinearBareDisplay/model.js.map +1 -1
- package/dist/LinearBasicDisplay/components/SetMaxHeight.d.ts +2 -1
- package/dist/LinearBasicDisplay/configSchema.d.ts +1 -0
- package/dist/LinearBasicDisplay/configSchema.js +1 -0
- package/dist/LinearBasicDisplay/configSchema.js.map +1 -1
- package/dist/LinearBasicDisplay/model.d.ts +67 -66
- package/dist/LinearBasicDisplay/model.js +1 -0
- package/dist/LinearBasicDisplay/model.js.map +1 -1
- package/dist/LinearGenomeView/components/CenterLine.d.ts +2 -1
- package/dist/LinearGenomeView/components/Cytobands.d.ts +2 -1
- package/dist/LinearGenomeView/components/ExportSvgDialog.d.ts +2 -1
- package/dist/LinearGenomeView/components/GetSequenceDialog.d.ts +2 -1
- package/dist/LinearGenomeView/components/Gridlines.d.ts +2 -1
- package/dist/LinearGenomeView/components/Header.d.ts +2 -1
- package/dist/LinearGenomeView/components/ImportForm.d.ts +2 -1
- package/dist/LinearGenomeView/components/LinearGenomeView.d.ts +2 -1
- package/dist/LinearGenomeView/components/LinearGenomeView.js +28 -4
- package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
- package/dist/LinearGenomeView/components/MiniControls.d.ts +3 -2
- package/dist/LinearGenomeView/components/MiniControls.js +20 -40
- package/dist/LinearGenomeView/components/MiniControls.js.map +1 -1
- package/dist/LinearGenomeView/components/OverviewRubberband.d.ts +1 -1
- package/dist/LinearGenomeView/components/OverviewScalebar.d.ts +2 -2
- package/dist/LinearGenomeView/components/OverviewScalebar.js +10 -4
- package/dist/LinearGenomeView/components/OverviewScalebar.js.map +1 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.d.ts +10 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.js +22 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.js.map +1 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.d.ts +5 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.js +52 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.js.map +1 -0
- package/dist/LinearGenomeView/components/{HelpDialog.d.ts → RefNameAutocomplete/HelpDialog.d.ts} +2 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete/HelpDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete/index.d.ts +18 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete/index.js +111 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete/index.js.map +1 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete/util.d.ts +12 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete/util.js +59 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete/util.js.map +1 -0
- package/dist/LinearGenomeView/components/Rubberband.d.ts +1 -1
- package/dist/LinearGenomeView/components/RubberbandSpan.d.ts +2 -1
- package/dist/LinearGenomeView/components/SearchBox.d.ts +2 -1
- package/dist/LinearGenomeView/components/SearchResultsDialog.d.ts +2 -1
- package/dist/LinearGenomeView/components/SearchResultsTable.d.ts +2 -1
- package/dist/LinearGenomeView/components/SequenceSearchDialog.d.ts +2 -1
- package/dist/LinearGenomeView/components/TrackContainer.d.ts +3 -3
- package/dist/LinearGenomeView/components/TrackContainer.js +12 -68
- package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -1
- package/dist/LinearGenomeView/components/TrackLabel.js +6 -10
- package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -1
- package/dist/LinearGenomeView/components/TrackLabelContainer.d.ts +9 -0
- package/dist/LinearGenomeView/components/TrackLabelContainer.js +32 -0
- package/dist/LinearGenomeView/components/TrackLabelContainer.js.map +1 -0
- package/dist/LinearGenomeView/components/TrackRenderingContainer.d.ts +10 -0
- package/dist/LinearGenomeView/components/TrackRenderingContainer.js +74 -0
- package/dist/LinearGenomeView/components/TrackRenderingContainer.js.map +1 -0
- package/dist/LinearGenomeView/components/TracksContainer.d.ts +1 -1
- package/dist/LinearGenomeView/components/TracksContainer.js +2 -2
- package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -1
- package/dist/LinearGenomeView/components/VerticalGuide.d.ts +2 -1
- package/dist/LinearGenomeView/components/ZoomControls.d.ts +2 -1
- package/dist/LinearGenomeView/model.d.ts +13 -12
- package/dist/LinearGenomeView/model.js +25 -25
- package/dist/LinearGenomeView/model.js.map +1 -1
- package/dist/LinearGenomeView/svgcomponents/SVGBackground.d.ts +2 -1
- package/dist/LinearGenomeView/svgcomponents/SVGHeader.d.ts +3 -4
- package/dist/LinearGenomeView/svgcomponents/SVGHeader.js +7 -2
- package/dist/LinearGenomeView/svgcomponents/SVGHeader.js.map +1 -1
- package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +1 -1
- package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js.map +1 -1
- package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +2 -1
- package/dist/LinearGenomeView/svgcomponents/SVGRuler.d.ts +2 -1
- package/dist/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +2 -1
- package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +2 -1
- package/dist/LinearGenomeView/svgcomponents/SVGTracks.d.ts +2 -1
- package/dist/LinearGenomeView/util.d.ts +2 -2
- package/dist/index.d.ts +160 -134
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +1 -1
- package/esm/BaseLinearDisplay/components/Block.d.ts +3 -3
- package/esm/BaseLinearDisplay/components/BlockMsg.d.ts +1 -1
- package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +3 -2
- package/esm/BaseLinearDisplay/components/TooLargeMessage.d.ts +2 -1
- package/esm/BaseLinearDisplay/components/Tooltip.d.ts +2 -1
- package/esm/BaseLinearDisplay/index.d.ts +5 -2
- package/esm/BaseLinearDisplay/index.js +3 -0
- package/esm/BaseLinearDisplay/index.js.map +1 -1
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +62 -142
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +36 -334
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/esm/BaseLinearDisplay/models/FeatureDensityMixin.d.ts +99 -0
- package/esm/BaseLinearDisplay/models/FeatureDensityMixin.js +184 -0
- package/esm/BaseLinearDisplay/models/FeatureDensityMixin.js.map +1 -0
- package/esm/BaseLinearDisplay/models/TrackHeightMixin.d.ts +30 -0
- package/esm/BaseLinearDisplay/models/TrackHeightMixin.js +53 -0
- package/esm/BaseLinearDisplay/models/TrackHeightMixin.js.map +1 -0
- package/esm/BaseLinearDisplay/models/autorunFeatureDensityStats.d.ts +2 -0
- package/esm/BaseLinearDisplay/models/autorunFeatureDensityStats.js +39 -0
- package/esm/BaseLinearDisplay/models/autorunFeatureDensityStats.js.map +1 -0
- package/esm/BaseLinearDisplay/models/configSchema.js +1 -0
- package/esm/BaseLinearDisplay/models/configSchema.js.map +1 -1
- package/esm/BaseLinearDisplay/models/renderSvg.d.ts +8 -0
- package/esm/BaseLinearDisplay/models/renderSvg.js +54 -0
- package/esm/BaseLinearDisplay/models/renderSvg.js.map +1 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +20 -16
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/esm/BasicTrack/configSchema.js +1 -0
- package/esm/BasicTrack/configSchema.js.map +1 -1
- package/esm/FeatureTrack/configSchema.d.ts +1 -3
- package/esm/FeatureTrack/configSchema.js +1 -0
- package/esm/FeatureTrack/configSchema.js.map +1 -1
- package/esm/LinearBareDisplay/configSchema.d.ts +1 -0
- package/esm/LinearBareDisplay/configSchema.js +1 -0
- package/esm/LinearBareDisplay/configSchema.js.map +1 -1
- package/esm/LinearBareDisplay/model.d.ts +52 -39
- package/esm/LinearBareDisplay/model.js +1 -0
- package/esm/LinearBareDisplay/model.js.map +1 -1
- package/esm/LinearBasicDisplay/components/SetMaxHeight.d.ts +2 -1
- package/esm/LinearBasicDisplay/configSchema.d.ts +1 -0
- package/esm/LinearBasicDisplay/configSchema.js +1 -0
- package/esm/LinearBasicDisplay/configSchema.js.map +1 -1
- package/esm/LinearBasicDisplay/model.d.ts +67 -66
- package/esm/LinearBasicDisplay/model.js +1 -0
- package/esm/LinearBasicDisplay/model.js.map +1 -1
- package/esm/LinearGenomeView/components/CenterLine.d.ts +2 -1
- package/esm/LinearGenomeView/components/Cytobands.d.ts +2 -1
- package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +2 -1
- package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +2 -1
- package/esm/LinearGenomeView/components/Gridlines.d.ts +2 -1
- package/esm/LinearGenomeView/components/Header.d.ts +2 -1
- package/esm/LinearGenomeView/components/ImportForm.d.ts +2 -1
- package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +2 -1
- package/esm/LinearGenomeView/components/LinearGenomeView.js +4 -3
- package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
- package/esm/LinearGenomeView/components/MiniControls.d.ts +3 -2
- package/esm/LinearGenomeView/components/MiniControls.js +20 -17
- package/esm/LinearGenomeView/components/MiniControls.js.map +1 -1
- package/esm/LinearGenomeView/components/OverviewRubberband.d.ts +1 -1
- package/esm/LinearGenomeView/components/OverviewScalebar.d.ts +2 -2
- package/esm/LinearGenomeView/components/OverviewScalebar.js +10 -4
- package/esm/LinearGenomeView/components/OverviewScalebar.js.map +1 -1
- package/esm/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.d.ts +10 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.js +16 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.js.map +1 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.d.ts +5 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.js +23 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.js.map +1 -0
- package/esm/LinearGenomeView/components/{HelpDialog.d.ts → RefNameAutocomplete/HelpDialog.d.ts} +2 -1
- package/esm/LinearGenomeView/components/RefNameAutocomplete/HelpDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete/index.d.ts +18 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete/index.js +83 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete/index.js.map +1 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete/util.d.ts +12 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete/util.js +50 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete/util.js.map +1 -0
- package/esm/LinearGenomeView/components/Rubberband.d.ts +1 -1
- package/esm/LinearGenomeView/components/RubberbandSpan.d.ts +2 -1
- package/esm/LinearGenomeView/components/SearchBox.d.ts +2 -1
- package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +2 -1
- package/esm/LinearGenomeView/components/SearchResultsTable.d.ts +2 -1
- package/esm/LinearGenomeView/components/SequenceSearchDialog.d.ts +2 -1
- package/esm/LinearGenomeView/components/TrackContainer.d.ts +3 -3
- package/esm/LinearGenomeView/components/TrackContainer.js +13 -69
- package/esm/LinearGenomeView/components/TrackContainer.js.map +1 -1
- package/esm/LinearGenomeView/components/TrackLabel.js +6 -10
- package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -1
- package/esm/LinearGenomeView/components/TrackLabelContainer.d.ts +9 -0
- package/esm/LinearGenomeView/components/TrackLabelContainer.js +27 -0
- package/esm/LinearGenomeView/components/TrackLabelContainer.js.map +1 -0
- package/esm/LinearGenomeView/components/TrackRenderingContainer.d.ts +10 -0
- package/esm/LinearGenomeView/components/TrackRenderingContainer.js +49 -0
- package/esm/LinearGenomeView/components/TrackRenderingContainer.js.map +1 -0
- package/esm/LinearGenomeView/components/TracksContainer.d.ts +1 -1
- package/esm/LinearGenomeView/components/TracksContainer.js +2 -2
- package/esm/LinearGenomeView/components/TracksContainer.js.map +1 -1
- package/esm/LinearGenomeView/components/VerticalGuide.d.ts +2 -1
- package/esm/LinearGenomeView/components/ZoomControls.d.ts +2 -1
- package/esm/LinearGenomeView/model.d.ts +13 -12
- package/esm/LinearGenomeView/model.js +21 -21
- package/esm/LinearGenomeView/model.js.map +1 -1
- package/esm/LinearGenomeView/svgcomponents/SVGBackground.d.ts +2 -1
- package/esm/LinearGenomeView/svgcomponents/SVGHeader.d.ts +3 -4
- package/esm/LinearGenomeView/svgcomponents/SVGHeader.js +7 -2
- package/esm/LinearGenomeView/svgcomponents/SVGHeader.js.map +1 -1
- package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +1 -1
- package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js.map +1 -1
- package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +2 -1
- package/esm/LinearGenomeView/svgcomponents/SVGRuler.d.ts +2 -1
- package/esm/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +2 -1
- package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +2 -1
- package/esm/LinearGenomeView/svgcomponents/SVGTracks.d.ts +2 -1
- package/esm/LinearGenomeView/util.d.ts +2 -2
- package/esm/index.d.ts +160 -134
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/package.json +2 -2
- package/src/BaseLinearDisplay/index.ts +5 -1
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +46 -407
- package/src/BaseLinearDisplay/models/FeatureDensityMixin.tsx +213 -0
- package/src/BaseLinearDisplay/models/TrackHeightMixin.tsx +59 -0
- package/src/BaseLinearDisplay/models/autorunFeatureDensityStats.ts +46 -0
- package/src/BaseLinearDisplay/models/configSchema.ts +1 -0
- package/src/BaseLinearDisplay/models/renderSvg.tsx +101 -0
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +21 -19
- package/src/BasicTrack/configSchema.ts +1 -0
- package/src/FeatureTrack/configSchema.ts +1 -0
- package/src/LinearBareDisplay/configSchema.ts +1 -0
- package/src/LinearBareDisplay/model.ts +1 -0
- package/src/LinearBasicDisplay/configSchema.ts +1 -0
- package/src/LinearBasicDisplay/model.ts +1 -0
- package/src/LinearGenomeView/components/LinearGenomeView.test.tsx +3 -3
- package/src/LinearGenomeView/components/LinearGenomeView.tsx +6 -3
- package/src/LinearGenomeView/components/MiniControls.tsx +37 -38
- package/src/LinearGenomeView/components/OverviewScalebar.tsx +11 -5
- package/src/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.tsx +53 -0
- package/src/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.tsx +44 -0
- package/src/LinearGenomeView/components/RefNameAutocomplete/index.tsx +160 -0
- package/src/LinearGenomeView/components/RefNameAutocomplete/util.ts +65 -0
- package/src/LinearGenomeView/components/TrackContainer.tsx +16 -104
- package/src/LinearGenomeView/components/TrackLabel.tsx +7 -27
- package/src/LinearGenomeView/components/TrackLabelContainer.tsx +48 -0
- package/src/LinearGenomeView/components/TrackRenderingContainer.tsx +96 -0
- package/src/LinearGenomeView/components/TracksContainer.tsx +2 -2
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +3 -3
- package/src/LinearGenomeView/model.ts +29 -28
- package/src/LinearGenomeView/svgcomponents/SVGHeader.tsx +8 -6
- package/src/LinearGenomeView/svgcomponents/SVGLinearGenomeView.tsx +1 -1
- package/src/index.ts +11 -5
- package/dist/LinearGenomeView/components/HelpDialog.js.map +0 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +0 -23
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +0 -189
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +0 -1
- package/esm/LinearGenomeView/components/HelpDialog.js.map +0 -1
- package/esm/LinearGenomeView/components/RefNameAutocomplete.d.ts +0 -23
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js +0 -161
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +0 -1
- package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +0 -321
- /package/dist/LinearGenomeView/components/{HelpDialog.js → RefNameAutocomplete/HelpDialog.js} +0 -0
- /package/esm/LinearGenomeView/components/{HelpDialog.js → RefNameAutocomplete/HelpDialog.js} +0 -0
- /package/src/LinearGenomeView/components/{HelpDialog.tsx → RefNameAutocomplete/HelpDialog.tsx} +0 -0
|
@@ -93,11 +93,14 @@ const Polygon = observer(function ({
|
|
|
93
93
|
const { tertiary, primary } = theme.palette
|
|
94
94
|
const polygonColor = tertiary ? tertiary.light : primary.light
|
|
95
95
|
|
|
96
|
+
// catches possible null from at's below
|
|
96
97
|
if (!contentBlocks.length) {
|
|
97
98
|
return null
|
|
98
99
|
}
|
|
99
|
-
|
|
100
|
-
const
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
101
|
+
const first = contentBlocks.at(0)!
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
103
|
+
const last = contentBlocks.at(-1)!
|
|
101
104
|
const topLeft =
|
|
102
105
|
(overview.bpToPx({
|
|
103
106
|
...first,
|
|
@@ -238,18 +241,21 @@ const Scalebar = observer(function ({
|
|
|
238
241
|
|
|
239
242
|
const { tertiary, primary } = theme.palette
|
|
240
243
|
const scalebarColor = tertiary ? tertiary.light : primary.light
|
|
241
|
-
|
|
244
|
+
// catches possible null from at's below
|
|
242
245
|
if (!visibleRegions.length) {
|
|
243
246
|
return null
|
|
244
247
|
}
|
|
245
|
-
|
|
248
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
249
|
+
const first = visibleRegions.at(0)!
|
|
250
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
251
|
+
const last = visibleRegions.at(-1)!
|
|
252
|
+
|
|
246
253
|
const firstOverviewPx =
|
|
247
254
|
overview.bpToPx({
|
|
248
255
|
...first,
|
|
249
256
|
coord: first.reversed ? first.end : first.start,
|
|
250
257
|
}) || 0
|
|
251
258
|
|
|
252
|
-
const last = visibleRegions[visibleRegions.length - 1]
|
|
253
259
|
const lastOverviewPx =
|
|
254
260
|
overview.bpToPx({
|
|
255
261
|
...last,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
AutocompleteRenderInputParams,
|
|
4
|
+
TextField,
|
|
5
|
+
TextFieldProps as TFP,
|
|
6
|
+
} from '@mui/material'
|
|
7
|
+
|
|
8
|
+
// locals
|
|
9
|
+
import EndAdornment from './EndAdornment'
|
|
10
|
+
|
|
11
|
+
export default function AutocompleteTextField({
|
|
12
|
+
TextFieldProps,
|
|
13
|
+
inputBoxVal,
|
|
14
|
+
params,
|
|
15
|
+
showHelp,
|
|
16
|
+
setInputValue,
|
|
17
|
+
setCurrentSearch,
|
|
18
|
+
}: {
|
|
19
|
+
TextFieldProps: TFP
|
|
20
|
+
inputBoxVal: string
|
|
21
|
+
showHelp?: boolean
|
|
22
|
+
params: AutocompleteRenderInputParams
|
|
23
|
+
setInputValue: (arg: string) => void
|
|
24
|
+
setCurrentSearch: (arg: string) => void
|
|
25
|
+
}) {
|
|
26
|
+
const { helperText, InputProps = {} } = TextFieldProps
|
|
27
|
+
return (
|
|
28
|
+
<TextField
|
|
29
|
+
onBlur={() =>
|
|
30
|
+
// this is used to restore a refName or the non-user-typed input
|
|
31
|
+
// to the box on blurring
|
|
32
|
+
setInputValue(inputBoxVal)
|
|
33
|
+
}
|
|
34
|
+
{...params}
|
|
35
|
+
{...TextFieldProps}
|
|
36
|
+
size="small"
|
|
37
|
+
helperText={helperText}
|
|
38
|
+
InputProps={{
|
|
39
|
+
...params.InputProps,
|
|
40
|
+
...InputProps,
|
|
41
|
+
|
|
42
|
+
endAdornment: (
|
|
43
|
+
<EndAdornment
|
|
44
|
+
showHelp={showHelp}
|
|
45
|
+
endAdornment={params.InputProps.endAdornment}
|
|
46
|
+
/>
|
|
47
|
+
),
|
|
48
|
+
}}
|
|
49
|
+
placeholder="Search for location"
|
|
50
|
+
onChange={e => setCurrentSearch(e.target.value)}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { Suspense, lazy, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { IconButton, InputAdornment } from '@mui/material'
|
|
4
|
+
|
|
5
|
+
// icons
|
|
6
|
+
import SearchIcon from '@mui/icons-material/Search'
|
|
7
|
+
import HelpIcon from '@mui/icons-material/Help'
|
|
8
|
+
|
|
9
|
+
// lazy
|
|
10
|
+
const HelpDialog = lazy(() => import('./HelpDialog'))
|
|
11
|
+
|
|
12
|
+
function HelpAdornment() {
|
|
13
|
+
const [isHelpDialogDisplayed, setHelpDialogDisplayed] = useState(false)
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<IconButton onClick={() => setHelpDialogDisplayed(true)} size="small">
|
|
17
|
+
<HelpIcon fontSize="small" />
|
|
18
|
+
</IconButton>
|
|
19
|
+
{isHelpDialogDisplayed ? (
|
|
20
|
+
<Suspense fallback={<div />}>
|
|
21
|
+
<HelpDialog handleClose={() => setHelpDialogDisplayed(false)} />
|
|
22
|
+
</Suspense>
|
|
23
|
+
) : null}
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default function EndAdornment({
|
|
29
|
+
showHelp,
|
|
30
|
+
endAdornment,
|
|
31
|
+
}: {
|
|
32
|
+
showHelp?: boolean
|
|
33
|
+
endAdornment: React.ReactNode
|
|
34
|
+
}) {
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<InputAdornment position="end" style={{ marginRight: 7 }}>
|
|
38
|
+
<SearchIcon fontSize="small" />
|
|
39
|
+
{showHelp ? <HelpAdornment /> : null}
|
|
40
|
+
</InputAdornment>
|
|
41
|
+
{endAdornment}
|
|
42
|
+
</>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { observer } from 'mobx-react'
|
|
3
|
+
import { getSession, useDebounce, measureText } from '@jbrowse/core/util'
|
|
4
|
+
import BaseResult, {
|
|
5
|
+
RefSequenceResult,
|
|
6
|
+
} from '@jbrowse/core/TextSearch/BaseResults'
|
|
7
|
+
import { Autocomplete, TextFieldProps as TFP } from '@mui/material'
|
|
8
|
+
|
|
9
|
+
// locals
|
|
10
|
+
import { LinearGenomeViewModel } from '../../model'
|
|
11
|
+
import { getDeduplicatedResult, getFiltered, Option } from './util'
|
|
12
|
+
import AutocompleteTextField from './AutocompleteTextField'
|
|
13
|
+
|
|
14
|
+
export default observer(function RefNameAutocomplete({
|
|
15
|
+
model,
|
|
16
|
+
onSelect,
|
|
17
|
+
assemblyName,
|
|
18
|
+
style,
|
|
19
|
+
fetchResults,
|
|
20
|
+
onChange,
|
|
21
|
+
value,
|
|
22
|
+
showHelp = true,
|
|
23
|
+
minWidth = 200,
|
|
24
|
+
maxWidth = 550,
|
|
25
|
+
TextFieldProps = {},
|
|
26
|
+
}: {
|
|
27
|
+
model: LinearGenomeViewModel
|
|
28
|
+
onSelect?: (region: BaseResult) => void
|
|
29
|
+
onChange?: (val: string) => void
|
|
30
|
+
assemblyName?: string
|
|
31
|
+
value?: string
|
|
32
|
+
fetchResults: (query: string) => Promise<BaseResult[]>
|
|
33
|
+
style?: React.CSSProperties
|
|
34
|
+
minWidth?: number
|
|
35
|
+
maxWidth?: number
|
|
36
|
+
showHelp?: boolean
|
|
37
|
+
TextFieldProps?: TFP
|
|
38
|
+
}) {
|
|
39
|
+
const session = getSession(model)
|
|
40
|
+
const { assemblyManager } = session
|
|
41
|
+
const [open, setOpen] = useState(false)
|
|
42
|
+
const [loaded, setLoaded] = useState(true)
|
|
43
|
+
const [currentSearch, setCurrentSearch] = useState('')
|
|
44
|
+
const [inputValue, setInputValue] = useState('')
|
|
45
|
+
const [searchOptions, setSearchOptions] = useState<Option[]>()
|
|
46
|
+
const debouncedSearch = useDebounce(currentSearch, 300)
|
|
47
|
+
const assembly = assemblyName ? assemblyManager.get(assemblyName) : undefined
|
|
48
|
+
const { coarseVisibleLocStrings, hasDisplayedRegions } = model
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
let active = true
|
|
52
|
+
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
54
|
+
;(async () => {
|
|
55
|
+
try {
|
|
56
|
+
if (debouncedSearch === '' || !assemblyName) {
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
setLoaded(false)
|
|
61
|
+
const results = await fetchResults(debouncedSearch)
|
|
62
|
+
if (active) {
|
|
63
|
+
setLoaded(true)
|
|
64
|
+
setSearchOptions(getDeduplicatedResult(results))
|
|
65
|
+
}
|
|
66
|
+
} catch (e) {
|
|
67
|
+
console.error(e)
|
|
68
|
+
if (active) {
|
|
69
|
+
session.notify(`${e}`, 'error')
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
})()
|
|
73
|
+
|
|
74
|
+
return () => {
|
|
75
|
+
active = false
|
|
76
|
+
}
|
|
77
|
+
}, [assemblyName, fetchResults, debouncedSearch, session, model])
|
|
78
|
+
|
|
79
|
+
const inputBoxVal = coarseVisibleLocStrings || value || ''
|
|
80
|
+
|
|
81
|
+
// heuristic, text width + 60 accommodates help icon and search icon
|
|
82
|
+
const width = Math.min(
|
|
83
|
+
Math.max(measureText(inputBoxVal, 14) + 100, minWidth),
|
|
84
|
+
maxWidth,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
// notes on implementation:
|
|
88
|
+
// The selectOnFocus setting helps highlight the field when clicked
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
<Autocomplete
|
|
92
|
+
data-testid="autocomplete"
|
|
93
|
+
disableListWrap
|
|
94
|
+
disableClearable
|
|
95
|
+
disabled={!assemblyName}
|
|
96
|
+
freeSolo
|
|
97
|
+
includeInputInList
|
|
98
|
+
selectOnFocus
|
|
99
|
+
style={{ ...style, width }}
|
|
100
|
+
value={inputBoxVal}
|
|
101
|
+
loading={!loaded}
|
|
102
|
+
inputValue={inputValue}
|
|
103
|
+
onInputChange={(_event, newInputValue) => {
|
|
104
|
+
setInputValue(newInputValue)
|
|
105
|
+
onChange?.(newInputValue)
|
|
106
|
+
}}
|
|
107
|
+
loadingText="loading results"
|
|
108
|
+
open={open}
|
|
109
|
+
onOpen={() => setOpen(true)}
|
|
110
|
+
onClose={() => {
|
|
111
|
+
setOpen(false)
|
|
112
|
+
setLoaded(true)
|
|
113
|
+
if (hasDisplayedRegions) {
|
|
114
|
+
setCurrentSearch('')
|
|
115
|
+
setSearchOptions(undefined)
|
|
116
|
+
}
|
|
117
|
+
}}
|
|
118
|
+
onChange={(_event, selectedOption) => {
|
|
119
|
+
if (!selectedOption || !assemblyName) {
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (typeof selectedOption === 'string') {
|
|
124
|
+
// handles string inputs on keyPress enter
|
|
125
|
+
onSelect?.(new BaseResult({ label: selectedOption }))
|
|
126
|
+
} else {
|
|
127
|
+
onSelect?.(selectedOption.result)
|
|
128
|
+
}
|
|
129
|
+
setInputValue(inputBoxVal)
|
|
130
|
+
}}
|
|
131
|
+
options={
|
|
132
|
+
!searchOptions?.length
|
|
133
|
+
? assembly?.regions?.map(option => ({
|
|
134
|
+
result: new RefSequenceResult({
|
|
135
|
+
refName: option.refName,
|
|
136
|
+
label: option.refName,
|
|
137
|
+
matchedAttribute: 'refName',
|
|
138
|
+
}),
|
|
139
|
+
})) || []
|
|
140
|
+
: searchOptions
|
|
141
|
+
}
|
|
142
|
+
getOptionDisabled={option => option.group === 'limitOption'}
|
|
143
|
+
filterOptions={(opts, { inputValue }) => getFiltered(opts, inputValue)}
|
|
144
|
+
renderInput={params => (
|
|
145
|
+
<AutocompleteTextField
|
|
146
|
+
showHelp={showHelp}
|
|
147
|
+
params={params}
|
|
148
|
+
inputBoxVal={inputBoxVal}
|
|
149
|
+
TextFieldProps={TextFieldProps}
|
|
150
|
+
setCurrentSearch={setCurrentSearch}
|
|
151
|
+
setInputValue={setInputValue}
|
|
152
|
+
/>
|
|
153
|
+
)}
|
|
154
|
+
getOptionLabel={opt =>
|
|
155
|
+
typeof opt === 'string' ? opt : opt.result.getDisplayString()
|
|
156
|
+
}
|
|
157
|
+
/>
|
|
158
|
+
</>
|
|
159
|
+
)
|
|
160
|
+
})
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
|
|
2
|
+
|
|
3
|
+
export interface Option {
|
|
4
|
+
group?: string
|
|
5
|
+
result: BaseResult
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// filter so don't need re-filtering
|
|
9
|
+
function filterOptions(options: Option[], searchQuery: string) {
|
|
10
|
+
return options.filter(
|
|
11
|
+
({ result }) =>
|
|
12
|
+
result.getLabel().toLowerCase().includes(searchQuery) ||
|
|
13
|
+
result.matchedObject,
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// the logic of this method is to only apply a filter to RefSequenceResults
|
|
18
|
+
// because they do not have a matchedObject. the trix search results already
|
|
19
|
+
export function getFiltered(opts: Option[], inputValue: string) {
|
|
20
|
+
const filtered = filterOptions(opts, inputValue.toLocaleLowerCase())
|
|
21
|
+
return [
|
|
22
|
+
...filtered.slice(0, 100),
|
|
23
|
+
...(filtered.length > 100
|
|
24
|
+
? [
|
|
25
|
+
{
|
|
26
|
+
group: 'limitOption',
|
|
27
|
+
result: new BaseResult({
|
|
28
|
+
label: 'keep typing for more results',
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
]
|
|
32
|
+
: []),
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function aggregateResults(results: BaseResult[]) {
|
|
37
|
+
const m: { [key: string]: BaseResult[] } = {}
|
|
38
|
+
|
|
39
|
+
for (const result of results) {
|
|
40
|
+
const displayString = result.getDisplayString()
|
|
41
|
+
if (!m[displayString]) {
|
|
42
|
+
m[displayString] = []
|
|
43
|
+
}
|
|
44
|
+
m[displayString].push(result)
|
|
45
|
+
}
|
|
46
|
+
return m
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function getDeduplicatedResult(results: BaseResult[]) {
|
|
50
|
+
return Object.entries(aggregateResults(results)).map(
|
|
51
|
+
([displayString, results]) =>
|
|
52
|
+
results.length === 1
|
|
53
|
+
? {
|
|
54
|
+
result: results[0],
|
|
55
|
+
}
|
|
56
|
+
: {
|
|
57
|
+
// deduplicate a "multi-result"
|
|
58
|
+
result: new BaseResult({
|
|
59
|
+
displayString,
|
|
60
|
+
results,
|
|
61
|
+
label: displayString,
|
|
62
|
+
}),
|
|
63
|
+
},
|
|
64
|
+
)
|
|
65
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useRef } from 'react'
|
|
2
2
|
import { Paper } from '@mui/material'
|
|
3
3
|
import { makeStyles } from 'tss-react/mui'
|
|
4
4
|
import { observer } from 'mobx-react'
|
|
@@ -7,13 +7,13 @@ import { ErrorBoundary } from 'react-error-boundary'
|
|
|
7
7
|
|
|
8
8
|
// jbrowse core
|
|
9
9
|
import { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'
|
|
10
|
-
import { getConf } from '@jbrowse/core/configuration'
|
|
11
10
|
import { ResizeHandle, ErrorMessage } from '@jbrowse/core/ui'
|
|
12
11
|
import { useDebouncedCallback } from '@jbrowse/core/util'
|
|
13
12
|
|
|
14
13
|
// locals
|
|
15
14
|
import { LinearGenomeViewModel } from '..'
|
|
16
|
-
import
|
|
15
|
+
import TrackLabelContainer from './TrackLabelContainer'
|
|
16
|
+
import TrackRenderingContainer from './TrackRenderingContainer'
|
|
17
17
|
|
|
18
18
|
const useStyles = makeStyles()({
|
|
19
19
|
root: {
|
|
@@ -33,55 +33,11 @@ const useStyles = makeStyles()({
|
|
|
33
33
|
width: '100%',
|
|
34
34
|
zIndex: 3,
|
|
35
35
|
},
|
|
36
|
-
trackLabel: {
|
|
37
|
-
zIndex: 3,
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
// aligns with block boundaries. check for example the breakpoint split view
|
|
41
|
-
// demo to see if features align if wanting to change things
|
|
42
|
-
renderingComponentContainer: {
|
|
43
|
-
position: 'absolute',
|
|
44
|
-
// -1 offset because of the 1px border of the Paper
|
|
45
|
-
left: -1,
|
|
46
|
-
height: '100%',
|
|
47
|
-
width: '100%',
|
|
48
|
-
},
|
|
49
|
-
trackLabelOffset: {
|
|
50
|
-
position: 'relative',
|
|
51
|
-
display: 'inline-block',
|
|
52
|
-
},
|
|
53
|
-
trackLabelOverlap: {
|
|
54
|
-
position: 'absolute',
|
|
55
|
-
},
|
|
56
|
-
trackRenderingContainer: {
|
|
57
|
-
overflowY: 'auto',
|
|
58
|
-
overflowX: 'hidden',
|
|
59
|
-
whiteSpace: 'nowrap',
|
|
60
|
-
position: 'relative',
|
|
61
|
-
background: 'none',
|
|
62
|
-
zIndex: 2,
|
|
63
|
-
},
|
|
64
36
|
})
|
|
65
37
|
|
|
66
38
|
type LGV = LinearGenomeViewModel
|
|
67
39
|
|
|
68
|
-
|
|
69
|
-
({ model, view }: { model: BaseTrackModel; view: LGV }) => {
|
|
70
|
-
const { classes, cx } = useStyles()
|
|
71
|
-
const display = model.displays[0]
|
|
72
|
-
const { trackLabel, trackLabelOverlap, trackLabelOffset } = classes
|
|
73
|
-
const labelStyle =
|
|
74
|
-
view.trackLabels !== 'overlapping' || display.prefersOffset
|
|
75
|
-
? trackLabelOffset
|
|
76
|
-
: trackLabelOverlap
|
|
77
|
-
|
|
78
|
-
return view.trackLabels !== 'hidden' ? (
|
|
79
|
-
<TrackLabel track={model} className={cx(trackLabel, labelStyle)} />
|
|
80
|
-
) : null
|
|
81
|
-
},
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
function TrackContainer({
|
|
40
|
+
export default observer(function TrackContainer({
|
|
85
41
|
model,
|
|
86
42
|
track,
|
|
87
43
|
}: {
|
|
@@ -90,76 +46,34 @@ function TrackContainer({
|
|
|
90
46
|
}) {
|
|
91
47
|
const { classes } = useStyles()
|
|
92
48
|
const display = track.displays[0]
|
|
93
|
-
const {
|
|
94
|
-
const
|
|
95
|
-
const trackId = getConf(track, 'trackId')
|
|
96
|
-
const ref = useRef<HTMLDivElement>(null)
|
|
49
|
+
const { draggingTrackId } = model
|
|
50
|
+
const ref2 = useRef<HTMLDivElement>(null)
|
|
97
51
|
const dimmed = draggingTrackId !== undefined && draggingTrackId !== display.id
|
|
98
|
-
const minimized = track.minimized
|
|
99
52
|
const debouncedOnDragEnter = useDebouncedCallback(() => {
|
|
100
53
|
if (isAlive(display) && dimmed) {
|
|
101
|
-
moveTrack(draggingTrackId, track.id)
|
|
54
|
+
model.moveTrack(draggingTrackId, track.id)
|
|
102
55
|
}
|
|
103
56
|
}, 100)
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
if (ref.current) {
|
|
106
|
-
model.trackRefs[trackId] = ref.current
|
|
107
|
-
}
|
|
108
|
-
return () => {
|
|
109
|
-
delete model.trackRefs[trackId]
|
|
110
|
-
}
|
|
111
|
-
}, [model.trackRefs, trackId])
|
|
112
57
|
|
|
113
58
|
return (
|
|
114
59
|
<Paper
|
|
115
|
-
ref={
|
|
60
|
+
ref={ref2}
|
|
116
61
|
className={classes.root}
|
|
117
62
|
variant="outlined"
|
|
118
63
|
onClick={event => {
|
|
119
64
|
if (event.detail === 2 && !track.displays[0].featureIdUnderMouse) {
|
|
120
|
-
const left =
|
|
65
|
+
const left = ref2.current?.getBoundingClientRect().left || 0
|
|
121
66
|
model.zoomTo(model.bpPerPx / 2, event.clientX - left, true)
|
|
122
67
|
}
|
|
123
68
|
}}
|
|
124
69
|
>
|
|
125
|
-
<
|
|
126
|
-
<ErrorBoundary
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<div
|
|
131
|
-
className={classes.trackRenderingContainer}
|
|
132
|
-
style={{ height: minimized ? 20 : height }}
|
|
133
|
-
onScroll={evt => display.setScrollTop(evt.currentTarget.scrollTop)}
|
|
70
|
+
<TrackLabelContainer track={track} view={model} />
|
|
71
|
+
<ErrorBoundary FallbackComponent={e => <ErrorMessage error={e.error} />}>
|
|
72
|
+
<TrackRenderingContainer
|
|
73
|
+
model={model}
|
|
74
|
+
track={track}
|
|
134
75
|
onDragEnter={debouncedOnDragEnter}
|
|
135
|
-
|
|
136
|
-
>
|
|
137
|
-
{!minimized ? (
|
|
138
|
-
<>
|
|
139
|
-
<div
|
|
140
|
-
className={classes.renderingComponentContainer}
|
|
141
|
-
style={{ transform: `scaleX(${model.scaleFactor})` }}
|
|
142
|
-
>
|
|
143
|
-
<RenderingComponent
|
|
144
|
-
model={display}
|
|
145
|
-
onHorizontalScroll={horizontalScroll}
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
|
|
149
|
-
{DisplayBlurb ? (
|
|
150
|
-
<div
|
|
151
|
-
style={{
|
|
152
|
-
position: 'absolute',
|
|
153
|
-
left: 0,
|
|
154
|
-
top: display.height - 20,
|
|
155
|
-
}}
|
|
156
|
-
>
|
|
157
|
-
<DisplayBlurb model={display} />
|
|
158
|
-
</div>
|
|
159
|
-
) : null}
|
|
160
|
-
</>
|
|
161
|
-
) : null}
|
|
162
|
-
</div>
|
|
76
|
+
/>
|
|
163
77
|
</ErrorBoundary>
|
|
164
78
|
<div
|
|
165
79
|
className={classes.overlay}
|
|
@@ -175,6 +89,4 @@ function TrackContainer({
|
|
|
175
89
|
/>
|
|
176
90
|
</Paper>
|
|
177
91
|
)
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export default observer(TrackContainer)
|
|
92
|
+
})
|
|
@@ -7,13 +7,7 @@ import { getSession, getContainingView } from '@jbrowse/core/util'
|
|
|
7
7
|
import { getTrackName } from '@jbrowse/core/util/tracks'
|
|
8
8
|
import { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'
|
|
9
9
|
import { SanitizedHTML } from '@jbrowse/core/ui'
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
bindTrigger,
|
|
14
|
-
bindPopover,
|
|
15
|
-
usePopupState,
|
|
16
|
-
} from 'material-ui-popup-state/hooks'
|
|
10
|
+
import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton'
|
|
17
11
|
|
|
18
12
|
// icons
|
|
19
13
|
import MoreVertIcon from '@mui/icons-material/MoreVert'
|
|
@@ -71,12 +65,6 @@ const TrackLabel = React.forwardRef<HTMLDivElement, Props>(function (
|
|
|
71
65
|
const minimized = track.minimized
|
|
72
66
|
const trackId = getConf(track, 'trackId')
|
|
73
67
|
const trackName = getTrackName(trackConf, session)
|
|
74
|
-
|
|
75
|
-
const popupState = usePopupState({
|
|
76
|
-
popupId: 'trackLabelMenu',
|
|
77
|
-
variant: 'popover',
|
|
78
|
-
})
|
|
79
|
-
|
|
80
68
|
const items = [
|
|
81
69
|
{
|
|
82
70
|
label: minimized ? 'Restore track' : 'Minimize track',
|
|
@@ -119,23 +107,15 @@ const TrackLabel = React.forwardRef<HTMLDivElement, Props>(function (
|
|
|
119
107
|
className={classes.trackName}
|
|
120
108
|
>
|
|
121
109
|
<SanitizedHTML
|
|
122
|
-
html={
|
|
110
|
+
html={[trackName, minimized ? '(minimized)' : '']
|
|
111
|
+
.filter(f => !!f)
|
|
112
|
+
.join(' ')}
|
|
123
113
|
/>
|
|
124
114
|
</Typography>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
className={classes.iconButton}
|
|
128
|
-
data-testid="track_menu_icon"
|
|
129
|
-
disabled={items.length === 0}
|
|
130
|
-
>
|
|
115
|
+
|
|
116
|
+
<CascadingMenuButton menuItems={items} data-testid="track_menu_icon">
|
|
131
117
|
<MoreVertIcon fontSize="small" />
|
|
132
|
-
</
|
|
133
|
-
<CascadingMenu
|
|
134
|
-
{...bindPopover(popupState)}
|
|
135
|
-
onMenuItemClick={(_: unknown, callback: Function) => callback()}
|
|
136
|
-
menuItems={items}
|
|
137
|
-
popupState={popupState}
|
|
138
|
-
/>
|
|
118
|
+
</CascadingMenuButton>
|
|
139
119
|
</Paper>
|
|
140
120
|
)
|
|
141
121
|
})
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { makeStyles } from 'tss-react/mui'
|
|
3
|
+
import { observer } from 'mobx-react'
|
|
4
|
+
|
|
5
|
+
// jbrowse core
|
|
6
|
+
import { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'
|
|
7
|
+
|
|
8
|
+
// locals
|
|
9
|
+
import { LinearGenomeViewModel } from '..'
|
|
10
|
+
import TrackLabel from './TrackLabel'
|
|
11
|
+
|
|
12
|
+
const useStyles = makeStyles()({
|
|
13
|
+
trackLabel: {
|
|
14
|
+
zIndex: 3,
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
trackLabelOffset: {
|
|
18
|
+
position: 'relative',
|
|
19
|
+
display: 'inline-block',
|
|
20
|
+
},
|
|
21
|
+
trackLabelOverlap: {
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
type LGV = LinearGenomeViewModel
|
|
27
|
+
|
|
28
|
+
const TrackLabelContainer = observer(function ({
|
|
29
|
+
track,
|
|
30
|
+
view,
|
|
31
|
+
}: {
|
|
32
|
+
track: BaseTrackModel
|
|
33
|
+
view: LGV
|
|
34
|
+
}) {
|
|
35
|
+
const { classes, cx } = useStyles()
|
|
36
|
+
const display = track.displays[0]
|
|
37
|
+
const { trackLabel, trackLabelOverlap, trackLabelOffset } = classes
|
|
38
|
+
const labelStyle =
|
|
39
|
+
view.trackLabels !== 'overlapping' || display.prefersOffset
|
|
40
|
+
? trackLabelOffset
|
|
41
|
+
: trackLabelOverlap
|
|
42
|
+
|
|
43
|
+
return view.trackLabels !== 'hidden' ? (
|
|
44
|
+
<TrackLabel track={track} className={cx(trackLabel, labelStyle)} />
|
|
45
|
+
) : null
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
export default TrackLabelContainer
|