nmrium 0.30.0 → 0.31.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 +3 -1
- package/lib/component/1d/FooterBanner.js +3 -1
- package/lib/component/1d/IntegralsSeries.js +3 -1
- package/lib/component/1d/LinesSeries.js +3 -1
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +3 -1
- package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib/component/1d/ranges/Ranges.js +8 -2
- package/lib/component/1d/tool/PeakPointer.js +3 -1
- package/lib/component/1d/tool/XLabelPointer.js +3 -1
- package/lib/component/2d/Contours.js +3 -1
- package/lib/component/2d/FooterBanner.js +3 -1
- package/lib/component/2d/Viewer2D.js +4 -4
- package/lib/component/2d/XAxis.js +2 -2
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib/component/2d/zones/IndicationLines.js +1 -1
- package/lib/component/2d/zones/Zones.js +14 -19
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/NMRium.js +14 -3
- package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
- package/lib/component/elements/popup/Modal/Provider.js +8 -11
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib/component/hooks/useExport.d.ts +0 -1
- package/lib/component/hooks/useExport.js +1 -17
- package/lib/component/hooks/useIntegralPath.js +5 -2
- package/lib/component/hooks/useNucleus.js +4 -4
- package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib/component/hooks/useSpectrum.js +3 -1
- package/lib/component/loader/DropZone.js +7 -147
- package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
- package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.d.ts +108 -49
- package/lib/component/reducer/Reducer.js +45 -41
- package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
- package/lib/component/reducer/actions/DomainActions.js +11 -9
- package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +218 -232
- package/lib/component/reducer/actions/IntegralsActions.js +13 -8
- package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
- package/lib/component/reducer/actions/LoadActions.js +19 -34
- package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
- package/lib/component/reducer/actions/MoleculeActions.js +22 -6
- package/lib/component/reducer/actions/PeaksActions.js +18 -12
- package/lib/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib/component/reducer/actions/RangesActions.d.ts +3 -3
- package/lib/component/reducer/actions/RangesActions.js +85 -27
- package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib/component/reducer/actions/SpectrumsActions.js +13 -10
- package/lib/component/reducer/actions/ToolsActions.js +38 -23
- package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
- package/lib/component/reducer/actions/ZonesActions.js +68 -17
- package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
- package/lib/component/reducer/helper/getSpectrum.js +3 -2
- package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib/component/reducer/types/Types.d.ts +5 -0
- package/lib/component/reducer/types/Types.js +5 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +6 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib/component/toolbar/BasicToolBar.js +4 -6
- package/lib/component/toolbar/FunctionToolBar.js +3 -1
- package/lib/component/utility/assert.d.ts +1 -0
- package/lib/component/utility/assert.js +5 -0
- package/lib/component/workspaces/exercise.js +6 -0
- package/lib/data/SpectraManager.d.ts +0 -4
- package/lib/data/SpectraManager.js +2 -87
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib/data/data1d/filter1d/fft.js +11 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
- package/lib/data/molecules/Molecule.d.ts +5 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +3 -1
- package/lib-cjs/component/1d/FooterBanner.js +3 -1
- package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
- package/lib-cjs/component/1d/LinesSeries.js +3 -1
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +3 -1
- package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib-cjs/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
- package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
- package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
- package/lib-cjs/component/2d/Contours.js +3 -1
- package/lib-cjs/component/2d/FooterBanner.js +3 -1
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/2d/XAxis.js +2 -2
- package/lib-cjs/component/2d/YAxis.js +2 -2
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
- package/lib-cjs/component/2d/zones/Zones.js +13 -18
- package/lib-cjs/component/NMRium.js +14 -3
- package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib-cjs/component/hooks/useExport.js +0 -16
- package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
- package/lib-cjs/component/hooks/useNucleus.js +4 -4
- package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib-cjs/component/hooks/useSpectrum.js +3 -1
- package/lib-cjs/component/loader/DropZone.js +6 -149
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
- package/lib-cjs/component/reducer/Reducer.js +48 -43
- package/lib-cjs/component/reducer/actions/DomainActions.js +11 -9
- package/lib-cjs/component/reducer/actions/FiltersActions.js +219 -233
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +13 -8
- package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +23 -6
- package/lib-cjs/component/reducer/actions/PeaksActions.js +18 -12
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib-cjs/component/reducer/actions/RangesActions.js +85 -27
- package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +13 -10
- package/lib-cjs/component/reducer/actions/ToolsActions.js +38 -23
- package/lib-cjs/component/reducer/actions/ZonesActions.js +71 -17
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
- package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
- package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib-cjs/component/reducer/types/Types.js +8 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib-cjs/component/toolbar/BasicToolBar.js +4 -6
- package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
- package/lib-cjs/component/utility/assert.js +9 -0
- package/lib-cjs/component/workspaces/exercise.js +6 -0
- package/lib-cjs/data/SpectraManager.js +3 -92
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +22 -22
- package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
- package/lib/component/utility/nmredataToNmrium.js +0 -66
- package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
- package/lib/component/utility/nmriumToNmredata.js +0 -80
- package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addRanges.js +0 -52
- package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
- package/lib/component/utility/util/nmredata/addSource.js +0 -54
- package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addZones.js +0 -41
- package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
- package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
- package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
- package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
- package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
- package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
- package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
- package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
- package/lib/component/utility/util/nmredata/getLabels.js +0 -66
- package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getToFix.js +0 -19
- package/lib/data/migration/MigrationManager.d.ts +0 -2
- package/lib/data/migration/MigrationManager.js +0 -19
- package/lib/data/migration/changeKeys.d.ts +0 -1
- package/lib/data/migration/changeKeys.js +0 -9
- package/lib/data/migration/migrateToVersion1.d.ts +0 -11
- package/lib/data/migration/migrateToVersion1.js +0 -32
- package/lib/data/migration/migrateToVersion2.d.ts +0 -1
- package/lib/data/migration/migrateToVersion2.js +0 -111
- package/lib/data/migration/migrateToVersion3.d.ts +0 -1
- package/lib/data/migration/migrateToVersion3.js +0 -55
- package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
- package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
- package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
- package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
- package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -45
- package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
- package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
- package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
- package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
- package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
- package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
- package/lib-cjs/data/migration/MigrationManager.js +0 -26
- package/lib-cjs/data/migration/changeKeys.js +0 -13
- package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
- package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
- package/lib-cjs/data/migration/migrateToVersion3.js +0 -58
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { buildCorrelationData } from 'nmr-correlation';
|
|
2
|
-
import { addJcamps
|
|
2
|
+
import { addJcamps } from '../../../data/SpectraManager';
|
|
3
|
+
import { initiateDatum1D } from '../../../data/data1d/Spectrum1D';
|
|
4
|
+
import { initiateDatum2D } from '../../../data/data2d/Spectrum2D';
|
|
3
5
|
import * as MoleculeManager from '../../../data/molecules/MoleculeManager';
|
|
4
6
|
import { DefaultTolerance } from '../../panels/SummaryPanel/CorrelationTable/Constants';
|
|
5
7
|
import { getInitialState } from '../Reducer';
|
|
6
|
-
import { INITIATE, LOAD_JSON_FILE
|
|
8
|
+
import { INITIATE, LOAD_JSON_FILE } from '../types/Types';
|
|
7
9
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
8
10
|
import { setActiveTab } from './ToolsActions';
|
|
9
11
|
function setIsLoading(draft, isLoading) {
|
|
@@ -80,15 +82,6 @@ function initiate(draft, action) {
|
|
|
80
82
|
state.actionType = INITIATE;
|
|
81
83
|
return state;
|
|
82
84
|
}
|
|
83
|
-
function loadJDFFile(draft, actions) {
|
|
84
|
-
const { files } = actions;
|
|
85
|
-
const spectra = addJDFs(files, draft.usedColors);
|
|
86
|
-
for (const spectrum of spectra) {
|
|
87
|
-
draft.data.push(spectrum);
|
|
88
|
-
}
|
|
89
|
-
setActiveTab(draft);
|
|
90
|
-
draft.isLoading = false;
|
|
91
|
-
}
|
|
92
85
|
function loadJcampFile(draft, actions) {
|
|
93
86
|
const { files } = actions;
|
|
94
87
|
const spectra = addJcamps(files, draft.usedColors);
|
|
@@ -111,30 +104,22 @@ function handleLoadJsonFile(draft, action) {
|
|
|
111
104
|
state.actionType = LOAD_JSON_FILE;
|
|
112
105
|
return state;
|
|
113
106
|
}
|
|
114
|
-
function
|
|
115
|
-
const {
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
function loadDropFiles(draft, actions) {
|
|
108
|
+
const { data, usedColors } = actions;
|
|
109
|
+
const { spectra, molecules } = data;
|
|
110
|
+
for (let spectrum of spectra) {
|
|
111
|
+
const { info } = spectrum;
|
|
112
|
+
if (info.dimension === 1) {
|
|
113
|
+
draft.data.push(initiateDatum1D(spectrum, usedColors));
|
|
114
|
+
}
|
|
115
|
+
else if (info.dimension === 2) {
|
|
116
|
+
draft.data.push(initiateDatum2D(spectrum, usedColors));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
for (let molecule of molecules) {
|
|
120
|
+
MoleculeManager.addMolfile(draft.molecules, molecule.molfile);
|
|
118
121
|
}
|
|
119
|
-
draft.isLoading = false;
|
|
120
|
-
}
|
|
121
|
-
function handleLoadZIPFile(draft, action) {
|
|
122
|
-
const { data, usedColors } = action.payload;
|
|
123
|
-
draft.data = draft.data.concat(data);
|
|
124
|
-
setColors(draft, usedColors);
|
|
125
122
|
setActiveTab(draft);
|
|
126
|
-
changeSpectrumVerticalAlignment(draft, { align: 'auto-check' });
|
|
127
123
|
draft.isLoading = false;
|
|
128
124
|
}
|
|
129
|
-
|
|
130
|
-
const state = getInitialState();
|
|
131
|
-
setData(state, action.payload);
|
|
132
|
-
setActiveTab(state);
|
|
133
|
-
changeSpectrumVerticalAlignment(state, { align: 'auto-check' });
|
|
134
|
-
state.isLoading = false;
|
|
135
|
-
state.width = draft.width;
|
|
136
|
-
state.height = draft.height;
|
|
137
|
-
state.actionType = LOAD_NMREDATA_FILE;
|
|
138
|
-
return state;
|
|
139
|
-
}
|
|
140
|
-
export { setIsLoading, initiate, loadJcampFile, loadJDFFile, handleLoadJsonFile, handleLoadNmredata, handleLoadMOLFile, handleLoadZIPFile, };
|
|
125
|
+
export { setIsLoading, initiate, loadJcampFile, loadDropFiles, handleLoadJsonFile, };
|
|
@@ -5,5 +5,6 @@ declare function setMoleculeHandler(draft: Draft<State>, action: any): void;
|
|
|
5
5
|
declare function deleteMoleculeHandler(draft: Draft<State>, action: any): void;
|
|
6
6
|
declare function predictSpectraFromMoleculeHandler(draft: Draft<State>, action: any): void;
|
|
7
7
|
declare function floatMoleculeOverSpectrum(draft: Draft<State>, action: any): void;
|
|
8
|
+
declare function changeFloatMoleculePosition(draft: Draft<State>, action: any): void;
|
|
8
9
|
declare function changeMoleculeLabel(draft: Draft<State>, action: any): void;
|
|
9
|
-
export { addMoleculeHandler, setMoleculeHandler, deleteMoleculeHandler, predictSpectraFromMoleculeHandler, floatMoleculeOverSpectrum, changeMoleculeLabel, };
|
|
10
|
+
export { addMoleculeHandler, setMoleculeHandler, deleteMoleculeHandler, predictSpectraFromMoleculeHandler, floatMoleculeOverSpectrum, changeFloatMoleculePosition, changeMoleculeLabel, };
|
|
@@ -2,6 +2,7 @@ import { generateSpectra } from '../../../data/PredictionManager';
|
|
|
2
2
|
import { changeSpectraRelativeSum } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
3
3
|
import * as MoleculeManager from '../../../data/molecules/MoleculeManager';
|
|
4
4
|
import getColor from '../../../data/utilities/getColor';
|
|
5
|
+
import { DRAGGABLE_STRUCTURE_INITIAL_POSITION } from '../../tool/FloatMoleculeStructures/DraggableStructure';
|
|
5
6
|
import nucleusToString from '../../utility/nucleusToString';
|
|
6
7
|
import { DISPLAYER_MODE } from '../core/Constants';
|
|
7
8
|
import { handleUnlinkRange } from './RangesActions';
|
|
@@ -65,10 +66,11 @@ function predictSpectraFromMoleculeHandler(draft, action) {
|
|
|
65
66
|
const color = getColor(false, draft.usedColors['1d']);
|
|
66
67
|
for (const spectrum of generateSpectra(data, options, color)) {
|
|
67
68
|
draft.data.push(spectrum);
|
|
68
|
-
draft.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
draft.view.spectra.activeSpectra[nucleusToString(spectrum.info.nucleus)] =
|
|
70
|
+
{
|
|
71
|
+
id: spectrum.id,
|
|
72
|
+
index: draft.data.length - 1,
|
|
73
|
+
};
|
|
72
74
|
}
|
|
73
75
|
draft.usedColors['1d'].push(color);
|
|
74
76
|
}
|
|
@@ -84,7 +86,21 @@ function floatMoleculeOverSpectrum(draft, action) {
|
|
|
84
86
|
!draft.view.floatingMolecules[moleculeIndex].visible;
|
|
85
87
|
}
|
|
86
88
|
else {
|
|
87
|
-
draft.view.floatingMolecules.push({
|
|
89
|
+
draft.view.floatingMolecules.push({
|
|
90
|
+
id,
|
|
91
|
+
visible: true,
|
|
92
|
+
position: DRAGGABLE_STRUCTURE_INITIAL_POSITION,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function changeFloatMoleculePosition(draft, action) {
|
|
97
|
+
const { id, position } = action.payload;
|
|
98
|
+
const molecule = draft.view.floatingMolecules.find((m) => m.id === id);
|
|
99
|
+
if (molecule) {
|
|
100
|
+
molecule.position = position;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
throw new Error(`Molecule ${id} does not exist`);
|
|
88
104
|
}
|
|
89
105
|
}
|
|
90
106
|
function changeMoleculeLabel(draft, action) {
|
|
@@ -92,4 +108,4 @@ function changeMoleculeLabel(draft, action) {
|
|
|
92
108
|
const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.id === id);
|
|
93
109
|
draft.molecules[moleculeIndex].label = label;
|
|
94
110
|
}
|
|
95
|
-
export { addMoleculeHandler, setMoleculeHandler, deleteMoleculeHandler, predictSpectraFromMoleculeHandler, floatMoleculeOverSpectrum, changeMoleculeLabel, };
|
|
111
|
+
export { addMoleculeHandler, setMoleculeHandler, deleteMoleculeHandler, predictSpectraFromMoleculeHandler, floatMoleculeOverSpectrum, changeFloatMoleculePosition, changeMoleculeLabel, };
|
|
@@ -5,9 +5,10 @@ import { getShiftX, lookupPeak, autoPeakPicking, optimizePeaks, } from '../../..
|
|
|
5
5
|
import { options } from '../../toolbar/ToolTypes';
|
|
6
6
|
import getRange from '../helper/getRange';
|
|
7
7
|
function addPeak(draft, mouseCoordinates) {
|
|
8
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
8
9
|
const state = original(draft);
|
|
9
|
-
if (
|
|
10
|
-
const { index } =
|
|
10
|
+
if (activeSpectrum?.id && state) {
|
|
11
|
+
const { index } = activeSpectrum;
|
|
11
12
|
const xShift = 10;
|
|
12
13
|
const startX = mouseCoordinates.x - xShift;
|
|
13
14
|
const endX = mouseCoordinates.x + xShift;
|
|
@@ -31,8 +32,9 @@ function addPeak(draft, mouseCoordinates) {
|
|
|
31
32
|
}
|
|
32
33
|
function addPeaks(draft, action) {
|
|
33
34
|
const state = original(draft);
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
36
|
+
if (activeSpectrum) {
|
|
37
|
+
const { index } = activeSpectrum;
|
|
36
38
|
const datumOriginal = state.data[index];
|
|
37
39
|
const { startX, endX } = action;
|
|
38
40
|
const [from, to] = getRange(draft, { startX, endX });
|
|
@@ -53,8 +55,9 @@ function addPeaks(draft, action) {
|
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
function deletePeak(draft, peakData) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
59
|
+
if (activeSpectrum) {
|
|
60
|
+
const { index } = activeSpectrum;
|
|
58
61
|
const state = original(draft);
|
|
59
62
|
if (peakData == null) {
|
|
60
63
|
draft.data[index].peaks.values = [];
|
|
@@ -67,8 +70,9 @@ function deletePeak(draft, peakData) {
|
|
|
67
70
|
}
|
|
68
71
|
function handleOptimizePeaks(draft, action) {
|
|
69
72
|
const { peaks } = action.payload;
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
74
|
+
if (activeSpectrum?.id) {
|
|
75
|
+
const { index } = activeSpectrum;
|
|
72
76
|
const datum = draft.data[index];
|
|
73
77
|
const [from, to] = draft.xDomain;
|
|
74
78
|
const newPeaks = optimizePeaks(draft.data[index], {
|
|
@@ -80,10 +84,11 @@ function handleOptimizePeaks(draft, action) {
|
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
function handleAutoPeakPicking(draft, autOptions) {
|
|
83
|
-
|
|
87
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
88
|
+
if (activeSpectrum?.id) {
|
|
84
89
|
draft.toolOptions.selectedTool = options.zoom.id;
|
|
85
90
|
draft.toolOptions.selectedOptionPanel = null;
|
|
86
|
-
const { index } =
|
|
91
|
+
const { index } = activeSpectrum;
|
|
87
92
|
const datum = draft.data[index];
|
|
88
93
|
const [from, to] = draft.xDomain;
|
|
89
94
|
const windowFromIndex = xFindClosestIndex(datum.data.x, from);
|
|
@@ -98,8 +103,9 @@ function handleAutoPeakPicking(draft, autOptions) {
|
|
|
98
103
|
}
|
|
99
104
|
function changePeakShapeHandler(draft, action) {
|
|
100
105
|
const { shape, id } = action.payload;
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
107
|
+
if (activeSpectrum?.id) {
|
|
108
|
+
const { index } = activeSpectrum;
|
|
103
109
|
const datum = draft.data[index];
|
|
104
110
|
const peakIndex = datum.peaks.values.findIndex((peak) => peak.id === id);
|
|
105
111
|
if (peakIndex !== -1) {
|
|
@@ -25,7 +25,7 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
25
25
|
if (['auto-check', 'stack'].includes(options.align || '')) {
|
|
26
26
|
dataPerNucleus = draft.data.filter((datum) => datum.info.nucleus === options?.activeTab
|
|
27
27
|
? options.activeTab
|
|
28
|
-
: draft.activeTab && datum.info.dimension === 1);
|
|
28
|
+
: draft.view.spectra.activeTab && datum.info.dimension === 1);
|
|
29
29
|
}
|
|
30
30
|
switch (options.align) {
|
|
31
31
|
case 'auto-check': {
|
|
@@ -53,21 +53,21 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
function setKeyPreferencesHandler(draft, keyCode) {
|
|
56
|
-
const {
|
|
57
|
-
|
|
56
|
+
const { data, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, view, } = draft;
|
|
57
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
58
|
+
if (view.spectra.activeTab) {
|
|
58
59
|
const groupByNucleus = groupByInfoKey('nucleus');
|
|
59
60
|
const spectrumsGroupsList = groupByNucleus(data);
|
|
60
61
|
const level = displayerMode === DISPLAYER_MODE.DM_2D
|
|
61
|
-
? spectrumsGroupsList[activeTab].reduce((acc, datum) => {
|
|
62
|
+
? spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
|
|
62
63
|
acc[datum.id] = datum.processingController.getLevel();
|
|
63
64
|
return acc;
|
|
64
65
|
}, {})
|
|
65
66
|
: null;
|
|
66
67
|
draft.keysPreferences[keyCode] = {
|
|
67
|
-
activeTab,
|
|
68
68
|
activeSpectrum,
|
|
69
69
|
displayerMode,
|
|
70
|
-
|
|
70
|
+
view,
|
|
71
71
|
zoom,
|
|
72
72
|
xDomain,
|
|
73
73
|
xDomains,
|
|
@@ -76,7 +76,7 @@ function setKeyPreferencesHandler(draft, keyCode) {
|
|
|
76
76
|
originDomain,
|
|
77
77
|
level,
|
|
78
78
|
margin,
|
|
79
|
-
data: spectrumsGroupsList[activeTab].reduce((acc, datum) => {
|
|
79
|
+
data: spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
|
|
80
80
|
acc[datum.id] = {
|
|
81
81
|
display: {
|
|
82
82
|
color: datum.display.color,
|
|
@@ -92,15 +92,13 @@ function setKeyPreferencesHandler(draft, keyCode) {
|
|
|
92
92
|
function applyKeyPreferencesHandler(draft, keyCode) {
|
|
93
93
|
const preferences = draft.keysPreferences[keyCode];
|
|
94
94
|
if (preferences) {
|
|
95
|
-
draft.activeTab = preferences.activeTab;
|
|
96
95
|
draft.data.forEach((datum, index) => {
|
|
97
96
|
if (nucleusToString(datum.info.nucleus) === preferences.activeTab) {
|
|
98
97
|
draft.data[index].display = Object.assign(cloneDeep(datum.display), preferences.data[datum.id].display);
|
|
99
98
|
}
|
|
100
99
|
});
|
|
100
|
+
draft.view = preferences.view;
|
|
101
101
|
draft.displayerMode = preferences.displayerMode;
|
|
102
|
-
draft.tabActiveSpectrum = preferences.tabActiveSpectrum;
|
|
103
|
-
draft.activeSpectrum = preferences.activeSpectrum;
|
|
104
102
|
draft.margin = preferences.margin;
|
|
105
103
|
setDomain(draft);
|
|
106
104
|
draft.xDomain = preferences.xDomain;
|
|
@@ -15,7 +15,7 @@ declare function handleChangeRangeRelativeValue(draft: any, action: any): void;
|
|
|
15
15
|
declare function handleChangeRangeSignalValue(draft: any, action: any): void;
|
|
16
16
|
declare function handleChangeRangesSumFlag(draft: any, action: any): void;
|
|
17
17
|
declare function handleUpdateRange(draft: Draft<State>, action: any): void;
|
|
18
|
-
declare function handleShowMultiplicityTrees(draft: Draft<State
|
|
19
|
-
declare function handleShowRangesIntegrals(draft: Draft<State
|
|
20
|
-
declare function handleShowJGraph(draft: Draft<State
|
|
18
|
+
declare function handleShowMultiplicityTrees(draft: Draft<State>, action: any): void;
|
|
19
|
+
declare function handleShowRangesIntegrals(draft: Draft<State>, action: any): void;
|
|
20
|
+
declare function handleShowJGraph(draft: Draft<State>, action: any): void;
|
|
21
21
|
export { handleAutoRangesDetection, handleDeleteRange, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag, handleUpdateRange, handleShowMultiplicityTrees, handleShowRangesIntegrals, handleAutoSpectraRangesDetection, handleShowJGraph, };
|
|
@@ -8,15 +8,25 @@ import { DatumKind, SignalKindsToInclude, } from '../../../data/constants/Signal
|
|
|
8
8
|
import { addRange, changeRangeSignal, detectRanges, updateRangesRelativeValues, changeRange, changeRangeRelativeValue, updateXShift, } from '../../../data/data1d/Spectrum1D';
|
|
9
9
|
import { setSumOptions } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
10
10
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/RangeUtilities';
|
|
11
|
+
import { rangeStateInit } from '../Reducer';
|
|
11
12
|
import getRange from '../helper/getRange';
|
|
12
13
|
import { handleUpdateCorrelations } from './CorrelationsActions';
|
|
13
14
|
import { setDomain, setIntegralsYDomain } from './DomainActions';
|
|
14
15
|
import { resetSelectedTool } from './ToolsActions';
|
|
15
16
|
function handleAutoRangesDetection(draft, options) {
|
|
16
|
-
const {
|
|
17
|
+
const { data, xDomain, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
18
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
17
19
|
if (activeSpectrum?.id) {
|
|
18
|
-
const { index } = activeSpectrum;
|
|
20
|
+
const { index, id } = activeSpectrum;
|
|
19
21
|
const datum = data[index];
|
|
22
|
+
// add range intial state
|
|
23
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
24
|
+
if (!range) {
|
|
25
|
+
draft.view.ranges.push({
|
|
26
|
+
spectrumID: id,
|
|
27
|
+
...rangeStateInit,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
20
30
|
const [from, to] = xDomain;
|
|
21
31
|
const windowFromIndex = xFindClosestIndex(datum.data.x, from);
|
|
22
32
|
const windowToIndex = xFindClosestIndex(datum.data.x, to);
|
|
@@ -50,7 +60,7 @@ function handleAutoSpectraRangesDetection(draft) {
|
|
|
50
60
|
clean: true,
|
|
51
61
|
keepPeaks: true,
|
|
52
62
|
};
|
|
53
|
-
const { data, activeTab: nucleus, molecules } = draft;
|
|
63
|
+
const { data, view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
|
|
54
64
|
for (const datum of data) {
|
|
55
65
|
if (datum.info.dimension === 1) {
|
|
56
66
|
detectRanges(datum, { peakPicking, molecules, nucleus });
|
|
@@ -62,8 +72,9 @@ function getRangeIndex(draft, spectrumIndex, rangeID) {
|
|
|
62
72
|
return draft.data[spectrumIndex].ranges.values.findIndex((range) => range.id === rangeID);
|
|
63
73
|
}
|
|
64
74
|
function handleDeleteRange(draft, action) {
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
76
|
+
if (activeSpectrum?.id) {
|
|
77
|
+
const { index } = activeSpectrum;
|
|
67
78
|
const { data, resetSelectTool = false } = action.payload;
|
|
68
79
|
const { id = null, assignmentData } = data;
|
|
69
80
|
const datum = draft.data[index];
|
|
@@ -85,8 +96,9 @@ function handleDeleteRange(draft, action) {
|
|
|
85
96
|
}
|
|
86
97
|
function handleChangeRangeSignalKind(draft, action) {
|
|
87
98
|
const state = original(draft);
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
100
|
+
if (activeSpectrum?.id) {
|
|
101
|
+
const { index } = activeSpectrum;
|
|
90
102
|
const { rowData, value } = action.payload.data;
|
|
91
103
|
const rangeIndex = getRangeIndex(state, index, rowData.id);
|
|
92
104
|
const _range = draft.data[index].ranges.values[rangeIndex];
|
|
@@ -102,8 +114,9 @@ function handleChangeRangeSignalKind(draft, action) {
|
|
|
102
114
|
}
|
|
103
115
|
function handleSaveEditedRange(draft, action) {
|
|
104
116
|
const state = original(draft);
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
118
|
+
if (activeSpectrum?.id) {
|
|
119
|
+
const { index } = activeSpectrum;
|
|
107
120
|
const { editedRowData, assignmentData } = action.payload;
|
|
108
121
|
// remove assignments in global state
|
|
109
122
|
const _editedRowData = unlink(editedRowData);
|
|
@@ -144,8 +157,9 @@ function handleDeleteSignal(draft, action) {
|
|
|
144
157
|
}
|
|
145
158
|
}
|
|
146
159
|
function handleUnlinkRange(draft, action) {
|
|
147
|
-
|
|
148
|
-
|
|
160
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
161
|
+
if (activeSpectrum?.id) {
|
|
162
|
+
const { index } = activeSpectrum;
|
|
149
163
|
const { assignmentData, rangeData = null, signalIndex = -1, } = action.payload;
|
|
150
164
|
// remove assignments in global state
|
|
151
165
|
if (rangeData) {
|
|
@@ -178,8 +192,9 @@ function handleUnlinkRange(draft, action) {
|
|
|
178
192
|
}
|
|
179
193
|
}
|
|
180
194
|
function handleSetDiaIDRange(draft, action) {
|
|
181
|
-
|
|
182
|
-
|
|
195
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
196
|
+
if (activeSpectrum?.id) {
|
|
197
|
+
const { index } = activeSpectrum;
|
|
183
198
|
const { rangeData, diaIDs, signalIndex, nbAtoms } = action.payload;
|
|
184
199
|
const getNbAtoms = (input, current = 0) => input + current;
|
|
185
200
|
const rangeIndex = getRangeIndex(draft, index, rangeData.id);
|
|
@@ -196,13 +211,15 @@ function handleSetDiaIDRange(draft, action) {
|
|
|
196
211
|
}
|
|
197
212
|
}
|
|
198
213
|
function handleResizeRange(draft, action) {
|
|
199
|
-
|
|
200
|
-
|
|
214
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
215
|
+
if (activeSpectrum?.id) {
|
|
216
|
+
const { index } = activeSpectrum;
|
|
201
217
|
changeRange(draft.data[index], action.data);
|
|
202
218
|
}
|
|
203
219
|
}
|
|
204
220
|
function handleChangeRangeSum(draft, options) {
|
|
205
|
-
const { data,
|
|
221
|
+
const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
222
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
206
223
|
if (activeSpectrum?.id) {
|
|
207
224
|
const { index } = activeSpectrum;
|
|
208
225
|
const datum = data[index];
|
|
@@ -213,10 +230,19 @@ function handleChangeRangeSum(draft, options) {
|
|
|
213
230
|
function addNewRange(draft, props) {
|
|
214
231
|
const { startX, endX, id } = props;
|
|
215
232
|
const range = getRange(draft, { startX, endX });
|
|
216
|
-
const {
|
|
233
|
+
const { view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
|
|
234
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
217
235
|
if (activeSpectrum?.id) {
|
|
218
236
|
const { index } = activeSpectrum;
|
|
219
237
|
const [from, to] = range;
|
|
238
|
+
// add range intial state
|
|
239
|
+
const rangeState = draft.view.ranges.find((r) => r.spectrumID === activeSpectrum.id);
|
|
240
|
+
if (!rangeState) {
|
|
241
|
+
draft.view.ranges.push({
|
|
242
|
+
spectrumID: activeSpectrum.id,
|
|
243
|
+
...rangeStateInit,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
220
246
|
addRange(draft.data[index], {
|
|
221
247
|
from,
|
|
222
248
|
to,
|
|
@@ -276,8 +302,9 @@ function handleChangeRangesSumFlag(draft, action) {
|
|
|
276
302
|
}
|
|
277
303
|
function handleUpdateRange(draft, action) {
|
|
278
304
|
const { range, resetSelectTool = false } = action.payload;
|
|
279
|
-
|
|
280
|
-
|
|
305
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
306
|
+
if (activeSpectrum?.id && range.id) {
|
|
307
|
+
const datum = draft.data[activeSpectrum?.index];
|
|
281
308
|
const index = datum.ranges.values.findIndex((_range) => _range.id === range.id);
|
|
282
309
|
datum.ranges.values[index] = range;
|
|
283
310
|
}
|
|
@@ -285,15 +312,46 @@ function handleUpdateRange(draft, action) {
|
|
|
285
312
|
resetSelectedTool(draft);
|
|
286
313
|
}
|
|
287
314
|
}
|
|
288
|
-
function handleShowMultiplicityTrees(draft) {
|
|
289
|
-
|
|
290
|
-
|
|
315
|
+
function handleShowMultiplicityTrees(draft, action) {
|
|
316
|
+
const { id } = action.payload;
|
|
317
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
318
|
+
if (range) {
|
|
319
|
+
range.showMultiplicityTrees = !range.showMultiplicityTrees;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
draft.view.ranges.push({
|
|
323
|
+
spectrumID: id,
|
|
324
|
+
...rangeStateInit,
|
|
325
|
+
showMultiplicityTrees: !rangeStateInit.showMultiplicityTrees,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
291
328
|
}
|
|
292
|
-
function handleShowRangesIntegrals(draft) {
|
|
293
|
-
|
|
294
|
-
|
|
329
|
+
function handleShowRangesIntegrals(draft, action) {
|
|
330
|
+
const { id } = action.payload;
|
|
331
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
332
|
+
if (range) {
|
|
333
|
+
range.showRangesIntegrals = !range.showRangesIntegrals;
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
draft.view.ranges.push({
|
|
337
|
+
spectrumID: id,
|
|
338
|
+
...rangeStateInit,
|
|
339
|
+
showRangesIntegrals: !rangeStateInit.showRangesIntegrals,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
295
342
|
}
|
|
296
|
-
function handleShowJGraph(draft) {
|
|
297
|
-
|
|
343
|
+
function handleShowJGraph(draft, action) {
|
|
344
|
+
const { id } = action.payload;
|
|
345
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
346
|
+
if (range) {
|
|
347
|
+
range.showJGraph = !range.showJGraph;
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
draft.view.ranges.push({
|
|
351
|
+
spectrumID: id,
|
|
352
|
+
...rangeStateInit,
|
|
353
|
+
showJGraph: !rangeStateInit.showJGraph,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
298
356
|
}
|
|
299
357
|
export { handleAutoRangesDetection, handleDeleteRange, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag, handleUpdateRange, handleShowMultiplicityTrees, handleShowRangesIntegrals, handleAutoSpectraRangesDetection, handleShowJGraph, };
|
|
@@ -5,28 +5,28 @@ function analyzeSpectra(draft, action) {
|
|
|
5
5
|
MultipleAnalysis.analyzeSpectra(draft.data, draft.spectraAnalysis, {
|
|
6
6
|
from,
|
|
7
7
|
to,
|
|
8
|
-
nucleus: draft.activeTab,
|
|
8
|
+
nucleus: draft.view.spectra.activeTab,
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
function handleDeleteSpectraRanges(draft, action) {
|
|
12
12
|
const { colKey } = action;
|
|
13
|
-
MultipleAnalysis.deleteSpectraAnalysis(draft.spectraAnalysis, colKey, draft.activeTab);
|
|
13
|
+
MultipleAnalysis.deleteSpectraAnalysis(draft.spectraAnalysis, colKey, draft.view.spectra.activeTab);
|
|
14
14
|
}
|
|
15
15
|
function handleResizeSpectraRange(draft, action) {
|
|
16
16
|
const { columnKey, from, to } = action.payload;
|
|
17
17
|
MultipleAnalysis.analyzeSpectra(draft.data, draft.spectraAnalysis, {
|
|
18
18
|
from,
|
|
19
19
|
to,
|
|
20
|
-
nucleus: draft.activeTab,
|
|
20
|
+
nucleus: draft.view.spectra.activeTab,
|
|
21
21
|
columnKey,
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
function handleSetColumns(draft, action) {
|
|
25
25
|
const data = action.payload;
|
|
26
|
-
MultipleAnalysis.setColumn(draft.spectraAnalysis, draft.activeTab, data);
|
|
26
|
+
MultipleAnalysis.setColumn(draft.spectraAnalysis, draft.view.spectra.activeTab, data);
|
|
27
27
|
}
|
|
28
28
|
function handleFilterColumn(draft, action) {
|
|
29
29
|
const { columnKey, valueKey } = action.payload;
|
|
30
|
-
MultipleAnalysis.changeColumnValueKey(draft.spectraAnalysis, draft.activeTab, columnKey, valueKey);
|
|
30
|
+
MultipleAnalysis.changeColumnValueKey(draft.spectraAnalysis, draft.view.spectra.activeTab, columnKey, valueKey);
|
|
31
31
|
}
|
|
32
32
|
export { analyzeSpectra, handleDeleteSpectraRanges, handleResizeSpectraRange, handleSetColumns, handleFilterColumn, };
|
|
@@ -65,10 +65,10 @@ function handleChangePeaksMarkersVisibility(draft, data) {
|
|
|
65
65
|
}
|
|
66
66
|
function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
67
67
|
let refreshDomain = false;
|
|
68
|
-
const currentActiveSpectrum = draft.
|
|
68
|
+
const currentActiveSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
69
69
|
if (activeSpectrum) {
|
|
70
70
|
const newIndex = draft.data.findIndex((d) => d.id === activeSpectrum.id);
|
|
71
|
-
const oldIndex = draft.data.findIndex((d) => d.id ===
|
|
71
|
+
const oldIndex = draft.data.findIndex((d) => d.id === currentActiveSpectrum?.id);
|
|
72
72
|
if (newIndex !== -1) {
|
|
73
73
|
const newActiveSpectrum = draft.data[newIndex];
|
|
74
74
|
newActiveSpectrum.display.isVisible = true;
|
|
@@ -82,8 +82,8 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
activeSpectrum = { ...activeSpectrum, index: newIndex };
|
|
85
|
-
draft.
|
|
86
|
-
|
|
85
|
+
draft.view.spectra.activeSpectra[draft.view.spectra.activeTab] =
|
|
86
|
+
activeSpectrum;
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
89
89
|
if (currentActiveSpectrum) {
|
|
@@ -93,8 +93,7 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
93
93
|
else {
|
|
94
94
|
refreshDomain = false;
|
|
95
95
|
}
|
|
96
|
-
draft.
|
|
97
|
-
draft.tabActiveSpectrum[draft.activeTab] = null;
|
|
96
|
+
draft.view.spectra.activeSpectra[draft.view.spectra.activeTab] = null;
|
|
98
97
|
}
|
|
99
98
|
if (options[draft.toolOptions.selectedTool].isFilter) {
|
|
100
99
|
draft.toolOptions.selectedTool = options.zoom.id;
|
|
@@ -137,13 +136,17 @@ function handleDeleteSpectra(draft, action) {
|
|
|
137
136
|
else {
|
|
138
137
|
draft.data = [];
|
|
139
138
|
}
|
|
140
|
-
setActiveTab(draft, {
|
|
139
|
+
setActiveTab(draft, {
|
|
140
|
+
tab: draft.view.spectra.activeTab,
|
|
141
|
+
refreshActiveTab: true,
|
|
142
|
+
});
|
|
141
143
|
}
|
|
142
144
|
function addMissingProjectionHandler(draft, action) {
|
|
143
145
|
const state = original(draft);
|
|
144
146
|
const { nucleus } = action;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
148
|
+
if (activeSpectrum?.id) {
|
|
149
|
+
const { index } = activeSpectrum;
|
|
147
150
|
for (let n of nucleus) {
|
|
148
151
|
const datum1D = getMissingProjection(state.data[index], n, draft.usedColors);
|
|
149
152
|
draft.data.push(datum1D);
|
|
@@ -159,7 +162,7 @@ function alignSpectraHandler(draft, action) {
|
|
|
159
162
|
if (draft.data && draft.data.length > 0) {
|
|
160
163
|
for (let datum of draft.data) {
|
|
161
164
|
if (datum.info?.dimension === 1 &&
|
|
162
|
-
datum.info.nucleus === draft.activeTab &&
|
|
165
|
+
datum.info.nucleus === draft.view.spectra.activeTab &&
|
|
163
166
|
!datum.info?.isFid) {
|
|
164
167
|
const shift = getReferenceShift(datum, { ...action.payload });
|
|
165
168
|
applyFilter(datum, [
|