nmrium 0.50.1 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/Chart1D.js +1 -1
- package/lib/component/1d/LinesSeries.js +2 -2
- package/lib/component/1d/Viewer1D.js +6 -11
- package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
- package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
- package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
- package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
- package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
- package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
- package/lib/component/2d/Viewer2D.js +16 -15
- package/lib/component/2d/ft/Contours.js +6 -3
- package/lib/component/2d/utilities/scale.d.ts +2 -1
- package/lib/component/2d/utilities/scale.js +12 -2
- package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
- package/lib/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +32 -18
- package/lib/component/context/DispatchContext.d.ts +1 -1
- package/lib/component/context/ToasterContext.d.ts +13 -0
- package/lib/component/context/ToasterContext.js +34 -0
- package/lib/component/elements/Label.js +1 -1
- package/lib/component/elements/Select.js +2 -2
- package/lib/component/elements/ToolbarPopoverItem.js +1 -1
- package/lib/component/header/ApodizationOptionsPanel.js +1 -1
- package/lib/component/header/AutoPeakPickingOptionPanel.js +7 -4
- package/lib/component/header/BaseLineCorrectionPanel.js +2 -2
- package/lib/component/header/Header.d.ts +1 -11
- package/lib/component/header/Header.js +5 -6
- package/lib/component/header/PhaseCorrectionPanel.js +24 -33
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
- package/lib/component/header/RangesPickingOptionPanel.js +7 -4
- package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
- package/lib/component/header/Zones2DOptionPanel.js +6 -2
- package/lib/component/hooks/useDialogToggle.d.ts +5 -0
- package/lib/component/hooks/useDialogToggle.js +16 -0
- package/lib/component/hooks/useExport.d.ts +9 -1
- package/lib/component/hooks/useExport.js +34 -36
- package/lib/component/hooks/useSaveSettings.js +6 -3
- package/lib/component/hooks/useToolsFunctions.d.ts +1 -1
- package/lib/component/hooks/useToolsFunctions.js +9 -7
- package/lib/component/loader/DropZone.js +14 -14
- package/lib/component/main/InnerNMRium.js +5 -9
- package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
- package/lib/component/main/InnerNMRiumContents.js +5 -3
- package/lib/component/main/NMRium.js +2 -2
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib/component/modal/EditPeakShapeModal.js +1 -1
- package/lib/component/modal/ExportAsJcampModal.js +15 -15
- package/lib/component/modal/ImportPublicationStringModal.js +5 -3
- package/lib/component/modal/LoadJCAMPModal.js +7 -5
- package/lib/component/modal/LogsHistoryModal.js +1 -1
- package/lib/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib/component/modal/PredictSpectraModal.js +11 -9
- package/lib/component/modal/SaveAsModal.d.ts +3 -4
- package/lib/component/modal/SaveAsModal.js +27 -27
- package/lib/component/modal/editRange/EditRangeModal.js +2 -2
- package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
- package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
- package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
- package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
- package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
- package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
- package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
- package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
- package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
- package/lib/component/modal/editZone/EditPathLengthFormik.js +2 -2
- package/lib/component/modal/editZone/EditZoneModal.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
- package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
- package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +9 -6
- package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +1 -1
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +13 -7
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
- package/lib/component/panels/Panels.js +5 -5
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +6 -3
- package/lib/component/panels/RangesPanel/RangesHeader.js +3 -3
- package/lib/component/panels/RangesPanel/RangesPanel.js +5 -5
- package/lib/component/panels/RangesPanel/RangesPreferences.js +1 -1
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.d.ts +5 -0
- package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPanelHeader.js +11 -11
- package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.js +12 -6
- package/lib/component/panels/SpectraPanel/SpectraTabs.d.ts +1 -0
- package/lib/component/panels/{SpectrumsPanel/SpectrumsTabs.js → SpectraPanel/SpectraTabs.js} +6 -6
- package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.js +2 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
- package/lib/component/panels/databasePanel/DatabasePreferences.js +1 -1
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +1 -1
- package/lib/component/panels/filtersPanel/FilterPanel.js +5 -3
- package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +7 -5
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +5 -5
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +6 -6
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +5 -3
- package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -2
- package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -1
- package/lib/component/reducer/Reducer.d.ts +3 -2
- package/lib/component/reducer/Reducer.js +40 -32
- package/lib/component/reducer/actions/DomainActions.js +3 -3
- package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
- package/lib/component/reducer/actions/FiltersActions.js +243 -91
- package/lib/component/reducer/actions/IntegralsActions.js +2 -2
- package/lib/component/reducer/actions/LoadActions.js +1 -1
- package/lib/component/reducer/actions/MoleculeActions.js +0 -1
- package/lib/component/reducer/actions/PreferencesActions.js +2 -2
- package/lib/component/reducer/actions/RangesActions.js +16 -6
- package/lib/component/reducer/actions/ToolsActions.d.ts +6 -6
- package/lib/component/reducer/actions/ToolsActions.js +83 -22
- package/lib/component/reducer/actions/ZonesActions.d.ts +2 -0
- package/lib/component/reducer/actions/ZonesActions.js +5 -1
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
- package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
- package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
- package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
- package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
- package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
- package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
- package/lib/component/toolbar/ToolBar.js +32 -27
- package/lib/component/toolbar/toolbarMenu.js +4 -4
- package/lib/component/utility/Events.d.ts +11 -0
- package/lib/component/utility/Events.js +22 -0
- package/lib/constants.js +5 -5
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
- package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +3 -3
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
- package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -0
- package/lib/data/getDefaultMatrixFilters.js +2 -2
- package/lib/data/matrixGeneration.js +1 -1
- package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
- package/lib/versionInfo.js +1 -1
- package/package.json +32 -30
- package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
- package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
- package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
- package/lib/component/elements/popup/Alert/Context.js +0 -10
- package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
- package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
- package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
- package/lib/component/elements/popup/Alert/Provider.js +0 -127
- package/lib/component/elements/popup/Alert/index.d.ts +0 -3
- package/lib/component/elements/popup/Alert/index.js +0 -3
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
- package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
- package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
- package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
- package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
- package/lib/component/modal/metaImportation/index.d.ts +0 -2
- package/lib/component/modal/metaImportation/index.js +0 -17
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.d.ts +0 -5
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.d.ts +0 -1
- package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
- package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.js +0 -0
- /package/lib/component/reducer/actions/{SpectrumsActions.d.ts → SpectraActions.d.ts} +0 -0
- /package/lib/component/reducer/actions/{SpectrumsActions.js → SpectraActions.js} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { v4 } from '@lukeed/uuid';
|
|
2
|
+
import { zoomIdentity } from 'd3';
|
|
2
3
|
import { contoursManager } from '../../../data/data2d/Spectrum2D/contours';
|
|
3
4
|
import { getYScale, getXScale } from '../../1d/utilities/scale';
|
|
4
5
|
import { LAYOUT } from '../../2d/utilities/DimensionLayout';
|
|
5
|
-
import { get2DYScale } from '../../2d/utilities/scale';
|
|
6
|
+
import { get2DXScale, get2DYScale } from '../../2d/utilities/scale';
|
|
6
7
|
import { defaultRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
|
|
7
8
|
import { options as Tools } from '../../toolbar/ToolTypes';
|
|
8
9
|
import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
@@ -94,7 +95,7 @@ function getSpectrumID(draft, index) {
|
|
|
94
95
|
}
|
|
95
96
|
return null;
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
+
function setSpectraVerticalAlign(draft) {
|
|
98
99
|
const currentVerticalAlign = getVerticalAlign(draft);
|
|
99
100
|
const verticalAlign = ['stack', 'bottom'].includes(currentVerticalAlign)
|
|
100
101
|
? 'center'
|
|
@@ -168,17 +169,70 @@ function handleBrushEnd(draft, action) {
|
|
|
168
169
|
const domainY = startY > endY ? [endY, startY] : [startY, endY];
|
|
169
170
|
addToBrushHistory(draft, { trackID, xDomain: domainX, yDomain: domainY });
|
|
170
171
|
}
|
|
172
|
+
function zoomWithScroll(draft, options) {
|
|
173
|
+
const { zoomOptions, direction = 'Horizontal', dimension } = options;
|
|
174
|
+
let scaleX;
|
|
175
|
+
let scaleY;
|
|
176
|
+
if (dimension === '1D') {
|
|
177
|
+
scaleX = getXScale(draft);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
scaleX = get2DXScale(draft);
|
|
181
|
+
scaleY = get2DYScale(draft);
|
|
182
|
+
}
|
|
183
|
+
const scaleRatio = toScaleRatio(zoomOptions, { invert: true });
|
|
184
|
+
if (direction === 'Both' || direction === 'Horizontal') {
|
|
185
|
+
const { x } = zoomOptions;
|
|
186
|
+
const domain = zoomIdentity
|
|
187
|
+
.translate(x, 0)
|
|
188
|
+
.scale(scaleRatio)
|
|
189
|
+
.translate(-x, 0)
|
|
190
|
+
.rescaleX(scaleX)
|
|
191
|
+
.domain();
|
|
192
|
+
const { originDomain: { xDomain: [x1, x2], }, } = draft;
|
|
193
|
+
draft.xDomain = [
|
|
194
|
+
domain[0] < x1 ? x1 : domain[0],
|
|
195
|
+
domain[1] > x2 ? x2 : domain[1],
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
if (dimension === '2D' &&
|
|
199
|
+
(direction === 'Both' || direction === 'Vertical')) {
|
|
200
|
+
const { y } = zoomOptions;
|
|
201
|
+
const domain = zoomIdentity
|
|
202
|
+
.translate(y, 0)
|
|
203
|
+
.scale(scaleRatio)
|
|
204
|
+
.translate(-y, 0)
|
|
205
|
+
.rescaleX(scaleY)
|
|
206
|
+
.domain();
|
|
207
|
+
const { originDomain: { yDomain: [x1, x2], }, } = draft;
|
|
208
|
+
draft.yDomain = [
|
|
209
|
+
domain[0] < x1 ? x1 : domain[0],
|
|
210
|
+
domain[1] > x2 ? x2 : domain[1],
|
|
211
|
+
];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
171
214
|
function handleZoom(draft, action) {
|
|
172
|
-
const {
|
|
215
|
+
const { options, trackID } = action.payload;
|
|
173
216
|
const { displayerMode, yDomains, toolOptions: { selectedTool }, } = draft;
|
|
174
|
-
const scaleRatio = toScaleRatio(
|
|
217
|
+
const scaleRatio = toScaleRatio(options);
|
|
175
218
|
switch (displayerMode) {
|
|
176
219
|
case '2D': {
|
|
177
|
-
|
|
178
|
-
if (
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
220
|
+
const { shiftKey } = options;
|
|
221
|
+
if (trackID === 'CENTER_2D') {
|
|
222
|
+
// change the vertical scale for traces in 2D phase correction
|
|
223
|
+
if (selectedTool === 'phaseCorrectionTwoDimensions') {
|
|
224
|
+
const { activeTraces } = getTwoDimensionPhaseCorrectionOptions(draft);
|
|
225
|
+
activeTraces.scaleRatio *= scaleRatio;
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
//zoom in/out in 2d
|
|
229
|
+
if (selectedTool === 'zoom' && shiftKey) {
|
|
230
|
+
zoomWithScroll(draft, {
|
|
231
|
+
zoomOptions: options,
|
|
232
|
+
dimension: '2D',
|
|
233
|
+
direction: 'Both',
|
|
234
|
+
});
|
|
235
|
+
}
|
|
182
236
|
}
|
|
183
237
|
else {
|
|
184
238
|
// change the vertical scale of 1D traces
|
|
@@ -187,7 +241,7 @@ function handleZoom(draft, action) {
|
|
|
187
241
|
const id = getSpectrumID(draft, index);
|
|
188
242
|
if (id) {
|
|
189
243
|
const domain = yDomains[id];
|
|
190
|
-
yDomains[id] = wheelZoom(
|
|
244
|
+
yDomains[id] = wheelZoom(options, domain);
|
|
191
245
|
}
|
|
192
246
|
}
|
|
193
247
|
}
|
|
@@ -195,15 +249,21 @@ function handleZoom(draft, action) {
|
|
|
195
249
|
}
|
|
196
250
|
case '1D': {
|
|
197
251
|
const activeSpectra = getActiveSpectra(draft);
|
|
252
|
+
const { shiftKey } = options;
|
|
253
|
+
// Horizontal zoom in/out 1d spectra by mouse wheel
|
|
254
|
+
if (selectedTool === 'zoom' && shiftKey) {
|
|
255
|
+
zoomWithScroll(draft, { zoomOptions: options, dimension: '1D' });
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
198
258
|
if (!activeSpectra) {
|
|
199
259
|
// rescale the spectra
|
|
200
260
|
for (const key of Object.keys(yDomains)) {
|
|
201
261
|
const domain = yDomains[key];
|
|
202
|
-
yDomains[key] = wheelZoom(
|
|
262
|
+
yDomains[key] = wheelZoom(options, domain);
|
|
203
263
|
}
|
|
204
264
|
return;
|
|
205
265
|
}
|
|
206
|
-
if (activeSpectra.length === 1 &&
|
|
266
|
+
if (activeSpectra.length === 1 && shiftKey) {
|
|
207
267
|
switch (selectedTool) {
|
|
208
268
|
case 'rangePicking': {
|
|
209
269
|
setRangesViewProperty(draft, 'integralsScaleRatio', (scale) => scale * scaleRatio);
|
|
@@ -221,7 +281,7 @@ function handleZoom(draft, action) {
|
|
|
221
281
|
for (const activeSpectrum of activeSpectra) {
|
|
222
282
|
const domain = yDomains?.[activeSpectrum?.id];
|
|
223
283
|
if (domain) {
|
|
224
|
-
yDomains[activeSpectrum?.id] = wheelZoom(
|
|
284
|
+
yDomains[activeSpectrum?.id] = wheelZoom(options, domain);
|
|
225
285
|
}
|
|
226
286
|
}
|
|
227
287
|
}
|
|
@@ -252,6 +312,7 @@ function zoomOut(draft, action) {
|
|
|
252
312
|
draft.xDomain = zoomValue.xDomain;
|
|
253
313
|
}
|
|
254
314
|
else {
|
|
315
|
+
draft.xDomain = xDomain;
|
|
255
316
|
setZoom(draft, { scale: 0.8 });
|
|
256
317
|
}
|
|
257
318
|
break;
|
|
@@ -340,16 +401,16 @@ function setTabActiveSpectrum(draft, dataGroupByTab) {
|
|
|
340
401
|
const tabSpectra = dataGroupByTab[tabKey];
|
|
341
402
|
const tabSpectraLength = tabSpectra.length;
|
|
342
403
|
if (tabSpectraLength >= 2) {
|
|
343
|
-
const
|
|
344
|
-
if (
|
|
404
|
+
const FTSpectra = tabSpectra.filter((d) => !d.info.isFid);
|
|
405
|
+
if (FTSpectra.length > 0) {
|
|
345
406
|
const selected = nucleusLength === 2 ||
|
|
346
|
-
(nucleusLength === 1 && tabSpectraLength !==
|
|
347
|
-
const index = draft.data.findIndex((datum) => datum.id ===
|
|
407
|
+
(nucleusLength === 1 && tabSpectraLength !== FTSpectra.length);
|
|
408
|
+
const index = draft.data.findIndex((datum) => datum.id === FTSpectra[0].id);
|
|
348
409
|
tabActiveSpectrum[tabKey] = [
|
|
349
|
-
{ id:
|
|
410
|
+
{ id: FTSpectra[0].id, index, selected },
|
|
350
411
|
];
|
|
351
412
|
}
|
|
352
|
-
else if (tabSpectraLength -
|
|
413
|
+
else if (tabSpectraLength - FTSpectra > 0) {
|
|
353
414
|
const id = tabSpectra[0].id;
|
|
354
415
|
const index = draft.data.findIndex((datum) => datum.id === id);
|
|
355
416
|
tabActiveSpectrum[tabKey] = [{ id, index, selected: true }];
|
|
@@ -411,7 +472,7 @@ function handelSetActiveTab(draft, action) {
|
|
|
411
472
|
}
|
|
412
473
|
}
|
|
413
474
|
function levelChangeHandler(draft, action) {
|
|
414
|
-
const { deltaY,
|
|
475
|
+
const { deltaY, altKey } = action.payload.options;
|
|
415
476
|
const { data, view: { spectra: { activeTab }, zoom: { levels }, }, } = draft;
|
|
416
477
|
const activeSpectra = getActiveSpectra(draft) || [];
|
|
417
478
|
const activeSpectraObj = {};
|
|
@@ -424,7 +485,7 @@ function levelChangeHandler(draft, action) {
|
|
|
424
485
|
for (const spectrum of spectra) {
|
|
425
486
|
const contourOptions = spectrum.display.contourOptions;
|
|
426
487
|
const zoom = contoursManager(spectrum.id, levels, contourOptions);
|
|
427
|
-
levels[spectrum.id] = zoom.wheel(deltaY,
|
|
488
|
+
levels[spectrum.id] = zoom.wheel(deltaY, altKey);
|
|
428
489
|
}
|
|
429
490
|
}
|
|
430
491
|
catch (error) {
|
|
@@ -444,4 +505,4 @@ function resetSpectraScale(draft) {
|
|
|
444
505
|
draft.yDomain = draft.originDomain.yDomain;
|
|
445
506
|
setZoom(draft, { scale: 0.8 });
|
|
446
507
|
}
|
|
447
|
-
export { handleResetSelectedTool, resetSelectedTool, setSelectedTool, activateTool,
|
|
508
|
+
export { handleResetSelectedTool, resetSelectedTool, setSelectedTool, activateTool, setSpectraVerticalAlign, handleChangeSpectrumDisplayMode, handleAddBaseLineZone, handleDeleteBaseLineZone, handleResizeBaseLineZone, handleToggleRealImaginaryVisibility, handleBrushEnd, handleZoom, zoomOut, handelSetActiveTab, levelChangeHandler, setActiveTab, setTab, setSpectraSameTopHandler, resetSpectraScale, setMargin, };
|
|
@@ -16,10 +16,12 @@ interface DeleteSignal2DProps {
|
|
|
16
16
|
}
|
|
17
17
|
type ChangeZonesFactorAction = ActionType<'CHANGE_ZONES_NOISE_FACTOR', {
|
|
18
18
|
zonesNoiseFactor: number;
|
|
19
|
+
zonesMinMaxRatio: number;
|
|
19
20
|
}>;
|
|
20
21
|
type Add2dZoneAction = ActionType<'ADD_2D_ZONE', ZoneBoundary>;
|
|
21
22
|
type AutoZonesDetectionAction = ActionType<'AUTO_ZONES_DETECTION', {
|
|
22
23
|
zonesNoiseFactor: number;
|
|
24
|
+
zonesMinMaxRatio: number;
|
|
23
25
|
}>;
|
|
24
26
|
type ChangeZoneSignalDeltaAction = ActionType<'CHANGE_ZONE_SIGNAL_VALUE', {
|
|
25
27
|
zoneId: string;
|
|
@@ -14,6 +14,7 @@ import { setDomain } from './DomainActions';
|
|
|
14
14
|
//action
|
|
15
15
|
function handleChangeZonesFactor(draft, action) {
|
|
16
16
|
draft.toolOptions.data.zonesNoiseFactor = action.payload.zonesNoiseFactor;
|
|
17
|
+
draft.toolOptions.data.zonesMinMaxRatio = action.payload.zonesMinMaxRatio;
|
|
17
18
|
}
|
|
18
19
|
//action
|
|
19
20
|
function handleAdd2dZone(draft, action) {
|
|
@@ -25,6 +26,7 @@ function handleAdd2dZone(draft, action) {
|
|
|
25
26
|
const zones = detectZonesManual(original(datum), {
|
|
26
27
|
selectedZone: drawnZone,
|
|
27
28
|
thresholdFactor: draft.toolOptions.data.zonesNoiseFactor,
|
|
29
|
+
maxPercentCutOff: draft.toolOptions.data.zonesMinMaxRatio,
|
|
28
30
|
convolutionByFFT: false,
|
|
29
31
|
});
|
|
30
32
|
datum.zones.values = datum.zones.values.concat(zones);
|
|
@@ -36,12 +38,13 @@ function handleAutoZonesDetection(draft, action) {
|
|
|
36
38
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
37
39
|
if (activeSpectrum?.id) {
|
|
38
40
|
const { index } = activeSpectrum;
|
|
39
|
-
const { zonesNoiseFactor: thresholdFactor } = action.payload;
|
|
41
|
+
const { zonesNoiseFactor: thresholdFactor, zonesMinMaxRatio: maxPercentCutOff, } = action.payload;
|
|
40
42
|
const [fromX, toX] = draft.xDomain;
|
|
41
43
|
const [fromY, toY] = draft.yDomain;
|
|
42
44
|
const detectionOptions = {
|
|
43
45
|
selectedZone: { fromX, toX, fromY, toY },
|
|
44
46
|
thresholdFactor,
|
|
47
|
+
maxPercentCutOff,
|
|
45
48
|
};
|
|
46
49
|
const datum = draft.data[index];
|
|
47
50
|
const zones = detectZones(original(datum), detectionOptions);
|
|
@@ -58,6 +61,7 @@ function handleAutoSpectraZonesDetection(draft) {
|
|
|
58
61
|
const detectionOptions = {
|
|
59
62
|
selectedZone: { fromX: minX, toX: maxX, fromY: minY, toY: maxY },
|
|
60
63
|
thresholdFactor: 1,
|
|
64
|
+
maxPercentCutOff: 0.03,
|
|
61
65
|
};
|
|
62
66
|
const zones = detectZones(original(datum), detectionOptions);
|
|
63
67
|
datum.zones.values = datum.zones.values.concat(zones);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
+
import { ZoomOptions } from '../../EventsTrackers/BrushTracker';
|
|
2
3
|
import { State } from '../Reducer';
|
|
3
4
|
export declare const ZOOM_TYPES: {
|
|
4
5
|
readonly HORIZONTAL: "HORIZONTAL";
|
|
@@ -7,12 +8,12 @@ export declare const ZOOM_TYPES: {
|
|
|
7
8
|
readonly FULL: "FULL";
|
|
8
9
|
};
|
|
9
10
|
export type ZoomType = keyof typeof ZOOM_TYPES;
|
|
10
|
-
declare function toScaleRatio(
|
|
11
|
-
interface
|
|
11
|
+
declare function toScaleRatio(options: ZoomOptions, zoomOptions?: ScaleRationOptions): number;
|
|
12
|
+
interface ScaleRationOptions {
|
|
12
13
|
factor?: number;
|
|
13
14
|
invert?: boolean;
|
|
14
15
|
}
|
|
15
|
-
declare function wheelZoom(
|
|
16
|
+
declare function wheelZoom(options: ZoomOptions, domain: number[], scaleOptions?: ScaleRationOptions): number[];
|
|
16
17
|
declare function setZoom(draft: Draft<State>, options?: {
|
|
17
18
|
scale?: number;
|
|
18
19
|
spectrumID?: string;
|
|
@@ -6,15 +6,15 @@ export const ZOOM_TYPES = {
|
|
|
6
6
|
STEP_HORIZONTAL: 'STEP_HORIZONTAL',
|
|
7
7
|
FULL: 'FULL',
|
|
8
8
|
};
|
|
9
|
-
function toScaleRatio(
|
|
9
|
+
function toScaleRatio(options, zoomOptions = {}) {
|
|
10
10
|
const { factor = 1, invert = false } = zoomOptions;
|
|
11
|
-
const deltaY = Math.abs(
|
|
11
|
+
const deltaY = Math.abs(options.deltaY) < 100 ? options.deltaY * 100 : options.deltaY;
|
|
12
12
|
const delta = deltaY * (invert ? -0.001 : 0.001) * factor;
|
|
13
13
|
const ratio = delta < 0 ? -1 / (delta - 1) : 1 + delta;
|
|
14
14
|
return ratio;
|
|
15
15
|
}
|
|
16
|
-
function wheelZoom(
|
|
17
|
-
const ratio = toScaleRatio(
|
|
16
|
+
function wheelZoom(options, domain, scaleOptions = {}) {
|
|
17
|
+
const ratio = toScaleRatio(options, scaleOptions);
|
|
18
18
|
const [min, max] = domain;
|
|
19
19
|
return [min * ratio, max * ratio];
|
|
20
20
|
}
|
|
@@ -32,11 +32,7 @@ function prepareGetLast(historyStack) {
|
|
|
32
32
|
export function addToBrushHistory(draft, options) {
|
|
33
33
|
const { displayerMode } = draft;
|
|
34
34
|
const { trackID, xDomain, yDomain } = options;
|
|
35
|
-
const brushHistory = zoomHistoryManager(
|
|
36
|
-
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
37
|
-
draft.zoom.history,
|
|
38
|
-
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
39
|
-
draft.view.spectra.activeTab);
|
|
35
|
+
const brushHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
|
|
40
36
|
if (displayerMode === '2D') {
|
|
41
37
|
switch (trackID) {
|
|
42
38
|
case 'CENTER_2D':
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
2
|
+
import { maxAbsoluteValue } from '../../utility/maxAbsoluteValue';
|
|
3
|
+
export function findStrongestPeak(data) {
|
|
4
|
+
if (!data)
|
|
5
|
+
return null;
|
|
6
|
+
const maxY = maxAbsoluteValue(data.re);
|
|
7
|
+
const index = xFindClosestIndex(data.re, maxY, { sorted: false });
|
|
8
|
+
return {
|
|
9
|
+
xValue: data.x[index],
|
|
10
|
+
yValue: maxY,
|
|
11
|
+
index,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Draft } from 'immer';
|
|
2
|
-
import type { PhaseCorrectionTraceData, State, TwoDimensionPhaseCorrection } from '../Reducer';
|
|
2
|
+
import type { PhaseCorrectionTraceData, State, TraceDirection, TwoDimensionPhaseCorrection } from '../Reducer';
|
|
3
3
|
export declare function getTwoDimensionPhaseCorrectionOptions(state: Draft<State> | State): Draft<TwoDimensionPhaseCorrection & {
|
|
4
4
|
activeTraces: PhaseCorrectionTraceData;
|
|
5
5
|
}>;
|
|
6
|
+
export declare function useTwoDimensionPhaseCorrectionOptions(direction: TraceDirection): PhaseCorrectionTraceData;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { useChartData } from '../../context/ChartContext';
|
|
1
2
|
export function getTwoDimensionPhaseCorrectionOptions(state) {
|
|
2
|
-
const { toolOptions: { data: { twoDimensionPhaseCorrection: { traces, activeTraceDirection }, }, }, } = state;
|
|
3
|
+
const { toolOptions: { data: { twoDimensionPhaseCorrection: { traces, activeTraceDirection, addTracesToBothDirections, }, }, }, } = state;
|
|
3
4
|
return {
|
|
4
5
|
activeTraces: traces[activeTraceDirection],
|
|
5
6
|
traces,
|
|
6
7
|
activeTraceDirection,
|
|
8
|
+
addTracesToBothDirections,
|
|
7
9
|
};
|
|
8
10
|
}
|
|
11
|
+
export function useTwoDimensionPhaseCorrectionOptions(direction) {
|
|
12
|
+
const { toolOptions: { data: { twoDimensionPhaseCorrection: { traces }, }, }, } = useChartData();
|
|
13
|
+
return traces[direction];
|
|
14
|
+
}
|
|
@@ -3,7 +3,7 @@ import { SvgNmrAlignBottom, SvgNmrAlignCenter, SvgNmrApodization, SvgNmrBaseline
|
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { FaSearchPlus, FaExpand, FaDiceFour, FaFileImport, FaFileExport, } from 'react-icons/fa';
|
|
5
5
|
import { PiKnifeBold } from 'react-icons/pi';
|
|
6
|
-
import { Toolbar
|
|
6
|
+
import { Toolbar } from 'react-science/ui';
|
|
7
7
|
import { useChartData } from '../context/ChartContext';
|
|
8
8
|
import { useDispatch } from '../context/DispatchContext';
|
|
9
9
|
import { useLoader } from '../context/LoaderContext';
|
|
@@ -11,12 +11,14 @@ import { ToolbarPopoverItem, } from '../elements/ToolbarPopoverItem';
|
|
|
11
11
|
import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
|
|
12
12
|
import { useCheckToolsVisibility, } from '../hooks/useCheckToolsVisibility';
|
|
13
13
|
import useDatumWithSpectraStatistics from '../hooks/useDatumWithSpectraStatistics';
|
|
14
|
+
import { useDialogToggle } from '../hooks/useDialogToggle';
|
|
14
15
|
import useExport from '../hooks/useExport';
|
|
15
16
|
import useToolsFunctions from '../hooks/useToolsFunctions';
|
|
16
17
|
import { useVerticalAlign } from '../hooks/useVerticalAlign';
|
|
17
18
|
import ImportPublicationStringModal from '../modal/ImportPublicationStringModal';
|
|
18
19
|
import { LoadJCAMPModal } from '../modal/LoadJCAMPModal';
|
|
19
|
-
import
|
|
20
|
+
import SaveAsModal from '../modal/SaveAsModal';
|
|
21
|
+
import { MetaImportationModal } from '../modal/metaImportation/MetaImportationModal';
|
|
20
22
|
import { options } from './ToolTypes';
|
|
21
23
|
import { EXPORT_MENU, IMPORT_MENU } from './toolbarMenu';
|
|
22
24
|
function isPopoverToolItem(item) {
|
|
@@ -26,15 +28,18 @@ export default function ToolBar() {
|
|
|
26
28
|
const { toolOptions: { selectedTool }, } = useChartData();
|
|
27
29
|
const isButtonVisible = useCheckToolsVisibility();
|
|
28
30
|
const dispatch = useDispatch();
|
|
29
|
-
const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler,
|
|
31
|
+
const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler, alignSpectraVerticallyHandler, handleChangeOption, handleFullZoomOut, } = useToolsFunctions();
|
|
30
32
|
const handleChange = useCallback((selectedOption) => {
|
|
31
33
|
handleChangeOption(selectedOption);
|
|
32
34
|
}, [handleChangeOption]);
|
|
33
35
|
const openLoader = useLoader();
|
|
34
|
-
const openMetaInformationModal = useMetaInformationImportationModal();
|
|
35
36
|
const isExperimentalFeature = useCheckExperimentalFeature();
|
|
36
|
-
const
|
|
37
|
-
|
|
37
|
+
const { dialog, closeDialog, openDialog } = useDialogToggle({
|
|
38
|
+
loadJCAMP: false,
|
|
39
|
+
importPublicationString: false,
|
|
40
|
+
metaImportation: false,
|
|
41
|
+
saveAs: false,
|
|
42
|
+
});
|
|
38
43
|
const verticalAlign = useVerticalAlign();
|
|
39
44
|
const { fidCounter, ftCounter } = useDatumWithSpectraStatistics();
|
|
40
45
|
const importMenu = isExperimentalFeature
|
|
@@ -58,20 +63,20 @@ export default function ToolBar() {
|
|
|
58
63
|
type: 'APPLY_FFT_DIMENSION_2_FILTER',
|
|
59
64
|
});
|
|
60
65
|
}, [dispatch]);
|
|
61
|
-
const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler,
|
|
66
|
+
const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler, } = useExport();
|
|
62
67
|
function importHandler(data) {
|
|
63
68
|
switch (data?.id) {
|
|
64
69
|
case 'importFile':
|
|
65
70
|
openLoader();
|
|
66
71
|
break;
|
|
67
72
|
case 'importJDX':
|
|
68
|
-
|
|
73
|
+
openDialog('loadJCAMP');
|
|
69
74
|
break;
|
|
70
75
|
case 'importPublicationString':
|
|
71
|
-
|
|
76
|
+
openDialog('importPublicationString');
|
|
72
77
|
break;
|
|
73
78
|
case 'importMetaInformation':
|
|
74
|
-
|
|
79
|
+
openDialog('metaImportation');
|
|
75
80
|
break;
|
|
76
81
|
default:
|
|
77
82
|
}
|
|
@@ -88,7 +93,7 @@ export default function ToolBar() {
|
|
|
88
93
|
saveAsJSONHandler();
|
|
89
94
|
break;
|
|
90
95
|
case 'advance_save':
|
|
91
|
-
|
|
96
|
+
openDialog('saveAs');
|
|
92
97
|
break;
|
|
93
98
|
case 'copy':
|
|
94
99
|
void saveToClipboardHandler();
|
|
@@ -105,23 +110,23 @@ export default function ToolBar() {
|
|
|
105
110
|
},
|
|
106
111
|
{
|
|
107
112
|
id: 'zoomOut',
|
|
108
|
-
title: 'Horizontal zoom out (
|
|
113
|
+
title: 'Horizontal zoom out (Press f), Horizontal and Vertical zoom out, double click (Press ff)',
|
|
109
114
|
onClick: handleFullZoomOut,
|
|
110
115
|
icon: _jsx(FaExpand, {}),
|
|
111
116
|
},
|
|
112
117
|
{
|
|
113
118
|
id: 'peakPicking',
|
|
114
|
-
title: `${options.peakPicking.label} (
|
|
119
|
+
title: `${options.peakPicking.label} (Press p)`,
|
|
115
120
|
icon: _jsx(SvgNmrPeakPicking, {}),
|
|
116
121
|
},
|
|
117
122
|
{
|
|
118
123
|
id: 'integral',
|
|
119
|
-
title: `${options.integral.label} (
|
|
124
|
+
title: `${options.integral.label} (Press i)`,
|
|
120
125
|
icon: _jsx(SvgNmrIntegrate, {}),
|
|
121
126
|
},
|
|
122
127
|
{
|
|
123
128
|
id: 'zonePicking',
|
|
124
|
-
title: `${options.zonePicking.label} (
|
|
129
|
+
title: `${options.zonePicking.label} (Press r)`,
|
|
125
130
|
icon: _jsx(FaDiceFour, {}),
|
|
126
131
|
},
|
|
127
132
|
{
|
|
@@ -131,7 +136,7 @@ export default function ToolBar() {
|
|
|
131
136
|
},
|
|
132
137
|
{
|
|
133
138
|
id: 'rangePicking',
|
|
134
|
-
title: `${options.rangePicking.label} (
|
|
139
|
+
title: `${options.rangePicking.label} (Press r)`,
|
|
135
140
|
icon: _jsx(SvgNmrRangePicking, {}),
|
|
136
141
|
},
|
|
137
142
|
{
|
|
@@ -139,7 +144,7 @@ export default function ToolBar() {
|
|
|
139
144
|
title: options.multipleSpectraAnalysis.label,
|
|
140
145
|
icon: _jsx(SvgNmrMultipleAnalysis, {}),
|
|
141
146
|
checkOptions: { checkSpectrumType: false },
|
|
142
|
-
condition: ftCounter >
|
|
147
|
+
condition: ftCounter > 0,
|
|
143
148
|
},
|
|
144
149
|
{
|
|
145
150
|
id: 'apodization',
|
|
@@ -148,34 +153,34 @@ export default function ToolBar() {
|
|
|
148
153
|
},
|
|
149
154
|
{
|
|
150
155
|
id: 'zeroFilling',
|
|
151
|
-
title: `${options.zeroFilling.label} (
|
|
156
|
+
title: `${options.zeroFilling.label} (Press z)`,
|
|
152
157
|
icon: _jsx(SvgNmrZeroFilling, {}),
|
|
153
158
|
},
|
|
154
159
|
{
|
|
155
160
|
id: 'phaseCorrection',
|
|
156
|
-
title: `${options.phaseCorrection.label} (
|
|
161
|
+
title: `${options.phaseCorrection.label} (Press a)`,
|
|
157
162
|
icon: _jsx(SvgNmrPhaseCorrection, {}),
|
|
158
163
|
},
|
|
159
164
|
{
|
|
160
165
|
id: 'phaseCorrectionTwoDimensions',
|
|
161
|
-
title: `${options.phaseCorrectionTwoDimensions.label} (
|
|
166
|
+
title: `${options.phaseCorrectionTwoDimensions.label} (Press a)`,
|
|
162
167
|
icon: _jsx(SvgNmrPhaseCorrection, {}),
|
|
163
168
|
},
|
|
164
169
|
{
|
|
165
170
|
id: 'baselineCorrection',
|
|
166
|
-
title: `${options.baselineCorrection.label} (
|
|
171
|
+
title: `${options.baselineCorrection.label} (Press b)`,
|
|
167
172
|
icon: _jsx(SvgNmrBaselineCorrection, {}),
|
|
168
173
|
},
|
|
169
174
|
{
|
|
170
175
|
id: 'exclusionZones',
|
|
171
|
-
title: `${options.exclusionZones.label} (
|
|
176
|
+
title: `${options.exclusionZones.label} (Press e)`,
|
|
172
177
|
icon: _jsx(SvgNmrMultipleAnalysis, {}),
|
|
173
178
|
checkOptions: { checkSpectrumType: false },
|
|
174
179
|
condition: ftCounter > 0,
|
|
175
180
|
},
|
|
176
181
|
{
|
|
177
182
|
id: 'fft',
|
|
178
|
-
title: `${options.fft.label} (
|
|
183
|
+
title: `${options.fft.label} (Press t)`,
|
|
179
184
|
onClick: handleOnFFTFilter,
|
|
180
185
|
icon: _jsx(SvgNmrFourierTransform, {}),
|
|
181
186
|
},
|
|
@@ -207,7 +212,7 @@ export default function ToolBar() {
|
|
|
207
212
|
},
|
|
208
213
|
{
|
|
209
214
|
id: 'spectraStackAlignments',
|
|
210
|
-
title: `${options.spectraStackAlignments.label} (
|
|
215
|
+
title: `${options.spectraStackAlignments.label} (Press s)`,
|
|
211
216
|
icon: verticalAlign === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})),
|
|
212
217
|
condition: ftCounter > 1,
|
|
213
218
|
onClick: changeDisplayViewModeHandler,
|
|
@@ -220,13 +225,13 @@ export default function ToolBar() {
|
|
|
220
225
|
},
|
|
221
226
|
{
|
|
222
227
|
id: 'spectraCenterAlignments',
|
|
223
|
-
title: `Baseline ${verticalAlign === 'bottom' ? 'center' : 'bottom'} (
|
|
228
|
+
title: `Baseline ${verticalAlign === 'bottom' ? 'center' : 'bottom'} (Press c)`,
|
|
224
229
|
icon: verticalAlign === 'bottom' ? (_jsx(SvgNmrAlignCenter, {})) : (_jsx(SvgNmrAlignBottom, {})),
|
|
225
230
|
condition: ftCounter > 0 || fidCounter > 0,
|
|
226
|
-
onClick:
|
|
231
|
+
onClick: alignSpectraVerticallyHandler,
|
|
227
232
|
},
|
|
228
233
|
];
|
|
229
|
-
return (_jsxs(_Fragment, { children: [_jsx(LoadJCAMPModal, { isOpen:
|
|
234
|
+
return (_jsxs(_Fragment, { children: [_jsx(LoadJCAMPModal, { isOpen: dialog.loadJCAMP, onCloseDialog: closeDialog }), _jsx(ImportPublicationStringModal, { isOpen: dialog.importPublicationString, onClose: closeDialog }), _jsx(MetaImportationModal, { isOpen: dialog.metaImportation, onCloseDialog: closeDialog }), _jsx(SaveAsModal, { isOpen: dialog.saveAs, onCloseDialog: closeDialog }), _jsx(Toolbar, { vertical: true, children: toolItems.map((item) => {
|
|
230
235
|
const { id, icon, title, checkOptions, condition } = item;
|
|
231
236
|
const show = isButtonVisible(id, checkOptions) &&
|
|
232
237
|
(condition === undefined || condition);
|
|
@@ -3,7 +3,7 @@ import { FaCopy, FaDownload, FaFile, FaFileDownload, FaFileImage, } from 'react-
|
|
|
3
3
|
const IMPORT_MENU = [
|
|
4
4
|
{
|
|
5
5
|
icon: _jsx(FaFile, {}),
|
|
6
|
-
text: 'Import from file system (Press Ctrl
|
|
6
|
+
text: 'Import from file system (Press Ctrl+o)',
|
|
7
7
|
data: {
|
|
8
8
|
id: 'importFile',
|
|
9
9
|
},
|
|
@@ -47,14 +47,14 @@ const EXPORT_MENU = [
|
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
icon: _jsx(FaFileDownload, {}),
|
|
50
|
-
text: 'Save data (
|
|
50
|
+
text: 'Save data (Press Ctrl+s)',
|
|
51
51
|
data: {
|
|
52
52
|
id: 'json',
|
|
53
53
|
},
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
icon: _jsx(FaFileDownload, {}),
|
|
57
|
-
text: 'Save data as
|
|
57
|
+
text: 'Save data as (Press Ctrl+Shift+s)',
|
|
58
58
|
data: {
|
|
59
59
|
id: 'advance_save',
|
|
60
60
|
},
|
|
@@ -68,7 +68,7 @@ const EXPORT_MENU = [
|
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
icon: _jsx(FaCopy, {}),
|
|
71
|
-
text: 'Copy image to
|
|
71
|
+
text: 'Copy image to clipboard (Press Ctrl+c)',
|
|
72
72
|
data: {
|
|
73
73
|
id: 'copy',
|
|
74
74
|
},
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import EE from 'eventemitter3';
|
|
2
|
+
import { BrushTrackerContext, ClickOptions } from '../EventsTrackers/BrushTracker';
|
|
2
3
|
declare const Emitter: {
|
|
3
4
|
on: (event: any, fn: any) => EE<string | symbol, any>;
|
|
4
5
|
once: (event: any, fn: any) => EE<string | symbol, any>;
|
|
5
6
|
off: (event: any, fn: any) => EE<string | symbol, any>;
|
|
6
7
|
emit: (event: any, payload: any) => boolean;
|
|
7
8
|
};
|
|
9
|
+
export type EventEmitterClickOptions = ClickOptions & {
|
|
10
|
+
xPPM: number;
|
|
11
|
+
};
|
|
12
|
+
interface UseEventOptions {
|
|
13
|
+
onBrushEnd?: (options: BrushTrackerContext & {
|
|
14
|
+
range: number[];
|
|
15
|
+
}) => void;
|
|
16
|
+
onClick?: (options: EventEmitterClickOptions) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function useEvent(options: UseEventOptions): void;
|
|
8
19
|
export default Emitter;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import EE from 'eventemitter3';
|
|
2
|
+
import { useEffect } from 'react';
|
|
2
3
|
const eventEmitter = new EE();
|
|
3
4
|
const Emitter = {
|
|
4
5
|
on: (event, fn) => eventEmitter.on(event, fn),
|
|
@@ -7,4 +8,25 @@ const Emitter = {
|
|
|
7
8
|
emit: (event, payload) => eventEmitter.emit(event, payload),
|
|
8
9
|
};
|
|
9
10
|
Object.freeze(Emitter);
|
|
11
|
+
export function useEvent(options) {
|
|
12
|
+
const { onBrushEnd, onClick } = options;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
function handle(event) {
|
|
15
|
+
onBrushEnd?.(event);
|
|
16
|
+
}
|
|
17
|
+
Emitter.on('brushEnd', handle);
|
|
18
|
+
return () => {
|
|
19
|
+
Emitter.off('brushEnd', handle);
|
|
20
|
+
};
|
|
21
|
+
}, [onBrushEnd]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
function handle(event) {
|
|
24
|
+
onClick?.(event);
|
|
25
|
+
}
|
|
26
|
+
Emitter.on('mouseClick', handle);
|
|
27
|
+
return () => {
|
|
28
|
+
Emitter.off('mouseClick', handle);
|
|
29
|
+
};
|
|
30
|
+
}, [onClick]);
|
|
31
|
+
}
|
|
10
32
|
export default Emitter;
|