nmrium 0.19.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/Chart1D.js +3 -3
- package/lib/component/1d/ExclusionZoneAnnotation.d.ts +11 -0
- package/lib/component/1d/ExclusionZoneAnnotation.js +18 -0
- package/lib/component/1d/ExclusionZonesAnnotations.d.ts +3 -0
- package/lib/component/1d/ExclusionZonesAnnotations.js +28 -0
- package/lib/component/1d/Line.js +11 -23
- package/lib/component/1d/Viewer1D.js +36 -5
- package/lib/component/1d/ranges/Ranges.js +3 -3
- package/lib/component/1d/{BaseLineZones.d.ts → tool/BaseLineZones.d.ts} +0 -0
- package/lib/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
- package/lib/component/1d/utilities/useIntegralPath.js +9 -10
- package/lib/component/2d/Contours.js +12 -11
- package/lib/component/2d/Left1DChart.js +7 -9
- package/lib/component/2d/Top1DChart.js +7 -7
- package/lib/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
- package/lib/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
- package/lib/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.js +106 -80
- package/lib/component/NMRium.d.ts +8 -3
- package/lib/component/NMRium.js +36 -33
- package/lib/component/elements/NumberInput.d.ts +1 -2
- package/lib/component/elements/Tab/Tab.js +1 -0
- package/lib/component/header/Header.js +10 -3
- package/lib/component/hooks/useActiveSpectrumStyleOptions.d.ts +6 -0
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +15 -0
- package/lib/component/hooks/useCheckExperimentalFeature.js +2 -1
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +6 -0
- package/lib/component/hooks/useToolsFunctions.js +2 -1
- package/lib/component/hooks/useXYReduce.d.ts +2 -1
- package/lib/component/loader/DropZone.js +88 -88
- package/lib/component/modal/ModalStyle.js +5 -2
- package/lib/component/modal/MoleculeStructureEditorModal.js +3 -2
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +1 -5
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -0
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +35 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +49 -67
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -23
- package/lib/component/panels/Panels.js +10 -0
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +5 -14
- package/lib/component/panels/RangesPanel/RangesPanel.js +0 -3
- package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +5 -5
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/SummaryPanel/Utilities.d.ts +7 -7
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +0 -3
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
- package/lib/component/panels/ZonesPanel/ZonesTable.js +9 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
- package/lib/component/reducer/Reducer.d.ts +11 -27
- package/lib/component/reducer/Reducer.js +4 -5
- package/lib/component/reducer/actions/CorrelationsActions.d.ts +7 -7
- package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -1
- package/lib/component/reducer/actions/FiltersActions.js +60 -18
- package/lib/component/reducer/actions/LoadActions.js +2 -3
- package/lib/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib/component/reducer/actions/PreferencesActions.js +4 -7
- package/lib/component/reducer/actions/RangesActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -3
- package/lib/component/reducer/actions/ToolsActions.js +13 -59
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
- package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib/component/reducer/helper/getRange.d.ts +6 -1
- package/lib/component/reducer/helper/getRange.js +1 -1
- package/lib/component/reducer/preferencesReducer.d.ts +2 -0
- package/lib/component/reducer/preferencesReducer.js +76 -36
- package/lib/component/toolbar/FunctionToolBar.js +9 -15
- package/lib/component/toolbar/ToolTypes.js +3 -3
- package/lib/component/utility/PathBuilder.d.ts +7 -0
- package/lib/component/utility/PathBuilder.js +17 -0
- package/lib/component/utility/getSpectraByNucleus.d.ts +3 -0
- package/lib/component/utility/getSpectraByNucleus.js +4 -0
- package/lib/component/workspaces/Workspace.d.ts +6 -0
- package/lib/component/workspaces/Workspace.js +1 -0
- package/lib/component/workspaces/basic.d.ts +2 -0
- package/lib/component/workspaces/basic.js +45 -0
- package/lib/component/workspaces/exercise1D.d.ts +2 -0
- package/lib/component/workspaces/exercise1D.js +45 -0
- package/lib/component/workspaces/index.d.ts +6 -0
- package/lib/component/workspaces/index.js +4 -0
- package/lib/component/workspaces/process1D.d.ts +2 -0
- package/lib/component/workspaces/process1D.js +43 -0
- package/lib/data/Filters.d.ts +2 -1
- package/lib/data/Filters.js +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.d.ts +3 -2
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +23 -15
- package/lib/data/data1d/filter1d/exclusionZones.d.ts +16 -0
- package/lib/data/data1d/filter1d/exclusionZones.js +28 -0
- package/lib/data/migration/MigrationManager.js +3 -0
- package/lib/data/types/data1d/ExclusionZone.d.ts +5 -0
- package/lib/data/types/data1d/ExclusionZone.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -3
- package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +23 -0
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +52 -0
- package/lib-cjs/component/1d/Line.js +11 -23
- package/lib-cjs/component/1d/Viewer1D.js +36 -5
- package/lib-cjs/component/1d/ranges/Ranges.js +1 -1
- package/lib-cjs/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
- package/lib-cjs/component/1d/utilities/useIntegralPath.js +9 -10
- package/lib-cjs/component/2d/Contours.js +12 -11
- package/lib-cjs/component/2d/Left1DChart.js +7 -9
- package/lib-cjs/component/2d/Top1DChart.js +7 -7
- package/lib-cjs/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
- package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +106 -80
- package/lib-cjs/component/NMRium.js +37 -34
- package/lib-cjs/component/elements/Tab/Tab.js +1 -0
- package/lib-cjs/component/header/Header.js +10 -3
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +21 -0
- package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
- package/lib-cjs/component/hooks/useToolsFunctions.js +2 -1
- package/lib-cjs/component/loader/DropZone.js +88 -88
- package/lib-cjs/component/modal/ModalStyle.js +5 -2
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +3 -2
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralSettings.js +1 -5
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +3 -16
- package/lib-cjs/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +40 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +48 -66
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -22
- package/lib-cjs/component/panels/Panels.js +10 -0
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +4 -13
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +0 -3
- package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +4 -17
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +0 -3
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
- package/lib-cjs/component/reducer/Reducer.js +4 -5
- package/lib-cjs/component/reducer/actions/FiltersActions.js +62 -18
- package/lib-cjs/component/reducer/actions/LoadActions.js +2 -3
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +4 -7
- package/lib-cjs/component/reducer/actions/RangesActions.js +1 -1
- package/lib-cjs/component/reducer/actions/ToolsActions.js +13 -61
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getRange.js +1 -1
- package/lib-cjs/component/reducer/preferencesReducer.js +75 -35
- package/lib-cjs/component/toolbar/FunctionToolBar.js +9 -15
- package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
- package/lib-cjs/component/utility/PathBuilder.js +21 -0
- package/lib-cjs/component/utility/getSpectraByNucleus.js +11 -0
- package/lib-cjs/component/workspaces/Workspace.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +48 -0
- package/lib-cjs/component/workspaces/exercise1D.js +48 -0
- package/lib-cjs/component/workspaces/index.js +6 -0
- package/lib-cjs/component/workspaces/process1D.js +46 -0
- package/lib-cjs/data/Filters.js +3 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +24 -15
- package/lib-cjs/data/data1d/filter1d/exclusionZones.js +34 -0
- package/lib-cjs/data/migration/MigrationManager.js +3 -0
- package/lib-cjs/data/types/data1d/ExclusionZone.js +2 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +28 -29
- package/lib/component/1d/ExclusionZone.d.ts +0 -8
- package/lib/component/1d/ExclusionZone.js +0 -30
- package/lib/component/1d/ExclusionZones.d.ts +0 -2
- package/lib/component/1d/ExclusionZones.js +0 -10
- package/lib/component/nmriumMode/basic.d.ts +0 -38
- package/lib/component/nmriumMode/basic.js +0 -37
- package/lib/component/nmriumMode/exercise1D.d.ts +0 -38
- package/lib/component/nmriumMode/exercise1D.js +0 -37
- package/lib/component/nmriumMode/process1D.d.ts +0 -38
- package/lib/component/nmriumMode/process1D.js +0 -37
- package/lib-cjs/component/1d/ExclusionZone.js +0 -32
- package/lib-cjs/component/1d/ExclusionZones.js +0 -16
- package/lib-cjs/component/nmriumMode/basic.js +0 -39
- package/lib-cjs/component/nmriumMode/exercise1D.js +0 -39
- package/lib-cjs/component/nmriumMode/process1D.js +0 -39
|
@@ -23,8 +23,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
26
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
26
27
|
const react_1 = require("react");
|
|
27
28
|
const react_d3_utils_1 = require("react-d3-utils");
|
|
29
|
+
const detectSignal_1 = require("../../data/data1d/Spectrum1D/ranges/detectSignal");
|
|
28
30
|
const Viewer2D_1 = require("../2d/Viewer2D");
|
|
29
31
|
const BrushTracker_1 = require("../EventsTrackers/BrushTracker");
|
|
30
32
|
const MouseTracker_1 = require("../EventsTrackers/MouseTracker");
|
|
@@ -32,10 +34,12 @@ const ChartContext_1 = require("../context/ChartContext");
|
|
|
32
34
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
33
35
|
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
34
36
|
const ScaleContext_1 = require("../context/ScaleContext");
|
|
37
|
+
const Alert_1 = require("../elements/popup/Alert");
|
|
35
38
|
const Modal_1 = require("../elements/popup/Modal");
|
|
36
39
|
const Spinner_1 = __importDefault(require("../loader/Spinner"));
|
|
37
40
|
const MultipletAnalysisModal_1 = __importDefault(require("../modal/MultipletAnalysisModal"));
|
|
38
41
|
const Zoom_1 = require("../reducer/actions/Zoom");
|
|
42
|
+
const getRange_1 = __importDefault(require("../reducer/helper/getRange"));
|
|
39
43
|
const scaleReducer_1 = __importStar(require("../reducer/scaleReducer"));
|
|
40
44
|
const Types_1 = require("../reducer/types/Types");
|
|
41
45
|
const BrushXY_1 = __importStar(require("../tool/BrushXY"));
|
|
@@ -54,6 +58,7 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
54
58
|
const { toolOptions: { selectedTool }, isLoading, data, mode, width: widthProp, height: heightProp, margin, activeSpectrum, xDomain, xDomains, yDomain, yDomains, verticalAlign, displayerKey, } = state;
|
|
55
59
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
56
60
|
const modal = (0, Modal_1.useModal)();
|
|
61
|
+
const alert = (0, Alert_1.useAlert)();
|
|
57
62
|
const [scaleState, dispatchScale] = (0, react_1.useReducer)(scaleReducer_1.default, scaleReducer_1.scaleInitialState);
|
|
58
63
|
(0, react_1.useEffect)(() => {
|
|
59
64
|
if (xDomain.length > 0 && yDomain.length > 0 && widthProp && heightProp) {
|
|
@@ -119,12 +124,28 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
119
124
|
...brushData,
|
|
120
125
|
});
|
|
121
126
|
break;
|
|
122
|
-
case ToolTypes_1.options.rangesPicking.id:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
case ToolTypes_1.options.rangesPicking.id: {
|
|
128
|
+
const [from, to] = (0, getRange_1.default)(state, {
|
|
129
|
+
startX: brushData.startX,
|
|
130
|
+
endX: brushData.endX,
|
|
126
131
|
});
|
|
132
|
+
if (!activeSpectrum)
|
|
133
|
+
break;
|
|
134
|
+
const { data: { x }, } = state.data[activeSpectrum.index];
|
|
135
|
+
const { fromIndex, toIndex } = (0, ml_spectra_processing_1.xGetFromToIndex)(x, { from, to });
|
|
136
|
+
if (toIndex - fromIndex <= detectSignal_1.MAX_LENGTH) {
|
|
137
|
+
dispatch({
|
|
138
|
+
type: Types_1.ADD_RANGE,
|
|
139
|
+
payload: {
|
|
140
|
+
...brushData,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
alert.error(`Advanced peak picking only available for area up to ${detectSignal_1.MAX_LENGTH} points`);
|
|
146
|
+
}
|
|
127
147
|
break;
|
|
148
|
+
}
|
|
128
149
|
case ToolTypes_1.options.multipleSpectraAnalysis.id:
|
|
129
150
|
dispatch({
|
|
130
151
|
type: Types_1.ANALYZE_SPECTRA,
|
|
@@ -163,7 +184,17 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
163
184
|
break;
|
|
164
185
|
}
|
|
165
186
|
}
|
|
166
|
-
}, [
|
|
187
|
+
}, [
|
|
188
|
+
scaleState,
|
|
189
|
+
selectedTool,
|
|
190
|
+
general.disableMultipletAnalysis,
|
|
191
|
+
modal,
|
|
192
|
+
data,
|
|
193
|
+
activeSpectrum,
|
|
194
|
+
dispatch,
|
|
195
|
+
state,
|
|
196
|
+
alert,
|
|
197
|
+
]);
|
|
167
198
|
const handelOnDoubleClick = (0, react_1.useCallback)(() => {
|
|
168
199
|
dispatch({ type: Types_1.FULL_ZOOM_OUT, zoomType: Zoom_1.ZoomType.STEP_HORIZONTAL });
|
|
169
200
|
}, [dispatch]);
|
|
@@ -10,7 +10,7 @@ const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
|
|
|
10
10
|
const Range_1 = __importDefault(require("./Range"));
|
|
11
11
|
const RangeIntegral_1 = __importDefault(require("./RangeIntegral"));
|
|
12
12
|
function RangesInner({ ranges, displayerKey, selectedTool, editRangeID, showMultiplicityTrees, showRangesIntegrals, }) {
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, children: ranges?.values?.map((range) => ((0, jsx_runtime_1.jsxs)(
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, children: ranges?.values?.map((range) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Range_1.default, { rangeData: range, selectedTool: selectedTool, showMultiplicityTrees: showMultiplicityTrees, startEditMode: editRangeID && editRangeID === range.id ? true : false }, void 0), showRangesIntegrals && (0, jsx_runtime_1.jsx)(RangeIntegral_1.default, { range: range }, void 0)] }, range.id))) }, void 0));
|
|
14
14
|
}
|
|
15
15
|
const MemoizedRanges = (0, react_1.memo)(RangesInner);
|
|
16
16
|
const empyData = { ranges: {} };
|
|
@@ -7,11 +7,11 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
7
7
|
/** @jsxImportSource @emotion/react */
|
|
8
8
|
const react_1 = require("@emotion/react");
|
|
9
9
|
const react_2 = require("react");
|
|
10
|
-
const ChartContext_1 = require("
|
|
11
|
-
const DispatchContext_1 = require("
|
|
12
|
-
const ScaleContext_1 = require("
|
|
13
|
-
const DeleteButton_1 = __importDefault(require("
|
|
14
|
-
const Types_1 = require("
|
|
10
|
+
const ChartContext_1 = require("../../context/ChartContext");
|
|
11
|
+
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
12
|
+
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
13
|
+
const DeleteButton_1 = __importDefault(require("../../elements/DeleteButton"));
|
|
14
|
+
const Types_1 = require("../../reducer/types/Types");
|
|
15
15
|
const styles = (0, react_1.css) `
|
|
16
16
|
pointer-events: bounding-box;
|
|
17
17
|
user-select: 'none';
|
|
@@ -4,6 +4,7 @@ const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
6
6
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
7
|
+
const PathBuilder_1 = require("../../utility/PathBuilder");
|
|
7
8
|
const scale_1 = require("./scale");
|
|
8
9
|
function useIntegralPath(integralOptions) {
|
|
9
10
|
const { xDomain, height, yDomain, margin, verticalAlign, data, activeSpectrum, zoom, } = (0, ChartContext_1.useChartData)();
|
|
@@ -41,27 +42,25 @@ function useIntegralPath(integralOptions) {
|
|
|
41
42
|
}
|
|
42
43
|
return { x: [], y: [] };
|
|
43
44
|
}, [activeSpectrum, data, integralOptions]);
|
|
44
|
-
const
|
|
45
|
+
const paths = (0, react_1.useMemo)(() => {
|
|
45
46
|
if (integral && scaleX) {
|
|
46
|
-
// @ts-expect-error Types will be fixed in ml-spectra-processing.
|
|
47
47
|
const xySeries = (0, ml_spectra_processing_1.xyReduce)(integral, {
|
|
48
48
|
from: xDomain[0],
|
|
49
49
|
to: xDomain[1],
|
|
50
50
|
nbPoints: 200,
|
|
51
51
|
optimize: true,
|
|
52
52
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return path;
|
|
53
|
+
const pathBuilder = new PathBuilder_1.PathBuilder();
|
|
54
|
+
pathBuilder.moveTo(scaleX()(xySeries.x[0]), scaleY(xySeries.y[0]));
|
|
55
|
+
for (let i = 1; i < xySeries.x.length; i++) {
|
|
56
|
+
pathBuilder.lineTo(scaleX()(xySeries.x[i]), scaleY(xySeries.y[i]));
|
|
57
|
+
}
|
|
58
|
+
return pathBuilder.toString();
|
|
60
59
|
}
|
|
61
60
|
else {
|
|
62
61
|
return '';
|
|
63
62
|
}
|
|
64
63
|
}, [integral, scaleX, scaleY, xDomain]);
|
|
65
|
-
return
|
|
64
|
+
return paths;
|
|
66
65
|
}
|
|
67
66
|
exports.default = useIntegralPath;
|
|
@@ -6,12 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
8
|
const react_1 = require("react");
|
|
9
|
+
const Spectrum2D_1 = require("../../data/data2d/Spectrum2D");
|
|
9
10
|
const ChartContext_1 = require("../context/ChartContext");
|
|
10
11
|
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
12
|
+
const PathBuilder_1 = require("../utility/PathBuilder");
|
|
11
13
|
const scale_1 = require("./utilities/scale");
|
|
12
|
-
function ContoursPaths({ id: spectrumID, sign, color }) {
|
|
14
|
+
function ContoursPaths({ id: spectrumID, sign, color, datum, }) {
|
|
13
15
|
const { margin, width, height, xDomain, yDomain, contours, activeSpectrum } = (0, ChartContext_1.useChartData)();
|
|
14
16
|
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
17
|
+
const { xShift, yShift } = (0, Spectrum2D_1.getShift)(datum);
|
|
15
18
|
const isActive = (0, react_1.useMemo)(() => {
|
|
16
19
|
return activeSpectrum === null
|
|
17
20
|
? true
|
|
@@ -22,28 +25,26 @@ function ContoursPaths({ id: spectrumID, sign, color }) {
|
|
|
22
25
|
function buildContourPath(data) {
|
|
23
26
|
const _scaleX = (0, scale_1.get2DXScale)({ margin, width, xDomain });
|
|
24
27
|
const _scaleY = (0, scale_1.get2DYScale)({ margin, height, yDomain });
|
|
25
|
-
|
|
28
|
+
const path = new PathBuilder_1.PathBuilder();
|
|
26
29
|
for (const element of data) {
|
|
27
30
|
if (element.lines) {
|
|
28
31
|
const lines = element.lines;
|
|
29
32
|
if (lines.length < 1e6) {
|
|
30
33
|
for (let i = 0; i < lines.length; i += 4) {
|
|
31
|
-
path
|
|
32
|
-
path
|
|
34
|
+
path.moveTo(_scaleX(lines[i] + xShift), _scaleY(lines[i + 1] + yShift));
|
|
35
|
+
path.lineTo(_scaleX(lines[i + 2] + xShift), _scaleY(lines[i + 3] + yShift));
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
else {
|
|
37
|
-
path
|
|
40
|
+
path.moveTo(_scaleX(element[0].x + xShift), _scaleY(element[0].y + yShift));
|
|
38
41
|
for (let j = 1; j < element.length; j++) {
|
|
39
|
-
path
|
|
42
|
+
path.lineTo(_scaleX(element[j].x + xShift), _scaleY(element[j].y + yShift));
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
path += 'Z';
|
|
46
|
-
return path;
|
|
46
|
+
path.closePath();
|
|
47
|
+
return path.toString();
|
|
47
48
|
}
|
|
48
49
|
const data = (0, react_1.useMemo)(() => {
|
|
49
50
|
return (0, get_1.default)(contours, `${spectrumID}.${sign}`, []);
|
|
@@ -55,7 +56,7 @@ function ContoursPaths({ id: spectrumID, sign, color }) {
|
|
|
55
56
|
}, d: buildContourPath(data) }, void 0));
|
|
56
57
|
}
|
|
57
58
|
function ContoursInner({ data, displayerKey }) {
|
|
58
|
-
return ((0, jsx_runtime_1.jsx)("g", { clipPath: `url(#${displayerKey}clip-chart-2d)`, className: "contours", children: data?.map((datum, index) => ((0, jsx_runtime_1.jsxs)("g", { children: [datum.display.isPositiveVisible && ((0, jsx_runtime_1.jsx)(ContoursPaths, { id: datum.id, sign: "positive", color: datum.display.positiveColor }, void 0)), datum.display.isNegativeVisible && ((0, jsx_runtime_1.jsx)(ContoursPaths, { id: datum.id, sign: "negative", color: datum.display.negativeColor }, void 0))] }, `${datum.id + index}`))) }, void 0));
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)("g", { clipPath: `url(#${displayerKey}clip-chart-2d)`, className: "contours", children: data?.map((datum, index) => ((0, jsx_runtime_1.jsxs)("g", { children: [datum.display.isPositiveVisible && ((0, jsx_runtime_1.jsx)(ContoursPaths, { id: datum.id, sign: "positive", datum: datum, color: datum.display.positiveColor }, void 0)), datum.display.isNegativeVisible && ((0, jsx_runtime_1.jsx)(ContoursPaths, { id: datum.id, sign: "negative", datum: datum, color: datum.display.negativeColor }, void 0))] }, `${datum.id + index}`))) }, void 0));
|
|
59
60
|
}
|
|
60
61
|
const MemoizedContours = (0, react_1.memo)(ContoursInner);
|
|
61
62
|
function Contours() {
|
|
@@ -23,6 +23,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
23
23
|
const react_1 = require("react");
|
|
24
24
|
const ChartContext_1 = require("../context/ChartContext");
|
|
25
25
|
const useXYReduce_1 = __importStar(require("../hooks/useXYReduce"));
|
|
26
|
+
const PathBuilder_1 = require("../utility/PathBuilder");
|
|
26
27
|
const scale_1 = require("./utilities/scale");
|
|
27
28
|
function Left1DChart({ margin: marignValue = 10, data: spectrum, }) {
|
|
28
29
|
const { height: originHeight, margin, yDomain, yDomains, displayerKey, } = (0, ChartContext_1.useChartData)();
|
|
@@ -38,15 +39,12 @@ function Left1DChart({ margin: marignValue = 10, data: spectrum, }) {
|
|
|
38
39
|
const scaleY = (0, scale_1.get1DYScale)(yDomains[spectrum.id], height, marignValue);
|
|
39
40
|
const { x, re: y } = spectrum.data;
|
|
40
41
|
const pathPoints = xyReduce({ x, y });
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
let
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return accumulator;
|
|
48
|
-
}, '');
|
|
49
|
-
return path;
|
|
42
|
+
const pathBuilder = new PathBuilder_1.PathBuilder();
|
|
43
|
+
pathBuilder.moveTo(scaleY(pathPoints.y[pathPoints.y.length - 1]), scaleX(pathPoints.x.length - 1));
|
|
44
|
+
for (let i = pathPoints.x.length - 2; i >= 0; i--) {
|
|
45
|
+
pathBuilder.lineTo(scaleY(pathPoints.y[i]), scaleX(pathPoints.x[i]));
|
|
46
|
+
}
|
|
47
|
+
return pathBuilder.toString();
|
|
50
48
|
}
|
|
51
49
|
else {
|
|
52
50
|
return undefined;
|
|
@@ -23,6 +23,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
23
23
|
const react_1 = require("react");
|
|
24
24
|
const ChartContext_1 = require("../context/ChartContext");
|
|
25
25
|
const useXYReduce_1 = __importStar(require("../hooks/useXYReduce"));
|
|
26
|
+
const PathBuilder_1 = require("../utility/PathBuilder");
|
|
26
27
|
const scale_1 = require("./utilities/scale");
|
|
27
28
|
function Top1DChart({ margin: marginProps = 10, data: spectrum, }) {
|
|
28
29
|
const { width, margin: originMargin, xDomain, yDomains, displayerKey, } = (0, ChartContext_1.useChartData)();
|
|
@@ -34,13 +35,12 @@ function Top1DChart({ margin: marginProps = 10, data: spectrum, }) {
|
|
|
34
35
|
const scaleY = (0, scale_1.get1DYScale)(yDomains[spectrum.id], height, marginProps);
|
|
35
36
|
const { x, re: y } = spectrum.data;
|
|
36
37
|
const pathPoints = xyReduce({ x, y });
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return path;
|
|
38
|
+
const pathBuilder = new PathBuilder_1.PathBuilder();
|
|
39
|
+
pathBuilder.moveTo(scaleX(pathPoints.x[0]), scaleY(pathPoints.y[0]));
|
|
40
|
+
for (let i = 1; i < pathPoints.x.length; i++) {
|
|
41
|
+
pathBuilder.lineTo(scaleX(pathPoints.x[i]), scaleY(pathPoints.y[i]));
|
|
42
|
+
}
|
|
43
|
+
return pathBuilder.toString();
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
46
|
return undefined;
|
|
@@ -23,6 +23,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
23
23
|
const react_1 = require("react");
|
|
24
24
|
const ChartContext_1 = require("../../../context/ChartContext");
|
|
25
25
|
const useXYReduce_1 = __importStar(require("../../../hooks/useXYReduce"));
|
|
26
|
+
const PathBuilder_1 = require("../../../utility/PathBuilder");
|
|
26
27
|
const scale_1 = require("../../utilities/scale");
|
|
27
28
|
const SliceScale_1 = require("./SliceScale");
|
|
28
29
|
function HorizontalSliceChart({ margin: marginProps = 10, data, }) {
|
|
@@ -35,13 +36,12 @@ function HorizontalSliceChart({ margin: marginProps = 10, data, }) {
|
|
|
35
36
|
const scaleX = (0, scale_1.get2DXScale)({ margin: originMargin, width, xDomain });
|
|
36
37
|
const scaleY = (0, SliceScale_1.getYScale)(height, y, marginProps);
|
|
37
38
|
const pathPoints = xyReduce({ x, y });
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return path;
|
|
39
|
+
const pathBuilder = new PathBuilder_1.PathBuilder();
|
|
40
|
+
pathBuilder.moveTo(scaleX(pathPoints.x[0]), scaleY(pathPoints.y[0]));
|
|
41
|
+
for (let i = 1; i < pathPoints.x.length; i++) {
|
|
42
|
+
pathBuilder.lineTo(scaleX(pathPoints.x[i]), scaleY(pathPoints.y[i]));
|
|
43
|
+
}
|
|
44
|
+
return pathBuilder.toString();
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
47
|
return undefined;
|
|
@@ -23,6 +23,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
23
23
|
const react_1 = require("react");
|
|
24
24
|
const ChartContext_1 = require("../../../context/ChartContext");
|
|
25
25
|
const useXYReduce_1 = __importStar(require("../../../hooks/useXYReduce"));
|
|
26
|
+
const PathBuilder_1 = require("../../../utility/PathBuilder");
|
|
26
27
|
const scale_1 = require("../../utilities/scale");
|
|
27
28
|
const SliceScale_1 = require("./SliceScale");
|
|
28
29
|
function VerticalSliceChart({ margin: marignValue = 10, data, }) {
|
|
@@ -35,15 +36,12 @@ function VerticalSliceChart({ margin: marignValue = 10, data, }) {
|
|
|
35
36
|
const scaleX = (0, scale_1.get2DYScale)({ height: originHeight, margin, yDomain });
|
|
36
37
|
const scaleY = (0, SliceScale_1.getYScale)(height, y, marignValue);
|
|
37
38
|
const pathPoints = xyReduce({ x, y });
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return accumulator;
|
|
45
|
-
}, '');
|
|
46
|
-
return path;
|
|
39
|
+
const pathBuilder = new PathBuilder_1.PathBuilder();
|
|
40
|
+
pathBuilder.moveTo(scaleY(pathPoints.y[pathPoints.y.length - 1]), scaleX(pathPoints.x.length - 1));
|
|
41
|
+
for (let i = pathPoints.x.length - 2; i >= 0; i--) {
|
|
42
|
+
pathBuilder.lineTo(scaleY(pathPoints.y[i]), scaleX(pathPoints.x[i]));
|
|
43
|
+
}
|
|
44
|
+
return pathBuilder.toString();
|
|
47
45
|
}
|
|
48
46
|
else {
|
|
49
47
|
return undefined;
|
|
@@ -72,8 +72,8 @@ function BrushTracker({ children, className, style, onBrush = () => null, onZoom
|
|
|
72
72
|
onZoom({ deltaY: deltaY || deltaX, shiftKey, deltaMode, x, y });
|
|
73
73
|
}, [onZoom]);
|
|
74
74
|
(0, react_1.useEffect)(() => {
|
|
75
|
-
const { step, startX, endX } = state;
|
|
76
|
-
if (step === 'end' && Math.
|
|
75
|
+
const { step, startX, endX, startY, endY } = state;
|
|
76
|
+
if (step === 'end' && Math.hypot(endX - startX, endY - startY) > 5) {
|
|
77
77
|
onBrush(state);
|
|
78
78
|
dispatch({
|
|
79
79
|
type: 'DONE',
|
|
@@ -17,7 +17,7 @@ const Constants_1 = require("../reducer/core/Constants");
|
|
|
17
17
|
const Types_1 = require("../reducer/types/Types");
|
|
18
18
|
const ToolTypes_1 = require("../toolbar/ToolTypes");
|
|
19
19
|
function KeysListenerTracker() {
|
|
20
|
-
const { keysPreferences, displayerMode, overDisplayer, data } = (0, ChartContext_1.useChartData)();
|
|
20
|
+
const { keysPreferences, displayerMode, overDisplayer, data, activeSpectrum, } = (0, ChartContext_1.useChartData)();
|
|
21
21
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
22
22
|
const alert = (0, Alert_1.useAlert)();
|
|
23
23
|
const openLoader = (0, LoaderContext_1.useLoader)();
|
|
@@ -28,10 +28,7 @@ function KeysListenerTracker() {
|
|
|
28
28
|
const allow1DTool = (0, react_1.useMemo)(() => {
|
|
29
29
|
return displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && data && data.length > 0;
|
|
30
30
|
}, [data, displayerMode]);
|
|
31
|
-
const
|
|
32
|
-
return displayerMode === Constants_1.DISPLAYER_MODE.DM_2D && data && data.length > 0;
|
|
33
|
-
}, [data, displayerMode]);
|
|
34
|
-
const deleteHandler = (0, react_1.useCallback)((sourceData) => {
|
|
31
|
+
const deleteHandler = (0, react_1.useCallback)(async (sourceData) => {
|
|
35
32
|
const { type, extra: { id }, } = sourceData;
|
|
36
33
|
switch (type) {
|
|
37
34
|
case index_1.HighlightedSource.INTEGRAL: {
|
|
@@ -79,12 +76,15 @@ function KeysListenerTracker() {
|
|
|
79
76
|
break;
|
|
80
77
|
}
|
|
81
78
|
case index_1.HighlightedSource.EXCLUSION_ZONE: {
|
|
79
|
+
const hideLoading = await alert.showLoading(`Exclusion filter in progress`);
|
|
82
80
|
dispatch({
|
|
83
81
|
type: Types_1.DELETE_EXCLUSION_ZONE,
|
|
84
82
|
payload: {
|
|
85
83
|
id,
|
|
84
|
+
spectrumID: sourceData.extra.spectrumID,
|
|
86
85
|
},
|
|
87
86
|
});
|
|
87
|
+
hideLoading();
|
|
88
88
|
// remove keys from the highlighted list after delete
|
|
89
89
|
remove();
|
|
90
90
|
break;
|
|
@@ -92,7 +92,7 @@ function KeysListenerTracker() {
|
|
|
92
92
|
default:
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
|
-
}, [assignmentData, dispatch, remove]);
|
|
95
|
+
}, [assignmentData, dispatch, remove, alert]);
|
|
96
96
|
const keysPreferencesListenerHandler = (0, react_1.useCallback)((e, num) => {
|
|
97
97
|
if (data && data.length > 0 && num >= 1 && num <= 9) {
|
|
98
98
|
if (e.shiftKey) {
|
|
@@ -122,100 +122,126 @@ function KeysListenerTracker() {
|
|
|
122
122
|
}
|
|
123
123
|
}, [alert, data, dispatch, keysPreferences]);
|
|
124
124
|
const toolsListenerHandler = (0, react_1.useCallback)((e) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
125
|
+
function check1DModeWithActiveSpectrum(label, checkSwitch = true) {
|
|
126
|
+
if (displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && !activeSpectrum) {
|
|
127
|
+
throw new Error(`Select a spectrum to proceed with ${label}`);
|
|
128
|
+
}
|
|
129
|
+
else if (checkSwitch && displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
|
|
130
|
+
throw new Error(`Switch to 1D Mode and select a spectrum to proceed with ${label}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function check2DModeWithActiveSpectrum(label, checkSwitch = true) {
|
|
134
|
+
if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D && !activeSpectrum) {
|
|
135
|
+
throw new Error(`Select a spectrum to proceed with ${label}`);
|
|
136
|
+
}
|
|
137
|
+
else if (checkSwitch && displayerMode === Constants_1.DISPLAYER_MODE.DM_1D) {
|
|
138
|
+
throw new Error(`Switch to 2D Mode and select a spectrum to proceed with ${label}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
if (!e.shiftKey && !e.metaKey) {
|
|
143
|
+
switch (e.key) {
|
|
144
|
+
case 'f':
|
|
145
|
+
handleFullZoomOut();
|
|
146
|
+
break;
|
|
147
|
+
case 'z':
|
|
148
|
+
case 'Escape':
|
|
149
|
+
handleChangeOption(ToolTypes_1.options.zoom.id);
|
|
150
|
+
break;
|
|
151
|
+
case 'r': {
|
|
152
|
+
if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
|
|
153
|
+
check2DModeWithActiveSpectrum(ToolTypes_1.options.zone2D.label, false);
|
|
154
|
+
handleChangeOption(ToolTypes_1.options.zone2D.id);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.rangesPicking.label, false);
|
|
158
|
+
handleChangeOption(ToolTypes_1.options.rangesPicking.id);
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
case 'a': {
|
|
163
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.phaseCorrection.label);
|
|
145
164
|
handleChangeOption(ToolTypes_1.options.phaseCorrection.id);
|
|
165
|
+
break;
|
|
146
166
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
case 'b': {
|
|
150
|
-
if (allow1DTool) {
|
|
167
|
+
case 'b': {
|
|
168
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.baseLineCorrection.label);
|
|
151
169
|
handleChangeOption(ToolTypes_1.options.baseLineCorrection.id);
|
|
170
|
+
break;
|
|
152
171
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
case 'p': {
|
|
156
|
-
if (allow1DTool) {
|
|
172
|
+
case 'p': {
|
|
173
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.peakPicking.label);
|
|
157
174
|
handleChangeOption(ToolTypes_1.options.peakPicking.id);
|
|
175
|
+
break;
|
|
158
176
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
case 'i': {
|
|
162
|
-
if (allow1DTool) {
|
|
177
|
+
case 'i': {
|
|
178
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.integral.label);
|
|
163
179
|
handleChangeOption(ToolTypes_1.options.integral.id);
|
|
180
|
+
break;
|
|
164
181
|
}
|
|
165
|
-
|
|
182
|
+
case 'e': {
|
|
183
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.exclusionZones.label);
|
|
184
|
+
handleChangeOption(ToolTypes_1.options.exclusionZones.id);
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
default:
|
|
166
188
|
}
|
|
167
|
-
default:
|
|
168
189
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
190
|
+
if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
191
|
+
switch (e.key) {
|
|
192
|
+
case 'c': {
|
|
193
|
+
if (allow1DTool) {
|
|
194
|
+
alignSpectrumsVerticallyHandler();
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
175
197
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
198
|
+
case 's': {
|
|
199
|
+
if (allow1DTool) {
|
|
200
|
+
changeDisplayViewModeHandler();
|
|
201
|
+
}
|
|
202
|
+
break;
|
|
181
203
|
}
|
|
182
|
-
|
|
204
|
+
default:
|
|
183
205
|
}
|
|
184
|
-
default:
|
|
185
206
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
207
|
+
if (!e.shiftKey && (e.metaKey || e.ctrlKey)) {
|
|
208
|
+
switch (e.key) {
|
|
209
|
+
case 'c':
|
|
210
|
+
void saveToClipboardHandler();
|
|
211
|
+
e.preventDefault();
|
|
212
|
+
break;
|
|
213
|
+
case 's':
|
|
214
|
+
void saveAsJSONHandler();
|
|
215
|
+
e.preventDefault();
|
|
216
|
+
break;
|
|
217
|
+
case 'o':
|
|
218
|
+
openLoader();
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
break;
|
|
221
|
+
default:
|
|
222
|
+
}
|
|
202
223
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
224
|
+
if (e.shiftKey && (e.metaKey || e.ctrlKey)) {
|
|
225
|
+
switch (e.key) {
|
|
226
|
+
case 's':
|
|
227
|
+
case 'S':
|
|
228
|
+
void saveAsHandler();
|
|
229
|
+
e.preventDefault();
|
|
230
|
+
break;
|
|
231
|
+
default:
|
|
232
|
+
}
|
|
212
233
|
}
|
|
213
234
|
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
alert.error(e.message);
|
|
237
|
+
}
|
|
214
238
|
}, [
|
|
239
|
+
activeSpectrum,
|
|
240
|
+
alert,
|
|
215
241
|
alignSpectrumsVerticallyHandler,
|
|
216
242
|
allow1DTool,
|
|
217
|
-
allow2DTool,
|
|
218
243
|
changeDisplayViewModeHandler,
|
|
244
|
+
displayerMode,
|
|
219
245
|
handleChangeOption,
|
|
220
246
|
handleFullZoomOut,
|
|
221
247
|
openLoader,
|
|
@@ -233,7 +259,7 @@ function KeysListenerTracker() {
|
|
|
233
259
|
else {
|
|
234
260
|
if (['Delete', 'Backspace'].includes(e.key) && highlight.sourceData) {
|
|
235
261
|
e.preventDefault();
|
|
236
|
-
deleteHandler(highlight.sourceData);
|
|
262
|
+
void deleteHandler(highlight.sourceData);
|
|
237
263
|
}
|
|
238
264
|
else {
|
|
239
265
|
toolsListenerHandler(e);
|