react-msaview 6.5.0 → 8.0.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/README.md +13 -11
- package/bundle/index.js +122 -112
- package/bundle/index.js.map +4 -4
- package/dist/colorSchemes.js +1 -2
- package/dist/colorSchemes.js.map +1 -1
- package/dist/columnStats.d.ts +28 -0
- package/dist/columnStats.js +34 -0
- package/dist/columnStats.js.map +1 -0
- package/dist/components/DragHandle.d.ts +3 -2
- package/dist/components/DragHandle.js +11 -5
- package/dist/components/DragHandle.js.map +1 -1
- package/dist/components/Loading.js +2 -2
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/MSAView.js +17 -6
- package/dist/components/MSAView.js.map +1 -1
- package/dist/components/MSAViewer.d.ts +69 -4
- package/dist/components/MSAViewer.js +201 -8
- package/dist/components/MSAViewer.js.map +1 -1
- package/dist/components/PortalTooltip.d.ts +11 -0
- package/dist/components/PortalTooltip.js +29 -0
- package/dist/components/PortalTooltip.js.map +1 -0
- package/dist/components/ResizeHandles.d.ts +3 -3
- package/dist/components/ResizeHandles.js +13 -24
- package/dist/components/ResizeHandles.js.map +1 -1
- package/dist/components/SequenceTextArea.js +3 -3
- package/dist/components/SequenceTextArea.js.map +1 -1
- package/dist/components/Track.js +41 -22
- package/dist/components/Track.js.map +1 -1
- package/dist/components/dialogs/{InterProScanDialog.d.ts → AnnotationFileDialog.d.ts} +2 -2
- package/dist/components/dialogs/AnnotationFileDialog.js +92 -0
- package/dist/components/dialogs/AnnotationFileDialog.js.map +1 -0
- package/dist/components/dialogs/ExportSVGDialog.js +5 -3
- package/dist/components/dialogs/ExportSVGDialog.js.map +1 -1
- package/dist/components/dialogs/FeatureDialog.js +13 -9
- package/dist/components/dialogs/FeatureDialog.js.map +1 -1
- package/dist/components/dialogs/TrackInfoDialog.js +1 -1
- package/dist/components/dialogs/TrackInfoDialog.js.map +1 -1
- package/dist/components/header/GappynessSlider.js +6 -11
- package/dist/components/header/GappynessSlider.js.map +1 -1
- package/dist/components/header/Header.js +7 -0
- package/dist/components/header/Header.js.map +1 -1
- package/dist/components/header/HeaderStatusArea.js +0 -2
- package/dist/components/header/HeaderStatusArea.js.map +1 -1
- package/dist/components/header/LoadWarnings.d.ts +6 -0
- package/dist/components/header/LoadWarnings.js +35 -0
- package/dist/components/header/LoadWarnings.js.map +1 -0
- package/dist/components/header/MultiAlignmentSelector.js +0 -0
- package/dist/components/header/MultiAlignmentSelector.js.map +1 -1
- package/dist/components/header/ScrollZoomIcons.d.ts +6 -0
- package/dist/components/header/ScrollZoomIcons.js +35 -0
- package/dist/components/header/ScrollZoomIcons.js.map +1 -0
- package/dist/components/header/TreeSettingsMenu.js +7 -1
- package/dist/components/header/TreeSettingsMenu.js.map +1 -1
- package/dist/components/header/UnshareableDataWarning.d.ts +6 -0
- package/dist/components/header/UnshareableDataWarning.js +40 -0
- package/dist/components/header/UnshareableDataWarning.js.map +1 -0
- package/dist/components/header/ZoomControls.js +49 -6
- package/dist/components/header/ZoomControls.js.map +1 -1
- package/dist/components/header/getAnnotationsMenu.js +11 -14
- package/dist/components/header/getAnnotationsMenu.js.map +1 -1
- package/dist/components/header/settingsMenuItems.js +10 -7
- package/dist/components/header/settingsMenuItems.js.map +1 -1
- package/dist/components/import/ImportForm.js +1 -1
- package/dist/components/import/ImportForm.js.map +1 -1
- package/dist/components/import/ImportFormExamples.js +2 -6
- package/dist/components/import/ImportFormExamples.js.map +1 -1
- package/dist/components/import/util.js +2 -0
- package/dist/components/import/util.js.map +1 -1
- package/dist/components/minimap/Minimap.js +1 -2
- package/dist/components/minimap/Minimap.js.map +1 -1
- package/dist/components/msa/AnnotationLegend.js +27 -19
- package/dist/components/msa/AnnotationLegend.js.map +1 -1
- package/dist/components/msa/MSACanvas.js +1 -1
- package/dist/components/msa/MSACanvas.js.map +1 -1
- package/dist/components/msa/MSACanvasBlock.js +17 -20
- package/dist/components/msa/MSACanvasBlock.js.map +1 -1
- package/dist/components/msa/MSAMouseoverCanvas.js +2 -1
- package/dist/components/msa/MSAMouseoverCanvas.js.map +1 -1
- package/dist/components/msa/domainBandCursor.d.ts +7 -11
- package/dist/components/msa/domainBandCursor.js +7 -11
- package/dist/components/msa/domainBandCursor.js.map +1 -1
- package/dist/components/msa/drawFeatureSpans.d.ts +53 -0
- package/dist/components/msa/drawFeatureSpans.js +78 -0
- package/dist/components/msa/drawFeatureSpans.js.map +1 -0
- package/dist/components/msa/legendRows.d.ts +8 -0
- package/dist/components/msa/legendRows.js +16 -0
- package/dist/components/msa/legendRows.js.map +1 -0
- package/dist/components/msa/msaRaster.d.ts +30 -27
- package/dist/components/msa/msaRaster.js +193 -90
- package/dist/components/msa/msaRaster.js.map +1 -1
- package/dist/components/msa/packDomainLanes.d.ts +20 -0
- package/dist/components/msa/packDomainLanes.js +33 -0
- package/dist/components/msa/packDomainLanes.js.map +1 -0
- package/dist/components/msa/renderBoxFeatureCanvasBlock.d.ts +3 -1
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js +51 -87
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js.map +1 -1
- package/dist/components/msa/renderHighlights.d.ts +44 -4
- package/dist/components/msa/renderHighlights.js +99 -11
- package/dist/components/msa/renderHighlights.js.map +1 -1
- package/dist/components/msa/renderMSABlock.d.ts +1 -2
- package/dist/components/msa/renderMSABlock.js +28 -31
- package/dist/components/msa/renderMSABlock.js.map +1 -1
- package/dist/components/msa/renderMSAMouseover.js +9 -30
- package/dist/components/msa/renderMSAMouseover.js.map +1 -1
- package/dist/components/msa/tileColor.js +4 -7
- package/dist/components/msa/tileColor.js.map +1 -1
- package/dist/components/msa/useMsaBlockMouse.d.ts +5 -3
- package/dist/components/msa/useMsaBlockMouse.js +6 -6
- package/dist/components/msa/useMsaBlockMouse.js.map +1 -1
- package/dist/components/renderCtx.d.ts +1 -1
- package/dist/components/rowpanels/RowPanelBlock.d.ts +9 -0
- package/dist/components/rowpanels/RowPanelBlock.js +86 -0
- package/dist/components/rowpanels/RowPanelBlock.js.map +1 -0
- package/dist/components/rowpanels/RowPanelHeaders.d.ts +12 -0
- package/dist/components/rowpanels/RowPanelHeaders.js +38 -0
- package/dist/components/rowpanels/RowPanelHeaders.js.map +1 -0
- package/dist/components/{msa/ColumnStats.d.ts → rowpanels/RowPanels.d.ts} +2 -2
- package/dist/components/rowpanels/RowPanels.js +32 -0
- package/dist/components/rowpanels/RowPanels.js.map +1 -0
- package/dist/components/rowpanels/headerLayout.d.ts +1 -0
- package/dist/components/rowpanels/headerLayout.js +5 -0
- package/dist/components/rowpanels/headerLayout.js.map +1 -0
- package/dist/components/rowpanels/renderFeaturePanel.d.ts +21 -0
- package/dist/components/rowpanels/renderFeaturePanel.js +37 -0
- package/dist/components/rowpanels/renderFeaturePanel.js.map +1 -0
- package/dist/components/rowpanels/renderRowPanel.d.ts +23 -0
- package/dist/components/rowpanels/renderRowPanel.js +22 -0
- package/dist/components/rowpanels/renderRowPanel.js.map +1 -0
- package/dist/components/rowpanels/renderStrip.d.ts +20 -0
- package/dist/components/rowpanels/renderStrip.js +26 -0
- package/dist/components/rowpanels/renderStrip.js.map +1 -0
- package/dist/components/tracks/TrackBlocks.js +13 -16
- package/dist/components/tracks/TrackBlocks.js.map +1 -1
- package/dist/components/tracks/TrackTooltipContent.d.ts +15 -0
- package/dist/components/tracks/TrackTooltipContent.js +109 -0
- package/dist/components/tracks/TrackTooltipContent.js.map +1 -0
- package/dist/components/tracks/drawTracks.d.ts +30 -12
- package/dist/components/tracks/drawTracks.js +127 -34
- package/dist/components/tracks/drawTracks.js.map +1 -1
- package/dist/components/tracks/useTrackHover.d.ts +22 -0
- package/dist/components/tracks/useTrackHover.js +30 -0
- package/dist/components/tracks/useTrackHover.js.map +1 -0
- package/dist/components/tree/CladeLabels.d.ts +12 -0
- package/dist/components/tree/CladeLabels.js +48 -0
- package/dist/components/tree/CladeLabels.js.map +1 -0
- package/dist/components/tree/TreeCanvas.js +6 -4
- package/dist/components/tree/TreeCanvas.js.map +1 -1
- package/dist/components/tree/TreeCanvasBlock.js +6 -21
- package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
- package/dist/components/tree/TreeOverview.d.ts +14 -0
- package/dist/components/tree/TreeOverview.js +75 -0
- package/dist/components/tree/TreeOverview.js.map +1 -0
- package/dist/components/tree/TreeRuler.js +11 -5
- package/dist/components/tree/TreeRuler.js.map +1 -1
- package/dist/components/tree/cladeBrackets.d.ts +25 -0
- package/dist/components/tree/cladeBrackets.js +51 -0
- package/dist/components/tree/cladeBrackets.js.map +1 -0
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.js +2 -2
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.js.map +1 -1
- package/dist/components/tree/renderTreeCanvas.d.ts +0 -1
- package/dist/components/tree/renderTreeCanvas.js +221 -47
- package/dist/components/tree/renderTreeCanvas.js.map +1 -1
- package/dist/components/tree/renderTreeOverview.d.ts +52 -0
- package/dist/components/tree/renderTreeOverview.js +138 -0
- package/dist/components/tree/renderTreeOverview.js.map +1 -0
- package/dist/components/tree/scaleBar.d.ts +10 -0
- package/dist/components/tree/scaleBar.js +24 -0
- package/dist/components/tree/scaleBar.js.map +1 -0
- package/dist/components/tree/useTreeHover.js +2 -4
- package/dist/components/tree/useTreeHover.js.map +1 -1
- package/dist/constants.d.ts +18 -1
- package/dist/constants.js +51 -8
- package/dist/constants.js.map +1 -1
- package/dist/createPaletteMap.d.ts +7 -6
- package/dist/createPaletteMap.js +10 -9
- package/dist/createPaletteMap.js.map +1 -1
- package/dist/element.d.ts +13 -0
- package/dist/element.js +269 -0
- package/dist/element.js.map +1 -0
- package/dist/featureFields.d.ts +11 -0
- package/dist/featureFields.js +17 -0
- package/dist/featureFields.js.map +1 -0
- package/dist/fetchUtils.d.ts +7 -7
- package/dist/fetchUtils.js +4 -32
- package/dist/fetchUtils.js.map +1 -1
- package/dist/flatToTree.js +1 -2
- package/dist/flatToTree.js.map +1 -1
- package/dist/ggplotPalettes.d.ts +10 -0
- package/dist/ggplotPalettes.js +58 -0
- package/dist/ggplotPalettes.js.map +1 -1
- package/dist/hierarchy.d.ts +29 -1
- package/dist/hierarchy.js +82 -19
- package/dist/hierarchy.js.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/model/DataModel.js +4 -4
- package/dist/model/DataModel.js.map +1 -1
- package/dist/model/msaModel.d.ts +3 -2
- package/dist/model/msaModel.js +3 -2
- package/dist/model/msaModel.js.map +1 -1
- package/dist/model/treeModel.d.ts +30 -0
- package/dist/model/treeModel.js +37 -1
- package/dist/model/treeModel.js.map +1 -1
- package/dist/model.d.ts +792 -259
- package/dist/model.js +2092 -675
- package/dist/model.js.map +1 -1
- package/dist/mount.d.ts +11 -0
- package/dist/mount.js +22 -0
- package/dist/mount.js.map +1 -0
- package/dist/neighborJoining.js +8 -32
- package/dist/neighborJoining.js.map +1 -1
- package/dist/renderToStaticMarkup.d.ts +15 -13
- package/dist/renderToStaticMarkup.js +37 -25
- package/dist/renderToStaticMarkup.js.map +1 -1
- package/dist/renderToSvg.js +198 -68
- package/dist/renderToSvg.js.map +1 -1
- package/dist/rowCoordinateCalculations.d.ts +26 -28
- package/dist/rowCoordinateCalculations.js +13 -39
- package/dist/rowCoordinateCalculations.js.map +1 -1
- package/dist/scales.d.ts +22 -0
- package/dist/scales.js +30 -0
- package/dist/scales.js.map +1 -0
- package/dist/seqPosToGlobalCol.d.ts +2 -3
- package/dist/seqPosToGlobalCol.js +5 -4
- package/dist/seqPosToGlobalCol.js.map +1 -1
- package/dist/sequenceLogo.d.ts +6 -11
- package/dist/sequenceLogo.js +6 -11
- package/dist/sequenceLogo.js.map +1 -1
- package/dist/stripDefault.d.ts +7 -14
- package/dist/stripDefault.js +7 -14
- package/dist/stripDefault.js.map +1 -1
- package/dist/svgTestUtil.d.ts +306 -124
- package/dist/types.d.ts +295 -3
- package/dist/umd.d.ts +2 -0
- package/dist/umd.js +4 -2
- package/dist/umd.js.map +1 -1
- package/dist/useCanvasAutorun.d.ts +5 -10
- package/dist/useCanvasAutorun.js +5 -10
- package/dist/useCanvasAutorun.js.map +1 -1
- package/dist/useMsaSvgFigure.d.ts +20 -0
- package/dist/useMsaSvgFigure.js +46 -0
- package/dist/useMsaSvgFigure.js.map +1 -0
- package/dist/util.d.ts +10 -4
- package/dist/util.js +37 -10
- package/dist/util.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wuss.d.ts +14 -0
- package/dist/wuss.js +55 -0
- package/dist/wuss.js.map +1 -0
- package/package.json +23 -14
- package/src/colorSchemes.ts +1 -2
- package/src/columnStats.ts +58 -0
- package/src/components/DragHandle.tsx +18 -7
- package/src/components/Loading.tsx +14 -8
- package/src/components/MSAView.tsx +19 -5
- package/src/components/MSAViewer.tsx +326 -10
- package/src/components/PortalTooltip.tsx +47 -0
- package/src/components/ResizeHandles.tsx +21 -36
- package/src/components/SequenceTextArea.tsx +3 -3
- package/src/components/Track.tsx +55 -18
- package/src/components/dialogs/AnnotationFileDialog.tsx +162 -0
- package/src/components/dialogs/ExportSVGDialog.tsx +7 -2
- package/src/components/dialogs/FeatureDialog.tsx +13 -9
- package/src/components/dialogs/TrackInfoDialog.tsx +1 -1
- package/src/components/header/GappynessSlider.tsx +6 -11
- package/src/components/header/Header.tsx +10 -0
- package/src/components/header/HeaderStatusArea.tsx +0 -5
- package/src/components/header/LoadWarnings.tsx +48 -0
- package/src/components/header/MultiAlignmentSelector.tsx +0 -0
- package/src/components/header/ScrollZoomIcons.tsx +52 -0
- package/src/components/header/TreeSettingsMenu.tsx +7 -1
- package/src/components/header/UnshareableDataWarning.tsx +56 -0
- package/src/components/header/ZoomControls.tsx +74 -14
- package/src/components/header/getAnnotationsMenu.ts +13 -17
- package/src/components/header/settingsMenuItems.ts +11 -6
- package/src/components/import/ImportForm.tsx +2 -2
- package/src/components/import/ImportFormExamples.tsx +4 -8
- package/src/components/import/util.ts +2 -0
- package/src/components/minimap/Minimap.tsx +1 -2
- package/src/components/msa/AnnotationLegend.tsx +48 -38
- package/src/components/msa/MSACanvas.tsx +3 -5
- package/src/components/msa/MSACanvasBlock.tsx +17 -21
- package/src/components/msa/MSAMouseoverCanvas.tsx +2 -1
- package/src/components/msa/domainBandCursor.ts +7 -11
- package/src/components/msa/drawFeatureSpans.ts +150 -0
- package/src/components/msa/legendRows.ts +24 -0
- package/src/components/msa/msaRaster.ts +236 -88
- package/src/components/msa/packDomainLanes.ts +36 -0
- package/src/components/msa/renderBoxFeatureCanvasBlock.ts +69 -123
- package/src/components/msa/renderHighlights.ts +141 -10
- package/src/components/msa/renderMSABlock.ts +29 -38
- package/src/components/msa/renderMSAMouseover.ts +9 -39
- package/src/components/msa/tileColor.ts +4 -7
- package/src/components/msa/useMsaBlockMouse.ts +6 -6
- package/src/components/renderCtx.ts +1 -0
- package/src/components/rowpanels/RowPanelBlock.tsx +139 -0
- package/src/components/rowpanels/RowPanelHeaders.tsx +57 -0
- package/src/components/rowpanels/RowPanels.tsx +77 -0
- package/src/components/rowpanels/headerLayout.ts +5 -0
- package/src/components/rowpanels/renderFeaturePanel.ts +66 -0
- package/src/components/rowpanels/renderRowPanel.ts +41 -0
- package/src/components/rowpanels/renderStrip.ts +46 -0
- package/src/components/tracks/TrackBlocks.tsx +13 -18
- package/src/components/tracks/TrackTooltipContent.tsx +156 -0
- package/src/components/tracks/drawTracks.ts +169 -38
- package/src/components/tracks/useTrackHover.ts +42 -0
- package/src/components/tree/CladeLabels.tsx +77 -0
- package/src/components/tree/TreeCanvas.tsx +4 -3
- package/src/components/tree/TreeCanvasBlock.tsx +10 -32
- package/src/components/tree/TreeOverview.tsx +106 -0
- package/src/components/tree/TreeRuler.tsx +29 -5
- package/src/components/tree/cladeBrackets.ts +73 -0
- package/src/components/tree/dialogs/TreeNodeInfoDialog.tsx +2 -2
- package/src/components/tree/renderTreeCanvas.ts +312 -48
- package/src/components/tree/renderTreeOverview.ts +212 -0
- package/src/components/tree/scaleBar.ts +23 -0
- package/src/components/tree/useTreeHover.ts +2 -4
- package/src/constants.ts +61 -8
- package/src/createPaletteMap.ts +10 -9
- package/src/element.ts +321 -0
- package/src/featureFields.ts +19 -0
- package/src/fetchUtils.ts +7 -40
- package/src/flatToTree.ts +1 -2
- package/src/ggplotPalettes.ts +60 -0
- package/src/hierarchy.ts +97 -20
- package/src/index.ts +46 -6
- package/src/model/DataModel.ts +5 -4
- package/src/model/msaModel.ts +3 -2
- package/src/model/treeModel.ts +42 -0
- package/src/model.ts +2492 -793
- package/src/mount.tsx +32 -0
- package/src/neighborJoining.ts +8 -32
- package/src/rawImports.d.ts +9 -0
- package/src/renderToStaticMarkup.ts +41 -25
- package/src/renderToSvg.tsx +365 -92
- package/src/rowCoordinateCalculations.ts +16 -62
- package/src/scales.ts +47 -0
- package/src/seqPosToGlobalCol.ts +5 -4
- package/src/sequenceLogo.ts +6 -11
- package/src/stripDefault.ts +7 -14
- package/src/types.ts +352 -12
- package/src/umd.ts +4 -2
- package/src/useCanvasAutorun.ts +5 -10
- package/src/useMsaSvgFigure.ts +72 -0
- package/src/util.ts +40 -14
- package/src/version.ts +1 -1
- package/src/wuss.ts +62 -0
- package/dist/components/dialogs/InterProScanDialog.js +0 -137
- package/dist/components/dialogs/InterProScanDialog.js.map +0 -1
- package/dist/components/dialogs/InterProScanFileDialog.d.ts +0 -7
- package/dist/components/dialogs/InterProScanFileDialog.js +0 -64
- package/dist/components/dialogs/InterProScanFileDialog.js.map +0 -1
- package/dist/components/msa/ColumnStats.js +0 -42
- package/dist/components/msa/ColumnStats.js.map +0 -1
- package/dist/launchInterProScan.d.ts +0 -13
- package/dist/launchInterProScan.js +0 -110
- package/dist/launchInterProScan.js.map +0 -1
- package/dist/useColorContrast.d.ts +0 -10
- package/dist/useColorContrast.js +0 -13
- package/dist/useColorContrast.js.map +0 -1
- package/src/clustalX.test.ts +0 -74
- package/src/colSpace.test.ts +0 -67
- package/src/collapseLogic.test.ts +0 -115
- package/src/colorSchemes.docs.test.ts +0 -57
- package/src/columnCounts.test.ts +0 -73
- package/src/columnStats.test.ts +0 -94
- package/src/columnTracks.test.ts +0 -97
- package/src/components/dialogs/InterProScanDialog.tsx +0 -214
- package/src/components/dialogs/InterProScanFileDialog.tsx +0 -138
- package/src/components/minimap/minimapLayout.test.ts +0 -71
- package/src/components/msa/ColumnStats.tsx +0 -54
- package/src/components/msa/msaRaster.test.ts +0 -145
- package/src/components/msa/renderBoxFeatureCanvasBlock.test.ts +0 -51
- package/src/components/tree/renderTreeCanvas.test.ts +0 -296
- package/src/dataInitialized.test.ts +0 -42
- package/src/domainBands.test.ts +0 -122
- package/src/domainLetterColor.test.ts +0 -80
- package/src/exportFileName.test.ts +0 -40
- package/src/fetchUtils.test.ts +0 -83
- package/src/flatToTree.test.ts +0 -51
- package/src/hierarchy.test.ts +0 -228
- package/src/highlights.test.ts +0 -70
- package/src/impgRender.test.tsx +0 -68
- package/src/largeTree.test.ts +0 -67
- package/src/launchInterProScan.ts +0 -167
- package/src/loadErrorDisplay.test.tsx +0 -102
- package/src/modelFilehandleLoaders.test.ts +0 -137
- package/src/modelReset.test.ts +0 -120
- package/src/neighborJoining.test.ts +0 -164
- package/src/parseAsn1.test.ts +0 -36
- package/src/propertyConservation.test.ts +0 -36
- package/src/renderColumnTracksSvg.test.tsx +0 -108
- package/src/renderDomainsSvg.test.tsx +0 -118
- package/src/renderHighlightsSvg.test.tsx +0 -85
- package/src/renderMinimapSvg.test.tsx +0 -62
- package/src/renderRasterSvg.test.tsx +0 -144
- package/src/renderSequenceLogoSvg.test.tsx +0 -165
- package/src/renderToSvg.test.tsx +0 -65
- package/src/reset.test.ts +0 -61
- package/src/rowCoordinateCalculations.test.ts +0 -211
- package/src/rowSpace.test.ts +0 -46
- package/src/segmentOverlay.test.ts +0 -70
- package/src/seqPosToGlobalCol.test.ts +0 -59
- package/src/sequenceLogo.test.ts +0 -88
- package/src/setFontSize.test.ts +0 -33
- package/src/stripDefault.test.ts +0 -48
- package/src/stripDefaultSnapshot.test.ts +0 -87
- package/src/treeMetadata.test.ts +0 -39
- package/src/useCanvasAutorun.test.tsx +0 -98
- package/src/useColorContrast.ts +0 -18
- package/src/viewChrome.test.tsx +0 -134
- package/src/wheelZoom.test.ts +0 -46
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { MsaViewModel } from '../../model.ts'
|
|
2
2
|
|
|
3
|
-
// Per-cell tile color for the active scheme
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// scheme needs also keeps the other one -- a per-column map for every column of
|
|
7
|
-
// the alignment -- from being computed at all.
|
|
3
|
+
// Per-cell tile color for the active scheme, resolved once per block. Reading
|
|
4
|
+
// only the active scheme's column table leaves the other per-column table
|
|
5
|
+
// uncomputed.
|
|
8
6
|
export function tileColorFn(model: MsaViewModel) {
|
|
9
7
|
const { colorSchemeName } = model
|
|
10
8
|
if (colorSchemeName === 'clustalx_protein_dynamic') {
|
|
@@ -23,8 +21,7 @@ export function tileColorFn(model: MsaViewModel) {
|
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
// The column table the active scheme colors from, or undefined for the static
|
|
26
|
-
// schemes.
|
|
27
|
-
// colors has to key on.
|
|
24
|
+
// schemes. A cache of rendered colors keys on its identity plus the scheme name.
|
|
28
25
|
export function tileColorTable(model: MsaViewModel) {
|
|
29
26
|
const { colorSchemeName } = model
|
|
30
27
|
if (colorSchemeName === 'clustalx_protein_dynamic') {
|
|
@@ -29,9 +29,11 @@ function eventToColRow({
|
|
|
29
29
|
* Translates pointer events over one MSA block into model column/row hover and
|
|
30
30
|
* click state, and reports where a tooltip should be anchored.
|
|
31
31
|
*
|
|
32
|
-
* The anchor is only tracked when there is something to show (an insertion
|
|
33
|
-
* domain under the cursor
|
|
34
|
-
*
|
|
32
|
+
* The anchor is only tracked when there is something to show (an insertion or a
|
|
33
|
+
* domain under the cursor), so plain mouse movement over the alignment updates
|
|
34
|
+
* the canvas overlay without re-rendering this component. Each track tooltips
|
|
35
|
+
* its own column statistics, and the header reads out the hovered row, residue
|
|
36
|
+
* and position.
|
|
35
37
|
*/
|
|
36
38
|
export function useMsaBlockMouse({
|
|
37
39
|
model,
|
|
@@ -62,9 +64,7 @@ export function useMsaBlockMouse({
|
|
|
62
64
|
model.setMousePos(hit ? pos.col : undefined, hit ? pos.row : undefined)
|
|
63
65
|
|
|
64
66
|
const hasTooltip =
|
|
65
|
-
!!model.hoveredInsertion ||
|
|
66
|
-
model.mouseOverDomains.length > 0 ||
|
|
67
|
-
(model.showColumnStats && !!model.mouseOverColumnStats)
|
|
67
|
+
!!model.hoveredInsertion || model.mouseOverDomains.length > 0
|
|
68
68
|
setTooltipPoint(
|
|
69
69
|
hasTooltip ? { x: event.clientX, y: event.clientY } : undefined,
|
|
70
70
|
)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { useTheme } from '@mui/material'
|
|
4
|
+
import { observer } from 'mobx-react'
|
|
5
|
+
|
|
6
|
+
import { featureField, featureName } from '../../featureFields.ts'
|
|
7
|
+
import { useCanvasAutorun } from '../../useCanvasAutorun.ts'
|
|
8
|
+
import PortalTooltip from '../PortalTooltip.tsx'
|
|
9
|
+
import { renderRowPanel } from './renderRowPanel.ts'
|
|
10
|
+
|
|
11
|
+
import type { MsaViewModel } from '../../model.ts'
|
|
12
|
+
import type { ResolvedRowPanel } from '../../types.ts'
|
|
13
|
+
|
|
14
|
+
interface Hover {
|
|
15
|
+
name: string
|
|
16
|
+
lines: string[]
|
|
17
|
+
clientX: number
|
|
18
|
+
clientY: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// what the cell or span under the pointer reads, which is the field a strip
|
|
22
|
+
// colors by, and a span's name, its coordinates and its encoded field
|
|
23
|
+
function hoverLines({
|
|
24
|
+
model,
|
|
25
|
+
panel,
|
|
26
|
+
name,
|
|
27
|
+
x,
|
|
28
|
+
}: {
|
|
29
|
+
model: MsaViewModel
|
|
30
|
+
panel: ResolvedRowPanel
|
|
31
|
+
name: string
|
|
32
|
+
x: number
|
|
33
|
+
}) {
|
|
34
|
+
if (panel.kind === 'strip') {
|
|
35
|
+
return [
|
|
36
|
+
`${panel.header}: ${model.rowDataOf(name)?.[panel.field] ?? '(none)'}`,
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
const span = panel.spans
|
|
40
|
+
.get(name)
|
|
41
|
+
?.findLast(s => x >= s.xStart && x <= s.xEnd)
|
|
42
|
+
if (!span) {
|
|
43
|
+
return []
|
|
44
|
+
}
|
|
45
|
+
const { annotation } = span
|
|
46
|
+
const strand =
|
|
47
|
+
annotation.strand === undefined
|
|
48
|
+
? ''
|
|
49
|
+
: annotation.strand < 0
|
|
50
|
+
? ' (-)'
|
|
51
|
+
: ' (+)'
|
|
52
|
+
const value = panel.field ? featureField(annotation, panel.field) : undefined
|
|
53
|
+
return [
|
|
54
|
+
featureName(annotation) ?? annotation.accession,
|
|
55
|
+
`${annotation.start}-${annotation.end}${strand}`,
|
|
56
|
+
...(value === undefined ? [] : [`${panel.field}: ${value}`]),
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const RowPanelBlock = observer(function ({
|
|
61
|
+
model,
|
|
62
|
+
panel,
|
|
63
|
+
offsetY,
|
|
64
|
+
}: {
|
|
65
|
+
model: MsaViewModel
|
|
66
|
+
panel: ResolvedRowPanel
|
|
67
|
+
offsetY: number
|
|
68
|
+
}) {
|
|
69
|
+
const [hovered, setHovered] = useState<Hover>()
|
|
70
|
+
const theme = useTheme()
|
|
71
|
+
const { blockSize, highResScaleFactor, rowHeight } = model
|
|
72
|
+
const width = panel.width
|
|
73
|
+
const height = blockSize
|
|
74
|
+
const canvasWidth = width * highResScaleFactor
|
|
75
|
+
const canvasHeight = height * highResScaleFactor
|
|
76
|
+
|
|
77
|
+
const ref = useCanvasAutorun({
|
|
78
|
+
draw: ctx => {
|
|
79
|
+
ctx.resetTransform()
|
|
80
|
+
ctx.clearRect(0, 0, canvasWidth, canvasHeight)
|
|
81
|
+
renderRowPanel({ ctx, model, theme, panel, x: 0, offsetY })
|
|
82
|
+
},
|
|
83
|
+
width: canvasWidth,
|
|
84
|
+
height: canvasHeight,
|
|
85
|
+
deps: [model, theme, panel, offsetY],
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<>
|
|
90
|
+
<canvas
|
|
91
|
+
ref={ref}
|
|
92
|
+
width={canvasWidth}
|
|
93
|
+
height={canvasHeight}
|
|
94
|
+
style={{ position: 'absolute', top: offsetY, left: 0, width, height }}
|
|
95
|
+
onMouseMove={event => {
|
|
96
|
+
// the blocks are laid out in row space and scrolled by a transform
|
|
97
|
+
// on their container, so the pointer's row comes off the canvas box
|
|
98
|
+
const { left, top } = event.currentTarget.getBoundingClientRect()
|
|
99
|
+
const row = Math.floor((event.clientY - top + offsetY) / rowHeight)
|
|
100
|
+
const name = model.leaves[row]?.data.name
|
|
101
|
+
const lines =
|
|
102
|
+
name === undefined
|
|
103
|
+
? []
|
|
104
|
+
: hoverLines({
|
|
105
|
+
model,
|
|
106
|
+
panel,
|
|
107
|
+
name,
|
|
108
|
+
x: event.clientX - left,
|
|
109
|
+
})
|
|
110
|
+
setHovered(
|
|
111
|
+
name === undefined || lines.length === 0
|
|
112
|
+
? undefined
|
|
113
|
+
: {
|
|
114
|
+
name,
|
|
115
|
+
lines,
|
|
116
|
+
clientX: event.clientX,
|
|
117
|
+
clientY: event.clientY,
|
|
118
|
+
},
|
|
119
|
+
)
|
|
120
|
+
model.setMousePos(undefined, name === undefined ? undefined : row)
|
|
121
|
+
}}
|
|
122
|
+
onMouseLeave={() => {
|
|
123
|
+
setHovered(undefined)
|
|
124
|
+
model.setMousePos(undefined, undefined)
|
|
125
|
+
}}
|
|
126
|
+
/>
|
|
127
|
+
{hovered ? (
|
|
128
|
+
<PortalTooltip clientX={hovered.clientX} clientY={hovered.clientY}>
|
|
129
|
+
<div>{hovered.name}</div>
|
|
130
|
+
{hovered.lines.map(line => (
|
|
131
|
+
<div key={line}>{line}</div>
|
|
132
|
+
))}
|
|
133
|
+
</PortalTooltip>
|
|
134
|
+
) : null}
|
|
135
|
+
</>
|
|
136
|
+
)
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
export default RowPanelBlock
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { observer } from 'mobx-react'
|
|
4
|
+
|
|
5
|
+
import { headerRunsAcross } from './headerLayout.ts'
|
|
6
|
+
|
|
7
|
+
import type { MsaViewModel } from '../../model.ts'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The row panel headers, in a band above the panels beside the tree ruler and
|
|
11
|
+
* the minimap. A narrow strip's name is DOM text turned on its side, since the
|
|
12
|
+
* canvas layer has no rotation, and the SVG export draws it with a
|
|
13
|
+
* `rotate(-90)`. A panel wider than the band is tall writes its name across.
|
|
14
|
+
*/
|
|
15
|
+
const RowPanelHeaders = observer(function ({ model }: { model: MsaViewModel }) {
|
|
16
|
+
const { resolvedRowPanels, rowPanelsHeaderHeight, fontSize } = model
|
|
17
|
+
return resolvedRowPanels.length > 0 ? (
|
|
18
|
+
<div
|
|
19
|
+
style={{
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexShrink: 0,
|
|
22
|
+
height: rowPanelsHeaderHeight,
|
|
23
|
+
alignItems: 'flex-end',
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
{resolvedRowPanels.map(panel => {
|
|
27
|
+
const across = headerRunsAcross(panel.width)
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
key={panel.id}
|
|
31
|
+
title={panel.header}
|
|
32
|
+
style={{
|
|
33
|
+
width: panel.width,
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
textOverflow: 'ellipsis',
|
|
36
|
+
whiteSpace: 'nowrap',
|
|
37
|
+
...(across
|
|
38
|
+
? { fontSize, textAlign: 'center' }
|
|
39
|
+
: {
|
|
40
|
+
height: rowPanelsHeaderHeight,
|
|
41
|
+
fontSize: Math.min(fontSize, panel.width),
|
|
42
|
+
// vertical-rl reads top to bottom, and the half turn makes
|
|
43
|
+
// it read upwards from the strip, as rotate(-90) exports
|
|
44
|
+
writingMode: 'vertical-rl',
|
|
45
|
+
transform: 'rotate(180deg)',
|
|
46
|
+
}),
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
{panel.header}
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
})}
|
|
53
|
+
</div>
|
|
54
|
+
) : null
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
export default RowPanelHeaders
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { useCallback, useRef } from 'react'
|
|
2
|
+
|
|
3
|
+
import { observer } from 'mobx-react'
|
|
4
|
+
|
|
5
|
+
import { useWheelScroll } from '../../useWheelScroll.ts'
|
|
6
|
+
import RowPanelBlock from './RowPanelBlock.tsx'
|
|
7
|
+
|
|
8
|
+
import type { MsaViewModel } from '../../model.ts'
|
|
9
|
+
import type { ResolvedRowPanel } from '../../types.ts'
|
|
10
|
+
|
|
11
|
+
const RowPanel = observer(function ({
|
|
12
|
+
model,
|
|
13
|
+
panel,
|
|
14
|
+
}: {
|
|
15
|
+
model: MsaViewModel
|
|
16
|
+
panel: ResolvedRowPanel
|
|
17
|
+
}) {
|
|
18
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
19
|
+
const { height, blocksY, scrollY } = model
|
|
20
|
+
const onScrollY = useCallback(
|
|
21
|
+
(d: number) => {
|
|
22
|
+
model.doScrollY(d)
|
|
23
|
+
},
|
|
24
|
+
[model],
|
|
25
|
+
)
|
|
26
|
+
const { onMouseDown, onMouseUp } = useWheelScroll({ ref, onScrollY })
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
ref={ref}
|
|
31
|
+
data-testid={`rowpanel_${panel.id}`}
|
|
32
|
+
onMouseDown={onMouseDown}
|
|
33
|
+
onMouseUp={onMouseUp}
|
|
34
|
+
style={{
|
|
35
|
+
height,
|
|
36
|
+
width: panel.width,
|
|
37
|
+
flexShrink: 0,
|
|
38
|
+
overflow: 'hidden',
|
|
39
|
+
position: 'relative',
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
{/* one transform for the whole block set, matching TreeCanvas: the
|
|
43
|
+
strips scroll in lockstep with the tree and the alignment */}
|
|
44
|
+
<div
|
|
45
|
+
style={{
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
top: 0,
|
|
48
|
+
left: 0,
|
|
49
|
+
transform: `translateY(${scrollY}px)`,
|
|
50
|
+
willChange: 'transform',
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
{blocksY.map(block => (
|
|
54
|
+
<RowPanelBlock
|
|
55
|
+
key={block}
|
|
56
|
+
model={model}
|
|
57
|
+
panel={panel}
|
|
58
|
+
offsetY={block}
|
|
59
|
+
/>
|
|
60
|
+
))}
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const RowPanels = observer(function ({ model }: { model: MsaViewModel }) {
|
|
67
|
+
const { resolvedRowPanels } = model
|
|
68
|
+
return resolvedRowPanels.length > 0 ? (
|
|
69
|
+
<div style={{ display: 'flex', flexShrink: 0 }}>
|
|
70
|
+
{resolvedRowPanels.map(panel => (
|
|
71
|
+
<RowPanel key={panel.id} model={model} panel={panel} />
|
|
72
|
+
))}
|
|
73
|
+
</div>
|
|
74
|
+
) : null
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
export default RowPanels
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { contrastTextFn } from '../../util.ts'
|
|
2
|
+
import { getVisibleLeaves } from '../getVisibleLeaves.ts'
|
|
3
|
+
import { drawFeatureSpans, spanRows } from '../msa/drawFeatureSpans.ts'
|
|
4
|
+
|
|
5
|
+
import type { MsaViewModel } from '../../model.ts'
|
|
6
|
+
import type { ResolvedFeaturePanel, RowPanelSpan } from '../../types.ts'
|
|
7
|
+
import type { RenderCtx } from '../renderCtx.ts'
|
|
8
|
+
import type { Theme } from '@mui/material'
|
|
9
|
+
|
|
10
|
+
// a span keeps a pixel clear above and below it, so stacked lanes and adjacent
|
|
11
|
+
// rows read apart
|
|
12
|
+
const rowPadding = 2
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The spans of a `features` panel, drawn with the mark the alignment overlay
|
|
16
|
+
* draws: an arrow where the feature carries a strand, a box otherwise, labeled
|
|
17
|
+
* where the text fits. The x mapping is the panel's own, resolved in
|
|
18
|
+
* `resolvedRowPanels`; a row needing several lanes divides its height between
|
|
19
|
+
* them.
|
|
20
|
+
*/
|
|
21
|
+
export function renderFeaturePanel({
|
|
22
|
+
ctx,
|
|
23
|
+
model,
|
|
24
|
+
theme,
|
|
25
|
+
panel,
|
|
26
|
+
x,
|
|
27
|
+
offsetY,
|
|
28
|
+
blockSizeYOverride,
|
|
29
|
+
highResScaleFactorOverride,
|
|
30
|
+
}: {
|
|
31
|
+
ctx: RenderCtx
|
|
32
|
+
model: MsaViewModel
|
|
33
|
+
theme: Theme
|
|
34
|
+
panel: ResolvedFeaturePanel
|
|
35
|
+
x: number
|
|
36
|
+
offsetY: number
|
|
37
|
+
blockSizeYOverride?: number
|
|
38
|
+
highResScaleFactorOverride?: number
|
|
39
|
+
}) {
|
|
40
|
+
const { rowHeight, blockSize, highResScaleFactor } = model
|
|
41
|
+
const by = blockSizeYOverride ?? blockSize
|
|
42
|
+
const k = highResScaleFactorOverride ?? highResScaleFactor
|
|
43
|
+
ctx.resetTransform()
|
|
44
|
+
ctx.scale(k, k)
|
|
45
|
+
ctx.translate(x, rowHeight / 2 - offsetY)
|
|
46
|
+
|
|
47
|
+
drawFeatureSpans<RowPanelSpan>({
|
|
48
|
+
ctx,
|
|
49
|
+
rows: spanRows(
|
|
50
|
+
getVisibleLeaves({ model, offsetY, blockSizeY: by }),
|
|
51
|
+
panel.spans,
|
|
52
|
+
),
|
|
53
|
+
layout: {
|
|
54
|
+
height: laneCount => Math.max(1, rowHeight / laneCount - rowPadding),
|
|
55
|
+
top: (y, lane, h) =>
|
|
56
|
+
y - rowHeight + lane * (h + rowPadding) + rowPadding / 2,
|
|
57
|
+
headLength: h => h,
|
|
58
|
+
},
|
|
59
|
+
xOf: span => [span.xStart, span.xEnd],
|
|
60
|
+
colors: panel.colors,
|
|
61
|
+
labelOf: span => panel.labels?.get(span.annotation),
|
|
62
|
+
contrastText: contrastTextFn(theme),
|
|
63
|
+
xMin: 0,
|
|
64
|
+
xMax: panel.width,
|
|
65
|
+
})
|
|
66
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { renderFeaturePanel } from './renderFeaturePanel.ts'
|
|
2
|
+
import { renderStrip } from './renderStrip.ts'
|
|
3
|
+
|
|
4
|
+
import type { MsaViewModel } from '../../model.ts'
|
|
5
|
+
import type { ResolvedRowPanel } from '../../types.ts'
|
|
6
|
+
import type { RenderCtx } from '../renderCtx.ts'
|
|
7
|
+
import type { Theme } from '@mui/material'
|
|
8
|
+
|
|
9
|
+
interface PanelArgs {
|
|
10
|
+
ctx: RenderCtx
|
|
11
|
+
model: MsaViewModel
|
|
12
|
+
theme: Theme
|
|
13
|
+
panel: ResolvedRowPanel
|
|
14
|
+
x: number
|
|
15
|
+
offsetY: number
|
|
16
|
+
blockSizeYOverride?: number
|
|
17
|
+
highResScaleFactorOverride?: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* One row panel, by kind. `x` is the panel's left edge in the context: the
|
|
22
|
+
* live view gives each panel a canvas of its own and passes 0, and the export
|
|
23
|
+
* packs every panel into one context and passes the panel's own offset.
|
|
24
|
+
*/
|
|
25
|
+
export function renderRowPanel({ panel, ...rest }: PanelArgs) {
|
|
26
|
+
if (panel.kind === 'features') {
|
|
27
|
+
renderFeaturePanel({ panel, ...rest })
|
|
28
|
+
} else {
|
|
29
|
+
renderStrip({ panel, ...rest })
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** every row panel side by side in one context, for the SVG export */
|
|
34
|
+
export function renderRowPanels({
|
|
35
|
+
model,
|
|
36
|
+
...rest
|
|
37
|
+
}: Omit<PanelArgs, 'panel' | 'x'>) {
|
|
38
|
+
for (const panel of model.resolvedRowPanels) {
|
|
39
|
+
renderRowPanel({ model, panel, x: panel.offsetX, ...rest })
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { getVisibleLeaves } from '../getVisibleLeaves.ts'
|
|
2
|
+
|
|
3
|
+
import type { MsaViewModel } from '../../model.ts'
|
|
4
|
+
import type { ResolvedStripPanel } from '../../types.ts'
|
|
5
|
+
import type { RenderCtx } from '../renderCtx.ts'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* One cell per row of a `strip` panel, in the color its field takes through
|
|
9
|
+
* the panel's scale. A row the table has no value for leaves the cell empty.
|
|
10
|
+
*
|
|
11
|
+
* `x` is the panel's left edge in the context: the live view gives each panel
|
|
12
|
+
* a canvas of its own and passes 0, and the export packs every panel into one
|
|
13
|
+
* context and passes the panel's own offset.
|
|
14
|
+
*/
|
|
15
|
+
export function renderStrip({
|
|
16
|
+
ctx,
|
|
17
|
+
model,
|
|
18
|
+
panel,
|
|
19
|
+
x,
|
|
20
|
+
offsetY,
|
|
21
|
+
blockSizeYOverride,
|
|
22
|
+
highResScaleFactorOverride,
|
|
23
|
+
}: {
|
|
24
|
+
ctx: RenderCtx
|
|
25
|
+
model: MsaViewModel
|
|
26
|
+
panel: ResolvedStripPanel
|
|
27
|
+
x: number
|
|
28
|
+
offsetY: number
|
|
29
|
+
blockSizeYOverride?: number
|
|
30
|
+
highResScaleFactorOverride?: number
|
|
31
|
+
}) {
|
|
32
|
+
const { rowHeight, blockSize, highResScaleFactor } = model
|
|
33
|
+
const by = blockSizeYOverride ?? blockSize
|
|
34
|
+
ctx.resetTransform()
|
|
35
|
+
const k = highResScaleFactorOverride ?? highResScaleFactor
|
|
36
|
+
ctx.scale(k, k)
|
|
37
|
+
ctx.translate(x, -offsetY)
|
|
38
|
+
for (const leaf of getVisibleLeaves({ model, offsetY, blockSizeY: by })) {
|
|
39
|
+
const color = panel.colors.get(leaf.data.name)
|
|
40
|
+
if (color) {
|
|
41
|
+
ctx.fillStyle = color
|
|
42
|
+
// leaf.x is the row's center, at rowHeight*(index+0.5)
|
|
43
|
+
ctx.fillRect(0, leaf.x! - rowHeight / 2, panel.width, rowHeight)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
+
import { useTheme } from '@mui/material'
|
|
3
4
|
import { observer } from 'mobx-react'
|
|
4
5
|
|
|
5
6
|
import { useCanvasAutorun } from '../../useCanvasAutorun.ts'
|
|
6
|
-
import { useColorContrast } from '../../useColorContrast.ts'
|
|
7
7
|
import { TrackResizeHandle } from '../ResizeHandles.tsx'
|
|
8
8
|
import { drawTrackBlock } from './drawTracks.ts'
|
|
9
9
|
|
|
@@ -19,11 +19,9 @@ const TrackBlock = observer(function ({
|
|
|
19
19
|
track: BasicTrack
|
|
20
20
|
offsetX: number
|
|
21
21
|
}) {
|
|
22
|
-
const { blockSize,
|
|
23
|
-
const { height
|
|
24
|
-
const
|
|
25
|
-
customColorScheme ?? colorScheme,
|
|
26
|
-
)
|
|
22
|
+
const { blockSize, highResScaleFactor } = model
|
|
23
|
+
const { height } = track.model
|
|
24
|
+
const theme = useTheme()
|
|
27
25
|
const canvasWidth = blockSize * highResScaleFactor
|
|
28
26
|
const canvasHeight = height * highResScaleFactor
|
|
29
27
|
|
|
@@ -31,11 +29,11 @@ const TrackBlock = observer(function ({
|
|
|
31
29
|
draw: ctx => {
|
|
32
30
|
ctx.resetTransform()
|
|
33
31
|
ctx.clearRect(0, 0, canvasWidth, canvasHeight)
|
|
34
|
-
drawTrackBlock({ model, ctx, track, offsetX, theme
|
|
32
|
+
drawTrackBlock({ model, ctx, track, offsetX, theme })
|
|
35
33
|
},
|
|
36
34
|
width: canvasWidth,
|
|
37
35
|
height: canvasHeight,
|
|
38
|
-
deps: [model, track, offsetX, theme
|
|
36
|
+
deps: [model, track, offsetX, theme],
|
|
39
37
|
})
|
|
40
38
|
|
|
41
39
|
return (
|
|
@@ -66,17 +64,14 @@ const TrackBlocks = observer(function ({
|
|
|
66
64
|
model: MsaViewModel
|
|
67
65
|
track: BasicTrack
|
|
68
66
|
}) {
|
|
69
|
-
// msaCanvasWidth, not msaAreaWidth:
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
// last columns appear in the tracks but not in the alignment, and the hovered
|
|
73
|
-
// -column indicator (sized to the canvas) stops short of the track it crosses
|
|
67
|
+
// msaCanvasWidth, not msaAreaWidth: tracks stop where the alignment canvas
|
|
68
|
+
// does, not 20px further under the vertical scrollbar, so their columns and
|
|
69
|
+
// the hover indicator line up with the alignment
|
|
74
70
|
const { blocksX, msaCanvasWidth, scrollX } = model
|
|
75
|
-
const { kind, height, data } = track.model
|
|
71
|
+
const { kind, height, data, arcs } = track.model
|
|
76
72
|
|
|
77
|
-
// a
|
|
78
|
-
|
|
79
|
-
if (kind === 'text' && !data) {
|
|
73
|
+
// a track with nothing to draw would still take up its vertical space
|
|
74
|
+
if ((kind === 'text' && !data) || (kind === 'arc' && !arcs?.length)) {
|
|
80
75
|
return null
|
|
81
76
|
}
|
|
82
77
|
|
|
@@ -103,7 +98,7 @@ const TrackBlocks = observer(function ({
|
|
|
103
98
|
<TrackBlock key={bx} model={model} track={track} offsetX={bx} />
|
|
104
99
|
))}
|
|
105
100
|
</div>
|
|
106
|
-
<TrackResizeHandle model={model}
|
|
101
|
+
<TrackResizeHandle model={model} track={track} />
|
|
107
102
|
</div>
|
|
108
103
|
)
|
|
109
104
|
})
|