react-cheminfo 0.27.0 → 0.29.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 +38 -25
- package/lib/chart/core/axisLabels.d.ts +82 -0
- package/lib/chart/core/axisLabels.d.ts.map +1 -0
- package/lib/chart/core/axisLabels.js +111 -0
- package/lib/chart/core/axisLabels.js.map +1 -0
- package/lib/chart/core/boxLayout.d.ts +53 -0
- package/lib/chart/core/boxLayout.d.ts.map +1 -0
- package/lib/chart/core/boxLayout.js +112 -0
- package/lib/chart/core/boxLayout.js.map +1 -0
- package/lib/chart/core/chartAxisScale.d.ts +23 -2
- package/lib/chart/core/chartAxisScale.d.ts.map +1 -1
- package/lib/chart/core/chartAxisScale.js +64 -13
- package/lib/chart/core/chartAxisScale.js.map +1 -1
- package/lib/chart/core/chartDomain.d.ts +160 -0
- package/lib/chart/core/chartDomain.d.ts.map +1 -0
- package/lib/chart/core/chartDomain.js +46 -0
- package/lib/chart/core/chartDomain.js.map +1 -0
- package/lib/chart/core/chartGeometry.d.ts +131 -0
- package/lib/chart/core/chartGeometry.d.ts.map +1 -0
- package/lib/chart/core/chartGeometry.js +101 -0
- package/lib/chart/core/chartGeometry.js.map +1 -0
- package/lib/chart/core/chartPane.d.ts +11 -0
- package/lib/chart/core/chartPane.d.ts.map +1 -0
- package/lib/chart/core/chartPane.js +11 -0
- package/lib/chart/core/chartPane.js.map +1 -0
- package/lib/chart/core/chartScale.d.ts +4 -1
- package/lib/chart/core/chartScale.d.ts.map +1 -1
- package/lib/chart/core/chartScale.js +8 -4
- package/lib/chart/core/chartScale.js.map +1 -1
- package/lib/chart/core/chartTheme.d.ts +156 -0
- package/lib/chart/core/chartTheme.d.ts.map +1 -0
- package/lib/chart/core/chartTheme.js +156 -0
- package/lib/chart/core/chartTheme.js.map +1 -0
- package/lib/chart/core/chartViewport.d.ts +32 -5
- package/lib/chart/core/chartViewport.d.ts.map +1 -1
- package/lib/chart/core/chartViewport.js +40 -11
- package/lib/chart/core/chartViewport.js.map +1 -1
- package/lib/chart/core/guidePlacement.d.ts +52 -0
- package/lib/chart/core/guidePlacement.d.ts.map +1 -0
- package/lib/chart/core/guidePlacement.js +52 -0
- package/lib/chart/core/guidePlacement.js.map +1 -0
- package/lib/chart/core/index.d.ts +29 -2
- package/lib/chart/core/index.d.ts.map +1 -1
- package/lib/chart/core/index.js +19 -2
- package/lib/chart/core/index.js.map +1 -1
- package/lib/chart/core/labelStack.d.ts +27 -0
- package/lib/chart/core/labelStack.d.ts.map +1 -0
- package/lib/chart/core/labelStack.js +62 -0
- package/lib/chart/core/labelStack.js.map +1 -0
- package/lib/chart/core/legendBox.d.ts +152 -0
- package/lib/chart/core/legendBox.d.ts.map +1 -0
- package/lib/chart/core/legendBox.js +169 -0
- package/lib/chart/core/legendBox.js.map +1 -0
- package/lib/chart/core/selectionGeometry.d.ts +45 -0
- package/lib/chart/core/selectionGeometry.d.ts.map +1 -0
- package/lib/chart/core/selectionGeometry.js +49 -0
- package/lib/chart/core/selectionGeometry.js.map +1 -0
- package/lib/chart/core/spectrumColor.d.ts +80 -0
- package/lib/chart/core/spectrumColor.d.ts.map +1 -0
- package/lib/chart/core/spectrumColor.js +120 -0
- package/lib/chart/core/spectrumColor.js.map +1 -0
- package/lib/chart/core/stackCapacity.d.ts +136 -0
- package/lib/chart/core/stackCapacity.d.ts.map +1 -0
- package/lib/chart/core/stackCapacity.js +153 -0
- package/lib/chart/core/stackCapacity.js.map +1 -0
- package/lib/chart/core/svgPoint.d.ts +62 -0
- package/lib/chart/core/svgPoint.d.ts.map +1 -0
- package/lib/chart/core/svgPoint.js +43 -0
- package/lib/chart/core/svgPoint.js.map +1 -0
- package/lib/chart/core/tracePath.d.ts +94 -0
- package/lib/chart/core/tracePath.d.ts.map +1 -0
- package/lib/chart/core/tracePath.js +191 -0
- package/lib/chart/core/tracePath.js.map +1 -0
- package/lib/chart/core/trackerReadout.d.ts +55 -0
- package/lib/chart/core/trackerReadout.d.ts.map +1 -0
- package/lib/chart/core/trackerReadout.js +53 -0
- package/lib/chart/core/trackerReadout.js.map +1 -0
- package/lib/chart/core/viewTransform.d.ts +167 -0
- package/lib/chart/core/viewTransform.d.ts.map +1 -0
- package/lib/chart/core/viewTransform.js +188 -0
- package/lib/chart/core/viewTransform.js.map +1 -0
- package/lib/chart/core/zoomDomain.d.ts +127 -0
- package/lib/chart/core/zoomDomain.d.ts.map +1 -0
- package/lib/chart/core/zoomDomain.js +175 -0
- package/lib/chart/core/zoomDomain.js.map +1 -0
- package/lib/chart/ui/Axes.d.ts +104 -0
- package/lib/chart/ui/Axes.d.ts.map +1 -0
- package/lib/chart/ui/Axes.js +155 -0
- package/lib/chart/ui/Axes.js.map +1 -0
- package/lib/chart/ui/AxisGuide.d.ts +60 -0
- package/lib/chart/ui/AxisGuide.d.ts.map +1 -0
- package/lib/chart/ui/AxisGuide.js +111 -0
- package/lib/chart/ui/AxisGuide.js.map +1 -0
- package/lib/chart/ui/ChartStack.d.ts +81 -0
- package/lib/chart/ui/ChartStack.d.ts.map +1 -0
- package/lib/chart/ui/ChartStack.js +42 -0
- package/lib/chart/ui/ChartStack.js.map +1 -0
- package/lib/chart/ui/ChartTracker.d.ts +36 -0
- package/lib/chart/ui/ChartTracker.d.ts.map +1 -0
- package/lib/chart/ui/ChartTracker.js +27 -0
- package/lib/chart/ui/ChartTracker.js.map +1 -0
- package/lib/chart/ui/PlotCaption.d.ts +44 -0
- package/lib/chart/ui/PlotCaption.d.ts.map +1 -0
- package/lib/chart/ui/PlotCaption.js +68 -0
- package/lib/chart/ui/PlotCaption.js.map +1 -0
- package/lib/chart/ui/SelectionRect.d.ts +27 -0
- package/lib/chart/ui/SelectionRect.d.ts.map +1 -0
- package/lib/chart/ui/SelectionRect.js +31 -0
- package/lib/chart/ui/SelectionRect.js.map +1 -0
- package/lib/chart/ui/TraceLegend.d.ts +99 -0
- package/lib/chart/ui/TraceLegend.d.ts.map +1 -0
- package/lib/chart/ui/TraceLegend.js +45 -0
- package/lib/chart/ui/TraceLegend.js.map +1 -0
- package/lib/chart/ui/chartGestures.d.ts +158 -0
- package/lib/chart/ui/chartGestures.d.ts.map +1 -0
- package/lib/chart/ui/chartGestures.js +145 -0
- package/lib/chart/ui/chartGestures.js.map +1 -0
- package/lib/chart/ui/chartStackLevel.d.ts +115 -0
- package/lib/chart/ui/chartStackLevel.d.ts.map +1 -0
- package/lib/chart/ui/chartStackLevel.js +96 -0
- package/lib/chart/ui/chartStackLevel.js.map +1 -0
- package/lib/chart/ui/chartSurface.d.ts +35 -0
- package/lib/chart/ui/chartSurface.d.ts.map +1 -0
- package/lib/chart/ui/chartSurface.js +58 -0
- package/lib/chart/ui/chartSurface.js.map +1 -0
- package/lib/chart/ui/index.d.ts +24 -0
- package/lib/chart/ui/index.d.ts.map +1 -1
- package/lib/chart/ui/index.js +13 -0
- package/lib/chart/ui/index.js.map +1 -1
- package/lib/chart/ui/useChartPointer.d.ts +124 -0
- package/lib/chart/ui/useChartPointer.d.ts.map +1 -0
- package/lib/chart/ui/useChartPointer.js +152 -0
- package/lib/chart/ui/useChartPointer.js.map +1 -0
- package/lib/chart/ui/useChartSize.d.ts +49 -0
- package/lib/chart/ui/useChartSize.d.ts.map +1 -0
- package/lib/chart/ui/useChartSize.js +91 -0
- package/lib/chart/ui/useChartSize.js.map +1 -0
- package/lib/chart/ui/useChartWindow.d.ts +147 -0
- package/lib/chart/ui/useChartWindow.d.ts.map +1 -0
- package/lib/chart/ui/useChartWindow.js +135 -0
- package/lib/chart/ui/useChartWindow.js.map +1 -0
- package/lib/chart/ui/useChartZoom.d.ts +88 -0
- package/lib/chart/ui/useChartZoom.d.ts.map +1 -0
- package/lib/chart/ui/useChartZoom.js +142 -0
- package/lib/chart/ui/useChartZoom.js.map +1 -0
- package/lib/chart/ui/useWheelListener.d.ts +30 -0
- package/lib/chart/ui/useWheelListener.d.ts.map +1 -0
- package/lib/chart/ui/useWheelListener.js +57 -0
- package/lib/chart/ui/useWheelListener.js.map +1 -0
- package/lib/clipboard/core/copyPng.d.ts +13 -0
- package/lib/clipboard/core/copyPng.d.ts.map +1 -0
- package/lib/clipboard/core/copyPng.js +19 -0
- package/lib/clipboard/core/copyPng.js.map +1 -0
- package/lib/clipboard/core/index.d.ts +1 -0
- package/lib/clipboard/core/index.d.ts.map +1 -1
- package/lib/clipboard/core/index.js +1 -0
- package/lib/clipboard/core/index.js.map +1 -1
- package/lib/clipboard/ui/CopyableValue.d.ts +12 -9
- package/lib/clipboard/ui/CopyableValue.d.ts.map +1 -1
- package/lib/clipboard/ui/CopyableValue.js +11 -15
- package/lib/clipboard/ui/CopyableValue.js.map +1 -1
- package/lib/core.d.ts +1 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +1 -0
- package/lib/core.js.map +1 -1
- package/lib/download/core/exportStyles.d.ts +22 -0
- package/lib/download/core/exportStyles.d.ts.map +1 -0
- package/lib/download/core/exportStyles.js +19 -0
- package/lib/download/core/exportStyles.js.map +1 -0
- package/lib/download/core/imageResolution.d.ts +88 -0
- package/lib/download/core/imageResolution.d.ts.map +1 -0
- package/lib/download/core/imageResolution.js +77 -0
- package/lib/download/core/imageResolution.js.map +1 -0
- package/lib/download/core/index.d.ts +13 -0
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +8 -0
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/core/pictureExport.d.ts +93 -0
- package/lib/download/core/pictureExport.d.ts.map +1 -0
- package/lib/download/core/pictureExport.js +116 -0
- package/lib/download/core/pictureExport.js.map +1 -0
- package/lib/download/core/stackedDrawing.d.ts +36 -0
- package/lib/download/core/stackedDrawing.d.ts.map +1 -0
- package/lib/download/core/stackedDrawing.js +98 -0
- package/lib/download/core/stackedDrawing.js.map +1 -0
- package/lib/download/core/svgBounds.d.ts +44 -0
- package/lib/download/core/svgBounds.d.ts.map +1 -0
- package/lib/download/core/svgBounds.js +69 -0
- package/lib/download/core/svgBounds.js.map +1 -0
- package/lib/download/core/svgNamespace.d.ts +9 -0
- package/lib/download/core/svgNamespace.d.ts.map +1 -0
- package/lib/download/core/svgNamespace.js +10 -0
- package/lib/download/core/svgNamespace.js.map +1 -0
- package/lib/download/core/svgToPng.d.ts +43 -0
- package/lib/download/core/svgToPng.d.ts.map +1 -0
- package/lib/download/core/svgToPng.js +79 -0
- package/lib/download/core/svgToPng.js.map +1 -0
- package/lib/download/core/svgToString.d.ts +45 -0
- package/lib/download/core/svgToString.d.ts.map +1 -0
- package/lib/download/core/svgToString.js +58 -0
- package/lib/download/core/svgToString.js.map +1 -0
- package/lib/download/ui/ExportDialogFrame.d.ts +46 -0
- package/lib/download/ui/ExportDialogFrame.d.ts.map +1 -0
- package/lib/download/ui/ExportDialogFrame.js +24 -0
- package/lib/download/ui/ExportDialogFrame.js.map +1 -0
- package/lib/download/ui/ExportImageDialog.d.ts +47 -0
- package/lib/download/ui/ExportImageDialog.d.ts.map +1 -0
- package/lib/download/ui/ExportImageDialog.js +25 -0
- package/lib/download/ui/ExportImageDialog.js.map +1 -0
- package/lib/download/ui/ExportNameField.d.ts +29 -0
- package/lib/download/ui/ExportNameField.d.ts.map +1 -0
- package/lib/download/ui/ExportNameField.js +99 -0
- package/lib/download/ui/ExportNameField.js.map +1 -0
- package/lib/download/ui/ExportPictureSection.d.ts +38 -0
- package/lib/download/ui/ExportPictureSection.d.ts.map +1 -0
- package/lib/download/ui/ExportPictureSection.js +48 -0
- package/lib/download/ui/ExportPictureSection.js.map +1 -0
- package/lib/download/ui/index.d.ts +10 -0
- package/lib/download/ui/index.d.ts.map +1 -1
- package/lib/download/ui/index.js +5 -0
- package/lib/download/ui/index.js.map +1 -1
- package/lib/download/ui/useDrawingBox.d.ts +23 -0
- package/lib/download/ui/useDrawingBox.d.ts.map +1 -0
- package/lib/download/ui/useDrawingBox.js +21 -0
- package/lib/download/ui/useDrawingBox.js.map +1 -0
- package/lib/error/core/describeSource.d.ts +17 -0
- package/lib/error/core/describeSource.d.ts.map +1 -0
- package/lib/error/core/describeSource.js +19 -0
- package/lib/error/core/describeSource.js.map +1 -0
- package/lib/error/core/index.d.ts +1 -0
- package/lib/error/core/index.d.ts.map +1 -1
- package/lib/error/core/index.js +1 -0
- package/lib/error/core/index.js.map +1 -1
- package/lib/help/ui/HelpBody.d.ts +10 -1
- package/lib/help/ui/HelpBody.d.ts.map +1 -1
- package/lib/help/ui/HelpBody.js +24 -1
- package/lib/help/ui/HelpBody.js.map +1 -1
- package/lib/help/ui/index.d.ts +1 -1
- package/lib/help/ui/index.d.ts.map +1 -1
- package/lib/help/ui/index.js.map +1 -1
- package/lib/ir/core/analysisSpectra.d.ts +46 -0
- package/lib/ir/core/analysisSpectra.d.ts.map +1 -0
- package/lib/ir/core/analysisSpectra.js +187 -0
- package/lib/ir/core/analysisSpectra.js.map +1 -0
- package/lib/ir/core/assignBands.d.ts +83 -0
- package/lib/ir/core/assignBands.d.ts.map +1 -0
- package/lib/ir/core/assignBands.js +83 -0
- package/lib/ir/core/assignBands.js.map +1 -0
- package/lib/ir/core/bandAssignments.d.ts +47 -0
- package/lib/ir/core/bandAssignments.d.ts.map +1 -0
- package/lib/ir/core/bandAssignments.js +305 -0
- package/lib/ir/core/bandAssignments.js.map +1 -0
- package/lib/ir/core/bandLabelPlan.d.ts +93 -0
- package/lib/ir/core/bandLabelPlan.d.ts.map +1 -0
- package/lib/ir/core/bandLabelPlan.js +104 -0
- package/lib/ir/core/bandLabelPlan.js.map +1 -0
- package/lib/ir/core/detectIrFormat.d.ts +23 -0
- package/lib/ir/core/detectIrFormat.d.ts.map +1 -0
- package/lib/ir/core/detectIrFormat.js +133 -0
- package/lib/ir/core/detectIrFormat.js.map +1 -0
- package/lib/ir/core/downloadSpectra.d.ts +26 -0
- package/lib/ir/core/downloadSpectra.d.ts.map +1 -0
- package/lib/ir/core/downloadSpectra.js +37 -0
- package/lib/ir/core/downloadSpectra.js.map +1 -0
- package/lib/ir/core/fromJcamp.d.ts +35 -0
- package/lib/ir/core/fromJcamp.d.ts.map +1 -0
- package/lib/ir/core/fromJcamp.js +48 -0
- package/lib/ir/core/fromJcamp.js.map +1 -0
- package/lib/ir/core/fromSpc.d.ts +30 -0
- package/lib/ir/core/fromSpc.d.ts.map +1 -0
- package/lib/ir/core/fromSpc.js +40 -0
- package/lib/ir/core/fromSpc.js.map +1 -0
- package/lib/ir/core/index.d.ts +51 -0
- package/lib/ir/core/index.d.ts.map +1 -0
- package/lib/ir/core/index.js +35 -0
- package/lib/ir/core/index.js.map +1 -0
- package/lib/ir/core/irBand.d.ts +45 -0
- package/lib/ir/core/irBand.d.ts.map +1 -0
- package/lib/ir/core/irBand.js +30 -0
- package/lib/ir/core/irBand.js.map +1 -0
- package/lib/ir/core/irCommands.d.ts +168 -0
- package/lib/ir/core/irCommands.d.ts.map +1 -0
- package/lib/ir/core/irCommands.js +94 -0
- package/lib/ir/core/irCommands.js.map +1 -0
- package/lib/ir/core/irDomain.d.ts +63 -0
- package/lib/ir/core/irDomain.d.ts.map +1 -0
- package/lib/ir/core/irDomain.js +136 -0
- package/lib/ir/core/irDomain.js.map +1 -0
- package/lib/ir/core/irEditorApi.d.ts +42 -0
- package/lib/ir/core/irEditorApi.d.ts.map +1 -0
- package/lib/ir/core/irEditorApi.js +10 -0
- package/lib/ir/core/irEditorApi.js.map +1 -0
- package/lib/ir/core/irFormat.d.ts +42 -0
- package/lib/ir/core/irFormat.d.ts.map +1 -0
- package/lib/ir/core/irFormat.js +51 -0
- package/lib/ir/core/irFormat.js.map +1 -0
- package/lib/ir/core/irMode.d.ts +160 -0
- package/lib/ir/core/irMode.d.ts.map +1 -0
- package/lib/ir/core/irMode.js +175 -0
- package/lib/ir/core/irMode.js.map +1 -0
- package/lib/ir/core/irReducer.d.ts +101 -0
- package/lib/ir/core/irReducer.d.ts.map +1 -0
- package/lib/ir/core/irReducer.js +207 -0
- package/lib/ir/core/irReducer.js.map +1 -0
- package/lib/ir/core/irSidePanels.d.ts +22 -0
- package/lib/ir/core/irSidePanels.d.ts.map +1 -0
- package/lib/ir/core/irSidePanels.js +12 -0
- package/lib/ir/core/irSidePanels.js.map +1 -0
- package/lib/ir/core/irSpectrum.d.ts +140 -0
- package/lib/ir/core/irSpectrum.d.ts.map +1 -0
- package/lib/ir/core/irSpectrum.js +34 -0
- package/lib/ir/core/irSpectrum.js.map +1 -0
- package/lib/ir/core/irState.d.ts +119 -0
- package/lib/ir/core/irState.d.ts.map +1 -0
- package/lib/ir/core/irState.js +92 -0
- package/lib/ir/core/irState.js.map +1 -0
- package/lib/ir/core/loadIrSpectra.d.ts +36 -0
- package/lib/ir/core/loadIrSpectra.d.ts.map +1 -0
- package/lib/ir/core/loadIrSpectra.js +44 -0
- package/lib/ir/core/loadIrSpectra.js.map +1 -0
- package/lib/ir/core/nearestBand.d.ts +35 -0
- package/lib/ir/core/nearestBand.d.ts.map +1 -0
- package/lib/ir/core/nearestBand.js +47 -0
- package/lib/ir/core/nearestBand.js.map +1 -0
- package/lib/ir/core/pickBands.d.ts +70 -0
- package/lib/ir/core/pickBands.d.ts.map +1 -0
- package/lib/ir/core/pickBands.js +125 -0
- package/lib/ir/core/pickBands.js.map +1 -0
- package/lib/ir/core/spectrumJcamp.d.ts +58 -0
- package/lib/ir/core/spectrumJcamp.d.ts.map +1 -0
- package/lib/ir/core/spectrumJcamp.js +156 -0
- package/lib/ir/core/spectrumJcamp.js.map +1 -0
- package/lib/ir/core/toIrSpectrum.d.ts +59 -0
- package/lib/ir/core/toIrSpectrum.d.ts.map +1 -0
- package/lib/ir/core/toIrSpectrum.js +56 -0
- package/lib/ir/core/toIrSpectrum.js.map +1 -0
- package/lib/ir/ui/BandMarks.d.ts +52 -0
- package/lib/ir/ui/BandMarks.d.ts.map +1 -0
- package/lib/ir/ui/BandMarks.js +71 -0
- package/lib/ir/ui/BandMarks.js.map +1 -0
- package/lib/ir/ui/BandsPanel.d.ts +31 -0
- package/lib/ir/ui/BandsPanel.d.ts.map +1 -0
- package/lib/ir/ui/BandsPanel.js +94 -0
- package/lib/ir/ui/BandsPanel.js.map +1 -0
- package/lib/ir/ui/IrAboutDialog.d.ts +18 -0
- package/lib/ir/ui/IrAboutDialog.d.ts.map +1 -0
- package/lib/ir/ui/IrAboutDialog.js +32 -0
- package/lib/ir/ui/IrAboutDialog.js.map +1 -0
- package/lib/ir/ui/IrCanvas.d.ts +38 -0
- package/lib/ir/ui/IrCanvas.d.ts.map +1 -0
- package/lib/ir/ui/IrCanvas.js +41 -0
- package/lib/ir/ui/IrCanvas.js.map +1 -0
- package/lib/ir/ui/IrChart.d.ts +28 -0
- package/lib/ir/ui/IrChart.d.ts.map +1 -0
- package/lib/ir/ui/IrChart.js +114 -0
- package/lib/ir/ui/IrChart.js.map +1 -0
- package/lib/ir/ui/IrCommandProvider.d.ts +15 -0
- package/lib/ir/ui/IrCommandProvider.d.ts.map +1 -0
- package/lib/ir/ui/IrCommandProvider.js +14 -0
- package/lib/ir/ui/IrCommandProvider.js.map +1 -0
- package/lib/ir/ui/IrCommandTooltip.d.ts +16 -0
- package/lib/ir/ui/IrCommandTooltip.d.ts.map +1 -0
- package/lib/ir/ui/IrCommandTooltip.js +22 -0
- package/lib/ir/ui/IrCommandTooltip.js.map +1 -0
- package/lib/ir/ui/IrDocumentationDialog.d.ts +18 -0
- package/lib/ir/ui/IrDocumentationDialog.d.ts.map +1 -0
- package/lib/ir/ui/IrDocumentationDialog.js +68 -0
- package/lib/ir/ui/IrDocumentationDialog.js.map +1 -0
- package/lib/ir/ui/IrEditor.d.ts +60 -0
- package/lib/ir/ui/IrEditor.d.ts.map +1 -0
- package/lib/ir/ui/IrEditor.js +42 -0
- package/lib/ir/ui/IrEditor.js.map +1 -0
- package/lib/ir/ui/IrHeader.d.ts +13 -0
- package/lib/ir/ui/IrHeader.d.ts.map +1 -0
- package/lib/ir/ui/IrHeader.js +21 -0
- package/lib/ir/ui/IrHeader.js.map +1 -0
- package/lib/ir/ui/IrLogo.d.ts +20 -0
- package/lib/ir/ui/IrLogo.d.ts.map +1 -0
- package/lib/ir/ui/IrLogo.js +17 -0
- package/lib/ir/ui/IrLogo.js.map +1 -0
- package/lib/ir/ui/IrPointerTracker.d.ts +29 -0
- package/lib/ir/ui/IrPointerTracker.d.ts.map +1 -0
- package/lib/ir/ui/IrPointerTracker.js +47 -0
- package/lib/ir/ui/IrPointerTracker.js.map +1 -0
- package/lib/ir/ui/IrShell.d.ts +25 -0
- package/lib/ir/ui/IrShell.d.ts.map +1 -0
- package/lib/ir/ui/IrShell.js +178 -0
- package/lib/ir/ui/IrShell.js.map +1 -0
- package/lib/ir/ui/IrSidePanel.d.ts +26 -0
- package/lib/ir/ui/IrSidePanel.d.ts.map +1 -0
- package/lib/ir/ui/IrSidePanel.js +39 -0
- package/lib/ir/ui/IrSidePanel.js.map +1 -0
- package/lib/ir/ui/IrStateProvider.d.ts +19 -0
- package/lib/ir/ui/IrStateProvider.d.ts.map +1 -0
- package/lib/ir/ui/IrStateProvider.js +16 -0
- package/lib/ir/ui/IrStateProvider.js.map +1 -0
- package/lib/ir/ui/IrStatusBar.d.ts +14 -0
- package/lib/ir/ui/IrStatusBar.d.ts.map +1 -0
- package/lib/ir/ui/IrStatusBar.js +48 -0
- package/lib/ir/ui/IrStatusBar.js.map +1 -0
- package/lib/ir/ui/IrToolbar.d.ts +18 -0
- package/lib/ir/ui/IrToolbar.d.ts.map +1 -0
- package/lib/ir/ui/IrToolbar.js +32 -0
- package/lib/ir/ui/IrToolbar.js.map +1 -0
- package/lib/ir/ui/IrTraces.d.ts +63 -0
- package/lib/ir/ui/IrTraces.d.ts.map +1 -0
- package/lib/ir/ui/IrTraces.js +72 -0
- package/lib/ir/ui/IrTraces.js.map +1 -0
- package/lib/ir/ui/MetadataPanel.d.ts +15 -0
- package/lib/ir/ui/MetadataPanel.d.ts.map +1 -0
- package/lib/ir/ui/MetadataPanel.js +49 -0
- package/lib/ir/ui/MetadataPanel.js.map +1 -0
- package/lib/ir/ui/SpectraPanel.d.ts +20 -0
- package/lib/ir/ui/SpectraPanel.d.ts.map +1 -0
- package/lib/ir/ui/SpectraPanel.js +42 -0
- package/lib/ir/ui/SpectraPanel.js.map +1 -0
- package/lib/ir/ui/SpectrumRow.d.ts +26 -0
- package/lib/ir/ui/SpectrumRow.d.ts.map +1 -0
- package/lib/ir/ui/SpectrumRow.js +41 -0
- package/lib/ir/ui/SpectrumRow.js.map +1 -0
- package/lib/ir/ui/index.d.ts +56 -0
- package/lib/ir/ui/index.d.ts.map +1 -0
- package/lib/ir/ui/index.js +36 -0
- package/lib/ir/ui/index.js.map +1 -0
- package/lib/ir/ui/irActions.d.ts +52 -0
- package/lib/ir/ui/irActions.d.ts.map +1 -0
- package/lib/ir/ui/irActions.js +62 -0
- package/lib/ir/ui/irActions.js.map +1 -0
- package/lib/ir/ui/irChartProps.d.ts +116 -0
- package/lib/ir/ui/irChartProps.d.ts.map +1 -0
- package/lib/ir/ui/irChartProps.js +14 -0
- package/lib/ir/ui/irChartProps.js.map +1 -0
- package/lib/ir/ui/irCommandContext.d.ts +35 -0
- package/lib/ir/ui/irCommandContext.d.ts.map +1 -0
- package/lib/ir/ui/irCommandContext.js +44 -0
- package/lib/ir/ui/irCommandContext.js.map +1 -0
- package/lib/ir/ui/irStateContext.d.ts +26 -0
- package/lib/ir/ui/irStateContext.d.ts.map +1 -0
- package/lib/ir/ui/irStateContext.js +37 -0
- package/lib/ir/ui/irStateContext.js.map +1 -0
- package/lib/ir/ui/useIrEditor.d.ts +51 -0
- package/lib/ir/ui/useIrEditor.d.ts.map +1 -0
- package/lib/ir/ui/useIrEditor.js +88 -0
- package/lib/ir/ui/useIrEditor.js.map +1 -0
- package/lib/ir/ui/useIrPointer.d.ts +66 -0
- package/lib/ir/ui/useIrPointer.d.ts.map +1 -0
- package/lib/ir/ui/useIrPointer.js +53 -0
- package/lib/ir/ui/useIrPointer.js.map +1 -0
- package/lib/ir/ui/useIrShortcuts.d.ts +24 -0
- package/lib/ir/ui/useIrShortcuts.d.ts.map +1 -0
- package/lib/ir/ui/useIrShortcuts.js +73 -0
- package/lib/ir/ui/useIrShortcuts.js.map +1 -0
- package/lib/ir/ui/useIrZoom.d.ts +51 -0
- package/lib/ir/ui/useIrZoom.d.ts.map +1 -0
- package/lib/ir/ui/useIrZoom.js +46 -0
- package/lib/ir/ui/useIrZoom.js.map +1 -0
- package/lib/ir.d.ts +13 -0
- package/lib/ir.d.ts.map +1 -0
- package/lib/ir.js +13 -0
- package/lib/ir.js.map +1 -0
- package/lib/panel/core/dialogStyles.d.ts +13 -0
- package/lib/panel/core/dialogStyles.d.ts.map +1 -0
- package/lib/panel/core/dialogStyles.js +11 -0
- package/lib/panel/core/dialogStyles.js.map +1 -0
- package/lib/panel/core/index.d.ts +19 -0
- package/lib/panel/core/index.d.ts.map +1 -0
- package/lib/panel/core/index.js +18 -0
- package/lib/panel/core/index.js.map +1 -0
- package/lib/panel/core/isEditingField.d.ts +17 -0
- package/lib/panel/core/isEditingField.d.ts.map +1 -0
- package/lib/panel/core/isEditingField.js +25 -0
- package/lib/panel/core/isEditingField.js.map +1 -0
- package/lib/panel/core/panelStyles.d.ts +242 -0
- package/lib/panel/core/panelStyles.d.ts.map +1 -0
- package/lib/panel/core/panelStyles.js +228 -0
- package/lib/panel/core/panelStyles.js.map +1 -0
- package/lib/panel/core/rowSpacers.d.ts +38 -0
- package/lib/panel/core/rowSpacers.d.ts.map +1 -0
- package/lib/panel/core/rowSpacers.js +31 -0
- package/lib/panel/core/rowSpacers.js.map +1 -0
- package/lib/panel/core/statusBar.d.ts +44 -0
- package/lib/panel/core/statusBar.d.ts.map +1 -0
- package/lib/panel/core/statusBar.js +40 -0
- package/lib/panel/core/statusBar.js.map +1 -0
- package/lib/panel/core/textFilter.d.ts +22 -0
- package/lib/panel/core/textFilter.d.ts.map +1 -0
- package/lib/panel/core/textFilter.js +32 -0
- package/lib/panel/core/textFilter.js.map +1 -0
- package/lib/panel/core/yieldToPainting.d.ts +17 -0
- package/lib/panel/core/yieldToPainting.d.ts.map +1 -0
- package/lib/panel/core/yieldToPainting.js +21 -0
- package/lib/panel/core/yieldToPainting.js.map +1 -0
- package/lib/panel/ui/AboutDialogFrame.d.ts +36 -0
- package/lib/panel/ui/AboutDialogFrame.d.ts.map +1 -0
- package/lib/panel/ui/AboutDialogFrame.js +43 -0
- package/lib/panel/ui/AboutDialogFrame.js.map +1 -0
- package/lib/panel/ui/ClearButton.d.ts +28 -0
- package/lib/panel/ui/ClearButton.d.ts.map +1 -0
- package/lib/panel/ui/ClearButton.js +23 -0
- package/lib/panel/ui/ClearButton.js.map +1 -0
- package/lib/panel/ui/DocumentationDialogFrame.d.ts +39 -0
- package/lib/panel/ui/DocumentationDialogFrame.d.ts.map +1 -0
- package/lib/panel/ui/DocumentationDialogFrame.js +29 -0
- package/lib/panel/ui/DocumentationDialogFrame.js.map +1 -0
- package/lib/panel/ui/FilterInput.d.ts +31 -0
- package/lib/panel/ui/FilterInput.d.ts.map +1 -0
- package/lib/panel/ui/FilterInput.js +23 -0
- package/lib/panel/ui/FilterInput.js.map +1 -0
- package/lib/panel/ui/HelpLabel.d.ts +24 -0
- package/lib/panel/ui/HelpLabel.d.ts.map +1 -0
- package/lib/panel/ui/HelpLabel.js +23 -0
- package/lib/panel/ui/HelpLabel.js.map +1 -0
- package/lib/panel/ui/PanelMessage.d.ts +41 -0
- package/lib/panel/ui/PanelMessage.d.ts.map +1 -0
- package/lib/panel/ui/PanelMessage.js +30 -0
- package/lib/panel/ui/PanelMessage.js.map +1 -0
- package/lib/panel/ui/PanelRail.d.ts +41 -0
- package/lib/panel/ui/PanelRail.d.ts.map +1 -0
- package/lib/panel/ui/PanelRail.js +12 -0
- package/lib/panel/ui/PanelRail.js.map +1 -0
- package/lib/panel/ui/Section.d.ts +25 -0
- package/lib/panel/ui/Section.d.ts.map +1 -0
- package/lib/panel/ui/Section.js +41 -0
- package/lib/panel/ui/Section.js.map +1 -0
- package/lib/panel/ui/SidePanelStack.d.ts +62 -0
- package/lib/panel/ui/SidePanelStack.d.ts.map +1 -0
- package/lib/panel/ui/SidePanelStack.js +40 -0
- package/lib/panel/ui/SidePanelStack.js.map +1 -0
- package/lib/panel/ui/SpectrumColorSwatch.d.ts +33 -0
- package/lib/panel/ui/SpectrumColorSwatch.d.ts.map +1 -0
- package/lib/panel/ui/SpectrumColorSwatch.js +76 -0
- package/lib/panel/ui/SpectrumColorSwatch.js.map +1 -0
- package/lib/panel/ui/index.d.ts +37 -0
- package/lib/panel/ui/index.d.ts.map +1 -0
- package/lib/panel/ui/index.js +24 -0
- package/lib/panel/ui/index.js.map +1 -0
- package/lib/panel/ui/useConfirmOnEnter.d.ts +19 -0
- package/lib/panel/ui/useConfirmOnEnter.d.ts.map +1 -0
- package/lib/panel/ui/useConfirmOnEnter.js +64 -0
- package/lib/panel/ui/useConfirmOnEnter.js.map +1 -0
- package/lib/panel/ui/useFilterBox.d.ts +23 -0
- package/lib/panel/ui/useFilterBox.d.ts.map +1 -0
- package/lib/panel/ui/useFilterBox.js +22 -0
- package/lib/panel/ui/useFilterBox.js.map +1 -0
- package/lib/panel/ui/useVirtualRows.d.ts +46 -0
- package/lib/panel/ui/useVirtualRows.d.ts.map +1 -0
- package/lib/panel/ui/useVirtualRows.js +56 -0
- package/lib/panel/ui/useVirtualRows.js.map +1 -0
- package/lib/panel/ui/useVirtualWindowRows.d.ts +40 -0
- package/lib/panel/ui/useVirtualWindowRows.d.ts.map +1 -0
- package/lib/panel/ui/useVirtualWindowRows.js +65 -0
- package/lib/panel/ui/useVirtualWindowRows.js.map +1 -0
- package/lib/ui.d.ts +1 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +1 -0
- package/lib/ui.js.map +1 -1
- package/package.json +8 -1
- package/src/chart/core/axisLabels.ts +117 -0
- package/src/chart/core/boxLayout.ts +126 -0
- package/src/chart/core/chartAxisScale.ts +92 -10
- package/src/chart/core/chartDomain.ts +185 -0
- package/src/chart/core/chartGeometry.ts +159 -0
- package/src/chart/core/chartPane.ts +10 -0
- package/src/chart/core/chartScale.ts +7 -4
- package/src/chart/core/chartTheme.ts +161 -0
- package/src/chart/core/chartViewport.ts +40 -13
- package/src/chart/core/guidePlacement.ts +66 -0
- package/src/chart/core/index.ts +121 -2
- package/src/chart/core/labelStack.ts +72 -0
- package/src/chart/core/legendBox.ts +263 -0
- package/src/chart/core/selectionGeometry.ts +68 -0
- package/src/chart/core/spectrumColor.ts +129 -0
- package/src/chart/core/stackCapacity.ts +162 -0
- package/src/chart/core/svgPoint.ts +77 -0
- package/src/chart/core/tracePath.ts +228 -0
- package/src/chart/core/trackerReadout.ts +78 -0
- package/src/chart/core/viewTransform.ts +287 -0
- package/src/chart/core/zoomDomain.ts +235 -0
- package/src/chart/ui/Axes.tsx +361 -0
- package/src/chart/ui/AxisGuide.tsx +187 -0
- package/src/chart/ui/ChartStack.tsx +130 -0
- package/src/chart/ui/ChartTracker.tsx +101 -0
- package/src/chart/ui/PlotCaption.tsx +108 -0
- package/src/chart/ui/SelectionRect.tsx +52 -0
- package/src/chart/ui/TraceLegend.tsx +193 -0
- package/src/chart/ui/chartGestures.ts +270 -0
- package/src/chart/ui/chartStackLevel.tsx +210 -0
- package/src/chart/ui/chartSurface.ts +66 -0
- package/src/chart/ui/index.ts +35 -0
- package/src/chart/ui/useChartPointer.ts +223 -0
- package/src/chart/ui/useChartSize.ts +115 -0
- package/src/chart/ui/useChartWindow.ts +240 -0
- package/src/chart/ui/useChartZoom.ts +255 -0
- package/src/chart/ui/useWheelListener.ts +62 -0
- package/src/clipboard/core/copyPng.ts +20 -0
- package/src/clipboard/core/index.ts +1 -0
- package/src/clipboard/ui/CopyableValue.tsx +22 -35
- package/src/core.ts +1 -0
- package/src/download/core/exportStyles.ts +20 -0
- package/src/download/core/imageResolution.ts +118 -0
- package/src/download/core/index.ts +34 -0
- package/src/download/core/pictureExport.ts +207 -0
- package/src/download/core/stackedDrawing.ts +108 -0
- package/src/download/core/svgBounds.ts +80 -0
- package/src/download/core/svgNamespace.ts +9 -0
- package/src/download/core/svgToPng.ts +121 -0
- package/src/download/core/svgToString.ts +95 -0
- package/src/download/ui/ExportDialogFrame.tsx +86 -0
- package/src/download/ui/ExportImageDialog.tsx +91 -0
- package/src/download/ui/ExportNameField.tsx +148 -0
- package/src/download/ui/ExportPictureSection.tsx +142 -0
- package/src/download/ui/index.ts +11 -0
- package/src/download/ui/useDrawingBox.ts +37 -0
- package/src/error/core/describeSource.ts +18 -0
- package/src/error/core/index.ts +1 -0
- package/src/help/ui/HelpBody.tsx +41 -2
- package/src/help/ui/index.ts +6 -1
- package/src/ir/core/analysisSpectra.ts +231 -0
- package/src/ir/core/assignBands.ts +144 -0
- package/src/ir/core/bandAssignments.ts +329 -0
- package/src/ir/core/bandLabelPlan.ts +194 -0
- package/src/ir/core/detectIrFormat.ts +139 -0
- package/src/ir/core/downloadSpectra.ts +57 -0
- package/src/ir/core/fromJcamp.ts +70 -0
- package/src/ir/core/fromSpc.ts +61 -0
- package/src/ir/core/index.ts +113 -0
- package/src/ir/core/irBand.ts +57 -0
- package/src/ir/core/irCommands.ts +154 -0
- package/src/ir/core/irDomain.ts +163 -0
- package/src/ir/core/irEditorApi.ts +44 -0
- package/src/ir/core/irFormat.ts +57 -0
- package/src/ir/core/irMode.ts +203 -0
- package/src/ir/core/irReducer.ts +273 -0
- package/src/ir/core/irSidePanels.ts +20 -0
- package/src/ir/core/irSpectrum.ts +155 -0
- package/src/ir/core/irState.ts +173 -0
- package/src/ir/core/loadIrSpectra.ts +79 -0
- package/src/ir/core/nearestBand.ts +57 -0
- package/src/ir/core/pickBands.ts +181 -0
- package/src/ir/core/spectrumJcamp.ts +178 -0
- package/src/ir/core/toIrSpectrum.ts +102 -0
- package/src/ir/ui/BandMarks.tsx +166 -0
- package/src/ir/ui/BandsPanel.tsx +271 -0
- package/src/ir/ui/IrAboutDialog.tsx +121 -0
- package/src/ir/ui/IrCanvas.tsx +91 -0
- package/src/ir/ui/IrChart.tsx +215 -0
- package/src/ir/ui/IrCommandProvider.tsx +32 -0
- package/src/ir/ui/IrCommandTooltip.tsx +36 -0
- package/src/ir/ui/IrDocumentationDialog.tsx +174 -0
- package/src/ir/ui/IrEditor.tsx +99 -0
- package/src/ir/ui/IrHeader.tsx +39 -0
- package/src/ir/ui/IrLogo.tsx +49 -0
- package/src/ir/ui/IrPointerTracker.tsx +102 -0
- package/src/ir/ui/IrShell.tsx +285 -0
- package/src/ir/ui/IrSidePanel.tsx +78 -0
- package/src/ir/ui/IrStateProvider.tsx +32 -0
- package/src/ir/ui/IrStatusBar.tsx +97 -0
- package/src/ir/ui/IrToolbar.tsx +102 -0
- package/src/ir/ui/IrTraces.tsx +134 -0
- package/src/ir/ui/MetadataPanel.tsx +88 -0
- package/src/ir/ui/SpectraPanel.tsx +114 -0
- package/src/ir/ui/SpectrumRow.tsx +127 -0
- package/src/ir/ui/index.ts +56 -0
- package/src/ir/ui/irActions.ts +103 -0
- package/src/ir/ui/irChartProps.ts +118 -0
- package/src/ir/ui/irCommandContext.tsx +62 -0
- package/src/ir/ui/irStateContext.ts +48 -0
- package/src/ir/ui/useIrEditor.ts +139 -0
- package/src/ir/ui/useIrPointer.ts +109 -0
- package/src/ir/ui/useIrShortcuts.ts +95 -0
- package/src/ir/ui/useIrZoom.ts +86 -0
- package/src/ir.ts +13 -0
- package/src/panel/core/dialogStyles.ts +11 -0
- package/src/panel/core/index.ts +47 -0
- package/src/panel/core/isEditingField.ts +23 -0
- package/src/panel/core/panelStyles.ts +248 -0
- package/src/panel/core/rowSpacers.ts +50 -0
- package/src/panel/core/statusBar.ts +48 -0
- package/src/panel/core/textFilter.ts +33 -0
- package/src/panel/core/yieldToPainting.ts +20 -0
- package/src/panel/ui/AboutDialogFrame.tsx +100 -0
- package/src/panel/ui/ClearButton.tsx +42 -0
- package/src/panel/ui/DocumentationDialogFrame.tsx +86 -0
- package/src/panel/ui/FilterInput.tsx +60 -0
- package/src/panel/ui/HelpLabel.tsx +43 -0
- package/src/panel/ui/PanelMessage.tsx +64 -0
- package/src/panel/ui/PanelRail.tsx +64 -0
- package/src/panel/ui/Section.tsx +66 -0
- package/src/panel/ui/SidePanelStack.tsx +109 -0
- package/src/panel/ui/SpectrumColorSwatch.tsx +119 -0
- package/src/panel/ui/index.ts +47 -0
- package/src/panel/ui/useConfirmOnEnter.ts +68 -0
- package/src/panel/ui/useFilterBox.ts +35 -0
- package/src/panel/ui/useVirtualRows.ts +82 -0
- package/src/panel/ui/useVirtualWindowRows.ts +86 -0
- package/src/ui.ts +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning a pointer on the screen into a point on the chart.
|
|
3
|
+
*
|
|
4
|
+
* Asked by everything that reads a gesture — the crosshair, the box zoom, the
|
|
5
|
+
* click that pins a label — so it is answered once, here, and all of them place
|
|
6
|
+
* the pointer in the same place.
|
|
7
|
+
*
|
|
8
|
+
* The SVG's own screen matrix is the only correct answer once the chart carries
|
|
9
|
+
* a `viewBox`: the element then draws in user units of its own, and a pointer
|
|
10
|
+
* 300 CSS pixels from the left edge of an 800-pixel-wide chart showing 600 user
|
|
11
|
+
* units is at 225 of them, not at 300. The matrix carries that scaling, the
|
|
12
|
+
* device pixel ratio and any transform an ancestor applies, all at once, so
|
|
13
|
+
* nothing downstream has to know that any of them happened.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Where a pointer is, in the user units the SVG draws in.
|
|
17
|
+
*
|
|
18
|
+
* The matrix maps user units onto the screen, so it is inverted to go the other
|
|
19
|
+
* way. It is applied here rather than through a `DOMPoint` so that the
|
|
20
|
+
* arithmetic can be read — and tested — without a browser standing by.
|
|
21
|
+
*
|
|
22
|
+
* A surface that is not laid out has no matrix to give: an SVG inside a folded
|
|
23
|
+
* panel, or one whose `viewBox` has collapsed to nothing, answers `null` rather
|
|
24
|
+
* than a matrix of zeros, and the caller is then told there is no position
|
|
25
|
+
* instead of being handed an infinity that lands every gesture at the same
|
|
26
|
+
* impossible place.
|
|
27
|
+
* @param surface - The SVG, `null` before it is on screen.
|
|
28
|
+
* @param clientX - Where the pointer is on the screen, horizontally.
|
|
29
|
+
* @param clientY - Where it is vertically.
|
|
30
|
+
* @returns The point, `null` when the surface cannot place it.
|
|
31
|
+
*/
|
|
32
|
+
export function svgPointAt(surface, clientX, clientY) {
|
|
33
|
+
const screen = surface?.getScreenCTM();
|
|
34
|
+
if (!screen)
|
|
35
|
+
return null;
|
|
36
|
+
const inverse = screen.inverse();
|
|
37
|
+
const x = clientX * inverse.a + clientY * inverse.c + inverse.e;
|
|
38
|
+
const y = clientX * inverse.b + clientY * inverse.d + inverse.f;
|
|
39
|
+
if (!Number.isFinite(x) || !Number.isFinite(y))
|
|
40
|
+
return null;
|
|
41
|
+
return { x, y };
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=svgPoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgPoint.js","sourceRoot":"","sources":["../../../src/chart/core/svgPoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAkCH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU,CACxB,OAA8B,EAC9B,OAAe,EACf,OAAe;IAEf,MAAM,MAAM,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC;IACvC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IACjC,MAAM,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAChE,MAAM,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAChE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5D,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one string a trace becomes, and why it is only ever one.
|
|
3
|
+
*
|
|
4
|
+
* A profile scan is a few hundred thousand samples and a peak table a few
|
|
5
|
+
* thousand sticks. Drawn as an element each, the browser holds a hundred
|
|
6
|
+
* thousand nodes for a picture that is a single stroke, and every pointer move
|
|
7
|
+
* across the chart then costs a walk of all of them. Both traces are therefore
|
|
8
|
+
* one `<path>` built here, and the only thing that ever changes is its `d`.
|
|
9
|
+
*
|
|
10
|
+
* Coordinates are rounded to a hundredth of a pixel. No display resolves more
|
|
11
|
+
* than that, while the full precision of a double writes `312.40000000000003`
|
|
12
|
+
* where `312.4` was meant — six times the string for a distance nobody can see.
|
|
13
|
+
*/
|
|
14
|
+
import type { NumberArray } from 'cheminfo-types';
|
|
15
|
+
import type { ChartScale } from './chartScale.ts';
|
|
16
|
+
/**
|
|
17
|
+
* The path of a continuous trace: every sample joined to the next.
|
|
18
|
+
*
|
|
19
|
+
* A sample that maps to nothing finite — a `NaN` intensity a reader let
|
|
20
|
+
* through, a mass a degenerate scale sent to infinity — breaks the line in two
|
|
21
|
+
* rather than being passed over, because joining the two sound samples either
|
|
22
|
+
* side of it draws a straight run across a stretch the instrument never
|
|
23
|
+
* reported. Writing the `NaN` into the string instead would void the whole
|
|
24
|
+
* path, and the trace would then silently not be drawn at all.
|
|
25
|
+
* @param x - Where each sample was taken, ascending.
|
|
26
|
+
* @param y - What was measured there, one per sample.
|
|
27
|
+
* @param xScale - The x axis as it is currently zoomed.
|
|
28
|
+
* @param yScale - The y axis as it is currently zoomed.
|
|
29
|
+
* @returns The `d` of one path; empty when there is nothing to draw, and a bare
|
|
30
|
+
* `M` for a trace of a single sample, which is a point and not a line.
|
|
31
|
+
*/
|
|
32
|
+
export declare function profilePath(x: NumberArray, y: NumberArray, xScale: ChartScale, yScale: ChartScale): string;
|
|
33
|
+
/**
|
|
34
|
+
* The path of a centroid: one stick per peak, standing on zero.
|
|
35
|
+
*
|
|
36
|
+
* The foot of every stick is where the intensity axis reads zero rather than
|
|
37
|
+
* the bottom of the plot, which is the same pixel until the chart is mirrored
|
|
38
|
+
* and then is not — a stick of the inverted half hangs from the rule the pair
|
|
39
|
+
* is reflected in. Nothing is clipped here: a peak taller than the window still
|
|
40
|
+
* gets its full stick, and the clip path over the data band is what stops it at
|
|
41
|
+
* the edge, so a zoom into the baseline shows the tall peak leaving the top
|
|
42
|
+
* rather than a gap where it stood.
|
|
43
|
+
* @param x - Where each peak sits, ascending.
|
|
44
|
+
* @param y - How tall each one is, one per peak.
|
|
45
|
+
* @param xScale - The x axis as it is currently zoomed.
|
|
46
|
+
* @param yScale - The y axis as it is currently zoomed, which the foot of the
|
|
47
|
+
* sticks is read off.
|
|
48
|
+
* @returns The `d` of one path, empty when there is nothing to draw.
|
|
49
|
+
*/
|
|
50
|
+
export declare function stickPath(x: NumberArray, y: NumberArray, xScale: ChartScale, yScale: ChartScale): string;
|
|
51
|
+
/** What an area is closed at, when the ground it stands on is not zero. */
|
|
52
|
+
export interface AreaPathOptions {
|
|
53
|
+
/**
|
|
54
|
+
* The value the area is closed down onto, in the units of the y axis.
|
|
55
|
+
*
|
|
56
|
+
* A chromatographic baseline is neither at zero nor horizontal — a gradient
|
|
57
|
+
* run drifts a few thousand counts between the first peak and the last — so
|
|
58
|
+
* shading a peak down to the axis shades the column of baseline under it as
|
|
59
|
+
* well, which at a weak peak is most of what the eye then reads as the peak.
|
|
60
|
+
* Given the value the integration was corrected against, the shading and the
|
|
61
|
+
* number in the table are about the same region.
|
|
62
|
+
* @default 0
|
|
63
|
+
*/
|
|
64
|
+
baseline?: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The path of the region under a trace: its top edge, closed onto a baseline.
|
|
68
|
+
*
|
|
69
|
+
* `profilePath` draws where a trace went and stops there, so nothing built on
|
|
70
|
+
* it can shade a region — and an integrated chromatographic peak, a UV band
|
|
71
|
+
* and an NMR integral are all that same picture, a stretch of one trace filled
|
|
72
|
+
* in to say how much of it was counted. The top edge is written exactly as
|
|
73
|
+
* `profilePath` writes it, so an area drawn under a trace lies along it to the
|
|
74
|
+
* hundredth of a pixel rather than a rounding apart from it.
|
|
75
|
+
*
|
|
76
|
+
* Each unbroken run of samples is closed on its own: down to the baseline
|
|
77
|
+
* where it ended, back along the baseline to where it began, and shut. A run
|
|
78
|
+
* of one sample encloses nothing and is left out altogether, which is what
|
|
79
|
+
* stops a break in the data from shading a spike of zero width.
|
|
80
|
+
*
|
|
81
|
+
* Nothing is clipped here, exactly as in `profilePath` and `stickPath` — a
|
|
82
|
+
* peak taller than the window keeps its whole area and the clip path over the
|
|
83
|
+
* data band is what stops it at the edge.
|
|
84
|
+
* @param x - Where each sample was taken, ascending.
|
|
85
|
+
* @param y - What was measured there, one per sample.
|
|
86
|
+
* @param xScale - The x axis as it is currently zoomed.
|
|
87
|
+
* @param yScale - The y axis as it is currently zoomed, which the baseline is
|
|
88
|
+
* read off.
|
|
89
|
+
* @param options - Where the ground under the area is.
|
|
90
|
+
* @returns The `d` of one path, holding one closed shape per unbroken run;
|
|
91
|
+
* empty when there is nothing wide enough to enclose anything.
|
|
92
|
+
*/
|
|
93
|
+
export declare function areaPath(x: NumberArray, y: NumberArray, xScale: ChartScale, yScale: ChartScale, options?: AreaPathOptions): string;
|
|
94
|
+
//# sourceMappingURL=tracePath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracePath.d.ts","sourceRoot":"","sources":["../../../src/chart/core/tracePath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CACzB,CAAC,EAAE,WAAW,EACd,CAAC,EAAE,WAAW,EACd,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,GACjB,MAAM,CAwBR;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CACvB,CAAC,EAAE,WAAW,EACd,CAAC,EAAE,WAAW,EACd,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,GACjB,MAAM,CAmBR;AAED,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,QAAQ,CACtB,CAAC,EAAE,WAAW,EACd,CAAC,EAAE,WAAW,EACd,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,eAAoB,GAC5B,MAAM,CAsCR"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one string a trace becomes, and why it is only ever one.
|
|
3
|
+
*
|
|
4
|
+
* A profile scan is a few hundred thousand samples and a peak table a few
|
|
5
|
+
* thousand sticks. Drawn as an element each, the browser holds a hundred
|
|
6
|
+
* thousand nodes for a picture that is a single stroke, and every pointer move
|
|
7
|
+
* across the chart then costs a walk of all of them. Both traces are therefore
|
|
8
|
+
* one `<path>` built here, and the only thing that ever changes is its `d`.
|
|
9
|
+
*
|
|
10
|
+
* Coordinates are rounded to a hundredth of a pixel. No display resolves more
|
|
11
|
+
* than that, while the full precision of a double writes `312.40000000000003`
|
|
12
|
+
* where `312.4` was meant — six times the string for a distance nobody can see.
|
|
13
|
+
*/
|
|
14
|
+
import { chartPixel } from "./chartScale.js";
|
|
15
|
+
/**
|
|
16
|
+
* The path of a continuous trace: every sample joined to the next.
|
|
17
|
+
*
|
|
18
|
+
* A sample that maps to nothing finite — a `NaN` intensity a reader let
|
|
19
|
+
* through, a mass a degenerate scale sent to infinity — breaks the line in two
|
|
20
|
+
* rather than being passed over, because joining the two sound samples either
|
|
21
|
+
* side of it draws a straight run across a stretch the instrument never
|
|
22
|
+
* reported. Writing the `NaN` into the string instead would void the whole
|
|
23
|
+
* path, and the trace would then silently not be drawn at all.
|
|
24
|
+
* @param x - Where each sample was taken, ascending.
|
|
25
|
+
* @param y - What was measured there, one per sample.
|
|
26
|
+
* @param xScale - The x axis as it is currently zoomed.
|
|
27
|
+
* @param yScale - The y axis as it is currently zoomed.
|
|
28
|
+
* @returns The `d` of one path; empty when there is nothing to draw, and a bare
|
|
29
|
+
* `M` for a trace of a single sample, which is a point and not a line.
|
|
30
|
+
*/
|
|
31
|
+
export function profilePath(x, y, xScale, yScale) {
|
|
32
|
+
// The two scales are read out here and the multiply-add written inline, as
|
|
33
|
+
// `chartScale` asks a loop over points to: a trace is tens of thousands of
|
|
34
|
+
// samples, and a helper call per sample per axis is the one cost this file
|
|
35
|
+
// can avoid without changing what it draws.
|
|
36
|
+
const { offset: xOffset, factor: xFactor } = xScale;
|
|
37
|
+
const { offset: yOffset, factor: yFactor } = yScale;
|
|
38
|
+
const count = Math.min(x.length, y.length);
|
|
39
|
+
let path = '';
|
|
40
|
+
let drawnInRun = 0;
|
|
41
|
+
for (let index = 0; index < count; index++) {
|
|
42
|
+
const pixelX = xOffset + x[index] * xFactor;
|
|
43
|
+
const pixelY = yOffset + y[index] * yFactor;
|
|
44
|
+
if (!Number.isFinite(pixelX) || !Number.isFinite(pixelY)) {
|
|
45
|
+
drawnInRun = 0;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const point = `${roundPixel(pixelX)} ${roundPixel(pixelY)}`;
|
|
49
|
+
if (drawnInRun === 0)
|
|
50
|
+
path += `M${point}`;
|
|
51
|
+
else if (drawnInRun === 1)
|
|
52
|
+
path += `L${point}`;
|
|
53
|
+
else
|
|
54
|
+
path += ` ${point}`;
|
|
55
|
+
drawnInRun++;
|
|
56
|
+
}
|
|
57
|
+
return path;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The path of a centroid: one stick per peak, standing on zero.
|
|
61
|
+
*
|
|
62
|
+
* The foot of every stick is where the intensity axis reads zero rather than
|
|
63
|
+
* the bottom of the plot, which is the same pixel until the chart is mirrored
|
|
64
|
+
* and then is not — a stick of the inverted half hangs from the rule the pair
|
|
65
|
+
* is reflected in. Nothing is clipped here: a peak taller than the window still
|
|
66
|
+
* gets its full stick, and the clip path over the data band is what stops it at
|
|
67
|
+
* the edge, so a zoom into the baseline shows the tall peak leaving the top
|
|
68
|
+
* rather than a gap where it stood.
|
|
69
|
+
* @param x - Where each peak sits, ascending.
|
|
70
|
+
* @param y - How tall each one is, one per peak.
|
|
71
|
+
* @param xScale - The x axis as it is currently zoomed.
|
|
72
|
+
* @param yScale - The y axis as it is currently zoomed, which the foot of the
|
|
73
|
+
* sticks is read off.
|
|
74
|
+
* @returns The `d` of one path, empty when there is nothing to draw.
|
|
75
|
+
*/
|
|
76
|
+
export function stickPath(x, y, xScale, yScale) {
|
|
77
|
+
const count = Math.min(x.length, y.length);
|
|
78
|
+
const foot = chartPixel(yScale, 0);
|
|
79
|
+
if (!Number.isFinite(foot))
|
|
80
|
+
return '';
|
|
81
|
+
const baseline = roundPixel(foot);
|
|
82
|
+
// The two scales are read out here and the multiply-add written inline, as
|
|
83
|
+
// `chartScale` asks a loop over points to: a trace is tens of thousands of
|
|
84
|
+
// samples, and a helper call per sample per axis is the one cost this file
|
|
85
|
+
// can avoid without changing what it draws.
|
|
86
|
+
const { offset: xOffset, factor: xFactor } = xScale;
|
|
87
|
+
const { offset: yOffset, factor: yFactor } = yScale;
|
|
88
|
+
let path = '';
|
|
89
|
+
for (let index = 0; index < count; index++) {
|
|
90
|
+
const pixelX = xOffset + x[index] * xFactor;
|
|
91
|
+
const pixelY = yOffset + y[index] * yFactor;
|
|
92
|
+
if (!Number.isFinite(pixelX) || !Number.isFinite(pixelY))
|
|
93
|
+
continue;
|
|
94
|
+
path += `M${roundPixel(pixelX)} ${baseline}V${roundPixel(pixelY)}`;
|
|
95
|
+
}
|
|
96
|
+
return path;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The path of the region under a trace: its top edge, closed onto a baseline.
|
|
100
|
+
*
|
|
101
|
+
* `profilePath` draws where a trace went and stops there, so nothing built on
|
|
102
|
+
* it can shade a region — and an integrated chromatographic peak, a UV band
|
|
103
|
+
* and an NMR integral are all that same picture, a stretch of one trace filled
|
|
104
|
+
* in to say how much of it was counted. The top edge is written exactly as
|
|
105
|
+
* `profilePath` writes it, so an area drawn under a trace lies along it to the
|
|
106
|
+
* hundredth of a pixel rather than a rounding apart from it.
|
|
107
|
+
*
|
|
108
|
+
* Each unbroken run of samples is closed on its own: down to the baseline
|
|
109
|
+
* where it ended, back along the baseline to where it began, and shut. A run
|
|
110
|
+
* of one sample encloses nothing and is left out altogether, which is what
|
|
111
|
+
* stops a break in the data from shading a spike of zero width.
|
|
112
|
+
*
|
|
113
|
+
* Nothing is clipped here, exactly as in `profilePath` and `stickPath` — a
|
|
114
|
+
* peak taller than the window keeps its whole area and the clip path over the
|
|
115
|
+
* data band is what stops it at the edge.
|
|
116
|
+
* @param x - Where each sample was taken, ascending.
|
|
117
|
+
* @param y - What was measured there, one per sample.
|
|
118
|
+
* @param xScale - The x axis as it is currently zoomed.
|
|
119
|
+
* @param yScale - The y axis as it is currently zoomed, which the baseline is
|
|
120
|
+
* read off.
|
|
121
|
+
* @param options - Where the ground under the area is.
|
|
122
|
+
* @returns The `d` of one path, holding one closed shape per unbroken run;
|
|
123
|
+
* empty when there is nothing wide enough to enclose anything.
|
|
124
|
+
*/
|
|
125
|
+
export function areaPath(x, y, xScale, yScale, options = {}) {
|
|
126
|
+
const { baseline = 0 } = options;
|
|
127
|
+
const ground = chartPixel(yScale, baseline);
|
|
128
|
+
if (!Number.isFinite(ground))
|
|
129
|
+
return '';
|
|
130
|
+
const foot = roundPixel(ground);
|
|
131
|
+
const count = Math.min(x.length, y.length);
|
|
132
|
+
// The two scales are read out here and the multiply-add written inline, as
|
|
133
|
+
// `chartScale` asks a loop over points to: a trace is tens of thousands of
|
|
134
|
+
// samples, and a helper call per sample per axis is the one cost this file
|
|
135
|
+
// can avoid without changing what it draws.
|
|
136
|
+
const { offset: xOffset, factor: xFactor } = xScale;
|
|
137
|
+
const { offset: yOffset, factor: yFactor } = yScale;
|
|
138
|
+
let path = '';
|
|
139
|
+
let edge = '';
|
|
140
|
+
let drawnInRun = 0;
|
|
141
|
+
let runStart = 0;
|
|
142
|
+
for (let index = 0; index < count; index++) {
|
|
143
|
+
const pixelX = xOffset + x[index] * xFactor;
|
|
144
|
+
const pixelY = yOffset + y[index] * yFactor;
|
|
145
|
+
if (!Number.isFinite(pixelX) || !Number.isFinite(pixelY)) {
|
|
146
|
+
path += closedRun(edge, drawnInRun, runStart, foot);
|
|
147
|
+
edge = '';
|
|
148
|
+
drawnInRun = 0;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
const left = roundPixel(pixelX);
|
|
152
|
+
const point = `${left} ${roundPixel(pixelY)}`;
|
|
153
|
+
if (drawnInRun === 0) {
|
|
154
|
+
edge = `M${point}`;
|
|
155
|
+
runStart = left;
|
|
156
|
+
}
|
|
157
|
+
else if (drawnInRun === 1) {
|
|
158
|
+
edge += `L${point}`;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
edge += ` ${point}`;
|
|
162
|
+
}
|
|
163
|
+
drawnInRun++;
|
|
164
|
+
}
|
|
165
|
+
return path + closedRun(edge, drawnInRun, runStart, foot);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Shut one run of samples down onto the baseline.
|
|
169
|
+
* @param edge - The top edge of the run, as `profilePath` would have written it.
|
|
170
|
+
* @param drawnInRun - How many samples that edge was drawn from.
|
|
171
|
+
* @param runStart - Where the run began, in pixels.
|
|
172
|
+
* @param foot - Where the baseline falls, in pixels.
|
|
173
|
+
* @returns The closed shape, empty for a run of fewer than two samples, which
|
|
174
|
+
* has no width and so encloses nothing.
|
|
175
|
+
*/
|
|
176
|
+
function closedRun(edge, drawnInRun, runStart, foot) {
|
|
177
|
+
if (drawnInRun < 2)
|
|
178
|
+
return '';
|
|
179
|
+
return `${edge}V${foot}H${runStart}Z`;
|
|
180
|
+
}
|
|
181
|
+
/** How many parts of a pixel a coordinate is written to. */
|
|
182
|
+
const PIXEL_PRECISION = 100;
|
|
183
|
+
/**
|
|
184
|
+
* A coordinate as the path writes it.
|
|
185
|
+
* @param value - Where the point falls, in pixels.
|
|
186
|
+
* @returns The same place, to a hundredth of a pixel.
|
|
187
|
+
*/
|
|
188
|
+
function roundPixel(value) {
|
|
189
|
+
return Math.round(value * PIXEL_PRECISION) / PIXEL_PRECISION;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=tracePath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracePath.js","sourceRoot":"","sources":["../../../src/chart/core/tracePath.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the crosshair writes what the axes say under it.
|
|
3
|
+
*
|
|
4
|
+
* The readout is the one thing on the chart that must never be clipped: it is
|
|
5
|
+
* what the pointer was put there to read, and the places it is most often put
|
|
6
|
+
* are exactly the awkward ones — on the tallest peak, hard against the top of
|
|
7
|
+
* the plot, or out at the far right where a label written rightwards runs off
|
|
8
|
+
* the edge. So the side it is written on and the line it starts on are both
|
|
9
|
+
* decided from the room there is, and neither is a fixed offset.
|
|
10
|
+
*/
|
|
11
|
+
import type { PlotRect } from './chartGeometry.ts';
|
|
12
|
+
import type { ChartPoint } from './svgPoint.ts';
|
|
13
|
+
/** The clear space between the crosshair and what is written beside it. */
|
|
14
|
+
export declare const READOUT_GAP = 6;
|
|
15
|
+
/**
|
|
16
|
+
* The room the readout claims, in pixels.
|
|
17
|
+
*
|
|
18
|
+
* A value at a deep zoom is `1234.5678` and the one under it is shorter, so this
|
|
19
|
+
* is the width of the longest line either can be — measured from the font rather
|
|
20
|
+
* than from the text, because the text is not on screen yet when the side it goes
|
|
21
|
+
* on has to be chosen.
|
|
22
|
+
*/
|
|
23
|
+
export declare const READOUT_WIDTH = 88;
|
|
24
|
+
/** How many lines the readout is written on: one for each axis. */
|
|
25
|
+
export declare const READOUT_LINES = 2;
|
|
26
|
+
/** Where the readout is written, and which way it runs from there. */
|
|
27
|
+
export interface ReadoutPlacement {
|
|
28
|
+
/** The edge the lines are anchored on. */
|
|
29
|
+
x: number;
|
|
30
|
+
/** The baseline of the first line. */
|
|
31
|
+
y: number;
|
|
32
|
+
/** Which way the text runs from `x`. */
|
|
33
|
+
anchor: 'start' | 'end';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Work out where the readout beside the pointer goes.
|
|
37
|
+
*
|
|
38
|
+
* It is written to the right of the crosshair and above the pointer, which is
|
|
39
|
+
* where a hand holding a mouse is not covering it, and flips to the left as soon
|
|
40
|
+
* as it would otherwise cross the right edge of the plot. Flipping rather than
|
|
41
|
+
* sliding: a readout pinned to the edge would drift away from the crosshair it
|
|
42
|
+
* belongs to as the pointer went further right, and the pair would stop reading
|
|
43
|
+
* as one thing.
|
|
44
|
+
*
|
|
45
|
+
* Both bounds are honoured rather than only the near one, so the last line never
|
|
46
|
+
* runs off the bottom of a short plot. In a plot too short to hold every line
|
|
47
|
+
* the top edge wins: the first line is the one worth keeping, because every
|
|
48
|
+
* viewer writes what its horizontal axis reads there first.
|
|
49
|
+
* @param point - Where the pointer is, in user units.
|
|
50
|
+
* @param plot - Where the plot sits inside the SVG.
|
|
51
|
+
* @param lines - How many lines are written. Defaults to `READOUT_LINES`.
|
|
52
|
+
* @returns The anchor, the first baseline, and which way the text runs.
|
|
53
|
+
*/
|
|
54
|
+
export declare function readoutPlacement(point: ChartPoint, plot: PlotRect, lines?: number): ReadoutPlacement;
|
|
55
|
+
//# sourceMappingURL=trackerReadout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackerReadout.d.ts","sourceRoot":"","sources":["../../../src/chart/core/trackerReadout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,2EAA2E;AAC3E,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC,mEAAmE;AACnE,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,0CAA0C;IAC1C,CAAC,EAAE,MAAM,CAAC;IACV,sCAAsC;IACtC,CAAC,EAAE,MAAM,CAAC;IACV,wCAAwC;IACxC,MAAM,EAAE,OAAO,GAAG,KAAK,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,QAAQ,EACd,KAAK,SAAgB,GACpB,gBAAgB,CAalB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the crosshair writes what the axes say under it.
|
|
3
|
+
*
|
|
4
|
+
* The readout is the one thing on the chart that must never be clipped: it is
|
|
5
|
+
* what the pointer was put there to read, and the places it is most often put
|
|
6
|
+
* are exactly the awkward ones — on the tallest peak, hard against the top of
|
|
7
|
+
* the plot, or out at the far right where a label written rightwards runs off
|
|
8
|
+
* the edge. So the side it is written on and the line it starts on are both
|
|
9
|
+
* decided from the room there is, and neither is a fixed offset.
|
|
10
|
+
*/
|
|
11
|
+
import { CHART_FONT, PEAK_LABEL } from "./chartTheme.js";
|
|
12
|
+
/** The clear space between the crosshair and what is written beside it. */
|
|
13
|
+
export const READOUT_GAP = 6;
|
|
14
|
+
/**
|
|
15
|
+
* The room the readout claims, in pixels.
|
|
16
|
+
*
|
|
17
|
+
* A value at a deep zoom is `1234.5678` and the one under it is shorter, so this
|
|
18
|
+
* is the width of the longest line either can be — measured from the font rather
|
|
19
|
+
* than from the text, because the text is not on screen yet when the side it goes
|
|
20
|
+
* on has to be chosen.
|
|
21
|
+
*/
|
|
22
|
+
export const READOUT_WIDTH = 88;
|
|
23
|
+
/** How many lines the readout is written on: one for each axis. */
|
|
24
|
+
export const READOUT_LINES = 2;
|
|
25
|
+
/**
|
|
26
|
+
* Work out where the readout beside the pointer goes.
|
|
27
|
+
*
|
|
28
|
+
* It is written to the right of the crosshair and above the pointer, which is
|
|
29
|
+
* where a hand holding a mouse is not covering it, and flips to the left as soon
|
|
30
|
+
* as it would otherwise cross the right edge of the plot. Flipping rather than
|
|
31
|
+
* sliding: a readout pinned to the edge would drift away from the crosshair it
|
|
32
|
+
* belongs to as the pointer went further right, and the pair would stop reading
|
|
33
|
+
* as one thing.
|
|
34
|
+
*
|
|
35
|
+
* Both bounds are honoured rather than only the near one, so the last line never
|
|
36
|
+
* runs off the bottom of a short plot. In a plot too short to hold every line
|
|
37
|
+
* the top edge wins: the first line is the one worth keeping, because every
|
|
38
|
+
* viewer writes what its horizontal axis reads there first.
|
|
39
|
+
* @param point - Where the pointer is, in user units.
|
|
40
|
+
* @param plot - Where the plot sits inside the SVG.
|
|
41
|
+
* @param lines - How many lines are written. Defaults to `READOUT_LINES`.
|
|
42
|
+
* @returns The anchor, the first baseline, and which way the text runs.
|
|
43
|
+
*/
|
|
44
|
+
export function readoutPlacement(point, plot, lines = READOUT_LINES) {
|
|
45
|
+
const runsRight = point.x + READOUT_GAP + READOUT_WIDTH <= plot.right;
|
|
46
|
+
const x = runsRight ? point.x + READOUT_GAP : point.x - READOUT_GAP;
|
|
47
|
+
const written = Math.max(1, lines);
|
|
48
|
+
const highest = plot.top + CHART_FONT.readout;
|
|
49
|
+
const lowest = plot.bottom - (written - 1) * PEAK_LABEL.lineHeight;
|
|
50
|
+
const y = Math.min(Math.max(point.y - READOUT_GAP, highest), Math.max(highest, lowest));
|
|
51
|
+
return { x, y, anchor: runsRight ? 'start' : 'end' };
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=trackerReadout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackerReadout.js","sourceRoot":"","sources":["../../../src/chart/core/trackerReadout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGzD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC,mEAAmE;AACnE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAY/B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAiB,EACjB,IAAc,EACd,KAAK,GAAG,aAAa;IAErB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,GAAG,WAAW,GAAG,aAAa,IAAI,IAAI,CAAC,KAAK,CAAC;IACtE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC;IAEpE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC;IACnE,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAChB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,WAAW,EAAE,OAAO,CAAC,EACxC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAC1B,CAAC;IAEF,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How much of a drawing surface is shown, and where.
|
|
3
|
+
*
|
|
4
|
+
* Everything here is arithmetic on a `viewBox`: zooming narrows the window and
|
|
5
|
+
* panning slides it, so what is inside is re-rendered at the new scale rather
|
|
6
|
+
* than magnified as pixels. None of it knows what is being drawn — it is the
|
|
7
|
+
* pan-and-zoom half of a canvas, and it is shared because a glycan drawing and
|
|
8
|
+
* an ion image ask the same questions of it and would otherwise answer them
|
|
9
|
+
* twice.
|
|
10
|
+
*
|
|
11
|
+
* What they do not share is how a surface is fitted before it is touched, which
|
|
12
|
+
* is why `baseViewBox` takes `maximumScale`: a glycan is centred at its own
|
|
13
|
+
* size up to a readable maximum, while an image is fitted to its frame.
|
|
14
|
+
*/
|
|
15
|
+
export interface ViewState {
|
|
16
|
+
/** How far in, `1` being the base view. */
|
|
17
|
+
zoom: number;
|
|
18
|
+
/** Left edge of the window, from the left edge of the base view. */
|
|
19
|
+
panX: number;
|
|
20
|
+
/** Top edge of the window, from the top edge of the base view. */
|
|
21
|
+
panY: number;
|
|
22
|
+
}
|
|
23
|
+
/** A rectangle of the drawing, shaped the way the `viewBox` wants it. */
|
|
24
|
+
export interface ViewBox {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
}
|
|
30
|
+
/** Closest and furthest the canvas will go. */
|
|
31
|
+
export declare const MINIMUM_ZOOM = 0.25;
|
|
32
|
+
export declare const MAXIMUM_ZOOM = 8;
|
|
33
|
+
/**
|
|
34
|
+
* Biggest a drawing unit is ever drawn at, in pixels, unless a caller says
|
|
35
|
+
* otherwise.
|
|
36
|
+
*
|
|
37
|
+
* Chosen against the glycan canvas, where a symbol is 34 units across and a
|
|
38
|
+
* bond 60 long, so a drawing at this scale reads about the size it does in a
|
|
39
|
+
* paper — which is as big as it is worth drawing. Without the cap a
|
|
40
|
+
* disaccharide on a wide screen is blown up until three residues fill a metre
|
|
41
|
+
* of pixels. A surface with its own idea of how big is big enough passes its
|
|
42
|
+
* own maximum instead.
|
|
43
|
+
*/
|
|
44
|
+
export declare const MAXIMUM_CONTENT_SCALE = 1.5;
|
|
45
|
+
/** The base view, seen as it comes: no zoom, no pan. */
|
|
46
|
+
export declare const INITIAL_VIEW: ViewState;
|
|
47
|
+
/**
|
|
48
|
+
* What the canvas shows before it is zoomed or panned.
|
|
49
|
+
*
|
|
50
|
+
* A drawing too big for the canvas is fitted to it, as anything drawn to be
|
|
51
|
+
* looked at whole must be. A drawing smaller than that is *not* stretched to
|
|
52
|
+
* fill it: it is drawn at its own size, up to `maximumScale`, in the middle of
|
|
53
|
+
* a window opened around it — so a disaccharide reads like a disaccharide
|
|
54
|
+
* however wide the screen it is on, and the empty canvas around it is still
|
|
55
|
+
* canvas, there to be clicked and drawn on.
|
|
56
|
+
* @param content - Size of the whole drawing, in canvas units.
|
|
57
|
+
* @param content.width - How wide the drawing is.
|
|
58
|
+
* @param content.height - How tall the drawing is.
|
|
59
|
+
* @param viewport - Size of the canvas on screen, in pixels.
|
|
60
|
+
* @param viewport.width - How wide the canvas is.
|
|
61
|
+
* @param viewport.height - How tall the canvas is.
|
|
62
|
+
* @param maximumScale - Biggest a canvas unit may be drawn, in pixels.
|
|
63
|
+
* @returns The rectangle of the drawing seen at zoom `1`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function baseViewBox(content: {
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
}, viewport: {
|
|
69
|
+
width: number;
|
|
70
|
+
height: number;
|
|
71
|
+
}, maximumScale?: number): ViewBox;
|
|
72
|
+
/**
|
|
73
|
+
* How far in and out a particular surface may go.
|
|
74
|
+
*
|
|
75
|
+
* Carried as an argument rather than fixed, because the two surfaces that use
|
|
76
|
+
* this disagree about it and both are right: a drawing may be zoomed out below
|
|
77
|
+
* its fitted size to see where it sits on the canvas, while an ion image has
|
|
78
|
+
* nothing outside itself to see — zooming out past the fit would only add
|
|
79
|
+
* emptiness — so its floor is the fit and its ceiling is far higher, since a
|
|
80
|
+
* twenty-micrometre pixel is worth magnifying.
|
|
81
|
+
*/
|
|
82
|
+
export interface ZoomBounds {
|
|
83
|
+
/**
|
|
84
|
+
* Furthest out.
|
|
85
|
+
* @default MINIMUM_ZOOM
|
|
86
|
+
*/
|
|
87
|
+
minimum?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Furthest in.
|
|
90
|
+
* @default MAXIMUM_ZOOM
|
|
91
|
+
*/
|
|
92
|
+
maximum?: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The magnification a window factor asks for.
|
|
96
|
+
*
|
|
97
|
+
* There are two ways to say "zoom" and this package uses both, so the
|
|
98
|
+
* conversion is named rather than written as a stray reciprocal. A chart zooms
|
|
99
|
+
* by resizing the **window** it shows — `chartWheelFactor` returns that, and a
|
|
100
|
+
* factor above one means a wider window and therefore less magnification. A
|
|
101
|
+
* drawing surface zooms by scaling the picture, so `zoomAbout` takes a
|
|
102
|
+
* **magnification**, where above one means larger.
|
|
103
|
+
*
|
|
104
|
+
* Feeding one to the other reverses the wheel: the gesture still works, it
|
|
105
|
+
* simply does the opposite of what the hand meant, which is the kind of defect
|
|
106
|
+
* that survives review because nothing throws and the picture still moves.
|
|
107
|
+
* @param windowFactor - How much the window is being multiplied by.
|
|
108
|
+
* @returns The magnification that corresponds to it.
|
|
109
|
+
*/
|
|
110
|
+
export declare function magnificationOf(windowFactor: number): number;
|
|
111
|
+
/**
|
|
112
|
+
* Hold a zoom inside what the surface allows.
|
|
113
|
+
* @param zoom - The wanted zoom.
|
|
114
|
+
* @param bounds - How far in and out this surface goes.
|
|
115
|
+
* @returns The zoom it will actually use.
|
|
116
|
+
*/
|
|
117
|
+
export declare function clampZoom(zoom: number, bounds?: ZoomBounds): number;
|
|
118
|
+
/**
|
|
119
|
+
* Zoom while keeping one point of the drawing under the pointer.
|
|
120
|
+
*
|
|
121
|
+
* Without the anchor the drawing would drift away from the cursor as it grows,
|
|
122
|
+
* which is what makes a wheel zoom feel wrong.
|
|
123
|
+
* @param view - Where the canvas is now.
|
|
124
|
+
* @param base - What the canvas shows at zoom `1`.
|
|
125
|
+
* @param factor - How much to multiply the zoom by.
|
|
126
|
+
* @param anchor - The surface point to keep still, usually the pointer.
|
|
127
|
+
* @param anchor.x - Its horizontal position, in drawing units.
|
|
128
|
+
* @param anchor.y - Its vertical position, in drawing units.
|
|
129
|
+
* @param bounds - How far in and out this surface goes.
|
|
130
|
+
* @returns Where the canvas goes.
|
|
131
|
+
*/
|
|
132
|
+
export declare function zoomAbout(view: ViewState, base: ViewBox, factor: number, anchor: {
|
|
133
|
+
x: number;
|
|
134
|
+
y: number;
|
|
135
|
+
}, bounds?: ZoomBounds): ViewState;
|
|
136
|
+
/**
|
|
137
|
+
* Slide the window, in canvas units.
|
|
138
|
+
* @param view - Where the canvas is now.
|
|
139
|
+
* @param deltaX - How far to move it horizontally.
|
|
140
|
+
* @param deltaY - How far to move it vertically.
|
|
141
|
+
* @returns Where the canvas goes.
|
|
142
|
+
*/
|
|
143
|
+
export declare function panBy(view: ViewState, deltaX: number, deltaY: number): ViewState;
|
|
144
|
+
/**
|
|
145
|
+
* Set the zoom about the middle of what is on screen, which is what the
|
|
146
|
+
* toolbar buttons want — they have no pointer to zoom around.
|
|
147
|
+
* @param view - Where the canvas is now.
|
|
148
|
+
* @param base - What the canvas shows at zoom `1`.
|
|
149
|
+
* @param zoom - The wanted zoom.
|
|
150
|
+
* @param bounds - How far in and out this surface goes.
|
|
151
|
+
* @returns Where the canvas goes.
|
|
152
|
+
*/
|
|
153
|
+
export declare function zoomToAboutCentre(view: ViewState, base: ViewBox, zoom: number, bounds?: ZoomBounds): ViewState;
|
|
154
|
+
/**
|
|
155
|
+
* The rectangle of the drawing the canvas is showing.
|
|
156
|
+
* @param view - Where the canvas is.
|
|
157
|
+
* @param base - What the canvas shows at zoom `1`.
|
|
158
|
+
* @returns The rectangle.
|
|
159
|
+
*/
|
|
160
|
+
export declare function viewBoxOf(view: ViewState, base: ViewBox): ViewBox;
|
|
161
|
+
/**
|
|
162
|
+
* The rectangle, written the way the `viewBox` attribute wants it.
|
|
163
|
+
* @param box - The rectangle.
|
|
164
|
+
* @returns The attribute.
|
|
165
|
+
*/
|
|
166
|
+
export declare function viewBoxAttribute(box: ViewBox): string;
|
|
167
|
+
//# sourceMappingURL=viewTransform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewTransform.d.ts","sourceRoot":"","sources":["../../../src/chart/core/viewTransform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,SAAS;IACxB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yEAAyE;AACzE,MAAM,WAAW,OAAO;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,+CAA+C;AAC/C,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC,eAAO,MAAM,YAAY,IAAI,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,wDAAwD;AACxD,eAAO,MAAM,YAAY,EAAE,SAAyC,CAAC;AAErE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC1C,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC3C,YAAY,SAAwB,GACnC,OAAO,CA0BT;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,UAAe,GAAG,MAAM,CAQvE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAChC,MAAM,GAAE,UAAe,GACtB,SAAS,CAwBX;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,SAAS,CAMX;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,UAAe,GACtB,SAAS,CAYX;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAOjE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAErD"}
|