nmrium 2.6.0 → 2.7.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/lib/component/1d/ApodizationLine.js +2 -2
- package/lib/component/1d/ApodizationLine.js.map +1 -1
- package/lib/component/1d/Line.js +2 -2
- package/lib/component/1d/Line.js.map +1 -1
- package/lib/component/1d/SVGContent1D.d.ts.map +1 -1
- package/lib/component/1d/SVGContent1D.js +4 -1
- package/lib/component/1d/SVGContent1D.js.map +1 -1
- package/lib/component/1d/baseline/BaselinePreview.js +2 -2
- package/lib/component/1d/baseline/BaselinePreview.js.map +1 -1
- package/lib/component/1d/database/DatabaseSpectrum.js +2 -2
- package/lib/component/1d/database/DatabaseSpectrum.js.map +1 -1
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js.map +1 -1
- package/lib/component/1d/matrix/Boxplot.js +5 -5
- package/lib/component/1d/matrix/Boxplot.js.map +1 -1
- package/lib/component/1d/matrix/Stocsy.js +2 -2
- package/lib/component/1d/matrix/Stocsy.js.map +1 -1
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts.map +1 -1
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +12 -3
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js.map +1 -1
- package/lib/component/1d/peaks/usePeakShapesPath.js +2 -2
- package/lib/component/1d/peaks/usePeakShapesPath.js.map +1 -1
- package/lib/component/1d/plugin_svg_chart.d.ts +2 -0
- package/lib/component/1d/plugin_svg_chart.d.ts.map +1 -0
- package/lib/component/1d/plugin_svg_chart.js +43 -0
- package/lib/component/1d/plugin_svg_chart.js.map +1 -0
- package/lib/component/1d-2d/components/RangeIndicator.d.ts.map +1 -1
- package/lib/component/1d-2d/components/RangeIndicator.js +1 -7
- package/lib/component/1d-2d/components/RangeIndicator.js.map +1 -1
- package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +2 -2
- package/lib/component/2d/1d-tracer/HorizontalSliceChart.js.map +1 -1
- package/lib/component/2d/1d-tracer/Left1DChart.js +2 -2
- package/lib/component/2d/1d-tracer/Left1DChart.js.map +1 -1
- package/lib/component/2d/1d-tracer/Top1DChart.js +2 -2
- package/lib/component/2d/1d-tracer/Top1DChart.js.map +1 -1
- package/lib/component/2d/1d-tracer/VerticalSliceChart.js +2 -2
- package/lib/component/2d/1d-tracer/VerticalSliceChart.js.map +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +3 -3
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js.map +1 -1
- package/lib/component/2d/ft/Contours.js +2 -2
- package/lib/component/2d/ft/Contours.js.map +1 -1
- package/lib/component/context/ScaleContext.d.ts +1 -1
- package/lib/component/context/ScaleContext.d.ts.map +1 -1
- package/lib/component/elements/D3Axis.d.ts.map +1 -1
- package/lib/component/elements/D3Axis.js +15 -32
- package/lib/component/elements/D3Axis.js.map +1 -1
- package/lib/component/elements/export/ExportContent.d.ts.map +1 -1
- package/lib/component/elements/export/ExportContent.js +2 -2
- package/lib/component/elements/export/ExportContent.js.map +1 -1
- package/lib/component/elements/export/ExportOptionsModal.d.ts.map +1 -1
- package/lib/component/elements/export/ExportOptionsModal.js +9 -3
- package/lib/component/elements/export/ExportOptionsModal.js.map +1 -1
- package/lib/component/elements/export/useExportConfigurer.d.ts +1 -0
- package/lib/component/elements/export/useExportConfigurer.d.ts.map +1 -1
- package/lib/component/elements/export/useExportConfigurer.js +5 -0
- package/lib/component/elements/export/useExportConfigurer.js.map +1 -1
- package/lib/component/elements/print/PrintContent.d.ts.map +1 -1
- package/lib/component/elements/print/PrintContent.js +6 -25
- package/lib/component/elements/print/PrintContent.js.map +1 -1
- package/lib/component/elements/utilities/transferStyles.d.ts +2 -0
- package/lib/component/elements/utilities/transferStyles.d.ts.map +1 -0
- package/lib/component/elements/utilities/transferStyles.js +29 -0
- package/lib/component/elements/utilities/transferStyles.js.map +1 -0
- package/lib/component/hooks/useIntegralPath.js +2 -2
- package/lib/component/hooks/useIntegralPath.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts +106 -105
- package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts +106 -105
- package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +106 -105
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +15 -15
- package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.d.ts +12 -10
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.js +32 -40
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/export_tab_validation.d.ts +61 -17
- package/lib/component/modal/setting/tanstack_general_settings/validation/export_tab_validation.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/export_tab_validation.js +79 -28
- package/lib/component/modal/setting/tanstack_general_settings/validation/export_tab_validation.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts +15 -15
- package/lib/component/panels/filtersPanel/processings_sections_panel.js +1 -1
- package/lib/component/panels/filtersPanel/processings_sections_panel.js.map +1 -1
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.d.ts +3 -3
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.d.ts.map +1 -1
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +69 -56
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js.map +1 -1
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js.map +1 -1
- package/lib/component/toolbar/nmr_toolbar.js +1 -1
- package/lib/component/toolbar/nmr_toolbar.js.map +1 -1
- package/lib/component/utility/core_slots/core_operator_chart_svg.d.ts +8 -0
- package/lib/component/utility/core_slots/core_operator_chart_svg.d.ts.map +1 -0
- package/lib/component/utility/core_slots/core_operator_chart_svg.js +23 -0
- package/lib/component/utility/core_slots/core_operator_chart_svg.js.map +1 -0
- package/lib/component/utility/core_slots/core_operator_panel_tool.d.ts +2 -8
- package/lib/component/utility/core_slots/core_operator_panel_tool.d.ts.map +1 -1
- package/lib/component/utility/core_slots/core_operator_panel_tool.js +8 -6
- package/lib/component/utility/core_slots/core_operator_panel_tool.js.map +1 -1
- package/lib/component/utility/core_slots/core_operator_tool.commons.d.ts +11 -0
- package/lib/component/utility/core_slots/core_operator_tool.commons.d.ts.map +1 -0
- package/lib/component/utility/core_slots/core_operator_tool.commons.js +30 -0
- package/lib/component/utility/core_slots/core_operator_tool.commons.js.map +1 -0
- package/lib/component/utility/core_slots/core_operator_tool.d.ts +2 -8
- package/lib/component/utility/core_slots/core_operator_tool.d.ts.map +1 -1
- package/lib/component/utility/core_slots/core_operator_tool.js +8 -6
- package/lib/component/utility/core_slots/core_operator_tool.js.map +1 -1
- package/lib/component/utility/export.d.ts +5 -0
- package/lib/component/utility/export.d.ts.map +1 -1
- package/lib/component/utility/export.js +22 -0
- package/lib/component/utility/export.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/contours.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +23 -10
- package/lib/data/data2d/Spectrum2D/contours.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/findBestMinContour/estimateNoiseLevel.d.ts +13 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/estimateNoiseLevel.d.ts.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/estimateNoiseLevel.js +40 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/estimateNoiseLevel.js.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/evaluation.d.ts +27 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/evaluation.d.ts.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/evaluation.js +230 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/evaluation.js.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/findAutomaticContourLevels.d.ts +227 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/findAutomaticContourLevels.d.ts.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/findAutomaticContourLevels.js +67 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/findAutomaticContourLevels.js.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/math.d.ts +4 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/math.d.ts.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/math.js +42 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/math.js.map +1 -0
- package/lib/data/utilities/calculateSanPlot.d.ts +3 -1
- package/lib/data/utilities/calculateSanPlot.d.ts.map +1 -1
- package/lib/data/utilities/calculateSanPlot.js +2 -2
- package/lib/data/utilities/calculateSanPlot.js.map +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +5 -5
- package/src/component/1d/ApodizationLine.tsx +2 -2
- package/src/component/1d/Line.tsx +2 -2
- package/src/component/1d/SVGContent1D.tsx +6 -0
- package/src/component/1d/baseline/BaselinePreview.tsx +2 -2
- package/src/component/1d/database/DatabaseSpectrum.tsx +2 -2
- package/src/component/1d/database/ResurrectedDatabaseRanges.tsx +2 -2
- package/src/component/1d/matrix/Boxplot.tsx +5 -5
- package/src/component/1d/matrix/Stocsy.tsx +2 -2
- package/src/component/1d/peaks/PeakAnnotationsSpreadMode.tsx +17 -3
- package/src/component/1d/peaks/usePeakShapesPath.ts +2 -2
- package/src/component/1d/plugin_svg_chart.tsx +60 -0
- package/src/component/1d-2d/components/RangeIndicator.tsx +8 -9
- package/src/component/2d/1d-tracer/HorizontalSliceChart.tsx +2 -2
- package/src/component/2d/1d-tracer/Left1DChart.tsx +2 -2
- package/src/component/2d/1d-tracer/Top1DChart.tsx +2 -2
- package/src/component/2d/1d-tracer/VerticalSliceChart.tsx +2 -2
- package/src/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.tsx +3 -3
- package/src/component/2d/ft/Contours.tsx +2 -2
- package/src/component/context/ScaleContext.tsx +1 -1
- package/src/component/elements/D3Axis.tsx +49 -67
- package/src/component/elements/export/ExportContent.tsx +3 -2
- package/src/component/elements/export/ExportOptionsModal.tsx +32 -1
- package/src/component/elements/export/useExportConfigurer.tsx +6 -0
- package/src/component/elements/print/PrintContent.tsx +6 -27
- package/src/component/elements/utilities/transferStyles.ts +32 -0
- package/src/component/hooks/useIntegralPath.ts +2 -2
- package/src/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.tsx +47 -57
- package/src/component/modal/setting/tanstack_general_settings/validation/export_tab_validation.ts +100 -28
- package/src/component/panels/filtersPanel/processings_sections_panel.tsx +1 -1
- package/src/component/panels/multipleAnalysisPanel/AlignSpectra.tsx +128 -98
- package/src/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.tsx +1 -1
- package/src/component/toolbar/nmr_toolbar.tsx +1 -1
- package/src/component/utility/core_slots/core_operator_chart_svg.tsx +61 -0
- package/src/component/utility/core_slots/core_operator_panel_tool.tsx +9 -27
- package/src/component/utility/core_slots/core_operator_tool.commons.ts +63 -0
- package/src/component/utility/core_slots/core_operator_tool.tsx +9 -27
- package/src/component/utility/export.ts +34 -0
- package/src/data/data2d/Spectrum2D/contours.ts +40 -14
- package/src/data/data2d/Spectrum2D/findBestMinContour/estimateNoiseLevel.ts +67 -0
- package/src/data/data2d/Spectrum2D/findBestMinContour/evaluation.ts +432 -0
- package/src/data/data2d/Spectrum2D/findBestMinContour/findAutomaticContourLevels.ts +431 -0
- package/src/data/data2d/Spectrum2D/findBestMinContour/math.ts +59 -0
- package/src/data/utilities/calculateSanPlot.ts +2 -1
- package/src/versionInfo.ts +1 -1
- package/lib/component/elements/export/utilities/transferDocumentStyles.d.ts +0 -2
- package/lib/component/elements/export/utilities/transferDocumentStyles.d.ts.map +0 -1
- package/lib/component/elements/export/utilities/transferDocumentStyles.js +0 -21
- package/lib/component/elements/export/utilities/transferDocumentStyles.js.map +0 -1
- package/lib/component/utility/PathBuilder.d.ts +0 -10
- package/lib/component/utility/PathBuilder.d.ts.map +0 -1
- package/lib/component/utility/PathBuilder.js +0 -38
- package/lib/component/utility/PathBuilder.js.map +0 -1
- package/src/component/elements/export/utilities/transferDocumentStyles.ts +0 -21
- package/src/component/utility/PathBuilder.ts +0 -41
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nmrium",
|
|
3
3
|
"description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.7.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"@hookform/resolvers": "^5.9.1",
|
|
66
66
|
"@tanstack/react-form": "^1.33.5",
|
|
67
67
|
"@tanstack/react-store": "^0.11.1",
|
|
68
|
-
"@zakodium/nmr-types": "^0.5.
|
|
69
|
-
"@zakodium/nmrium-core": "^0.7.
|
|
70
|
-
"@zakodium/nmrium-core-plugins": "^0.7.
|
|
68
|
+
"@zakodium/nmr-types": "^0.5.26",
|
|
69
|
+
"@zakodium/nmrium-core": "^0.7.65",
|
|
70
|
+
"@zakodium/nmrium-core-plugins": "^0.7.87",
|
|
71
71
|
"@zakodium/pdnd-esm": "^1.1.1",
|
|
72
72
|
"@zakodium/utils": "^0.5.1",
|
|
73
73
|
"@zip.js/zip.js": "^2.8.53",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"react-ocl-nmr": "^4.1.1",
|
|
112
112
|
"react-plot": "^3.1.2",
|
|
113
113
|
"react-rnd": "^10.5.3",
|
|
114
|
-
"react-science": "^23.
|
|
114
|
+
"react-science": "^23.1.1",
|
|
115
115
|
"react-table": "^7.8.0",
|
|
116
116
|
"smart-array-filter": "^5.0.0",
|
|
117
117
|
"ts-pattern": "^5.9.0",
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
createApodizationWindowData,
|
|
7
7
|
default1DApodization,
|
|
8
8
|
} from 'nmr-processing';
|
|
9
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
9
10
|
|
|
10
11
|
import { useChartData } from '../context/ChartContext.js';
|
|
11
12
|
import { useFilterSyncOptions } from '../context/FilterSyncOptionsContext.js';
|
|
@@ -16,7 +17,6 @@ import useSpectrum from '../hooks/useSpectrum.js';
|
|
|
16
17
|
import useTempSpectrum from '../hooks/useTempSpectrum.js';
|
|
17
18
|
import { useVerticalAlign } from '../hooks/useVerticalAlign.js';
|
|
18
19
|
import type { ApodizationOptions } from '../panels/filtersPanel/Filters/hooks/useApodization.js';
|
|
19
|
-
import { PathBuilder } from '../utility/PathBuilder.js';
|
|
20
20
|
|
|
21
21
|
import { useIsInset } from './inset/InsetProvider.js';
|
|
22
22
|
import { getXScale, getYScale } from './utilities/scale.js';
|
|
@@ -84,7 +84,7 @@ export function ApodizationLine() {
|
|
|
84
84
|
scaleX = windowScaleX;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
const pathBuilder = new
|
|
87
|
+
const pathBuilder = new SVGPathBuilder();
|
|
88
88
|
const { re, x } = tempSpectrum.data;
|
|
89
89
|
|
|
90
90
|
const apodizationOptions = merge(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
3
4
|
|
|
4
5
|
import { useScaleChecked } from '../context/ScaleContext.js';
|
|
5
6
|
import useActiveSpectrumStyleOptions from '../hooks/useActiveSpectrumStyleOptions.js';
|
|
6
7
|
import useXYReduce from '../hooks/useXYReduce.js';
|
|
7
|
-
import { PathBuilder } from '../utility/PathBuilder.js';
|
|
8
8
|
import { parseColor } from '../utility/parseColor.js';
|
|
9
9
|
|
|
10
10
|
import { useInsetOptions } from './inset/InsetProvider.js';
|
|
@@ -31,7 +31,7 @@ function Line({ data, id, display, index }: LineProps) {
|
|
|
31
31
|
const _scaleX = scaleX();
|
|
32
32
|
const _scaleY = scaleY({ spectrumId: id });
|
|
33
33
|
|
|
34
|
-
const pathBuilder = new
|
|
34
|
+
const pathBuilder = new SVGPathBuilder();
|
|
35
35
|
if (data?.x && data?.y && _scaleX(0)) {
|
|
36
36
|
const pathPoints = xyReduce(data);
|
|
37
37
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ClipPathContainer } from '../1d-2d/components/ClipPathContainer.js';
|
|
2
2
|
import SpectrumInfoBlock from '../1d-2d/components/SpectrumInfoBlock.js';
|
|
3
3
|
import { ShareDataProvider } from '../context/ShareDataContext.js';
|
|
4
|
+
import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature.ts';
|
|
4
5
|
|
|
5
6
|
import { ApodizationLine } from './ApodizationLine.js';
|
|
6
7
|
import ExclusionZonesAnnotations from './ExclusionZonesAnnotations.js';
|
|
@@ -18,11 +19,14 @@ import MultiAnalysisRanges from './multiAnalysis/MultiAnalysisRanges.js';
|
|
|
18
19
|
import MultiplicityTrees from './multiplicityTree/MultiplicityTrees.js';
|
|
19
20
|
import Peaks from './peaks/Peaks.js';
|
|
20
21
|
import PeaksShapes from './peaks/PeaksShapes.js';
|
|
22
|
+
import { PluginSVGChart } from './plugin_svg_chart.tsx';
|
|
21
23
|
import Ranges from './ranges/Ranges.js';
|
|
22
24
|
import RangesIntegrals from './ranges/RangesIntegrals.js';
|
|
23
25
|
import { Signals } from './ranges/Signals.tsx';
|
|
24
26
|
|
|
25
27
|
export function SVGContent1D() {
|
|
28
|
+
const isExperimental = useCheckExperimentalFeature();
|
|
29
|
+
|
|
26
30
|
return (
|
|
27
31
|
<g>
|
|
28
32
|
<ClipPathContainer>
|
|
@@ -47,6 +51,8 @@ export function SVGContent1D() {
|
|
|
47
51
|
<SpectrumInfoBlock />
|
|
48
52
|
|
|
49
53
|
<SimilarityTree />
|
|
54
|
+
|
|
55
|
+
{isExperimental && <PluginSVGChart />}
|
|
50
56
|
</ClipPathContainer>
|
|
51
57
|
<Signals />
|
|
52
58
|
<JGraph />
|
|
@@ -4,6 +4,7 @@ import type { Spectrum1D } from '@zakodium/nmrium-core';
|
|
|
4
4
|
import { isSpectrum1D } from '@zakodium/nmrium-core';
|
|
5
5
|
import { xyBaselineCalculation } from 'nmr-processing';
|
|
6
6
|
import { useMemo, useRef, useState } from 'react';
|
|
7
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
7
8
|
|
|
8
9
|
import { useChartData } from '../../context/ChartContext.tsx';
|
|
9
10
|
import { useFilterSyncOptions } from '../../context/FilterSyncOptionsContext.tsx';
|
|
@@ -18,7 +19,6 @@ import {
|
|
|
18
19
|
DEFAULT_BASELINE_ALGORITHM,
|
|
19
20
|
getBaselineValues,
|
|
20
21
|
} from '../../panels/filtersPanel/Filters/hooks/useBaselineCorrection.tsx';
|
|
21
|
-
import { PathBuilder } from '../../utility/PathBuilder.ts';
|
|
22
22
|
|
|
23
23
|
import { getMedianWindow } from './getMedianWindow.ts';
|
|
24
24
|
import { getMedianY } from './getMedianY.ts';
|
|
@@ -227,7 +227,7 @@ function SpectrumPreview({ spectrum, anchors }: SpectrumPreviewProps) {
|
|
|
227
227
|
const _scaleX = scaleX();
|
|
228
228
|
const _scaleY = scaleY({ spectrumId: activeSpectrum?.id });
|
|
229
229
|
|
|
230
|
-
const pathBuilder = new
|
|
230
|
+
const pathBuilder = new SVGPathBuilder();
|
|
231
231
|
|
|
232
232
|
if (!x || !y || !_scaleX(0)) return '';
|
|
233
233
|
|
|
@@ -2,6 +2,7 @@ import type { Spectrum1D } from '@zakodium/nmrium-core';
|
|
|
2
2
|
import { extent } from 'd3-array';
|
|
3
3
|
import throttle from 'lodash/throttle.js';
|
|
4
4
|
import { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
5
6
|
|
|
6
7
|
import { useChartData } from '../../context/ChartContext.js';
|
|
7
8
|
import { useCore } from '../../context/CoreContext.js';
|
|
@@ -13,7 +14,6 @@ import {
|
|
|
13
14
|
} from '../../highlight/index.js';
|
|
14
15
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences.js';
|
|
15
16
|
import { spinnerContext } from '../../loader/SpinnerContext.js';
|
|
16
|
-
import { PathBuilder } from '../../utility/PathBuilder.js';
|
|
17
17
|
import { getYScaleWithRation } from '../utilities/scale.js';
|
|
18
18
|
|
|
19
19
|
function DatabaseSpectrum() {
|
|
@@ -61,7 +61,7 @@ function DatabaseSpectrum() {
|
|
|
61
61
|
setLoading(false);
|
|
62
62
|
const spectrum = data?.spectra?.[0] || null;
|
|
63
63
|
if (spectrum) {
|
|
64
|
-
const pathBuilder = new
|
|
64
|
+
const pathBuilder = new SVGPathBuilder();
|
|
65
65
|
const { x, re: y } = (spectrum as Spectrum1D).data;
|
|
66
66
|
const yDomain = extent(y) as number[];
|
|
67
67
|
const finalScaleX = scaleX();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Spectrum1D } from '@zakodium/nmrium-core';
|
|
2
2
|
import { extent } from 'd3-array';
|
|
3
3
|
import { rangesToXY } from 'nmr-processing';
|
|
4
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
4
5
|
|
|
5
6
|
import { useChartData } from '../../context/ChartContext.js';
|
|
6
7
|
import { useScaleChecked } from '../../context/ScaleContext.js';
|
|
@@ -11,7 +12,6 @@ import {
|
|
|
11
12
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences.js';
|
|
12
13
|
import useSpectrum from '../../hooks/useSpectrum.js';
|
|
13
14
|
import { useVerticalAlign } from '../../hooks/useVerticalAlign.js';
|
|
14
|
-
import { PathBuilder } from '../../utility/PathBuilder.js';
|
|
15
15
|
import { getYScale } from '../utilities/scale.js';
|
|
16
16
|
|
|
17
17
|
const emptyData = { info: { originFrequency: 400 } };
|
|
@@ -71,7 +71,7 @@ function ResurrectedDatabaseRanges() {
|
|
|
71
71
|
const finalScaleX = scaleX();
|
|
72
72
|
|
|
73
73
|
const paths = spectra.map(({ data: { x, y }, from, to }) => {
|
|
74
|
-
const pathBuilder = new
|
|
74
|
+
const pathBuilder = new SVGPathBuilder();
|
|
75
75
|
pathBuilder.moveTo(finalScaleX(x[0]), scaleY(y[0]));
|
|
76
76
|
for (let i = 1; i < x.length; i++) {
|
|
77
77
|
pathBuilder.lineTo(finalScaleX(x[i]), scaleY(y[i]));
|
|
@@ -4,12 +4,12 @@ import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
|
4
4
|
import { matrixToBoxPlot } from 'nmr-processing';
|
|
5
5
|
import type { CSSProperties } from 'react';
|
|
6
6
|
import { useMemo } from 'react';
|
|
7
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
7
8
|
|
|
8
9
|
import { useChartData } from '../../context/ChartContext.js';
|
|
9
10
|
import { useScaleChecked } from '../../context/ScaleContext.js';
|
|
10
11
|
import { useActiveNucleusTab } from '../../hooks/useActiveNucleusTab.js';
|
|
11
12
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences.js';
|
|
12
|
-
import { PathBuilder } from '../../utility/PathBuilder.js';
|
|
13
13
|
import { getYScaleWithRation } from '../utilities/scale.js';
|
|
14
14
|
|
|
15
15
|
import { sliceArrayForDomain, useMatrix } from './useMatrix.js';
|
|
@@ -64,7 +64,7 @@ function usePath(
|
|
|
64
64
|
const { scaleX } = useScaleChecked();
|
|
65
65
|
const scaleY = useYScale(scaleRatio, yDomain);
|
|
66
66
|
|
|
67
|
-
const pathBuilder = new
|
|
67
|
+
const pathBuilder = new SVGPathBuilder();
|
|
68
68
|
|
|
69
69
|
const xScaler = scaleX();
|
|
70
70
|
|
|
@@ -83,8 +83,8 @@ function useAreaPath(
|
|
|
83
83
|
const { scaleX } = useScaleChecked();
|
|
84
84
|
const scaleY = useYScale(scaleRatio, yDomain);
|
|
85
85
|
|
|
86
|
-
const pathBuilder = new
|
|
87
|
-
const pathBuilder2 = new
|
|
86
|
+
const pathBuilder = new SVGPathBuilder();
|
|
87
|
+
const pathBuilder2 = new SVGPathBuilder();
|
|
88
88
|
|
|
89
89
|
const xScaler = scaleX();
|
|
90
90
|
|
|
@@ -97,7 +97,7 @@ function useAreaPath(
|
|
|
97
97
|
pathBuilder2.lineTo(xScaler(pathPoints.x[i]), scaleY(pathPoints.y2[i]));
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
return
|
|
100
|
+
return SVGPathBuilder.concat(pathBuilder, pathBuilder2).toString();
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function useBoxPlot() {
|
|
@@ -2,12 +2,12 @@ import { extent } from 'd3-array';
|
|
|
2
2
|
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
3
3
|
import { matrixToStocsy } from 'nmr-processing';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
5
6
|
|
|
6
7
|
import { useChartData } from '../../context/ChartContext.js';
|
|
7
8
|
import { useScaleChecked } from '../../context/ScaleContext.js';
|
|
8
9
|
import { useActiveNucleusTab } from '../../hooks/useActiveNucleusTab.js';
|
|
9
10
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences.js';
|
|
10
|
-
import { PathBuilder } from '../../utility/PathBuilder.js';
|
|
11
11
|
import { getYScaleWithRation } from '../utilities/scale.js';
|
|
12
12
|
|
|
13
13
|
import {
|
|
@@ -162,7 +162,7 @@ function RenderStocsyAsSVG(props: StocsyProps) {
|
|
|
162
162
|
|
|
163
163
|
return Object.keys(colorGroups).map((color) => {
|
|
164
164
|
const points = colorGroups[color];
|
|
165
|
-
const pathBuilder = new
|
|
165
|
+
const pathBuilder = new SVGPathBuilder();
|
|
166
166
|
|
|
167
167
|
pathBuilder.moveTo(xScaler(points[0].x), scaleY(points[0].y));
|
|
168
168
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memo, useState } from 'react';
|
|
1
|
+
import { memo, useCallback, useRef, useState } from 'react';
|
|
2
2
|
import { useResizeObserver } from 'react-d3-utils';
|
|
3
3
|
import { BsArrowsMove } from 'react-icons/bs';
|
|
4
4
|
|
|
@@ -81,7 +81,18 @@ function PeakAnnotationsSpreadMode(props: PeakAnnotationsSpreadModeProps) {
|
|
|
81
81
|
spectrumKey,
|
|
82
82
|
} = props;
|
|
83
83
|
|
|
84
|
-
const [
|
|
84
|
+
const [resizeRef, { height: boxSizeHeight } = { height: 0 }] =
|
|
85
|
+
useResizeObserver();
|
|
86
|
+
const labelGroupRef = useRef<SVGGElement | null>(null);
|
|
87
|
+
const ref = useCallback(
|
|
88
|
+
(node: SVGGElement | null) => {
|
|
89
|
+
// Keep a direct SVG node ref for getBBox (SVG unit measurement).
|
|
90
|
+
labelGroupRef.current = node;
|
|
91
|
+
// ResizeObserver is used as a re-render trigger when geometry changes.
|
|
92
|
+
resizeRef(node);
|
|
93
|
+
},
|
|
94
|
+
[resizeRef],
|
|
95
|
+
);
|
|
85
96
|
const { marginTop, isDragActive, onPointerDown } = usePeaksPosition();
|
|
86
97
|
|
|
87
98
|
const actionsButtons: ActionsButtonsPopoverProps['buttons'] = [
|
|
@@ -104,7 +115,9 @@ function PeakAnnotationsSpreadMode(props: PeakAnnotationsSpreadModeProps) {
|
|
|
104
115
|
groupMargin: 10,
|
|
105
116
|
});
|
|
106
117
|
|
|
107
|
-
|
|
118
|
+
// getBBox is stable across export/view contexts because it returns SVG-space size.
|
|
119
|
+
const bboxHeight = labelGroupRef.current?.getBBox().height ?? 0;
|
|
120
|
+
const roundedBoxHeight = Math.max(0, Math.round(bboxHeight));
|
|
108
121
|
|
|
109
122
|
let y = roundedBoxHeight + marginTop;
|
|
110
123
|
|
|
@@ -115,6 +128,7 @@ function PeakAnnotationsSpreadMode(props: PeakAnnotationsSpreadModeProps) {
|
|
|
115
128
|
if (marginTop < 0) {
|
|
116
129
|
y = roundedBoxHeight;
|
|
117
130
|
}
|
|
131
|
+
|
|
118
132
|
return (
|
|
119
133
|
<ActionsButtonsPopover
|
|
120
134
|
targetTagName="g"
|
|
@@ -2,10 +2,10 @@ import type { Peak1D } from '@zakodium/nmr-types';
|
|
|
2
2
|
import type { Spectrum1D } from '@zakodium/nmrium-core';
|
|
3
3
|
import type { DataXY } from 'cheminfo-types';
|
|
4
4
|
import { peakToXY, peaksToXY } from 'nmr-processing';
|
|
5
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
5
6
|
|
|
6
7
|
import { useChartData } from '../../context/ChartContext.js';
|
|
7
8
|
import { useScaleChecked } from '../../context/ScaleContext.js';
|
|
8
|
-
import { PathBuilder } from '../../utility/PathBuilder.js';
|
|
9
9
|
|
|
10
10
|
type PeaksShapesOptions =
|
|
11
11
|
| {
|
|
@@ -56,7 +56,7 @@ export function usePeakShapesPath(spectrum: Spectrum1D) {
|
|
|
56
56
|
const _scaleX = scaleX();
|
|
57
57
|
const _scaleY = scaleY({ spectrumId: spectrum.id });
|
|
58
58
|
|
|
59
|
-
const pathBuilder = new
|
|
59
|
+
const pathBuilder = new SVGPathBuilder();
|
|
60
60
|
let fill = 'transparent';
|
|
61
61
|
|
|
62
62
|
if (pathSeries) {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useChartData } from '../context/ChartContext.tsx';
|
|
4
|
+
import { useCore } from '../context/CoreContext.tsx';
|
|
5
|
+
import { useScaleChecked } from '../context/ScaleContext.tsx';
|
|
6
|
+
import { useIndicatorLineColor } from '../hooks/useIndicatorLineColor.ts';
|
|
7
|
+
import { useStableSpectrum } from '../hooks/useSpectrum.ts';
|
|
8
|
+
import { useVerticalAlign } from '../hooks/useVerticalAlign.ts';
|
|
9
|
+
import { useLiveOperation } from '../panels/filtersPanel/processings/use_live_operation.ts';
|
|
10
|
+
import { CoreOperatorChartSVG } from '../utility/core_slots/core_operator_chart_svg.tsx';
|
|
11
|
+
|
|
12
|
+
import { getYScale } from './utilities/scale.ts';
|
|
13
|
+
|
|
14
|
+
export function PluginSVGChart() {
|
|
15
|
+
const core = useCore();
|
|
16
|
+
const spectrum = useStableSpectrum();
|
|
17
|
+
const { height, width, margin } = useChartData();
|
|
18
|
+
const [liveOperation] = useLiveOperation();
|
|
19
|
+
const { scaleX: scaleXBuilder } = useScaleChecked();
|
|
20
|
+
const indicatorLineColor = useIndicatorLineColor();
|
|
21
|
+
|
|
22
|
+
const scaleX = useMemo(() => scaleXBuilder(), [scaleXBuilder]);
|
|
23
|
+
const scaleY = useWindowYScale();
|
|
24
|
+
|
|
25
|
+
if (!liveOperation) return null;
|
|
26
|
+
if (!spectrum) return null;
|
|
27
|
+
|
|
28
|
+
const operatorUI = core.slotOperator(liveOperation.operatorId);
|
|
29
|
+
if (!operatorUI) return null;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<CoreOperatorChartSVG
|
|
33
|
+
core={core}
|
|
34
|
+
operatorUI={operatorUI}
|
|
35
|
+
spectrum={spectrum}
|
|
36
|
+
operation={liveOperation}
|
|
37
|
+
height={height}
|
|
38
|
+
width={width}
|
|
39
|
+
margin={margin}
|
|
40
|
+
scaleX={scaleX}
|
|
41
|
+
scaleY={scaleY}
|
|
42
|
+
indicatorLineColor={indicatorLineColor}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function useWindowYScale() {
|
|
48
|
+
const { spectraBottomMargin } = useScaleChecked();
|
|
49
|
+
const { height, margin, yDomains } = useChartData();
|
|
50
|
+
const verticalAlign = useVerticalAlign();
|
|
51
|
+
|
|
52
|
+
return getYScale({
|
|
53
|
+
height,
|
|
54
|
+
margin,
|
|
55
|
+
verticalAlign,
|
|
56
|
+
yDomain: [0, 1],
|
|
57
|
+
yDomains,
|
|
58
|
+
spectraBottomMargin,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -4,19 +4,13 @@ import { useChartData } from '../../context/ChartContext.tsx';
|
|
|
4
4
|
import { formatNumber } from '../../utility/formatNumber.ts';
|
|
5
5
|
|
|
6
6
|
const Path = styled.path`
|
|
7
|
-
fill: none;
|
|
8
7
|
stroke-width: 1px;
|
|
9
8
|
shape-rendering: crispedges;
|
|
10
|
-
stroke: black;
|
|
11
9
|
|
|
12
10
|
&:hover {
|
|
13
11
|
stroke: red;
|
|
14
12
|
}
|
|
15
13
|
`;
|
|
16
|
-
const Text = styled.text`
|
|
17
|
-
font-size: 11px;
|
|
18
|
-
fill: black;
|
|
19
|
-
`;
|
|
20
14
|
|
|
21
15
|
export type IndicatorOrientation = 'horizontal' | 'vertical';
|
|
22
16
|
|
|
@@ -95,11 +89,16 @@ export function RangeIndicator(props: RangeIndicatorProps) {
|
|
|
95
89
|
|
|
96
90
|
return (
|
|
97
91
|
<g transform={layout.groupTransform} style={{ opacity }} onClick={onClick}>
|
|
98
|
-
<Path d={layout.pathD} />
|
|
92
|
+
<Path d={layout.pathD} fill="none" stroke="black" />
|
|
99
93
|
{value !== undefined && (
|
|
100
|
-
<
|
|
94
|
+
<text
|
|
95
|
+
transform={layout.textTransform}
|
|
96
|
+
textAnchor={layout.textAnchor}
|
|
97
|
+
fontSize={11}
|
|
98
|
+
fill="black"
|
|
99
|
+
>
|
|
101
100
|
{formatNumber(value, format ?? '')}
|
|
102
|
-
</
|
|
101
|
+
</text>
|
|
103
102
|
)}
|
|
104
103
|
</g>
|
|
105
104
|
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Spectrum2D } from '@zakodium/nmrium-core';
|
|
2
2
|
import type { NmrData1D } from 'cheminfo-types';
|
|
3
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
3
4
|
|
|
4
5
|
import { useChartData } from '../../context/ChartContext.js';
|
|
5
6
|
import useSpectrum from '../../hooks/useSpectrum.js';
|
|
6
|
-
import { PathBuilder } from '../../utility/PathBuilder.js';
|
|
7
7
|
import { getSliceYScale, useScale2DX } from '../utilities/scale.js';
|
|
8
8
|
|
|
9
9
|
interface BaseProps {
|
|
@@ -32,7 +32,7 @@ function usePath(data: NmrData1D, options: UsePathOptions) {
|
|
|
32
32
|
margin: verticalMargin,
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
const pathBuilder = new
|
|
35
|
+
const pathBuilder = new SVGPathBuilder();
|
|
36
36
|
pathBuilder.moveTo(scaleX(x[0]), scaleY(y[0]));
|
|
37
37
|
for (let i = 1; i < x.length; i++) {
|
|
38
38
|
pathBuilder.lineTo(scaleX(x[i]), scaleY(y[i]));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Spectrum1D } from '@zakodium/nmrium-core';
|
|
2
2
|
import { memo, useRef } from 'react';
|
|
3
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
3
4
|
|
|
4
5
|
import { Signals1D } from '../../1d-2d/components/Signals1D.tsx';
|
|
5
6
|
import { useChartData } from '../../context/ChartContext.js';
|
|
6
7
|
import useXYReduce from '../../hooks/useXYReduce.js';
|
|
7
|
-
import { PathBuilder } from '../../utility/PathBuilder.js';
|
|
8
8
|
import { use1DTraceYScale, useScale2DY } from '../utilities/scale.js';
|
|
9
9
|
|
|
10
10
|
import { Ranges1D } from './Ranges1D.tsx';
|
|
@@ -28,7 +28,7 @@ function usePath(spectrum: Spectrum1D, options: UsePathOptions) {
|
|
|
28
28
|
const { x, re: y } = spectrum.data;
|
|
29
29
|
const pathPoints = xyReduce({ x, y });
|
|
30
30
|
|
|
31
|
-
const pathBuilder = new
|
|
31
|
+
const pathBuilder = new SVGPathBuilder();
|
|
32
32
|
|
|
33
33
|
pathBuilder.moveTo(
|
|
34
34
|
scaleY(pathPoints.y.at(-1) as number),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Spectrum1D } from '@zakodium/nmrium-core';
|
|
2
2
|
import { memo, useRef } from 'react';
|
|
3
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
3
4
|
|
|
4
5
|
import { Signals1D } from '../../1d-2d/components/Signals1D.tsx';
|
|
5
6
|
import { useChartData } from '../../context/ChartContext.js';
|
|
6
7
|
import useXYReduce from '../../hooks/useXYReduce.js';
|
|
7
|
-
import { PathBuilder } from '../../utility/PathBuilder.js';
|
|
8
8
|
import { use1DTraceYScale, useScale2DX } from '../utilities/scale.js';
|
|
9
9
|
|
|
10
10
|
import { Ranges1D } from './Ranges1D.tsx';
|
|
@@ -28,7 +28,7 @@ function usePath(spectrum: Spectrum1D, options: UsePathOptions) {
|
|
|
28
28
|
const { x, re: y } = spectrum.data;
|
|
29
29
|
const pathPoints = xyReduce({ x, y });
|
|
30
30
|
|
|
31
|
-
const pathBuilder = new
|
|
31
|
+
const pathBuilder = new SVGPathBuilder();
|
|
32
32
|
pathBuilder.moveTo(scaleX(pathPoints.x[0]), scaleY(pathPoints.y[0]));
|
|
33
33
|
for (let i = 1; i < pathPoints.x.length; i++) {
|
|
34
34
|
pathBuilder.lineTo(scaleX(pathPoints.x[i]), scaleY(pathPoints.y[i]));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Spectrum2D } from '@zakodium/nmrium-core';
|
|
2
2
|
import type { NmrData1D } from 'cheminfo-types';
|
|
3
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
3
4
|
|
|
4
5
|
import { useChartData } from '../../context/ChartContext.js';
|
|
5
6
|
import useSpectrum from '../../hooks/useSpectrum.js';
|
|
6
|
-
import { PathBuilder } from '../../utility/PathBuilder.js';
|
|
7
7
|
import { getSliceYScale, useScale2DY } from '../utilities/scale.js';
|
|
8
8
|
|
|
9
9
|
interface BaseProps {
|
|
@@ -35,7 +35,7 @@ function usePath(data: NmrData1D, props: usePathOptions) {
|
|
|
35
35
|
margin: horizontalMargin,
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
const pathBuilder = new
|
|
38
|
+
const pathBuilder = new SVGPathBuilder();
|
|
39
39
|
|
|
40
40
|
pathBuilder.moveTo(scaleY(y.at(-1) as number), scaleX(x.at(-1) as number));
|
|
41
41
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Spectrum1D, Spectrum2D } from '@zakodium/nmrium-core';
|
|
2
2
|
import { Filters1D } from 'nmr-processing';
|
|
3
3
|
import type { ReactNode, SVGAttributes } from 'react';
|
|
4
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
4
5
|
|
|
5
6
|
import { getSlice } from '../../../../data/data2d/Spectrum2D/index.js';
|
|
6
7
|
import { useChartData } from '../../../context/ChartContext.js';
|
|
7
8
|
import { useActiveSpectrum } from '../../../hooks/useActiveSpectrum.js';
|
|
8
9
|
import useSpectrum from '../../../hooks/useSpectrum.js';
|
|
9
10
|
import type { TraceDirection } from '../../../reducer/Reducer.js';
|
|
10
|
-
import { PathBuilder } from '../../../utility/PathBuilder.js';
|
|
11
11
|
import {
|
|
12
12
|
get2DXScale,
|
|
13
13
|
get2DYScale,
|
|
@@ -43,7 +43,7 @@ function usePath(x: Float64Array, y: Float64Array, direction: TraceDirection) {
|
|
|
43
43
|
scaleRatio,
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
const pathBuilder = new
|
|
46
|
+
const pathBuilder = new SVGPathBuilder();
|
|
47
47
|
pathBuilder.moveTo(scaleX(x[0]), scaleY(y[0]));
|
|
48
48
|
for (let i = 1; i < x.length; i++) {
|
|
49
49
|
pathBuilder.lineTo(scaleX(x[i]), scaleY(y[i]));
|
|
@@ -58,7 +58,7 @@ function usePath(x: Float64Array, y: Float64Array, direction: TraceDirection) {
|
|
|
58
58
|
scaleRatio,
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
const pathBuilder = new
|
|
61
|
+
const pathBuilder = new SVGPathBuilder();
|
|
62
62
|
|
|
63
63
|
pathBuilder.moveTo(scaleY(y.at(-1) as number), scaleX(x.at(-1) as number));
|
|
64
64
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import debounce from 'lodash/debounce.js';
|
|
2
2
|
import { memo, useMemo, useRef } from 'react';
|
|
3
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
3
4
|
|
|
4
5
|
import type { LevelSign } from '../../../data/data2d/Spectrum2D/contours.js';
|
|
5
6
|
import { drawContours } from '../../../data/data2d/Spectrum2D/contours.js';
|
|
@@ -12,7 +13,6 @@ import { useToaster } from '../../context/ToasterContext.js';
|
|
|
12
13
|
import type { SpectrumFTData } from '../../hooks/use2DReducer.tsx';
|
|
13
14
|
import { use2DReducer } from '../../hooks/use2DReducer.tsx';
|
|
14
15
|
import { useActiveSpectrum } from '../../hooks/useActiveSpectrum.js';
|
|
15
|
-
import { PathBuilder } from '../../utility/PathBuilder.js';
|
|
16
16
|
import { useScale2DX, useScale2DY } from '../utilities/scale.js';
|
|
17
17
|
|
|
18
18
|
interface SpectrumContoursProps {
|
|
@@ -33,7 +33,7 @@ function usePath(contours: ReturnType<typeof drawContours>['contours']) {
|
|
|
33
33
|
const scaleX = useScale2DX();
|
|
34
34
|
const scaleY = useScale2DY();
|
|
35
35
|
|
|
36
|
-
const pathBuilder = new
|
|
36
|
+
const pathBuilder = new SVGPathBuilder();
|
|
37
37
|
for (const element of contours) {
|
|
38
38
|
if (element.lines) {
|
|
39
39
|
const lines = element.lines;
|
|
@@ -20,7 +20,7 @@ export interface ScaleLinearNumberOptions {
|
|
|
20
20
|
}
|
|
21
21
|
type ScaleLinearNumberFunction = (
|
|
22
22
|
options?: ScaleLinearNumberOptions,
|
|
23
|
-
) => ScaleLinear<number, number
|
|
23
|
+
) => ScaleLinear<number, number>;
|
|
24
24
|
|
|
25
25
|
interface ScaleState {
|
|
26
26
|
scaleX: ScaleLinearNumberFunction | null;
|