nmrium 0.31.0 → 0.33.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/Chart1D.js +1 -1
- package/lib/component/1d/FooterBanner.js +17 -10
- package/lib/component/1d/{Integral.d.ts → integral/Integral.d.ts} +0 -0
- package/lib/component/1d/{Integral.js → integral/Integral.js} +2 -2
- package/lib/component/1d/integral/IntegralIndicator.d.ts +9 -0
- package/lib/component/1d/integral/IntegralIndicator.js +27 -0
- package/lib/component/1d/{IntegralResizable.d.ts → integral/IntegralResizable.d.ts} +0 -0
- package/lib/component/1d/integral/IntegralResizable.js +69 -0
- package/lib/component/1d/{IntegralsSeries.d.ts → integral/IntegralsSeries.d.ts} +0 -0
- package/lib/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +3 -3
- package/lib/component/1d/ranges/Range.js +27 -50
- package/lib/component/1d/utilities/scale.js +2 -2
- package/lib/component/2d/Contours.js +61 -42
- package/lib/component/2d/Left1DChart.js +1 -1
- package/lib/component/2d/Top1DChart.js +1 -1
- package/lib/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib/component/NMRium.d.ts +1 -1
- package/lib/component/NMRium.js +1 -1
- package/lib/component/SplitPaneWrapper.js +1 -1
- package/lib/component/elements/EditableColumn.d.ts +3 -1
- package/lib/component/elements/EditableColumn.js +18 -3
- package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
- package/lib/component/elements/formik/FormikColorPicker.js +5 -8
- package/lib/component/elements/formik/FormikInput.d.ts +0 -1
- package/lib/component/elements/formik/FormikInput.js +8 -19
- package/lib/component/elements/formik/FormikOnChange.d.ts +1 -1
- package/lib/component/elements/formik/FormikOnChange.js +13 -10
- package/lib/component/elements/formik/FormikSlider.d.ts +2 -4
- package/lib/component/elements/formik/FormikSlider.js +8 -11
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib/component/hooks/useExport.js +1 -1
- package/lib/component/loader/DropZone.js +9 -1
- package/lib/component/modal/ExportAsMatrixModal.js +1 -1
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
- package/lib/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +1 -3
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
- package/lib/component/panels/extra/preferences/ColumnsHelper.js +5 -2
- package/lib/component/reducer/Reducer.d.ts +20 -59
- package/lib/component/reducer/Reducer.js +24 -10
- package/lib/component/reducer/actions/DomainActions.js +3 -2
- package/lib/component/reducer/actions/FiltersActions.js +12 -3
- package/lib/component/reducer/actions/IntegralsActions.js +6 -5
- package/lib/component/reducer/actions/PeaksActions.js +7 -6
- package/lib/component/reducer/actions/PreferencesActions.js +18 -36
- package/lib/component/reducer/actions/RangesActions.d.ts +1 -1
- package/lib/component/reducer/actions/RangesActions.js +20 -16
- package/lib/component/reducer/actions/SpectrumsActions.js +13 -6
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +15 -28
- package/lib/component/reducer/actions/ZonesActions.js +9 -8
- package/lib/component/reducer/core/Constants.js +1 -1
- package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
- package/lib/component/toolbar/BasicToolBar.js +8 -7
- package/lib/component/utility/FileUtility.d.ts +1 -8
- package/lib/component/utility/FileUtility.js +2 -17
- package/lib/component/utility/{Export.d.ts → export.d.ts} +0 -0
- package/lib/component/utility/{Export.js → export.js} +27 -44
- package/lib/component/utility/formatNumber.d.ts +6 -1
- package/lib/component/utility/formatNumber.js +4 -3
- package/lib/component/workspaces/Workspace.d.ts +1 -1
- package/lib/component/workspaces/exercise.js +4 -4
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/data/Filters.d.ts +1 -2
- package/lib/data/Filters.js +1 -2
- package/lib/data/SpectraManager.d.ts +1 -2
- package/lib/data/SpectraManager.js +22 -55
- package/lib/data/data1d/filter1d/fft.js +21 -4
- package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
- package/lib/data/data2d/Processing2D.js +3 -2
- package/lib/data/data2d/Spectrum2D/contours.d.ts +40 -0
- package/lib/data/data2d/Spectrum2D/contours.js +132 -0
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +2 -3
- package/lib/data/types/common/Source.d.ts +1 -0
- package/lib/data/types/data2d/Data2D.d.ts +2 -0
- package/lib/data/types/data2d/Datum2D.d.ts +0 -1
- package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
- package/lib/data/utilities/calculateSanPlot.js +31 -0
- package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +16 -9
- package/lib-cjs/component/1d/{Integral.js → integral/Integral.js} +2 -2
- package/lib-cjs/component/1d/integral/IntegralIndicator.js +31 -0
- package/lib-cjs/component/1d/integral/IntegralResizable.js +74 -0
- package/lib-cjs/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +3 -3
- package/lib-cjs/component/1d/ranges/Range.js +27 -50
- package/lib-cjs/component/1d/utilities/scale.js +2 -2
- package/lib-cjs/component/2d/Contours.js +60 -41
- package/lib-cjs/component/2d/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/Top1DChart.js +1 -1
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib-cjs/component/NMRium.js +2 -2
- package/lib-cjs/component/SplitPaneWrapper.js +1 -1
- package/lib-cjs/component/elements/EditableColumn.js +18 -3
- package/lib-cjs/component/elements/formik/FormikColorPicker.js +4 -7
- package/lib-cjs/component/elements/formik/FormikInput.js +8 -19
- package/lib-cjs/component/elements/formik/FormikOnChange.js +13 -10
- package/lib-cjs/component/elements/formik/FormikSlider.js +7 -10
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib-cjs/component/hooks/useExport.js +6 -6
- package/lib-cjs/component/loader/DropZone.js +9 -1
- package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -2
- package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -4
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -2
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +1 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
- package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +5 -2
- package/lib-cjs/component/reducer/Reducer.js +23 -9
- package/lib-cjs/component/reducer/actions/DomainActions.js +3 -2
- package/lib-cjs/component/reducer/actions/FiltersActions.js +12 -3
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +6 -5
- package/lib-cjs/component/reducer/actions/PeaksActions.js +7 -6
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +18 -36
- package/lib-cjs/component/reducer/actions/RangesActions.js +20 -16
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +12 -5
- package/lib-cjs/component/reducer/actions/ToolsActions.js +15 -28
- package/lib-cjs/component/reducer/actions/ZonesActions.js +9 -8
- package/lib-cjs/component/reducer/core/Constants.js +1 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
- package/lib-cjs/component/toolbar/BasicToolBar.js +7 -6
- package/lib-cjs/component/utility/FileUtility.js +2 -18
- package/lib-cjs/component/utility/{Export.js → export.js} +51 -45
- package/lib-cjs/component/utility/formatNumber.js +4 -3
- package/lib-cjs/component/workspaces/exercise.js +4 -4
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib-cjs/data/Filters.js +1 -3
- package/lib-cjs/data/SpectraManager.js +23 -57
- package/lib-cjs/data/data1d/filter1d/fft.js +20 -3
- package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
- package/lib-cjs/data/data2d/Processing2D.js +3 -2
- package/lib-cjs/data/data2d/Spectrum2D/contours.js +138 -0
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +2 -3
- package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +21 -20
- package/lib/component/1d/IntegralResizable.js +0 -72
- package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +0 -1
- package/lib/component/panels/RangesPanel/TableColumns/format.js +0 -8
- package/lib/data/data1d/Data1DManager.d.ts +0 -3
- package/lib/data/data1d/Data1DManager.js +0 -98
- package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
- package/lib/data/data1d/filter1d/absolute.js +0 -26
- package/lib/data/data2d/Data2DManager.d.ts +0 -3
- package/lib/data/data2d/Data2DManager.js +0 -34
- package/lib/data/types/data2d/Contour.d.ts +0 -4
- package/lib/data/types/data2d/Contour.js +0 -1
- package/lib/data/types/data2d/Contours.d.ts +0 -2
- package/lib/data/types/data2d/Contours.js +0 -1
- package/lib-cjs/component/1d/IntegralResizable.js +0 -77
- package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +0 -14
- package/lib-cjs/data/data1d/Data1DManager.js +0 -104
- package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
- package/lib-cjs/data/data2d/Data2DManager.js +0 -40
- package/lib-cjs/data/types/data2d/Contour.js +0 -2
- package/lib-cjs/data/types/data2d/Contours.js +0 -2
|
@@ -2,10 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import FloatMoleculeStructures from '../tool/FloatMoleculeStructures';
|
|
3
3
|
import ApdoizationLine from './ApodizationLine';
|
|
4
4
|
import ExclusionZonesAnnotations from './ExclusionZonesAnnotations';
|
|
5
|
-
import IntegralsSeries from './IntegralsSeries';
|
|
6
5
|
import LinesSeries from './LinesSeries';
|
|
7
6
|
import XAxis from './XAxis';
|
|
8
7
|
import DatabaseElements from './database/DatabaseElements';
|
|
8
|
+
import IntegralsSeries from './integral/IntegralsSeries';
|
|
9
9
|
import JGraph from './jCouplingGraph/JGraph';
|
|
10
10
|
import MultiAnalysisRanges from './multiAnalysis/MultiAnalysisRanges';
|
|
11
11
|
import PeakAnnotations from './peaks/PeakAnnotations';
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
|
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
5
|
-
import { useContext,
|
|
5
|
+
import { useContext, Fragment, memo } from 'react';
|
|
6
6
|
import { BsCursor } from 'react-icons/bs';
|
|
7
7
|
import { IoPulseSharp } from 'react-icons/io5';
|
|
8
8
|
import { get1DDataXY } from '../../data/data1d/Spectrum1D/get1DDataXY';
|
|
@@ -67,14 +67,6 @@ function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, ac
|
|
|
67
67
|
const { startX, endX, step } = useContext(BrushContext);
|
|
68
68
|
const { scaleX } = useScaleChecked();
|
|
69
69
|
const format = useFormatNumberByNucleus(activeTab);
|
|
70
|
-
const getYValue = useCallback((xPosition) => {
|
|
71
|
-
if (spectrum) {
|
|
72
|
-
const data = get1DDataXY(spectrum);
|
|
73
|
-
const xIndex = xFindClosestIndex(data.x, scaleX().invert(xPosition));
|
|
74
|
-
return data.y[xIndex];
|
|
75
|
-
}
|
|
76
|
-
return 1;
|
|
77
|
-
}, [spectrum, scaleX]);
|
|
78
70
|
if (!position ||
|
|
79
71
|
position.y < margin.top ||
|
|
80
72
|
position.x < margin.left ||
|
|
@@ -82,7 +74,22 @@ function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, ac
|
|
|
82
74
|
position.y > height - margin.bottom) {
|
|
83
75
|
return _jsx("div", { css: styles });
|
|
84
76
|
}
|
|
85
|
-
|
|
77
|
+
function getXIndex(xPosition) {
|
|
78
|
+
if (spectrum) {
|
|
79
|
+
const data = get1DDataXY(spectrum);
|
|
80
|
+
return xFindClosestIndex(data.x, scaleX().invert(xPosition));
|
|
81
|
+
}
|
|
82
|
+
return 0;
|
|
83
|
+
}
|
|
84
|
+
function getYValue(xPosition) {
|
|
85
|
+
if (spectrum) {
|
|
86
|
+
const data = get1DDataXY(spectrum);
|
|
87
|
+
const xIndex = getXIndex(xPosition);
|
|
88
|
+
return data.y[xIndex];
|
|
89
|
+
}
|
|
90
|
+
return 1;
|
|
91
|
+
}
|
|
92
|
+
return (_jsxs("div", { css: styles, children: [_jsx(BsCursor, {}), _jsxs("div", { children: [_jsx("span", { className: "label", children: " \uD835\uDEC5: " }), _jsx("span", { className: "value", children: format(scaleX().invert(position.x)) }), _jsx("span", { className: "unit", children: "ppm" }), activeSpectrum && spectrum?.info?.originFrequency && (_jsxs(_Fragment, { children: [_jsxs("span", { className: "value", children: ["\u00A0(", format(scaleX().invert(position.x) * spectrum?.info?.originFrequency, 'hz')] }), _jsx("span", { className: "unit", children: "Hz" }), _jsx("span", { className: "value", children: ") " }), _jsx("span", { children: "," }), _jsx("span", { className: "label", children: " Index: " }), _jsx("span", { className: "value", children: getXIndex(position.x) })] }))] }), step === 'brushing' && (_jsxs("div", { children: [_jsx("span", { className: "label", children: " \u0394ppm: " }), _jsx("span", { className: "value", children: (scaleX().invert(startX) - scaleX().invert(endX)).toPrecision(6) })] })), activeSpectrum && (_jsxs(Fragment, { children: [spectrum?.info?.originFrequency && step === 'brushing' && (_jsxs("div", { children: [_jsx("span", { className: "label", children: " \u0394Hz: " }), _jsx("span", { className: "value", children: ((scaleX().invert(startX) - scaleX().invert(endX)) *
|
|
86
93
|
spectrum?.info?.originFrequency).toPrecision(5) })] })), step === 'brushing' && (_jsxs("div", { children: [_jsx("span", { className: "label", children: " ratio :" }), _jsxs("span", { className: "value", children: [((getYValue(startX) / (getYValue(endX) || Number.MIN_VALUE)) *
|
|
87
94
|
100).toFixed(2), "%"] })] }))] })), activeSpectrum && (_jsxs(Fragment, { children: [_jsx("div", { className: "separator" }), _jsx(IoPulseSharp, {}), _jsxs("div", { children: [_jsx("span", { className: "label", children: "Intensity: " }), _jsx("span", { className: "value yvalue", children: format(getYValue(position.x)) })] })] }))] }));
|
|
88
95
|
}
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import useIntegralPath from '
|
|
3
|
-
import { usePanelPreferences } from '
|
|
2
|
+
import useIntegralPath from '../../hooks/useIntegralPath';
|
|
3
|
+
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
4
4
|
import IntegralResizable from './IntegralResizable';
|
|
5
5
|
function Integral({ integral, isActive, nucleus }) {
|
|
6
6
|
const path = useIntegralPath(integral);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useChartData } from '../../context/ChartContext';
|
|
3
|
+
import { formatNumber } from '../../utility/formatNumber';
|
|
4
|
+
const styles = {
|
|
5
|
+
text: {
|
|
6
|
+
fontSize: '11px',
|
|
7
|
+
textAnchor: 'middle',
|
|
8
|
+
dominantBaseline: 'middle',
|
|
9
|
+
writingMode: 'vertical-rl',
|
|
10
|
+
fill: 'black',
|
|
11
|
+
},
|
|
12
|
+
path: {
|
|
13
|
+
fill: 'none',
|
|
14
|
+
strokeWidth: '1px',
|
|
15
|
+
shapeRendering: 'crispEdges',
|
|
16
|
+
stroke: 'black',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
export function IntegralIndicator(props) {
|
|
20
|
+
const { value, width, format, opacity = 1 } = props;
|
|
21
|
+
const { height, margin } = useChartData();
|
|
22
|
+
const bottom = height - margin.bottom;
|
|
23
|
+
return (_jsxs("g", { style: { transform: `translate(0,${bottom - 10}px) `, opacity }, children: [_jsx("text", { style: {
|
|
24
|
+
...styles.text,
|
|
25
|
+
transform: `translate(${width / 2}px,-12px) scale(-1)`,
|
|
26
|
+
}, children: value ? formatNumber(value, format) : '' }), _jsx("path", { style: styles.path, d: `M0 0 L0 5 L${width} 5 L${width} 0 ` })] }));
|
|
27
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { useChartData } from '../../context/ChartContext';
|
|
5
|
+
import { useDispatch } from '../../context/DispatchContext';
|
|
6
|
+
import { useGlobal } from '../../context/GlobalContext';
|
|
7
|
+
import { useScaleChecked } from '../../context/ScaleContext';
|
|
8
|
+
import Resizer from '../../elements/resizer/Resizer';
|
|
9
|
+
import { HighlightEventSource, useHighlight } from '../../highlight/index';
|
|
10
|
+
import { RESIZE_INTEGRAL } from '../../reducer/types/Types';
|
|
11
|
+
import { options } from '../../toolbar/ToolTypes';
|
|
12
|
+
import { IntegralIndicator } from './IntegralIndicator';
|
|
13
|
+
const stylesOnHover = css `
|
|
14
|
+
pointer-events: bounding-box;
|
|
15
|
+
@-moz-document url-prefix() {
|
|
16
|
+
pointer-events: fill;
|
|
17
|
+
}
|
|
18
|
+
.highlight {
|
|
19
|
+
fill: transparent;
|
|
20
|
+
}
|
|
21
|
+
.target {
|
|
22
|
+
visibility: hidden;
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
const stylesHighlighted = css `
|
|
26
|
+
pointer-events: bounding-box;
|
|
27
|
+
|
|
28
|
+
@-moz-document url-prefix() {
|
|
29
|
+
pointer-events: fill;
|
|
30
|
+
}
|
|
31
|
+
fill: #ff6f0057;
|
|
32
|
+
|
|
33
|
+
.target {
|
|
34
|
+
visibility: visible;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
function IntegralResizable({ integralData, integralFormat, }) {
|
|
38
|
+
const { height, margin, toolOptions: { selectedTool }, } = useChartData();
|
|
39
|
+
const { viewerRef } = useGlobal();
|
|
40
|
+
const { scaleX } = useScaleChecked();
|
|
41
|
+
const dispatch = useDispatch();
|
|
42
|
+
const { id, integral } = integralData;
|
|
43
|
+
const highlight = useHighlight([id], {
|
|
44
|
+
type: HighlightEventSource.INTEGRAL,
|
|
45
|
+
extra: { id },
|
|
46
|
+
});
|
|
47
|
+
function handleOnStopResizing(position) {
|
|
48
|
+
dispatch({
|
|
49
|
+
type: RESIZE_INTEGRAL,
|
|
50
|
+
payload: {
|
|
51
|
+
data: {
|
|
52
|
+
...integralData,
|
|
53
|
+
from: scaleX().invert(position.x2),
|
|
54
|
+
to: scaleX().invert(position.x1),
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const from = integralData.from ? scaleX()(integralData.from) : 0;
|
|
60
|
+
const to = integralData.to ? scaleX()(integralData.to) : 0;
|
|
61
|
+
const bottom = height - margin.bottom;
|
|
62
|
+
return (_jsx("g", { onMouseEnter: () => highlight.show(), onMouseLeave: () => highlight.hide(), children: _jsx(Resizer, { tag: "svg", initialPosition: { x1: to, x2: from }, onEnd: handleOnStopResizing, parentElement: viewerRef, disabled: selectedTool !== options.integral.id, children: ({ x1, x2 }, isActive) => {
|
|
63
|
+
const width = x2 - x1;
|
|
64
|
+
return (_jsxs("g", { css: highlight.isActive || isActive
|
|
65
|
+
? stylesHighlighted
|
|
66
|
+
: stylesOnHover, children: [_jsx("rect", { width: width, height: bottom, className: "highlight", "data-no-export": "true" }), _jsx(IntegralIndicator, { value: integral, format: integralFormat, width: width })] }));
|
|
67
|
+
} }, `${id}_${to}_${from}`) }));
|
|
68
|
+
}
|
|
69
|
+
export default IntegralResizable;
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { isSpectrum1D } from '
|
|
4
|
-
import { useChartData } from '
|
|
5
|
-
import { useActiveSpectrum } from '
|
|
3
|
+
import { isSpectrum1D } from '../../../data/data1d/Spectrum1D';
|
|
4
|
+
import { useChartData } from '../../context/ChartContext';
|
|
5
|
+
import { useActiveSpectrum } from '../../reducer/Reducer';
|
|
6
6
|
import Integral from './Integral';
|
|
7
7
|
function IntegralsSeries() {
|
|
8
8
|
const { xDomains, data, displayerKey, view: { spectra: { activeTab: nucleus }, }, } = useChartData();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import { useCallback, useState, useEffect } from 'react';
|
|
5
4
|
import { checkRangeKind } from '../../../data/utilities/RangeUtilities';
|
|
6
5
|
import { useAssignment, useAssignmentData, } from '../../assignment/AssignmentsContext';
|
|
7
6
|
import { filterForIDsWithAssignment } from '../../assignment/utilities/filterForIDsWithAssignment';
|
|
@@ -12,18 +11,17 @@ import Resizer from '../../elements/resizer/Resizer';
|
|
|
12
11
|
import { HighlightEventSource, useHighlight } from '../../highlight';
|
|
13
12
|
import { RESIZE_RANGE } from '../../reducer/types/Types';
|
|
14
13
|
import { options } from '../../toolbar/ToolTypes';
|
|
15
|
-
import {
|
|
14
|
+
import { IntegralIndicator } from '../integral/IntegralIndicator';
|
|
16
15
|
import MultiplicityTree from '../multiplicityTree/MultiplicityTree';
|
|
17
16
|
const stylesOnHover = css `
|
|
18
17
|
pointer-events: bounding-box;
|
|
19
18
|
@-moz-document url-prefix() {
|
|
20
19
|
pointer-events: fill;
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.delete-button {
|
|
21
|
+
.highlight {
|
|
22
|
+
fill: transparent;
|
|
23
|
+
}
|
|
24
|
+
.target {
|
|
27
25
|
visibility: hidden;
|
|
28
26
|
}
|
|
29
27
|
`;
|
|
@@ -33,13 +31,10 @@ const stylesHighlighted = css `
|
|
|
33
31
|
@-moz-document url-prefix() {
|
|
34
32
|
pointer-events: fill;
|
|
35
33
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
.delete-button {
|
|
34
|
+
fill: #ff6f0057;
|
|
35
|
+
|
|
36
|
+
.target {
|
|
41
37
|
visibility: visible;
|
|
42
|
-
cursor: pointer;
|
|
43
38
|
}
|
|
44
39
|
`;
|
|
45
40
|
function Range({ rangeData, showMultiplicityTrees, selectedTool, relativeFormat, }) {
|
|
@@ -50,20 +45,8 @@ function Range({ rangeData, showMultiplicityTrees, selectedTool, relativeFormat,
|
|
|
50
45
|
const highlightRange = useHighlight([assignmentRange.id].concat(assignmentRange.assigned?.x || []).concat(filterForIDsWithAssignment(assignmentData, signals.map((_signal) => _signal.id))), { type: HighlightEventSource.RANGE, extra: { id } });
|
|
51
46
|
const { scaleX } = useScaleChecked();
|
|
52
47
|
const dispatch = useDispatch();
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (selectedTool && selectedTool === options.editRange.id) {
|
|
57
|
-
setIsBlockedByEditing(true);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
setIsBlockedByEditing(false);
|
|
61
|
-
}
|
|
62
|
-
}, [selectedTool]);
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
setReduceOpacity(!checkRangeKind(rangeData));
|
|
65
|
-
}, [rangeData]);
|
|
66
|
-
const handleOnStopResizing = useCallback((position) => {
|
|
48
|
+
const isBlockedByEditing = selectedTool && selectedTool === options.editRange.id;
|
|
49
|
+
function handleOnStopResizing(position) {
|
|
67
50
|
dispatch({
|
|
68
51
|
type: RESIZE_RANGE,
|
|
69
52
|
data: {
|
|
@@ -72,40 +55,34 @@ function Range({ rangeData, showMultiplicityTrees, selectedTool, relativeFormat,
|
|
|
72
55
|
to: scaleX().invert(position.x1),
|
|
73
56
|
},
|
|
74
57
|
});
|
|
75
|
-
}
|
|
76
|
-
|
|
58
|
+
}
|
|
59
|
+
function mouseEnterHandler() {
|
|
77
60
|
assignmentRange.show('x');
|
|
78
61
|
highlightRange.show();
|
|
79
|
-
}
|
|
80
|
-
|
|
62
|
+
}
|
|
63
|
+
function mouseLeaveHandler() {
|
|
81
64
|
assignmentRange.hide();
|
|
82
65
|
highlightRange.hide();
|
|
83
|
-
}
|
|
84
|
-
|
|
66
|
+
}
|
|
67
|
+
function assignHandler(e) {
|
|
85
68
|
if (selectedTool === options.rangePicking.id &&
|
|
86
69
|
e.shiftKey &&
|
|
87
70
|
!isBlockedByEditing) {
|
|
88
71
|
assignmentRange.setActive('x');
|
|
89
72
|
}
|
|
90
|
-
}
|
|
73
|
+
}
|
|
91
74
|
const from = scaleX()(rangeData.from);
|
|
92
75
|
const to = scaleX()(rangeData.to);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
highlightRange.isActive ||
|
|
104
|
-
assignmentRange.isActive
|
|
105
|
-
? 1
|
|
106
|
-
: 0.6, children: integration !== undefined
|
|
107
|
-
? formatNumber(integration, relativeFormat)
|
|
108
|
-
: '' })] })) }, `${id}_${to}_${from}`), showMultiplicityTrees &&
|
|
76
|
+
const isNotSignal = !checkRangeKind(rangeData);
|
|
77
|
+
return (_jsxs("g", { "data-test-id": "range", style: { outline: 'none' }, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, onClick: assignHandler, children: [_jsx(Resizer, { tag: "svg", initialPosition: { x1: to, x2: from }, onEnd: handleOnStopResizing, parentElement: viewerRef, disabled: selectedTool !== options.rangePicking.id, children: ({ x1, x2 }, isActive) => {
|
|
78
|
+
const width = x2 - x1;
|
|
79
|
+
return (_jsxs("g", { css: isBlockedByEditing ||
|
|
80
|
+
highlightRange.isActive ||
|
|
81
|
+
assignmentRange.isActive ||
|
|
82
|
+
isActive
|
|
83
|
+
? stylesHighlighted
|
|
84
|
+
: stylesOnHover, children: [_jsx("rect", { width: width, height: "100%", className: "highlight", "data-no-export": "true" }), _jsx(IntegralIndicator, { value: integration, format: relativeFormat, width: width, opacity: isNotSignal ? 0.5 : 1 })] }));
|
|
85
|
+
} }, `${id}_${to}_${from}`), showMultiplicityTrees &&
|
|
109
86
|
signals &&
|
|
110
87
|
signals.length > 0 &&
|
|
111
88
|
signals.map((_signal) => (_jsx(MultiplicityTree, { rangeFrom: rangeData.from, rangeTo: rangeData.to, signal: _signal }, _signal.id)))] }, id));
|
|
@@ -9,8 +9,8 @@ function getXScale(state, spectrumId = null) {
|
|
|
9
9
|
function getYScale(state, spectrumId = null) {
|
|
10
10
|
const { height, margin, verticalAlign, yDomain, yDomains } = state;
|
|
11
11
|
const _height = verticalAlign.align === 'center'
|
|
12
|
-
? (height -
|
|
13
|
-
: height - margin.bottom -
|
|
12
|
+
? (height - 40) / 2
|
|
13
|
+
: height - margin.bottom - 40;
|
|
14
14
|
let domainY = [];
|
|
15
15
|
if (spectrumId === null || yDomains[spectrumId] === undefined) {
|
|
16
16
|
domainY = [0, yDomain[1]];
|
|
@@ -1,64 +1,83 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import debounce from 'lodash/debounce';
|
|
2
3
|
import get from 'lodash/get';
|
|
3
|
-
import { memo, useMemo } from 'react';
|
|
4
|
+
import { memo, useMemo, useRef } from 'react';
|
|
4
5
|
import { getShift } from '../../data/data2d/Spectrum2D';
|
|
6
|
+
import { drawContours, getDefaultContoursLevel, } from '../../data/data2d/Spectrum2D/contours';
|
|
5
7
|
import { useChartData } from '../context/ChartContext';
|
|
6
8
|
import { usePreferences } from '../context/PreferencesContext';
|
|
9
|
+
import { useAlert } from '../elements/popup/Alert';
|
|
7
10
|
import { useActiveSpectrum } from '../reducer/Reducer';
|
|
8
11
|
import { PathBuilder } from '../utility/PathBuilder';
|
|
12
|
+
import nucleusToString from '../utility/nucleusToString';
|
|
9
13
|
import { get2DXScale, get2DYScale } from './utilities/scale';
|
|
10
|
-
function
|
|
11
|
-
const { margin, width, height, xDomain, yDomain
|
|
12
|
-
const activeSpectrum = useActiveSpectrum();
|
|
13
|
-
const preferences = usePreferences();
|
|
14
|
+
function usePath(datum, contours) {
|
|
15
|
+
const { margin, width, height, xDomain, yDomain } = useChartData();
|
|
14
16
|
const { xShift, yShift } = getShift(datum);
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (lines.length < 1e6) {
|
|
26
|
-
for (let i = 0; i < lines.length; i += 4) {
|
|
27
|
-
pathBuilder.moveTo(_scaleX(lines[i] + xShift), _scaleY(lines[i + 1] + yShift));
|
|
28
|
-
pathBuilder.lineTo(_scaleX(lines[i + 2] + xShift), _scaleY(lines[i + 3] + yShift));
|
|
29
|
-
}
|
|
17
|
+
const _scaleX = get2DXScale({ margin, width, xDomain });
|
|
18
|
+
const _scaleY = get2DYScale({ margin, height, yDomain });
|
|
19
|
+
const pathBuilder = new PathBuilder();
|
|
20
|
+
for (const element of contours) {
|
|
21
|
+
if (element.lines) {
|
|
22
|
+
const lines = element.lines;
|
|
23
|
+
if (lines.length < 1e6) {
|
|
24
|
+
for (let i = 0; i < lines.length; i += 4) {
|
|
25
|
+
pathBuilder.moveTo(_scaleX(lines[i] + xShift), _scaleY(lines[i + 1] + yShift));
|
|
26
|
+
pathBuilder.lineTo(_scaleX(lines[i + 2] + xShift), _scaleY(lines[i + 3] + yShift));
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
pathBuilder.moveTo(_scaleX(element[0].x + xShift), _scaleY(element[0].y + yShift));
|
|
32
|
+
for (let j = 1; j < element.length; j++) {
|
|
33
|
+
pathBuilder.lineTo(_scaleX(element[j].x + xShift), _scaleY(element[j].y + yShift));
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
|
-
pathBuilder.closePath();
|
|
40
|
-
return pathBuilder.toString();
|
|
41
36
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
pathBuilder.closePath();
|
|
38
|
+
return pathBuilder.toString();
|
|
39
|
+
}
|
|
40
|
+
const useContoursLevel = (datum, sign) => {
|
|
41
|
+
const { view: { zoom: { levels }, }, } = useChartData();
|
|
42
|
+
const { id, display: { contourOptions }, } = datum;
|
|
43
|
+
const defaultLevel = getDefaultContoursLevel(contourOptions);
|
|
44
|
+
const level = levels?.[id]?.[sign];
|
|
45
|
+
return isNaN(level) ? defaultLevel[sign] : level;
|
|
46
|
+
};
|
|
47
|
+
function ContoursPaths({ id: spectrumID, sign, color, datum, onTimeout, }) {
|
|
48
|
+
const activeSpectrum = useActiveSpectrum();
|
|
49
|
+
const preferences = usePreferences();
|
|
50
|
+
const level = useContoursLevel(datum, sign);
|
|
51
|
+
const contours = useMemo(() => {
|
|
52
|
+
const { contours, timeout } = drawContours(level, datum, sign === 'negative');
|
|
53
|
+
if (timeout) {
|
|
54
|
+
onTimeout();
|
|
55
|
+
}
|
|
56
|
+
return contours;
|
|
57
|
+
}, [datum, level, onTimeout, sign]);
|
|
58
|
+
const path = usePath(datum, contours);
|
|
59
|
+
const opacity = activeSpectrum === null || spectrumID === activeSpectrum.id
|
|
60
|
+
? '1'
|
|
61
|
+
: get(preferences.current, 'general.dimmedSpectraOpacity', 0.1);
|
|
62
|
+
return (_jsx("path", { fill: "none", "data-test-id": "spectrum-line", stroke: color, strokeWidth: "1", opacity: opacity, d: path }));
|
|
53
63
|
}
|
|
54
64
|
function ContoursInner({ data, displayerKey }) {
|
|
55
|
-
|
|
65
|
+
const alert = useAlert();
|
|
66
|
+
const debounceAlert = useRef(debounce(() => {
|
|
67
|
+
alert.error('Too many contour lines, only showing the first ones');
|
|
68
|
+
}, 2000));
|
|
69
|
+
function timeoutHandler() {
|
|
70
|
+
debounceAlert.current();
|
|
71
|
+
}
|
|
72
|
+
return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-2d)`, className: "contours", children: data?.map((datum) => (_jsxs("g", { children: [datum.display.isPositiveVisible && (_jsx(ContoursPaths, { id: datum.id, sign: "positive", datum: datum, color: datum.display.positiveColor, onTimeout: timeoutHandler })), datum.display.isNegativeVisible && (_jsx(ContoursPaths, { id: datum.id, sign: "negative", datum: datum, color: datum.display.negativeColor, onTimeout: timeoutHandler }))] }, datum.id))) }));
|
|
56
73
|
}
|
|
57
74
|
const MemoizedContours = memo(ContoursInner);
|
|
58
75
|
export default function Contours() {
|
|
59
|
-
const { data: spectra, displayerKey } = useChartData();
|
|
76
|
+
const { data: spectra, displayerKey, view: { spectra: { activeTab }, }, } = useChartData();
|
|
60
77
|
const data = useMemo(() => {
|
|
61
|
-
return spectra.filter((datum) => datum.info.dimension === 2 &&
|
|
62
|
-
|
|
78
|
+
return spectra.filter((datum) => datum.info.dimension === 2 &&
|
|
79
|
+
datum.info.isFt &&
|
|
80
|
+
activeTab === nucleusToString(datum.info.nucleus));
|
|
81
|
+
}, [activeTab, spectra]);
|
|
63
82
|
return _jsx(MemoizedContours, { ...{ data, displayerKey } });
|
|
64
83
|
}
|
|
@@ -41,6 +41,6 @@ function Left1DChart({ margin: marignValue = 10, data: spectrum, }) {
|
|
|
41
41
|
const mainHeight = originHeight - margin.bottom - margin.top;
|
|
42
42
|
if (!mainHeight || !height)
|
|
43
43
|
return null;
|
|
44
|
-
return (_jsxs("svg", { viewBox: `0 0 ${height} ${mainHeight + margin.top}`, width: height, height: mainHeight + margin.top, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-left`, children: _jsx("rect", { width: height, height: mainHeight, x: "0", y: margin.top }) }) }), _jsx("g", { clipPath: `url(#${displayerKey}clip-left)`, children: _jsx("path", { className: "line", stroke:
|
|
44
|
+
return (_jsxs("svg", { viewBox: `0 0 ${height} ${mainHeight + margin.top}`, width: height, height: mainHeight + margin.top, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-left`, children: _jsx("rect", { width: height, height: mainHeight, x: "0", y: margin.top }) }) }), _jsx("g", { clipPath: `url(#${displayerKey}clip-left)`, children: _jsx("path", { className: "line", stroke: spectrum.display.color, fill: "none", d: paths }) })] }));
|
|
45
45
|
}
|
|
46
46
|
export default memo(Left1DChart);
|
|
@@ -37,6 +37,6 @@ function Top1DChart({ margin: marginProps = 10, data: spectrum, }) {
|
|
|
37
37
|
if (!width || !height) {
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
|
-
return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-top`, children: _jsx("rect", { width: width - originMargin.left - originMargin.right, height: height, x: originMargin.left, y: `${0}` }) }) }), _jsx("g", { clipPath: `url(#${displayerKey}clip-top)`, children: _jsx("path", { className: "line", stroke:
|
|
40
|
+
return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-top`, children: _jsx("rect", { width: width - originMargin.left - originMargin.right, height: height, x: originMargin.left, y: `${0}` }) }) }), _jsx("g", { clipPath: `url(#${displayerKey}clip-top)`, children: _jsx("path", { className: "line", stroke: spectrum.display.color, fill: "none", strokeWidth: "1px", d: paths }) })] }));
|
|
41
41
|
}
|
|
42
42
|
export default memo(Top1DChart);
|
|
@@ -13,6 +13,9 @@ const initialState = {
|
|
|
13
13
|
startY: 0,
|
|
14
14
|
endY: 0,
|
|
15
15
|
};
|
|
16
|
+
function stopPageScrolling(event) {
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
}
|
|
16
19
|
export const BrushContext = createContext(initialState);
|
|
17
20
|
export function BrushTracker({ children, className, style, onBrush = () => null, onZoom = () => null, onDoubleClick = () => null, onClick = () => null, noPropagation, }) {
|
|
18
21
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
@@ -35,6 +38,24 @@ export function BrushTracker({ children, className, style, onBrush = () => null,
|
|
|
35
38
|
});
|
|
36
39
|
setMouseDownTime(event.timeStamp);
|
|
37
40
|
}
|
|
41
|
+
function moveCallback(event) {
|
|
42
|
+
dispatch({
|
|
43
|
+
type: 'MOVE',
|
|
44
|
+
screenX: event.screenX,
|
|
45
|
+
screenY: event.screenY,
|
|
46
|
+
clientX: event.clientX,
|
|
47
|
+
clientY: event.clientY,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function mouseUpCallback() {
|
|
51
|
+
dispatch({
|
|
52
|
+
type: 'UP',
|
|
53
|
+
});
|
|
54
|
+
window.removeEventListener('mousemove', moveCallback);
|
|
55
|
+
window.removeEventListener('mouseup', mouseUpCallback);
|
|
56
|
+
}
|
|
57
|
+
window.addEventListener('mousemove', moveCallback);
|
|
58
|
+
window.addEventListener('mouseup', mouseUpCallback);
|
|
38
59
|
return false;
|
|
39
60
|
}, [noPropagation]);
|
|
40
61
|
const clickHandler = useCallback((e) => {
|
|
@@ -74,34 +95,22 @@ export function BrushTracker({ children, className, style, onBrush = () => null,
|
|
|
74
95
|
});
|
|
75
96
|
}
|
|
76
97
|
}, [onBrush, state]);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const upCallback = useCallback((event) => {
|
|
87
|
-
dispatch({
|
|
88
|
-
type: 'UP',
|
|
89
|
-
clientX: event.clientX,
|
|
90
|
-
clientY: event.clientY,
|
|
91
|
-
});
|
|
92
|
-
return false;
|
|
93
|
-
}, []);
|
|
94
|
-
return (_jsx(BrushContext.Provider, { value: state, children: _jsx("div", { className: className, style: style, onMouseDown: mouseDownHandler, onMouseUp: upCallback, onMouseMove: moveCallback, onClick: clickHandler, onWheel: handleMouseWheel, children: children }) }));
|
|
98
|
+
return (_jsx(BrushContext.Provider, { value: state, children: _jsx("div", { className: className, style: style, onMouseDown: mouseDownHandler, onClick: clickHandler, onWheel: handleMouseWheel, onMouseEnter: () => {
|
|
99
|
+
// disable page scrolling once the mouse over the Displayer
|
|
100
|
+
window.addEventListener('wheel', stopPageScrolling, {
|
|
101
|
+
passive: false,
|
|
102
|
+
});
|
|
103
|
+
}, onMouseLeave: () => {
|
|
104
|
+
// disable page scrolling once the mouse over the Displayer
|
|
105
|
+
window.removeEventListener('wheel', stopPageScrolling);
|
|
106
|
+
}, children: children }) }));
|
|
95
107
|
}
|
|
96
108
|
function reducer(state, action) {
|
|
97
109
|
switch (action.type) {
|
|
98
110
|
case 'UP':
|
|
99
111
|
if (state.step === 'brushing' || state.step === 'start') {
|
|
100
|
-
const { clientX, clientY } = action;
|
|
101
112
|
return {
|
|
102
113
|
...state,
|
|
103
|
-
endX: clientX - state.boundingRect.x,
|
|
104
|
-
endY: clientY - state.boundingRect.y,
|
|
105
114
|
step: state.step === 'start' ? 'initial' : 'end',
|
|
106
115
|
};
|
|
107
116
|
}
|
|
@@ -8,7 +8,7 @@ import { NMRiumGeneralPreferences } from '../types/NMRiumGeneralPreferences';
|
|
|
8
8
|
import { NMRiumPanelPreferences } from '../types/NMRiumPanelPreferences';
|
|
9
9
|
import { NMRiumToolBarPreferences } from '../types/NMRiumToolBarPreferences';
|
|
10
10
|
import { ViewState } from './reducer/Reducer';
|
|
11
|
-
import { BlobObject } from './utility/
|
|
11
|
+
import { BlobObject } from './utility/export';
|
|
12
12
|
export type { NMRiumDataReturn } from '../types/NMRiumDataReturn';
|
|
13
13
|
export declare type NMRiumWorkspace = 'exercise' | 'process1D' | 'default' | 'prediction' | 'embedded';
|
|
14
14
|
export interface NMRiumProps {
|
package/lib/component/NMRium.js
CHANGED
|
@@ -30,7 +30,7 @@ import { DISPLAYER_MODE } from './reducer/core/Constants';
|
|
|
30
30
|
import preferencesReducer, { preferencesInitialState, initPreferencesState, } from './reducer/preferences/preferencesReducer';
|
|
31
31
|
import { INITIATE, SET_LOADING_FLAG, SET_MOUSE_OVER_DISPLAYER, } from './reducer/types/Types';
|
|
32
32
|
import ToolBar from './toolbar/ToolBar';
|
|
33
|
-
import { getBlob } from './utility/
|
|
33
|
+
import { getBlob } from './utility/export';
|
|
34
34
|
const viewerContainerStyle = css `
|
|
35
35
|
border: 0.55px #e6e6e6 solid;
|
|
36
36
|
display: flex;
|
|
@@ -4,5 +4,5 @@ import { usePreferences } from './context/PreferencesContext';
|
|
|
4
4
|
export function SplitPaneWrapper({ children }) {
|
|
5
5
|
const { current } = usePreferences();
|
|
6
6
|
const { hidePanelOnLoad = false, initialPanelWidth = '560px' } = current?.display?.general || {};
|
|
7
|
-
return (_jsx(SplitPane, {
|
|
7
|
+
return (_jsx(SplitPane, { initialSize: initialPanelWidth, direction: "horizontal", controlledSide: "end", initialClosed: hidePanelOnLoad ? true : 600, children: children }, hidePanelOnLoad ? 'true' : 'false'));
|
|
8
8
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
|
|
2
|
+
import { InputProps } from './Input';
|
|
3
|
+
interface EditableColumnProps extends Omit<InputProps, 'style' | 'value' | 'type'> {
|
|
3
4
|
onSave?: (element: any) => void;
|
|
4
5
|
onEditStart?: (element: any) => void;
|
|
5
6
|
type?: 'number' | 'text';
|
|
@@ -7,6 +8,7 @@ interface EditableColumnProps {
|
|
|
7
8
|
value: string | number;
|
|
8
9
|
style?: CSSProperties;
|
|
9
10
|
validate?: (value?: any) => boolean;
|
|
11
|
+
textOverFlowEllipses?: boolean;
|
|
10
12
|
}
|
|
11
13
|
declare const EditableColumn: import("react").ForwardRefExoticComponent<EditableColumnProps & import("react").RefAttributes<unknown>>;
|
|
12
14
|
export default EditableColumn;
|