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
|
@@ -23,9 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.handleLoadJsonFile = exports.loadDropFiles = exports.loadJcampFile = exports.initiate = exports.setIsLoading = void 0;
|
|
27
27
|
const nmr_correlation_1 = require("nmr-correlation");
|
|
28
28
|
const SpectraManager_1 = require("../../../data/SpectraManager");
|
|
29
|
+
const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
30
|
+
const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
|
|
29
31
|
const MoleculeManager = __importStar(require("../../../data/molecules/MoleculeManager"));
|
|
30
32
|
const Constants_1 = require("../../panels/SummaryPanel/CorrelationTable/Constants");
|
|
31
33
|
const Reducer_1 = require("../Reducer");
|
|
@@ -108,16 +110,6 @@ function initiate(draft, action) {
|
|
|
108
110
|
return state;
|
|
109
111
|
}
|
|
110
112
|
exports.initiate = initiate;
|
|
111
|
-
function loadJDFFile(draft, actions) {
|
|
112
|
-
const { files } = actions;
|
|
113
|
-
const spectra = (0, SpectraManager_1.addJDFs)(files, draft.usedColors);
|
|
114
|
-
for (const spectrum of spectra) {
|
|
115
|
-
draft.data.push(spectrum);
|
|
116
|
-
}
|
|
117
|
-
(0, ToolsActions_1.setActiveTab)(draft);
|
|
118
|
-
draft.isLoading = false;
|
|
119
|
-
}
|
|
120
|
-
exports.loadJDFFile = loadJDFFile;
|
|
121
113
|
function loadJcampFile(draft, actions) {
|
|
122
114
|
const { files } = actions;
|
|
123
115
|
const spectra = (0, SpectraManager_1.addJcamps)(files, draft.usedColors);
|
|
@@ -142,32 +134,22 @@ function handleLoadJsonFile(draft, action) {
|
|
|
142
134
|
return state;
|
|
143
135
|
}
|
|
144
136
|
exports.handleLoadJsonFile = handleLoadJsonFile;
|
|
145
|
-
function
|
|
146
|
-
const {
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
function loadDropFiles(draft, actions) {
|
|
138
|
+
const { data, usedColors } = actions;
|
|
139
|
+
const { spectra, molecules } = data;
|
|
140
|
+
for (let spectrum of spectra) {
|
|
141
|
+
const { info } = spectrum;
|
|
142
|
+
if (info.dimension === 1) {
|
|
143
|
+
draft.data.push((0, Spectrum1D_1.initiateDatum1D)(spectrum, usedColors));
|
|
144
|
+
}
|
|
145
|
+
else if (info.dimension === 2) {
|
|
146
|
+
draft.data.push((0, Spectrum2D_1.initiateDatum2D)(spectrum, usedColors));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
for (let molecule of molecules) {
|
|
150
|
+
MoleculeManager.addMolfile(draft.molecules, molecule.molfile);
|
|
149
151
|
}
|
|
150
|
-
draft.isLoading = false;
|
|
151
|
-
}
|
|
152
|
-
exports.handleLoadMOLFile = handleLoadMOLFile;
|
|
153
|
-
function handleLoadZIPFile(draft, action) {
|
|
154
|
-
const { data, usedColors } = action.payload;
|
|
155
|
-
draft.data = draft.data.concat(data);
|
|
156
|
-
setColors(draft, usedColors);
|
|
157
152
|
(0, ToolsActions_1.setActiveTab)(draft);
|
|
158
|
-
(0, PreferencesActions_1.changeSpectrumVerticalAlignment)(draft, { align: 'auto-check' });
|
|
159
153
|
draft.isLoading = false;
|
|
160
154
|
}
|
|
161
|
-
exports.
|
|
162
|
-
function handleLoadNmredata(draft, action) {
|
|
163
|
-
const state = (0, Reducer_1.getInitialState)();
|
|
164
|
-
setData(state, action.payload);
|
|
165
|
-
(0, ToolsActions_1.setActiveTab)(state);
|
|
166
|
-
(0, PreferencesActions_1.changeSpectrumVerticalAlignment)(state, { align: 'auto-check' });
|
|
167
|
-
state.isLoading = false;
|
|
168
|
-
state.width = draft.width;
|
|
169
|
-
state.height = draft.height;
|
|
170
|
-
state.actionType = Types_1.LOAD_NMREDATA_FILE;
|
|
171
|
-
return state;
|
|
172
|
-
}
|
|
173
|
-
exports.handleLoadNmredata = handleLoadNmredata;
|
|
155
|
+
exports.loadDropFiles = loadDropFiles;
|
|
@@ -26,11 +26,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.changeMoleculeLabel = exports.floatMoleculeOverSpectrum = exports.predictSpectraFromMoleculeHandler = exports.deleteMoleculeHandler = exports.setMoleculeHandler = exports.addMoleculeHandler = void 0;
|
|
29
|
+
exports.changeMoleculeLabel = exports.changeFloatMoleculePosition = exports.floatMoleculeOverSpectrum = exports.predictSpectraFromMoleculeHandler = exports.deleteMoleculeHandler = exports.setMoleculeHandler = exports.addMoleculeHandler = void 0;
|
|
30
30
|
const PredictionManager_1 = require("../../../data/PredictionManager");
|
|
31
31
|
const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
|
|
32
32
|
const MoleculeManager = __importStar(require("../../../data/molecules/MoleculeManager"));
|
|
33
33
|
const getColor_1 = __importDefault(require("../../../data/utilities/getColor"));
|
|
34
|
+
const DraggableStructure_1 = require("../../tool/FloatMoleculeStructures/DraggableStructure");
|
|
34
35
|
const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
|
|
35
36
|
const Constants_1 = require("../core/Constants");
|
|
36
37
|
const RangesActions_1 = require("./RangesActions");
|
|
@@ -97,10 +98,11 @@ function predictSpectraFromMoleculeHandler(draft, action) {
|
|
|
97
98
|
const color = (0, getColor_1.default)(false, draft.usedColors['1d']);
|
|
98
99
|
for (const spectrum of (0, PredictionManager_1.generateSpectra)(data, options, color)) {
|
|
99
100
|
draft.data.push(spectrum);
|
|
100
|
-
draft.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
draft.view.spectra.activeSpectra[(0, nucleusToString_1.default)(spectrum.info.nucleus)] =
|
|
102
|
+
{
|
|
103
|
+
id: spectrum.id,
|
|
104
|
+
index: draft.data.length - 1,
|
|
105
|
+
};
|
|
104
106
|
}
|
|
105
107
|
draft.usedColors['1d'].push(color);
|
|
106
108
|
}
|
|
@@ -117,10 +119,25 @@ function floatMoleculeOverSpectrum(draft, action) {
|
|
|
117
119
|
!draft.view.floatingMolecules[moleculeIndex].visible;
|
|
118
120
|
}
|
|
119
121
|
else {
|
|
120
|
-
draft.view.floatingMolecules.push({
|
|
122
|
+
draft.view.floatingMolecules.push({
|
|
123
|
+
id,
|
|
124
|
+
visible: true,
|
|
125
|
+
position: DraggableStructure_1.DRAGGABLE_STRUCTURE_INITIAL_POSITION,
|
|
126
|
+
});
|
|
121
127
|
}
|
|
122
128
|
}
|
|
123
129
|
exports.floatMoleculeOverSpectrum = floatMoleculeOverSpectrum;
|
|
130
|
+
function changeFloatMoleculePosition(draft, action) {
|
|
131
|
+
const { id, position } = action.payload;
|
|
132
|
+
const molecule = draft.view.floatingMolecules.find((m) => m.id === id);
|
|
133
|
+
if (molecule) {
|
|
134
|
+
molecule.position = position;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
throw new Error(`Molecule ${id} does not exist`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.changeFloatMoleculePosition = changeFloatMoleculePosition;
|
|
124
141
|
function changeMoleculeLabel(draft, action) {
|
|
125
142
|
const { id, label } = action.payload;
|
|
126
143
|
const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.id === id);
|
|
@@ -11,9 +11,10 @@ const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
|
11
11
|
const ToolTypes_1 = require("../../toolbar/ToolTypes");
|
|
12
12
|
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
13
13
|
function addPeak(draft, mouseCoordinates) {
|
|
14
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
14
15
|
const state = (0, immer_1.original)(draft);
|
|
15
|
-
if (
|
|
16
|
-
const { index } =
|
|
16
|
+
if (activeSpectrum?.id && state) {
|
|
17
|
+
const { index } = activeSpectrum;
|
|
17
18
|
const xShift = 10;
|
|
18
19
|
const startX = mouseCoordinates.x - xShift;
|
|
19
20
|
const endX = mouseCoordinates.x + xShift;
|
|
@@ -38,8 +39,9 @@ function addPeak(draft, mouseCoordinates) {
|
|
|
38
39
|
exports.addPeak = addPeak;
|
|
39
40
|
function addPeaks(draft, action) {
|
|
40
41
|
const state = (0, immer_1.original)(draft);
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
43
|
+
if (activeSpectrum) {
|
|
44
|
+
const { index } = activeSpectrum;
|
|
43
45
|
const datumOriginal = state.data[index];
|
|
44
46
|
const { startX, endX } = action;
|
|
45
47
|
const [from, to] = (0, getRange_1.default)(draft, { startX, endX });
|
|
@@ -61,8 +63,9 @@ function addPeaks(draft, action) {
|
|
|
61
63
|
}
|
|
62
64
|
exports.addPeaks = addPeaks;
|
|
63
65
|
function deletePeak(draft, peakData) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
67
|
+
if (activeSpectrum) {
|
|
68
|
+
const { index } = activeSpectrum;
|
|
66
69
|
const state = (0, immer_1.original)(draft);
|
|
67
70
|
if (peakData == null) {
|
|
68
71
|
draft.data[index].peaks.values = [];
|
|
@@ -76,8 +79,9 @@ function deletePeak(draft, peakData) {
|
|
|
76
79
|
exports.deletePeak = deletePeak;
|
|
77
80
|
function handleOptimizePeaks(draft, action) {
|
|
78
81
|
const { peaks } = action.payload;
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
83
|
+
if (activeSpectrum?.id) {
|
|
84
|
+
const { index } = activeSpectrum;
|
|
81
85
|
const datum = draft.data[index];
|
|
82
86
|
const [from, to] = draft.xDomain;
|
|
83
87
|
const newPeaks = (0, Spectrum1D_1.optimizePeaks)(draft.data[index], {
|
|
@@ -90,10 +94,11 @@ function handleOptimizePeaks(draft, action) {
|
|
|
90
94
|
}
|
|
91
95
|
exports.handleOptimizePeaks = handleOptimizePeaks;
|
|
92
96
|
function handleAutoPeakPicking(draft, autOptions) {
|
|
93
|
-
|
|
97
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
98
|
+
if (activeSpectrum?.id) {
|
|
94
99
|
draft.toolOptions.selectedTool = ToolTypes_1.options.zoom.id;
|
|
95
100
|
draft.toolOptions.selectedOptionPanel = null;
|
|
96
|
-
const { index } =
|
|
101
|
+
const { index } = activeSpectrum;
|
|
97
102
|
const datum = draft.data[index];
|
|
98
103
|
const [from, to] = draft.xDomain;
|
|
99
104
|
const windowFromIndex = (0, ml_spectra_processing_1.xFindClosestIndex)(datum.data.x, from);
|
|
@@ -109,8 +114,9 @@ function handleAutoPeakPicking(draft, autOptions) {
|
|
|
109
114
|
exports.handleAutoPeakPicking = handleAutoPeakPicking;
|
|
110
115
|
function changePeakShapeHandler(draft, action) {
|
|
111
116
|
const { shape, id } = action.payload;
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
118
|
+
if (activeSpectrum?.id) {
|
|
119
|
+
const { index } = activeSpectrum;
|
|
114
120
|
const datum = draft.data[index];
|
|
115
121
|
const peakIndex = datum.peaks.values.findIndex((peak) => peak.id === id);
|
|
116
122
|
if (peakIndex !== -1) {
|
|
@@ -31,7 +31,7 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
31
31
|
if (['auto-check', 'stack'].includes(options.align || '')) {
|
|
32
32
|
dataPerNucleus = draft.data.filter((datum) => datum.info.nucleus === options?.activeTab
|
|
33
33
|
? options.activeTab
|
|
34
|
-
: draft.activeTab && datum.info.dimension === 1);
|
|
34
|
+
: draft.view.spectra.activeTab && datum.info.dimension === 1);
|
|
35
35
|
}
|
|
36
36
|
switch (options.align) {
|
|
37
37
|
case 'auto-check': {
|
|
@@ -60,21 +60,21 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
60
60
|
}
|
|
61
61
|
exports.changeSpectrumVerticalAlignment = changeSpectrumVerticalAlignment;
|
|
62
62
|
function setKeyPreferencesHandler(draft, keyCode) {
|
|
63
|
-
const {
|
|
64
|
-
|
|
63
|
+
const { data, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, view, } = draft;
|
|
64
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
65
|
+
if (view.spectra.activeTab) {
|
|
65
66
|
const groupByNucleus = (0, GroupByInfoKey_1.default)('nucleus');
|
|
66
67
|
const spectrumsGroupsList = groupByNucleus(data);
|
|
67
68
|
const level = displayerMode === Constants_1.DISPLAYER_MODE.DM_2D
|
|
68
|
-
? spectrumsGroupsList[activeTab].reduce((acc, datum) => {
|
|
69
|
+
? spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
|
|
69
70
|
acc[datum.id] = datum.processingController.getLevel();
|
|
70
71
|
return acc;
|
|
71
72
|
}, {})
|
|
72
73
|
: null;
|
|
73
74
|
draft.keysPreferences[keyCode] = {
|
|
74
|
-
activeTab,
|
|
75
75
|
activeSpectrum,
|
|
76
76
|
displayerMode,
|
|
77
|
-
|
|
77
|
+
view,
|
|
78
78
|
zoom,
|
|
79
79
|
xDomain,
|
|
80
80
|
xDomains,
|
|
@@ -83,7 +83,7 @@ function setKeyPreferencesHandler(draft, keyCode) {
|
|
|
83
83
|
originDomain,
|
|
84
84
|
level,
|
|
85
85
|
margin,
|
|
86
|
-
data: spectrumsGroupsList[activeTab].reduce((acc, datum) => {
|
|
86
|
+
data: spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
|
|
87
87
|
acc[datum.id] = {
|
|
88
88
|
display: {
|
|
89
89
|
color: datum.display.color,
|
|
@@ -100,15 +100,13 @@ exports.setKeyPreferencesHandler = setKeyPreferencesHandler;
|
|
|
100
100
|
function applyKeyPreferencesHandler(draft, keyCode) {
|
|
101
101
|
const preferences = draft.keysPreferences[keyCode];
|
|
102
102
|
if (preferences) {
|
|
103
|
-
draft.activeTab = preferences.activeTab;
|
|
104
103
|
draft.data.forEach((datum, index) => {
|
|
105
104
|
if ((0, nucleusToString_1.default)(datum.info.nucleus) === preferences.activeTab) {
|
|
106
105
|
draft.data[index].display = Object.assign((0, cloneDeep_1.default)(datum.display), preferences.data[datum.id].display);
|
|
107
106
|
}
|
|
108
107
|
});
|
|
108
|
+
draft.view = preferences.view;
|
|
109
109
|
draft.displayerMode = preferences.displayerMode;
|
|
110
|
-
draft.tabActiveSpectrum = preferences.tabActiveSpectrum;
|
|
111
|
-
draft.activeSpectrum = preferences.activeSpectrum;
|
|
112
110
|
draft.margin = preferences.margin;
|
|
113
111
|
(0, DomainActions_1.setDomain)(draft);
|
|
114
112
|
draft.xDomain = preferences.xDomain;
|
|
@@ -37,15 +37,25 @@ const SignalsKinds_1 = require("../../../data/constants/SignalsKinds");
|
|
|
37
37
|
const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
38
38
|
const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
|
|
39
39
|
const RangeUtilities_1 = require("../../../data/utilities/RangeUtilities");
|
|
40
|
+
const Reducer_1 = require("../Reducer");
|
|
40
41
|
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
41
42
|
const CorrelationsActions_1 = require("./CorrelationsActions");
|
|
42
43
|
const DomainActions_1 = require("./DomainActions");
|
|
43
44
|
const ToolsActions_1 = require("./ToolsActions");
|
|
44
45
|
function handleAutoRangesDetection(draft, options) {
|
|
45
|
-
const {
|
|
46
|
+
const { data, xDomain, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
47
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
46
48
|
if (activeSpectrum?.id) {
|
|
47
|
-
const { index } = activeSpectrum;
|
|
49
|
+
const { index, id } = activeSpectrum;
|
|
48
50
|
const datum = data[index];
|
|
51
|
+
// add range intial state
|
|
52
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
53
|
+
if (!range) {
|
|
54
|
+
draft.view.ranges.push({
|
|
55
|
+
spectrumID: id,
|
|
56
|
+
...Reducer_1.rangeStateInit,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
49
59
|
const [from, to] = xDomain;
|
|
50
60
|
const windowFromIndex = (0, ml_spectra_processing_1.xFindClosestIndex)(datum.data.x, from);
|
|
51
61
|
const windowToIndex = (0, ml_spectra_processing_1.xFindClosestIndex)(datum.data.x, to);
|
|
@@ -80,7 +90,7 @@ function handleAutoSpectraRangesDetection(draft) {
|
|
|
80
90
|
clean: true,
|
|
81
91
|
keepPeaks: true,
|
|
82
92
|
};
|
|
83
|
-
const { data, activeTab: nucleus, molecules } = draft;
|
|
93
|
+
const { data, view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
|
|
84
94
|
for (const datum of data) {
|
|
85
95
|
if (datum.info.dimension === 1) {
|
|
86
96
|
(0, Spectrum1D_1.detectRanges)(datum, { peakPicking, molecules, nucleus });
|
|
@@ -93,8 +103,9 @@ function getRangeIndex(draft, spectrumIndex, rangeID) {
|
|
|
93
103
|
return draft.data[spectrumIndex].ranges.values.findIndex((range) => range.id === rangeID);
|
|
94
104
|
}
|
|
95
105
|
function handleDeleteRange(draft, action) {
|
|
96
|
-
|
|
97
|
-
|
|
106
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
107
|
+
if (activeSpectrum?.id) {
|
|
108
|
+
const { index } = activeSpectrum;
|
|
98
109
|
const { data, resetSelectTool = false } = action.payload;
|
|
99
110
|
const { id = null, assignmentData } = data;
|
|
100
111
|
const datum = draft.data[index];
|
|
@@ -117,8 +128,9 @@ function handleDeleteRange(draft, action) {
|
|
|
117
128
|
exports.handleDeleteRange = handleDeleteRange;
|
|
118
129
|
function handleChangeRangeSignalKind(draft, action) {
|
|
119
130
|
const state = (0, immer_1.original)(draft);
|
|
120
|
-
|
|
121
|
-
|
|
131
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
132
|
+
if (activeSpectrum?.id) {
|
|
133
|
+
const { index } = activeSpectrum;
|
|
122
134
|
const { rowData, value } = action.payload.data;
|
|
123
135
|
const rangeIndex = getRangeIndex(state, index, rowData.id);
|
|
124
136
|
const _range = draft.data[index].ranges.values[rangeIndex];
|
|
@@ -135,8 +147,9 @@ function handleChangeRangeSignalKind(draft, action) {
|
|
|
135
147
|
exports.handleChangeRangeSignalKind = handleChangeRangeSignalKind;
|
|
136
148
|
function handleSaveEditedRange(draft, action) {
|
|
137
149
|
const state = (0, immer_1.original)(draft);
|
|
138
|
-
|
|
139
|
-
|
|
150
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
151
|
+
if (activeSpectrum?.id) {
|
|
152
|
+
const { index } = activeSpectrum;
|
|
140
153
|
const { editedRowData, assignmentData } = action.payload;
|
|
141
154
|
// remove assignments in global state
|
|
142
155
|
const _editedRowData = (0, RangeUtilities_1.unlink)(editedRowData);
|
|
@@ -179,8 +192,9 @@ function handleDeleteSignal(draft, action) {
|
|
|
179
192
|
}
|
|
180
193
|
exports.handleDeleteSignal = handleDeleteSignal;
|
|
181
194
|
function handleUnlinkRange(draft, action) {
|
|
182
|
-
|
|
183
|
-
|
|
195
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
196
|
+
if (activeSpectrum?.id) {
|
|
197
|
+
const { index } = activeSpectrum;
|
|
184
198
|
const { assignmentData, rangeData = null, signalIndex = -1, } = action.payload;
|
|
185
199
|
// remove assignments in global state
|
|
186
200
|
if (rangeData) {
|
|
@@ -214,8 +228,9 @@ function handleUnlinkRange(draft, action) {
|
|
|
214
228
|
}
|
|
215
229
|
exports.handleUnlinkRange = handleUnlinkRange;
|
|
216
230
|
function handleSetDiaIDRange(draft, action) {
|
|
217
|
-
|
|
218
|
-
|
|
231
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
232
|
+
if (activeSpectrum?.id) {
|
|
233
|
+
const { index } = activeSpectrum;
|
|
219
234
|
const { rangeData, diaIDs, signalIndex, nbAtoms } = action.payload;
|
|
220
235
|
const getNbAtoms = (input, current = 0) => input + current;
|
|
221
236
|
const rangeIndex = getRangeIndex(draft, index, rangeData.id);
|
|
@@ -233,14 +248,16 @@ function handleSetDiaIDRange(draft, action) {
|
|
|
233
248
|
}
|
|
234
249
|
exports.handleSetDiaIDRange = handleSetDiaIDRange;
|
|
235
250
|
function handleResizeRange(draft, action) {
|
|
236
|
-
|
|
237
|
-
|
|
251
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
252
|
+
if (activeSpectrum?.id) {
|
|
253
|
+
const { index } = activeSpectrum;
|
|
238
254
|
(0, Spectrum1D_1.changeRange)(draft.data[index], action.data);
|
|
239
255
|
}
|
|
240
256
|
}
|
|
241
257
|
exports.handleResizeRange = handleResizeRange;
|
|
242
258
|
function handleChangeRangeSum(draft, options) {
|
|
243
|
-
const { data,
|
|
259
|
+
const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
260
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
244
261
|
if (activeSpectrum?.id) {
|
|
245
262
|
const { index } = activeSpectrum;
|
|
246
263
|
const datum = data[index];
|
|
@@ -252,10 +269,19 @@ exports.handleChangeRangeSum = handleChangeRangeSum;
|
|
|
252
269
|
function addNewRange(draft, props) {
|
|
253
270
|
const { startX, endX, id } = props;
|
|
254
271
|
const range = (0, getRange_1.default)(draft, { startX, endX });
|
|
255
|
-
const {
|
|
272
|
+
const { view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
|
|
273
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
256
274
|
if (activeSpectrum?.id) {
|
|
257
275
|
const { index } = activeSpectrum;
|
|
258
276
|
const [from, to] = range;
|
|
277
|
+
// add range intial state
|
|
278
|
+
const rangeState = draft.view.ranges.find((r) => r.spectrumID === activeSpectrum.id);
|
|
279
|
+
if (!rangeState) {
|
|
280
|
+
draft.view.ranges.push({
|
|
281
|
+
spectrumID: activeSpectrum.id,
|
|
282
|
+
...Reducer_1.rangeStateInit,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
259
285
|
(0, Spectrum1D_1.addRange)(draft.data[index], {
|
|
260
286
|
from,
|
|
261
287
|
to,
|
|
@@ -319,8 +345,9 @@ function handleChangeRangesSumFlag(draft, action) {
|
|
|
319
345
|
exports.handleChangeRangesSumFlag = handleChangeRangesSumFlag;
|
|
320
346
|
function handleUpdateRange(draft, action) {
|
|
321
347
|
const { range, resetSelectTool = false } = action.payload;
|
|
322
|
-
|
|
323
|
-
|
|
348
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
349
|
+
if (activeSpectrum?.id && range.id) {
|
|
350
|
+
const datum = draft.data[activeSpectrum?.index];
|
|
324
351
|
const index = datum.ranges.values.findIndex((_range) => _range.id === range.id);
|
|
325
352
|
datum.ranges.values[index] = range;
|
|
326
353
|
}
|
|
@@ -329,17 +356,48 @@ function handleUpdateRange(draft, action) {
|
|
|
329
356
|
}
|
|
330
357
|
}
|
|
331
358
|
exports.handleUpdateRange = handleUpdateRange;
|
|
332
|
-
function handleShowMultiplicityTrees(draft) {
|
|
333
|
-
|
|
334
|
-
|
|
359
|
+
function handleShowMultiplicityTrees(draft, action) {
|
|
360
|
+
const { id } = action.payload;
|
|
361
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
362
|
+
if (range) {
|
|
363
|
+
range.showMultiplicityTrees = !range.showMultiplicityTrees;
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
draft.view.ranges.push({
|
|
367
|
+
spectrumID: id,
|
|
368
|
+
...Reducer_1.rangeStateInit,
|
|
369
|
+
showMultiplicityTrees: !Reducer_1.rangeStateInit.showMultiplicityTrees,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
335
372
|
}
|
|
336
373
|
exports.handleShowMultiplicityTrees = handleShowMultiplicityTrees;
|
|
337
|
-
function handleShowRangesIntegrals(draft) {
|
|
338
|
-
|
|
339
|
-
|
|
374
|
+
function handleShowRangesIntegrals(draft, action) {
|
|
375
|
+
const { id } = action.payload;
|
|
376
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
377
|
+
if (range) {
|
|
378
|
+
range.showRangesIntegrals = !range.showRangesIntegrals;
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
draft.view.ranges.push({
|
|
382
|
+
spectrumID: id,
|
|
383
|
+
...Reducer_1.rangeStateInit,
|
|
384
|
+
showRangesIntegrals: !Reducer_1.rangeStateInit.showRangesIntegrals,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
340
387
|
}
|
|
341
388
|
exports.handleShowRangesIntegrals = handleShowRangesIntegrals;
|
|
342
|
-
function handleShowJGraph(draft) {
|
|
343
|
-
|
|
389
|
+
function handleShowJGraph(draft, action) {
|
|
390
|
+
const { id } = action.payload;
|
|
391
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
392
|
+
if (range) {
|
|
393
|
+
range.showJGraph = !range.showJGraph;
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
draft.view.ranges.push({
|
|
397
|
+
spectrumID: id,
|
|
398
|
+
...Reducer_1.rangeStateInit,
|
|
399
|
+
showJGraph: !Reducer_1.rangeStateInit.showJGraph,
|
|
400
|
+
});
|
|
401
|
+
}
|
|
344
402
|
}
|
|
345
403
|
exports.handleShowJGraph = handleShowJGraph;
|
|
@@ -34,13 +34,13 @@ function analyzeSpectra(draft, action) {
|
|
|
34
34
|
MultipleAnalysis.analyzeSpectra(draft.data, draft.spectraAnalysis, {
|
|
35
35
|
from,
|
|
36
36
|
to,
|
|
37
|
-
nucleus: draft.activeTab,
|
|
37
|
+
nucleus: draft.view.spectra.activeTab,
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
exports.analyzeSpectra = analyzeSpectra;
|
|
41
41
|
function handleDeleteSpectraRanges(draft, action) {
|
|
42
42
|
const { colKey } = action;
|
|
43
|
-
MultipleAnalysis.deleteSpectraAnalysis(draft.spectraAnalysis, colKey, draft.activeTab);
|
|
43
|
+
MultipleAnalysis.deleteSpectraAnalysis(draft.spectraAnalysis, colKey, draft.view.spectra.activeTab);
|
|
44
44
|
}
|
|
45
45
|
exports.handleDeleteSpectraRanges = handleDeleteSpectraRanges;
|
|
46
46
|
function handleResizeSpectraRange(draft, action) {
|
|
@@ -48,18 +48,18 @@ function handleResizeSpectraRange(draft, action) {
|
|
|
48
48
|
MultipleAnalysis.analyzeSpectra(draft.data, draft.spectraAnalysis, {
|
|
49
49
|
from,
|
|
50
50
|
to,
|
|
51
|
-
nucleus: draft.activeTab,
|
|
51
|
+
nucleus: draft.view.spectra.activeTab,
|
|
52
52
|
columnKey,
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
exports.handleResizeSpectraRange = handleResizeSpectraRange;
|
|
56
56
|
function handleSetColumns(draft, action) {
|
|
57
57
|
const data = action.payload;
|
|
58
|
-
MultipleAnalysis.setColumn(draft.spectraAnalysis, draft.activeTab, data);
|
|
58
|
+
MultipleAnalysis.setColumn(draft.spectraAnalysis, draft.view.spectra.activeTab, data);
|
|
59
59
|
}
|
|
60
60
|
exports.handleSetColumns = handleSetColumns;
|
|
61
61
|
function handleFilterColumn(draft, action) {
|
|
62
62
|
const { columnKey, valueKey } = action.payload;
|
|
63
|
-
MultipleAnalysis.changeColumnValueKey(draft.spectraAnalysis, draft.activeTab, columnKey, valueKey);
|
|
63
|
+
MultipleAnalysis.changeColumnValueKey(draft.spectraAnalysis, draft.view.spectra.activeTab, columnKey, valueKey);
|
|
64
64
|
}
|
|
65
65
|
exports.handleFilterColumn = handleFilterColumn;
|
|
@@ -96,10 +96,10 @@ function handleChangePeaksMarkersVisibility(draft, data) {
|
|
|
96
96
|
exports.handleChangePeaksMarkersVisibility = handleChangePeaksMarkersVisibility;
|
|
97
97
|
function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
98
98
|
let refreshDomain = false;
|
|
99
|
-
const currentActiveSpectrum = draft.
|
|
99
|
+
const currentActiveSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
100
100
|
if (activeSpectrum) {
|
|
101
101
|
const newIndex = draft.data.findIndex((d) => d.id === activeSpectrum.id);
|
|
102
|
-
const oldIndex = draft.data.findIndex((d) => d.id ===
|
|
102
|
+
const oldIndex = draft.data.findIndex((d) => d.id === currentActiveSpectrum?.id);
|
|
103
103
|
if (newIndex !== -1) {
|
|
104
104
|
const newActiveSpectrum = draft.data[newIndex];
|
|
105
105
|
newActiveSpectrum.display.isVisible = true;
|
|
@@ -113,8 +113,8 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
activeSpectrum = { ...activeSpectrum, index: newIndex };
|
|
116
|
-
draft.
|
|
117
|
-
|
|
116
|
+
draft.view.spectra.activeSpectra[draft.view.spectra.activeTab] =
|
|
117
|
+
activeSpectrum;
|
|
118
118
|
}
|
|
119
119
|
else {
|
|
120
120
|
if (currentActiveSpectrum) {
|
|
@@ -124,8 +124,7 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
124
124
|
else {
|
|
125
125
|
refreshDomain = false;
|
|
126
126
|
}
|
|
127
|
-
draft.
|
|
128
|
-
draft.tabActiveSpectrum[draft.activeTab] = null;
|
|
127
|
+
draft.view.spectra.activeSpectra[draft.view.spectra.activeTab] = null;
|
|
129
128
|
}
|
|
130
129
|
if (ToolTypes_1.options[draft.toolOptions.selectedTool].isFilter) {
|
|
131
130
|
draft.toolOptions.selectedTool = ToolTypes_1.options.zoom.id;
|
|
@@ -171,14 +170,18 @@ function handleDeleteSpectra(draft, action) {
|
|
|
171
170
|
else {
|
|
172
171
|
draft.data = [];
|
|
173
172
|
}
|
|
174
|
-
(0, ToolsActions_1.setActiveTab)(draft, {
|
|
173
|
+
(0, ToolsActions_1.setActiveTab)(draft, {
|
|
174
|
+
tab: draft.view.spectra.activeTab,
|
|
175
|
+
refreshActiveTab: true,
|
|
176
|
+
});
|
|
175
177
|
}
|
|
176
178
|
exports.handleDeleteSpectra = handleDeleteSpectra;
|
|
177
179
|
function addMissingProjectionHandler(draft, action) {
|
|
178
180
|
const state = (0, immer_1.original)(draft);
|
|
179
181
|
const { nucleus } = action;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
183
|
+
if (activeSpectrum?.id) {
|
|
184
|
+
const { index } = activeSpectrum;
|
|
182
185
|
for (let n of nucleus) {
|
|
183
186
|
const datum1D = (0, Spectrum2D_1.getMissingProjection)(state.data[index], n, draft.usedColors);
|
|
184
187
|
draft.data.push(datum1D);
|
|
@@ -195,7 +198,7 @@ function alignSpectraHandler(draft, action) {
|
|
|
195
198
|
if (draft.data && draft.data.length > 0) {
|
|
196
199
|
for (let datum of draft.data) {
|
|
197
200
|
if (datum.info?.dimension === 1 &&
|
|
198
|
-
datum.info.nucleus === draft.activeTab &&
|
|
201
|
+
datum.info.nucleus === draft.view.spectra.activeTab &&
|
|
199
202
|
!datum.info?.isFid) {
|
|
200
203
|
const shift = (0, Spectrum1D_1.getReferenceShift)(datum, { ...action.payload });
|
|
201
204
|
(0, FiltersManager_1.applyFilter)(datum, [
|