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
|
@@ -6,9 +6,11 @@ import { LAYOUT } from '../../2d/utilities/DimensionLayout';
|
|
|
6
6
|
import { get2DYScale } from '../../2d/utilities/scale';
|
|
7
7
|
import { options } from '../../toolbar/ToolTypes';
|
|
8
8
|
import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
9
|
+
import { rangeStateInit } from '../Reducer';
|
|
9
10
|
import { DISPLAYER_MODE, MARGIN } from '../core/Constants';
|
|
10
11
|
import { setZoom, wheelZoom, ZoomType } from '../helper/Zoom1DManager';
|
|
11
12
|
import zoomHistoryManager from '../helper/ZoomHistoryManager';
|
|
13
|
+
import { getActiveSpectrumOrFail } from '../helper/getActiveSpectrumOrFail';
|
|
12
14
|
import { setDomain, setIntegralsYDomain, setMode, } from './DomainActions';
|
|
13
15
|
import { calculateBaseLineCorrection, resetSpectrumByFilter, setFilterChanges, } from './FiltersActions';
|
|
14
16
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
@@ -40,7 +42,18 @@ function setSelectedTool(draft, action) {
|
|
|
40
42
|
if (selectedTool) {
|
|
41
43
|
// start Range edit mode
|
|
42
44
|
if (selectedTool === options.editRange.id) {
|
|
43
|
-
|
|
45
|
+
const activeSpectrum = getActiveSpectrumOrFail(draft);
|
|
46
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === activeSpectrum?.id);
|
|
47
|
+
if (range) {
|
|
48
|
+
range.showMultiplicityTrees = true;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
draft.view.ranges.push({
|
|
52
|
+
spectrumID: activeSpectrum.id,
|
|
53
|
+
...rangeStateInit,
|
|
54
|
+
showMultiplicityTrees: true,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
44
57
|
}
|
|
45
58
|
if (selectedTool !== draft.toolOptions.selectedTool) {
|
|
46
59
|
resetTool(draft, false);
|
|
@@ -116,7 +129,7 @@ function handleBrushEnd(draft, action) {
|
|
|
116
129
|
const endY = yScale.invert(action.endY);
|
|
117
130
|
const domainX = startX > endX ? [endX, startX] : [startX, endX];
|
|
118
131
|
const domainY = startY > endY ? [endY, startY] : [startY, endY];
|
|
119
|
-
const brushHistory = zoomHistoryManager(draft.zoom.history, draft.activeTab);
|
|
132
|
+
const brushHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
|
|
120
133
|
if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
121
134
|
switch (action.trackID) {
|
|
122
135
|
case LAYOUT.CENTER_2D:
|
|
@@ -144,21 +157,25 @@ function handleBrushEnd(draft, action) {
|
|
|
144
157
|
}
|
|
145
158
|
}
|
|
146
159
|
function setVerticalIndicatorXPosition(draft, position) {
|
|
147
|
-
|
|
160
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
161
|
+
if (activeSpectrum?.id) {
|
|
148
162
|
const scaleX = getXScale(draft);
|
|
149
163
|
const value = scaleX.invert(position);
|
|
150
|
-
const datum = draft.data[
|
|
164
|
+
const datum = draft.data[activeSpectrum.index];
|
|
151
165
|
const index = xFindClosestIndex(datum.data.x, value);
|
|
152
166
|
draft.toolOptions.data.pivot = { value, index };
|
|
153
167
|
}
|
|
154
168
|
}
|
|
155
169
|
function getSpectrumID(draft, index) {
|
|
156
|
-
const spectrum = draft.
|
|
157
|
-
return spectrum?.id
|
|
170
|
+
const spectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab.split(',')[index]];
|
|
171
|
+
return spectrum?.id || null;
|
|
158
172
|
}
|
|
159
173
|
function handleZoom(draft, action) {
|
|
160
174
|
const { event, trackID, selectedTool } = action;
|
|
161
|
-
const {
|
|
175
|
+
const { view: { ranges: rangeState }, displayerMode, } = draft;
|
|
176
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
177
|
+
const { showRangesIntegrals } = rangeState.find((r) => r.spectrumID === activeSpectrum?.id) ||
|
|
178
|
+
rangeStateInit;
|
|
162
179
|
if (displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
163
180
|
const index = trackID === LAYOUT.TOP_1D ? 0 : trackID === LAYOUT.LEFT_1D ? 1 : null;
|
|
164
181
|
if (index !== null) {
|
|
@@ -190,7 +207,7 @@ function handleZoom(draft, action) {
|
|
|
190
207
|
function zoomOut(draft, action) {
|
|
191
208
|
if (draft?.data.length > 0) {
|
|
192
209
|
const { zoomType, trackID } = action;
|
|
193
|
-
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.activeTab);
|
|
210
|
+
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
|
|
194
211
|
if (draft.displayerMode === DISPLAYER_MODE.DM_1D) {
|
|
195
212
|
switch (zoomType) {
|
|
196
213
|
case ZoomType.HORIZONTAL: {
|
|
@@ -233,8 +250,8 @@ function zoomOut(draft, action) {
|
|
|
233
250
|
}
|
|
234
251
|
}
|
|
235
252
|
function hasAcceptedSpectrum(draft, index) {
|
|
236
|
-
const nucleuses = draft.activeTab.split(',');
|
|
237
|
-
const activeSpectrum = draft.
|
|
253
|
+
const nucleuses = draft.view.spectra.activeTab.split(',');
|
|
254
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[nucleuses[index]];
|
|
238
255
|
return (activeSpectrum?.id &&
|
|
239
256
|
!draft.data[activeSpectrum.index].info.isFid);
|
|
240
257
|
}
|
|
@@ -259,7 +276,7 @@ function setMargin(draft) {
|
|
|
259
276
|
function processing2DData(draft, data) {
|
|
260
277
|
if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
261
278
|
let _data = {};
|
|
262
|
-
for (const datum of data[draft.activeTab]) {
|
|
279
|
+
for (const datum of data[draft.view.spectra.activeTab]) {
|
|
263
280
|
_data[datum.id] = datum.processingController.drawContours();
|
|
264
281
|
}
|
|
265
282
|
draft.contours = _data;
|
|
@@ -305,29 +322,26 @@ function setTabActiveSpectrum(draft, dataGroupByTab) {
|
|
|
305
322
|
}
|
|
306
323
|
}
|
|
307
324
|
}
|
|
308
|
-
draft.
|
|
325
|
+
draft.view.spectra.activeSpectra = tabActiveSpectrum;
|
|
309
326
|
return tabs2D;
|
|
310
327
|
}
|
|
311
328
|
function setTab(draft, dataGroupByTab, tab, refresh = false) {
|
|
312
329
|
const groupByTab = Object.keys(dataGroupByTab).sort((a, b) => a.split(',').length > b.split(',').length ? -1 : 1);
|
|
313
330
|
if (JSON.stringify(groupByTab) !==
|
|
314
|
-
JSON.stringify(Object.keys(draft.
|
|
331
|
+
JSON.stringify(Object.keys(draft.view.spectra.activeSpectra)) ||
|
|
315
332
|
refresh) {
|
|
316
333
|
const tabs2D = setTabActiveSpectrum(draft, dataGroupByTab);
|
|
317
334
|
if (tabs2D.length > 0 && tab == null) {
|
|
318
|
-
draft.
|
|
319
|
-
draft.activeTab = tabs2D[0];
|
|
335
|
+
draft.view.spectra.activeTab = tabs2D[0];
|
|
320
336
|
}
|
|
321
337
|
else {
|
|
322
|
-
draft.
|
|
323
|
-
draft.activeTab = tab;
|
|
338
|
+
draft.view.spectra.activeTab = tab;
|
|
324
339
|
}
|
|
325
340
|
}
|
|
326
341
|
else {
|
|
327
|
-
draft.activeTab = tab;
|
|
328
|
-
draft.activeSpectrum = draft.tabActiveSpectrum[tab];
|
|
342
|
+
draft.view.spectra.activeTab = tab;
|
|
329
343
|
}
|
|
330
|
-
setDisplayerMode(draft, dataGroupByTab[draft.activeTab]);
|
|
344
|
+
setDisplayerMode(draft, dataGroupByTab[draft.view.spectra.activeTab]);
|
|
331
345
|
setMargin(draft);
|
|
332
346
|
}
|
|
333
347
|
function setActiveTab(draft, options) {
|
|
@@ -341,7 +355,7 @@ function setActiveTab(draft, options) {
|
|
|
341
355
|
processing2DData(draft, dataGroupByNucleus);
|
|
342
356
|
setDomain(draft, domainOptions);
|
|
343
357
|
setIntegralsYDomain(draft, dataGroupByNucleus[currentTab]);
|
|
344
|
-
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.activeTab);
|
|
358
|
+
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
|
|
345
359
|
const zoomValue = zoomHistory.getLast();
|
|
346
360
|
if (zoomValue) {
|
|
347
361
|
draft.xDomain = zoomValue.xDomain;
|
|
@@ -355,9 +369,10 @@ function handelSetActiveTab(draft, tab) {
|
|
|
355
369
|
}
|
|
356
370
|
}
|
|
357
371
|
function levelChangeHandler(draft, { deltaY, shiftKey }) {
|
|
372
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
358
373
|
try {
|
|
359
|
-
if (
|
|
360
|
-
const { index, id } =
|
|
374
|
+
if (activeSpectrum?.id) {
|
|
375
|
+
const { index, id } = activeSpectrum;
|
|
361
376
|
const processingController = draft.data[index]
|
|
362
377
|
.processingController;
|
|
363
378
|
if (shiftKey) {
|
|
@@ -12,4 +12,7 @@ declare function handleSetSignalPathLength(draft: Draft<State>, action: any): vo
|
|
|
12
12
|
declare function handleUnlinkZone(draft: Draft<State>, action: any): void;
|
|
13
13
|
declare function handleSetDiaIDZone(draft: Draft<State>, action: any): void;
|
|
14
14
|
declare function handleSaveEditedZone(draft: Draft<State>, action: any): void;
|
|
15
|
-
|
|
15
|
+
declare function handleShowZones(draft: Draft<State>, action: any): void;
|
|
16
|
+
declare function handleShowSignals(draft: Draft<State>, action: any): void;
|
|
17
|
+
declare function handleShowPeaks(draft: Draft<State>, action: any): void;
|
|
18
|
+
export { add2dZoneHandler, handleAutoZonesDetection, handleDeleteSignal, handleDeleteZone, changeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, changeZonesFactorHandler, handleAutoSpectraZonesDetection, handleShowZones, handleShowSignals, handleShowPeaks, };
|
|
@@ -6,6 +6,7 @@ import * as FiltersManager from '../../../data/FiltersManager';
|
|
|
6
6
|
import { DatumKind, SignalKindsToInclude, } from '../../../data/constants/SignalsKinds';
|
|
7
7
|
import { changeZoneSignal, detectZones, detectZonesManual, updateShift, } from '../../../data/data2d/Spectrum2D';
|
|
8
8
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/ZoneUtilities';
|
|
9
|
+
import { zoneStateInit } from '../Reducer';
|
|
9
10
|
import get2DRange from '../helper/get2DRange';
|
|
10
11
|
import { handleUpdateCorrelations } from './CorrelationsActions';
|
|
11
12
|
import { setDomain } from './DomainActions';
|
|
@@ -13,8 +14,9 @@ function changeZonesFactorHandler(draft, action) {
|
|
|
13
14
|
draft.toolOptions.data.zonesNoiseFactor = action.payload;
|
|
14
15
|
}
|
|
15
16
|
function add2dZoneHandler(draft, action) {
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
18
|
+
if (activeSpectrum?.id) {
|
|
19
|
+
const { index } = activeSpectrum;
|
|
18
20
|
const drawnZone = get2DRange(draft, action);
|
|
19
21
|
const datum = draft.data[index];
|
|
20
22
|
const zones = detectZonesManual(original(datum), {
|
|
@@ -27,8 +29,9 @@ function add2dZoneHandler(draft, action) {
|
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
function handleAutoZonesDetection(draft, detectionOptions) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
33
|
+
if (activeSpectrum?.id) {
|
|
34
|
+
const { index } = activeSpectrum;
|
|
32
35
|
const [fromX, toX] = draft.xDomain;
|
|
33
36
|
const [fromY, toY] = draft.yDomain;
|
|
34
37
|
detectionOptions.selectedZone = { fromX, toX, fromY, toY };
|
|
@@ -54,8 +57,9 @@ function handleAutoSpectraZonesDetection(draft) {
|
|
|
54
57
|
}
|
|
55
58
|
function changeZoneSignalDelta(draft, action) {
|
|
56
59
|
const { zoneID, signal } = action.payload;
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
61
|
+
if (activeSpectrum?.id) {
|
|
62
|
+
const { index } = activeSpectrum;
|
|
59
63
|
const { xShift, yShift } = changeZoneSignal(draft.data[index], zoneID, signal);
|
|
60
64
|
let filters = [];
|
|
61
65
|
if (xShift !== 0) {
|
|
@@ -75,8 +79,9 @@ function getZoneIndex(state, spectrumIndex, zoneID) {
|
|
|
75
79
|
}
|
|
76
80
|
function handleChangeZoneSignalKind(draft, action) {
|
|
77
81
|
const state = original(draft);
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
83
|
+
if (activeSpectrum?.id) {
|
|
84
|
+
const { index } = activeSpectrum;
|
|
80
85
|
const { rowData, value } = action.payload;
|
|
81
86
|
const zoneIndex = getZoneIndex(state, index, rowData.id);
|
|
82
87
|
const _zone = draft.data[index].zones.values[zoneIndex];
|
|
@@ -89,8 +94,9 @@ function handleChangeZoneSignalKind(draft, action) {
|
|
|
89
94
|
}
|
|
90
95
|
function handleDeleteZone(draft, action) {
|
|
91
96
|
const state = original(draft);
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
98
|
+
if (activeSpectrum?.id) {
|
|
99
|
+
const { index } = activeSpectrum;
|
|
94
100
|
const { id, assignmentData } = action.payload;
|
|
95
101
|
if (id) {
|
|
96
102
|
const zone = draft.data[index].zones.values.find((zone) => zone.id === id);
|
|
@@ -143,8 +149,9 @@ function handleSetSignalPathLength(draft, action) {
|
|
|
143
149
|
}
|
|
144
150
|
function handleUnlinkZone(draft, action) {
|
|
145
151
|
const state = original(draft);
|
|
146
|
-
|
|
147
|
-
|
|
152
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
153
|
+
if (activeSpectrum?.id) {
|
|
154
|
+
const { index } = activeSpectrum;
|
|
148
155
|
const { zoneData = null, assignmentData, isOnZoneLevel = undefined, signalIndex = -1, axis = undefined, } = action.payload;
|
|
149
156
|
if (zoneData) {
|
|
150
157
|
// remove assignments in global state
|
|
@@ -165,8 +172,9 @@ function handleUnlinkZone(draft, action) {
|
|
|
165
172
|
}
|
|
166
173
|
function handleSetDiaIDZone(draft, action) {
|
|
167
174
|
const state = original(draft);
|
|
168
|
-
|
|
169
|
-
|
|
175
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
176
|
+
if (activeSpectrum?.id) {
|
|
177
|
+
const { index } = activeSpectrum;
|
|
170
178
|
const { zoneData, diaIDs, axis, signalIndex, nbAtoms } = action.payload;
|
|
171
179
|
const getNbAtoms = (input, current = 0) => input + current;
|
|
172
180
|
const zoneIndex = getZoneIndex(state, index, zoneData.id);
|
|
@@ -183,8 +191,9 @@ function handleSetDiaIDZone(draft, action) {
|
|
|
183
191
|
}
|
|
184
192
|
function handleSaveEditedZone(draft, action) {
|
|
185
193
|
const state = original(draft);
|
|
186
|
-
|
|
187
|
-
|
|
194
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
195
|
+
if (activeSpectrum?.id) {
|
|
196
|
+
const { index } = activeSpectrum;
|
|
188
197
|
const { editedRowData } = action.payload;
|
|
189
198
|
delete editedRowData.tableMetaInfo;
|
|
190
199
|
const zoneIndex = getZoneIndex(state, index, editedRowData.id);
|
|
@@ -197,7 +206,49 @@ function handleSaveEditedZone(draft, action) {
|
|
|
197
206
|
handleOnChangeZonesData(draft);
|
|
198
207
|
}
|
|
199
208
|
}
|
|
209
|
+
function handleShowZones(draft, action) {
|
|
210
|
+
const { id } = action.payload;
|
|
211
|
+
const zone = draft.view.zones.find((r) => r.spectrumID === id);
|
|
212
|
+
if (zone) {
|
|
213
|
+
zone.showZones = !zone.showZones;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
draft.view.zones.push({
|
|
217
|
+
spectrumID: id,
|
|
218
|
+
...zoneStateInit,
|
|
219
|
+
showZones: !zoneStateInit.showZones,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function handleShowSignals(draft, action) {
|
|
224
|
+
const { id } = action.payload;
|
|
225
|
+
const zone = draft.view.zones.find((r) => r.spectrumID === id);
|
|
226
|
+
if (zone) {
|
|
227
|
+
zone.showSignals = !zone.showSignals;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
draft.view.zones.push({
|
|
231
|
+
spectrumID: id,
|
|
232
|
+
...zoneStateInit,
|
|
233
|
+
showSignals: !zoneStateInit.showSignals,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function handleShowPeaks(draft, action) {
|
|
238
|
+
const { id } = action.payload;
|
|
239
|
+
const zone = draft.view.zones.find((r) => r.spectrumID === id);
|
|
240
|
+
if (zone) {
|
|
241
|
+
zone.showPeaks = !zone.showPeaks;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
draft.view.zones.push({
|
|
245
|
+
spectrumID: id,
|
|
246
|
+
...zoneStateInit,
|
|
247
|
+
showPeaks: !zoneStateInit.showPeaks,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
200
251
|
function handleOnChangeZonesData(draft) {
|
|
201
252
|
handleUpdateCorrelations(draft);
|
|
202
253
|
}
|
|
203
|
-
export { add2dZoneHandler, handleAutoZonesDetection, handleDeleteSignal, handleDeleteZone, changeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, changeZonesFactorHandler, handleAutoSpectraZonesDetection, };
|
|
254
|
+
export { add2dZoneHandler, handleAutoZonesDetection, handleDeleteSignal, handleDeleteZone, changeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, changeZonesFactorHandler, handleAutoSpectraZonesDetection, handleShowZones, handleShowSignals, handleShowPeaks, };
|
|
@@ -14,7 +14,8 @@ function wheelZoom(event, domain, zoomOptions = {}) {
|
|
|
14
14
|
return [min * ratio, max * ratio];
|
|
15
15
|
}
|
|
16
16
|
function setZoom(draft, options = {}) {
|
|
17
|
-
const { height, margin
|
|
17
|
+
const { height, margin } = draft;
|
|
18
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
18
19
|
const { scale = 1, spectrumID = null } = options;
|
|
19
20
|
if (activeSpectrum === null && spectrumID === null) {
|
|
20
21
|
const { shareYDomain, yDomain, yDomains } = draft.originDomain;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { assert } from '../../utility/assert';
|
|
2
|
+
export function getActiveSpectrumOrFail(draft) {
|
|
3
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
4
|
+
assert(activeSpectrum !== null, 'Active spectrum must have id');
|
|
5
|
+
return activeSpectrum;
|
|
6
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export function getSpectrum(state, value) {
|
|
2
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
2
3
|
if (value === undefined) {
|
|
3
|
-
if (
|
|
4
|
-
const index =
|
|
4
|
+
if (activeSpectrum?.id) {
|
|
5
|
+
const index = activeSpectrum.index;
|
|
5
6
|
return state.data[index];
|
|
6
7
|
}
|
|
7
8
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { max } from 'd3';
|
|
2
2
|
export function getStrongestPeak(draft) {
|
|
3
|
-
const {
|
|
3
|
+
const { data } = draft;
|
|
4
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
4
5
|
if (activeSpectrum) {
|
|
5
6
|
const activeData = data[activeSpectrum?.index].data;
|
|
6
7
|
const strongestPeakValue = max(activeData.re);
|
|
@@ -12,6 +12,7 @@ export declare const LOAD_NMREDATA_FILE = "LOAD_NMREDATA_FILE";
|
|
|
12
12
|
export declare const LOAD_MOL_FILE = "LOAD_MOL_FILE";
|
|
13
13
|
export declare const LOAD_ZIP_FILE = "LOAD_ZIP_FILE";
|
|
14
14
|
export declare const LOAD_JDF_FILE = "LOAD_JDF_FILE";
|
|
15
|
+
export declare const LOAD_DROP_FILES = "LOAD_DROP_FILES";
|
|
15
16
|
export declare const ADD_PEAK = "ADD_PEAK";
|
|
16
17
|
export declare const ADD_PEAKS = "ADD_PEAKS";
|
|
17
18
|
export declare const CHANGE_PEAK_SHAPE = "CHANGE_PEAK_SHAPE";
|
|
@@ -39,6 +40,7 @@ export declare const ADD_MOLECULE = "ADD_MOLECULE";
|
|
|
39
40
|
export declare const SET_MOLECULE = "SET_MOLECULE";
|
|
40
41
|
export declare const DELETE_MOLECULE = "DELETE_MOLECULE";
|
|
41
42
|
export declare const FLOAT_MOLECULE_OVER_SPECTRUM = "FLOAT_MOLECULE_OVER_SPECTRUM";
|
|
43
|
+
export declare const CHANGE_FLOAT_MOLECULE_POSITION = "CHANGE_FLOAT_MOLECULE_POSITION";
|
|
42
44
|
export declare const CHANGE_MOLECULE_LABEL = "CHANGE_MOLECULE_LABEL";
|
|
43
45
|
export declare const SET_CORRELATION = "SET_CORRELATION";
|
|
44
46
|
export declare const SET_CORRELATIONS = "SET_CORRELATIONS";
|
|
@@ -127,6 +129,9 @@ export declare const SHOW_MULTIPLICTY_TREES = "SHOW_MULTIPLICTY_TREES";
|
|
|
127
129
|
export declare const SHOW_RANGES_INTEGRALS = "SHOW_RANGES_INTEGRALS";
|
|
128
130
|
export declare const AUTO_RANGES_SPECTRA_PICKING = "AUTO_RANGES_SPECTRA_PICKING";
|
|
129
131
|
export declare const AUTO_ZONES_SPECTRA_PICKING = "AUTO_ZONES_SPECTRA_PICKING";
|
|
132
|
+
export declare const SHOW_ZONES = "SHOW_ZONES";
|
|
133
|
+
export declare const SHOW_ZONES_SIGNALS = "SHOW_ZONES_SIGNALS";
|
|
134
|
+
export declare const SHOW_ZONES_PEAKS = "SHOW_ZONES_PEAKS";
|
|
130
135
|
export declare const GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = "GENERATE_SPECTRUM_FROM_PUBLICATION_STRING";
|
|
131
136
|
export declare const RESURRECTING_SPECTRUM_FROM_RANGES = "RESURRECTING_SPECTRUM_FROM_RANGES";
|
|
132
137
|
export declare const RESURRECTING_SPECTRUM_FROM_JCAMP = "RESURRECTING_SPECTRUM_FROM_JCAMP";
|
|
@@ -6,6 +6,7 @@ export const LOAD_NMREDATA_FILE = 'LOAD_NMREDATA_FILE';
|
|
|
6
6
|
export const LOAD_MOL_FILE = 'LOAD_MOL_FILE';
|
|
7
7
|
export const LOAD_ZIP_FILE = 'LOAD_ZIP_FILE';
|
|
8
8
|
export const LOAD_JDF_FILE = 'LOAD_JDF_FILE';
|
|
9
|
+
export const LOAD_DROP_FILES = 'LOAD_DROP_FILES';
|
|
9
10
|
export const ADD_PEAK = 'ADD_PEAK';
|
|
10
11
|
export const ADD_PEAKS = 'ADD_PEAKS';
|
|
11
12
|
export const CHANGE_PEAK_SHAPE = 'CHANGE_PEAK_SHAPE';
|
|
@@ -33,6 +34,7 @@ export const ADD_MOLECULE = 'ADD_MOLECULE';
|
|
|
33
34
|
export const SET_MOLECULE = 'SET_MOLECULE';
|
|
34
35
|
export const DELETE_MOLECULE = 'DELETE_MOLECULE';
|
|
35
36
|
export const FLOAT_MOLECULE_OVER_SPECTRUM = 'FLOAT_MOLECULE_OVER_SPECTRUM';
|
|
37
|
+
export const CHANGE_FLOAT_MOLECULE_POSITION = 'CHANGE_FLOAT_MOLECULE_POSITION';
|
|
36
38
|
export const CHANGE_MOLECULE_LABEL = 'CHANGE_MOLECULE_LABEL';
|
|
37
39
|
export const SET_CORRELATION = 'SET_CORRELATION';
|
|
38
40
|
export const SET_CORRELATIONS = 'SET_CORRELATIONS';
|
|
@@ -121,6 +123,9 @@ export const SHOW_MULTIPLICTY_TREES = 'SHOW_MULTIPLICTY_TREES';
|
|
|
121
123
|
export const SHOW_RANGES_INTEGRALS = 'SHOW_RANGES_INTEGRALS';
|
|
122
124
|
export const AUTO_RANGES_SPECTRA_PICKING = 'AUTO_RANGES_SPECTRA_PICKING';
|
|
123
125
|
export const AUTO_ZONES_SPECTRA_PICKING = 'AUTO_ZONES_SPECTRA_PICKING';
|
|
126
|
+
export const SHOW_ZONES = 'SHOW_ZONES';
|
|
127
|
+
export const SHOW_ZONES_SIGNALS = 'SHOW_ZONES_SIGNALS';
|
|
128
|
+
export const SHOW_ZONES_PEAKS = 'SHOW_ZONES_PEAKS';
|
|
124
129
|
export const GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = 'GENERATE_SPECTRUM_FROM_PUBLICATION_STRING';
|
|
125
130
|
export const RESURRECTING_SPECTRUM_FROM_RANGES = 'RESURRECTING_SPECTRUM_FROM_RANGES';
|
|
126
131
|
export const RESURRECTING_SPECTRUM_FROM_JCAMP = 'RESURRECTING_SPECTRUM_FROM_JCAMP';
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { StateMoleculeExtended } from '../../../data/molecules/Molecule';
|
|
2
2
|
import { Ranges } from '../../../data/types/data1d';
|
|
3
3
|
import { Zones } from '../../../data/types/data2d';
|
|
4
|
+
import { Position } from '../../elements/draggble/useDraggable';
|
|
4
5
|
import { DISPLAYER_MODE } from '../../reducer/core/Constants';
|
|
5
6
|
interface DraggableStructureProps {
|
|
6
7
|
zones: Zones;
|
|
7
8
|
ranges: Ranges;
|
|
8
9
|
molecule: StateMoleculeExtended;
|
|
10
|
+
position?: Position;
|
|
9
11
|
activeTab: string;
|
|
10
12
|
displayerMode: DISPLAYER_MODE;
|
|
11
13
|
index?: number;
|
|
12
14
|
}
|
|
15
|
+
export declare const DRAGGABLE_STRUCTURE_INITIAL_POSITION: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
};
|
|
13
19
|
export declare function DraggableStructure(props: DraggableStructureProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
14
20
|
export {};
|
|
@@ -9,7 +9,7 @@ import { useGlobal } from '../../context/GlobalContext';
|
|
|
9
9
|
import SVGDraggable from '../../elements/draggble/SVGDraggable';
|
|
10
10
|
import { useMoleculeEditor } from '../../modal/MoleculeStructureEditorModal';
|
|
11
11
|
import useAtomAssignment from '../../panels/MoleculesPanel/useAtomAssignment';
|
|
12
|
-
import { FLOAT_MOLECULE_OVER_SPECTRUM, SET_MOLECULE, } from '../../reducer/types/Types';
|
|
12
|
+
import { CHANGE_FLOAT_MOLECULE_POSITION, FLOAT_MOLECULE_OVER_SPECTRUM, SET_MOLECULE, } from '../../reducer/types/Types';
|
|
13
13
|
import ActionsButton from './ActionsButton';
|
|
14
14
|
const style = css `
|
|
15
15
|
border: 1px solid transparent;
|
|
@@ -25,8 +25,9 @@ const style = css `
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
`;
|
|
28
|
+
export const DRAGGABLE_STRUCTURE_INITIAL_POSITION = { x: 100, y: 50 };
|
|
28
29
|
export function DraggableStructure(props) {
|
|
29
|
-
const { zones, ranges, molecule, activeTab, displayerMode, index } = props;
|
|
30
|
+
const { zones, ranges, molecule, activeTab, displayerMode, index, position = DRAGGABLE_STRUCTURE_INITIAL_POSITION, } = props;
|
|
30
31
|
const { viewerRef } = useGlobal();
|
|
31
32
|
const dispatch = useDispatch();
|
|
32
33
|
const openMoleculeEditor = useMoleculeEditor();
|
|
@@ -37,7 +38,13 @@ export function DraggableStructure(props) {
|
|
|
37
38
|
payload: { id: molecule.id },
|
|
38
39
|
});
|
|
39
40
|
}, [dispatch, molecule]);
|
|
40
|
-
|
|
41
|
+
const dragFloatMoleculeHandler = useCallback((position) => {
|
|
42
|
+
dispatch({
|
|
43
|
+
type: CHANGE_FLOAT_MOLECULE_POSITION,
|
|
44
|
+
payload: { id: molecule.id, position },
|
|
45
|
+
});
|
|
46
|
+
}, [dispatch, molecule]);
|
|
47
|
+
return (_jsx(SVGDraggable, { width: 150, height: 100, initialPosition: position, dragHandleClassName: "handle", parentElement: viewerRef, onEnd: dragFloatMoleculeHandler, children: (width, height) => (_jsxs("foreignObject", { width: width, height: height + 30, "data-replace-float-structure": "true", css: style, onDoubleClick: () => openMoleculeEditor(molecule), children: [_jsx(ActionsButton, { onFloatBtnClick: floatMoleculeHandler }), _jsx(OCLnmr, { OCL: OCL, autoCrop: true, id: `molSVG${index || ''}`, width: width - 20, height: height, molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
|
|
41
48
|
? currentDiaIDsToHighlight
|
|
42
49
|
: assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: (molfile) => {
|
|
43
50
|
dispatch({
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { useChartData } from '../../context/ChartContext';
|
|
4
4
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
5
|
+
import { assert } from '../../utility/assert';
|
|
5
6
|
import { DraggableStructure } from './DraggableStructure';
|
|
6
7
|
export function FloatMoleculeStructuresInner(props) {
|
|
7
8
|
const { zones, ranges, floatingMolecules, molecules, activeTab, displayerMode, } = props;
|
|
@@ -9,18 +10,23 @@ export function FloatMoleculeStructuresInner(props) {
|
|
|
9
10
|
return null;
|
|
10
11
|
return (_jsx("g", { children: floatingMolecules
|
|
11
12
|
.filter((molecule) => molecule.visible)
|
|
12
|
-
.map((
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
.map(({ id, position }) => {
|
|
14
|
+
const molecule = molecules.find((m) => m.id === id);
|
|
15
|
+
assert(molecule !== undefined, 'molecule should be defined');
|
|
16
|
+
return (_jsx(DraggableStructure, { ...{
|
|
17
|
+
zones,
|
|
18
|
+
ranges,
|
|
19
|
+
activeTab,
|
|
20
|
+
displayerMode,
|
|
21
|
+
position,
|
|
22
|
+
molecule,
|
|
23
|
+
} }, id));
|
|
24
|
+
}) }));
|
|
19
25
|
}
|
|
20
26
|
const MemoizedFloatMoleculeStructures = memo(FloatMoleculeStructuresInner);
|
|
21
27
|
const emptyData = { ranges: {}, zones: {} };
|
|
22
28
|
export default function FloatMoleculeStructures() {
|
|
23
|
-
const { molecules, displayerMode,
|
|
29
|
+
const { molecules, displayerMode, view: { floatingMolecules, spectra: { activeTab }, }, } = useChartData();
|
|
24
30
|
const data = useSpectrum(emptyData);
|
|
25
31
|
const ranges = data?.ranges || {};
|
|
26
32
|
const zones = data?.zones || {};
|
|
@@ -16,6 +16,7 @@ import useExport from '../hooks/useExport';
|
|
|
16
16
|
import useToolsFunctions from '../hooks/useToolsFunctions';
|
|
17
17
|
import ImportPublicationStringModal from '../modal/ImportPublicationStringModal';
|
|
18
18
|
import LoadJCAMPModal from '../modal/LoadJCAMPModal';
|
|
19
|
+
import { useActiveSpectrum, } from '../reducer/Reducer';
|
|
19
20
|
import { LOAD_JCAMP_FILE, SET_LOADING_FLAG } from '../reducer/types/Types';
|
|
20
21
|
const IMPORT_MENU = [
|
|
21
22
|
{
|
|
@@ -79,7 +80,7 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
|
|
|
79
80
|
: IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
|
|
80
81
|
}, [isExperimentalFeature]);
|
|
81
82
|
const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler, alignSpectrumsVerticallyHandler, } = useToolsFunctions();
|
|
82
|
-
const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler,
|
|
83
|
+
const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler, saveAsHandler, } = useExport();
|
|
83
84
|
const LoadJacmpHandler = useCallback((file) => {
|
|
84
85
|
if (file) {
|
|
85
86
|
dispatch({ type: LOAD_JCAMP_FILE, files: [file] });
|
|
@@ -127,9 +128,6 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
|
|
|
127
128
|
case 'advance_save':
|
|
128
129
|
void saveAsHandler();
|
|
129
130
|
break;
|
|
130
|
-
case 'nmre':
|
|
131
|
-
void saveAsNMREHandler();
|
|
132
|
-
break;
|
|
133
131
|
case 'copy':
|
|
134
132
|
void saveToClipboardHandler();
|
|
135
133
|
break;
|
|
@@ -141,7 +139,6 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
|
|
|
141
139
|
saveAsPNGHandler,
|
|
142
140
|
saveAsJSONHandler,
|
|
143
141
|
saveAsHandler,
|
|
144
|
-
saveAsNMREHandler,
|
|
145
142
|
saveToClipboardHandler,
|
|
146
143
|
]);
|
|
147
144
|
return (_jsxs(Fragment, { children: [isButtonVisible('import') && (_jsx(ToolbarMenu, { component: _jsx(FaFileImport, {}), toolTip: "Import", onClick: (element) => {
|
|
@@ -159,7 +156,8 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
|
|
|
159
156
|
}
|
|
160
157
|
const MemoizedBasicToolBar = memo(BasicToolBarInner);
|
|
161
158
|
export default function BasicToolBar() {
|
|
162
|
-
const {
|
|
159
|
+
const { verticalAlign, displayerMode, view: { spectra: { activeTab }, }, } = useChartData();
|
|
160
|
+
const activeSpectrum = useActiveSpectrum();
|
|
163
161
|
const { info, fidCounter, ftCounter } = useDatumWithSpectraStatistics();
|
|
164
162
|
return (_jsx(MemoizedBasicToolBar, { ...{
|
|
165
163
|
info,
|
|
@@ -11,6 +11,7 @@ import ToggleButtonGroup from '../elements/toggle/ToggleButtonGroup';
|
|
|
11
11
|
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
12
12
|
import useDatumWithSpectraStatistics from '../hooks/useDatumWithSpectraStatistics';
|
|
13
13
|
import useToolsFunctions from '../hooks/useToolsFunctions';
|
|
14
|
+
import { useActiveSpectrum } from '../reducer/Reducer';
|
|
14
15
|
import { APPLY_FFT_FILTER, SET_SELECTED_FILTER } from '../reducer/types/Types';
|
|
15
16
|
import { options } from './ToolTypes';
|
|
16
17
|
function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, ftCounter, }) {
|
|
@@ -47,7 +48,8 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, ftCou
|
|
|
47
48
|
}
|
|
48
49
|
const MemoizedFunctionToolBar = memo(FunctionToolBarInner);
|
|
49
50
|
export default function FunctionToolBar({ defaultValue = options.zoom.id, }) {
|
|
50
|
-
const {
|
|
51
|
+
const { displayerMode, view: { spectra: { activeTab }, }, } = useChartData();
|
|
52
|
+
const activeSpectrum = useActiveSpectrum();
|
|
51
53
|
const data = useDatumWithSpectraStatistics();
|
|
52
54
|
return (_jsx(MemoizedFunctionToolBar, { ...{
|
|
53
55
|
...data,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assert(value: unknown, message?: string): asserts value;
|
|
@@ -10,6 +10,12 @@ export const exercise = {
|
|
|
10
10
|
integralsPanel: { display: true },
|
|
11
11
|
},
|
|
12
12
|
toolBarButtons: {
|
|
13
|
+
peakPicking: true,
|
|
14
|
+
apodization: true,
|
|
15
|
+
zeroFilling: true,
|
|
16
|
+
fastFourierTransform: true,
|
|
17
|
+
phaseCorrection: true,
|
|
18
|
+
baselineCorrection: true,
|
|
13
19
|
integral: true,
|
|
14
20
|
spectraCenterAlignments: true,
|
|
15
21
|
spectraStackAlignments: true,
|
|
@@ -7,11 +7,7 @@ export declare enum DataExportOptions {
|
|
|
7
7
|
export declare type DataExportOptionsType = keyof typeof DataExportOptions;
|
|
8
8
|
export declare function addJcampFromURL(spectra: any, jcampURL: any, options: any, usedColors: any): Promise<void>;
|
|
9
9
|
export declare function addJcamp(spectra: any, jcamp: any, options: any, usedColors: any): void;
|
|
10
|
-
export declare function addJDF(spectra: any, jdf: any, options?: any, usedColors?: any): void;
|
|
11
10
|
export declare function fromJSON(data?: any[], usedColors?: any): Promise<any[]>;
|
|
12
|
-
export declare function addBruker(options: any, data: any, usedColors: any): Promise<any[]>;
|
|
13
|
-
export declare function fromZip(zipFiles: any): Promise<never[]>;
|
|
14
|
-
export declare function addJDFs(files: any, usedColors: any): never[];
|
|
15
11
|
export declare function addJcamps(files: any, usedColors: any): never[];
|
|
16
12
|
/**
|
|
17
13
|
*
|