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
|
@@ -22,6 +22,6 @@ function Chart1D({ mode, width, height, margin, displayerKey }) {
|
|
|
22
22
|
const { current: { general: { spectraRendering }, }, } = usePreferences();
|
|
23
23
|
const innerWidth = width - margin.left - margin.right;
|
|
24
24
|
const innerHeight = height - margin.bottom;
|
|
25
|
-
return (_jsx(PeakEditionProvider, { children: _jsxs("svg", { id: "nmrSVG", width: width, height: height, viewBox: `0 0 ${width} ${height}`, fontFamily: "Arial, Helvetica, sans-serif", shapeRendering: spectraRendering, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-1d`, children: _jsx("rect", { width: innerWidth, height: innerHeight, x: margin.left, y: "0" }) }) }), _jsx(LinesSeries, {}), _jsx(ApodizationLine, {}), _jsx(IntegralsSeries, {}), _jsx(Peaks, { peaksSource: "peaks" }), _jsx(RangesIntegrals, {}), _jsx(Peaks, { peaksSource: "ranges" }), _jsx(
|
|
25
|
+
return (_jsx(PeakEditionProvider, { children: _jsxs("svg", { id: "nmrSVG", width: width, height: height, viewBox: `0 0 ${width} ${height}`, fontFamily: "Arial, Helvetica, sans-serif", shapeRendering: spectraRendering, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-1d`, children: _jsx("rect", { width: innerWidth, height: innerHeight, x: margin.left, y: "0" }) }) }), _jsx(LinesSeries, {}), _jsx(ApodizationLine, {}), _jsx(IntegralsSeries, {}), _jsx(Peaks, { peaksSource: "peaks" }), _jsx(RangesIntegrals, {}), _jsx(Ranges, {}), _jsx(Peaks, { peaksSource: "ranges" }), _jsx(MultiplicityTrees, {}), _jsx(JGraph, {}), _jsx(MultiAnalysisRanges, {}), _jsx(BaseLineZones, {}), _jsx(ExclusionZonesAnnotations, {}), _jsx(DatabaseElements, {}), _jsx(PeaksShapes, {}), _jsx(SpectraTracker, {}), _jsx(SpectrumInfoBlock, {}), _jsx(SimilarityTree, {}), _jsx("g", { className: "container", style: { pointerEvents: 'none' }, children: _jsx(XAxis, { showGrid: true, mode: mode }) })] }) }));
|
|
26
26
|
}
|
|
27
27
|
export default Chart1D;
|
|
@@ -19,7 +19,7 @@ const style = css `
|
|
|
19
19
|
}
|
|
20
20
|
`;
|
|
21
21
|
function LinesSeries() {
|
|
22
|
-
const { data, displayerKey, xDomains, width, margin, height } = useChartData();
|
|
22
|
+
const { data, displayerKey, xDomains, width, margin, height, toolOptions: { selectedTool }, } = useChartData();
|
|
23
23
|
const activeSpectra = useActiveSpectra();
|
|
24
24
|
const { shiftY } = useScaleChecked();
|
|
25
25
|
const verticalAlign = useVerticalAlign();
|
|
@@ -27,7 +27,7 @@ function LinesSeries() {
|
|
|
27
27
|
const innerHeight = height - margin.bottom - SPECTRA_BOTTOM_MARGIN;
|
|
28
28
|
const spectra = (data?.filter((d) => isSpectrum1D(d) && d.display.isVisible && xDomains[d.id]) || []);
|
|
29
29
|
const { setActiveSpectrum } = useSetActiveSpectrumAction();
|
|
30
|
-
return (_jsxs("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, className: "
|
|
30
|
+
return (_jsxs("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, className: "spectra", children: [spectra.map((d, i) => (_jsxs("g", { children: [_jsx(Line, { display: d.display, id: d.id, data: get1DDataXY(d), index: i }), verticalAlign === 'stack' && selectedTool === 'zoom' && (_jsx("rect", { css: style, y: innerHeight - shiftY * i - BOX_SIZE / 2, x: margin.left, width: `${innerWidth}px`, height: `${BOX_SIZE}px`, onClick: (e) => {
|
|
31
31
|
setActiveSpectrum(e, d.id);
|
|
32
32
|
}, "data-no-export": "true" }))] }, d.id))), activeSpectra?.map((activeSpectrum) => (_jsx("use", { href: `#${activeSpectrum.id}` }, activeSpectrum.id)))] }));
|
|
33
33
|
}
|
|
@@ -219,19 +219,17 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
219
219
|
payload: { zoomType: ZOOM_TYPES.STEP_HORIZONTAL },
|
|
220
220
|
});
|
|
221
221
|
}, [dispatch]);
|
|
222
|
-
const handleZoom = useCallback((
|
|
223
|
-
dispatch({ type: 'SET_ZOOM', payload: {
|
|
222
|
+
const handleZoom = useCallback((options) => {
|
|
223
|
+
dispatch({ type: 'SET_ZOOM', payload: { options } });
|
|
224
224
|
}, [dispatch]);
|
|
225
225
|
const mouseClick = useCallback((event) => {
|
|
226
226
|
if (!scaleState.scaleX)
|
|
227
227
|
return;
|
|
228
228
|
const xPPM = scaleState.scaleX().invert(event.x);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
});
|
|
234
|
-
};
|
|
229
|
+
Events.emit('mouseClick', {
|
|
230
|
+
...event,
|
|
231
|
+
xPPM,
|
|
232
|
+
});
|
|
235
233
|
const keyModifiers = getModifiersKey(event);
|
|
236
234
|
switch (keyModifiers) {
|
|
237
235
|
case primaryKeyIdentifier: {
|
|
@@ -242,9 +240,6 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
242
240
|
payload: event,
|
|
243
241
|
});
|
|
244
242
|
break;
|
|
245
|
-
case options.editRange.id:
|
|
246
|
-
propagateEvent();
|
|
247
|
-
break;
|
|
248
243
|
case options.integral.id:
|
|
249
244
|
dispatch({
|
|
250
245
|
type: 'CUT_INTEGRAL',
|
|
@@ -4,7 +4,7 @@ import { readFromWebSource } from 'nmr-load-save';
|
|
|
4
4
|
import { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { useChartData } from '../../context/ChartContext';
|
|
6
6
|
import { useScaleChecked } from '../../context/ScaleContext';
|
|
7
|
-
import {
|
|
7
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
8
8
|
import { HighlightEventSource, useHighlightData } from '../../highlight';
|
|
9
9
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
10
10
|
import { useVerticalAlign } from '../../hooks/useVerticalAlign';
|
|
@@ -18,7 +18,7 @@ function DatabaseSpectrum() {
|
|
|
18
18
|
const [isLoading, setLoading] = useState(false);
|
|
19
19
|
const { highlight } = useHighlightData();
|
|
20
20
|
const { scaleX } = useScaleChecked();
|
|
21
|
-
const
|
|
21
|
+
const toaster = useToaster();
|
|
22
22
|
const { color, marginBottom } = usePanelPreferences('database');
|
|
23
23
|
const { jcampURL: jcampRelativeURL = '', baseURL } = highlight?.sourceData?.extra || {};
|
|
24
24
|
const getSpinner = useContext(spinnerContext);
|
|
@@ -60,7 +60,7 @@ function DatabaseSpectrum() {
|
|
|
60
60
|
}
|
|
61
61
|
catch (error) {
|
|
62
62
|
reportError(error);
|
|
63
|
-
|
|
63
|
+
toaster.show({ message: 'Failed to Load spectrum', intent: 'danger' });
|
|
64
64
|
}
|
|
65
65
|
}, 250));
|
|
66
66
|
useEffect(() => {
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useChartData } from '../../context/ChartContext';
|
|
3
|
+
import useSpectrum from '../../hooks/useSpectrum';
|
|
3
4
|
import { PathBuilder } from '../../utility/PathBuilder';
|
|
4
5
|
import { useScale2DX, getSliceYScale } from '../utilities/scale';
|
|
5
6
|
function usePath(data, options) {
|
|
6
7
|
const { height = 100, vericalMargin = 10 } = options;
|
|
7
8
|
const { mode } = useChartData();
|
|
8
9
|
const scaleX = useScale2DX();
|
|
9
|
-
|
|
10
|
+
const spectrum = useSpectrum();
|
|
11
|
+
if (!data || !spectrum)
|
|
10
12
|
return '';
|
|
11
13
|
const { x, re: y } = data;
|
|
12
|
-
const scaleY = getSliceYScale(
|
|
14
|
+
const scaleY = getSliceYScale(spectrum.data, height, mode, {
|
|
15
|
+
margin: vericalMargin,
|
|
16
|
+
});
|
|
13
17
|
const pathBuilder = new PathBuilder();
|
|
14
18
|
pathBuilder.moveTo(scaleX(x[0]), scaleY(y[0]));
|
|
15
19
|
for (let i = 1; i < x.length; i++) {
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useChartData } from '../../context/ChartContext';
|
|
3
|
+
import useSpectrum from '../../hooks/useSpectrum';
|
|
3
4
|
import { PathBuilder } from '../../utility/PathBuilder';
|
|
4
5
|
import { getSliceYScale, useScale2DY } from '../utilities/scale';
|
|
5
6
|
function usePath(data, props) {
|
|
6
7
|
const { reverse, width = 100, horizontalMargin = 10 } = props;
|
|
7
8
|
const { mode } = useChartData();
|
|
8
9
|
const scaleX = useScale2DY(reverse);
|
|
10
|
+
const spectrum = useSpectrum();
|
|
11
|
+
if (!data || !spectrum) {
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
9
14
|
const { x, re: y } = data;
|
|
10
|
-
const scaleY = getSliceYScale(
|
|
15
|
+
const scaleY = getSliceYScale(spectrum.data, width, mode, {
|
|
16
|
+
margin: horizontalMargin,
|
|
17
|
+
});
|
|
11
18
|
const pathBuilder = new PathBuilder();
|
|
12
19
|
pathBuilder.moveTo(scaleY(y.at(-1)), scaleX(x.at(-1)));
|
|
13
20
|
for (let i = x.length - 2; i >= 0; i--) {
|
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { getSlice } from '../../../../data/data2d/Spectrum2D';
|
|
3
2
|
import { useMouseTracker } from '../../../EventsTrackers/MouseTracker';
|
|
4
|
-
import { useChartData } from '../../../context/ChartContext';
|
|
5
|
-
import { useActiveSpectrum } from '../../../hooks/useActiveSpectrum';
|
|
6
|
-
import { useScale2DX, useScale2DY } from '../../utilities/scale';
|
|
7
3
|
import { SpectrumPhaseTrace } from './SpectrumPhaseTrace';
|
|
8
|
-
import { useActivePhaseTraces } from './useActivePhaseTraces';
|
|
9
4
|
export function PhaseTraceWithMouse() {
|
|
10
|
-
const { width, height, data: spectra } = useChartData();
|
|
11
|
-
const activeSpectrum = useActiveSpectrum();
|
|
12
|
-
const { activeTraceDirection, color } = useActivePhaseTraces();
|
|
13
5
|
const position = useMouseTracker();
|
|
14
|
-
|
|
15
|
-
const scale2dY = useScale2DY();
|
|
16
|
-
if (!position || !width || !height || !activeSpectrum?.id) {
|
|
6
|
+
if (!position) {
|
|
17
7
|
return null;
|
|
18
8
|
}
|
|
19
|
-
|
|
20
|
-
const sliceData = getSlice(spectrum, {
|
|
21
|
-
x: scale2dX.invert(position.x),
|
|
22
|
-
y: scale2dY.invert(position.y),
|
|
23
|
-
});
|
|
24
|
-
const data = sliceData?.[activeTraceDirection]?.data;
|
|
25
|
-
if (!data) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
return (_jsx(SpectrumPhaseTrace, { data: data, position: position, color: color, direction: activeTraceDirection }));
|
|
9
|
+
return _jsx(SpectrumPhaseTrace, { positionUnit: "Pixel", position: position });
|
|
29
10
|
}
|
|
@@ -6,7 +6,7 @@ import { SpectraPhaseTraces } from './SpectraPhaseTraces';
|
|
|
6
6
|
export function PhaseTraces() {
|
|
7
7
|
const { width, height, margin, displayerKey } = useChartData();
|
|
8
8
|
const activeSpectrum = useActiveSpectrum();
|
|
9
|
-
if (!activeSpectrum?.id)
|
|
9
|
+
if (!activeSpectrum?.id || !width || !height)
|
|
10
10
|
return null;
|
|
11
11
|
const clipWidth = width - margin.left - margin.right;
|
|
12
12
|
const clipHeight = height - margin.top - margin.bottom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function SpectraPhaseTraces(): import("@emotion/react/jsx-runtime").JSX.Element[]
|
|
1
|
+
export declare function SpectraPhaseTraces(): import("@emotion/react/jsx-runtime").JSX.Element[];
|
|
@@ -3,43 +3,32 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { useChartData } from '../../../context/ChartContext';
|
|
5
5
|
import { HighlightEventSource, useHighlight } from '../../../highlight';
|
|
6
|
-
import { useScale2DX, useScale2DY } from '../../utilities/scale';
|
|
7
6
|
import { SpectrumPhaseTrace } from './SpectrumPhaseTrace';
|
|
8
7
|
import { useActivePhaseTraces } from './useActivePhaseTraces';
|
|
9
8
|
const BOX_SIZE = 20;
|
|
10
9
|
const style = css `
|
|
11
|
-
|
|
12
|
-
fill: transparent;
|
|
13
|
-
}
|
|
10
|
+
fill: transparent;
|
|
14
11
|
|
|
15
12
|
&:hover {
|
|
16
|
-
|
|
17
|
-
fill: #ff6f0057;
|
|
18
|
-
}
|
|
13
|
+
fill: #ff6f0057;
|
|
19
14
|
}
|
|
20
15
|
`;
|
|
21
16
|
export function SpectraPhaseTraces() {
|
|
22
|
-
const { width, height } = useChartData();
|
|
23
17
|
const { spectra = [], color, activeTraceDirection } = useActivePhaseTraces();
|
|
24
|
-
if (!width || !height || spectra.length === 0) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
18
|
return spectra.map((spectrumTrace) => {
|
|
28
19
|
return (_jsx(PhaseTrace, { spectrum: spectrumTrace, color: color, direction: activeTraceDirection }, spectrumTrace.id));
|
|
29
20
|
});
|
|
30
21
|
}
|
|
31
22
|
function PhaseTrace(props) {
|
|
32
23
|
const { width, height, margin } = useChartData();
|
|
33
|
-
const { spectrum: {
|
|
24
|
+
const { spectrum: { x, y, id }, direction, } = props;
|
|
34
25
|
const highligh = useHighlight([id], {
|
|
35
26
|
type: HighlightEventSource.PHASE_CORRECTION_TRACE,
|
|
36
27
|
extra: { id },
|
|
37
28
|
});
|
|
38
|
-
const
|
|
39
|
-
const scale2dY = useScale2DY();
|
|
40
|
-
const innerheight = height - margin.top - margin.bottom;
|
|
29
|
+
const innerHeight = height - margin.top - margin.bottom;
|
|
41
30
|
const innerWidth = width - margin.left - margin.right;
|
|
42
|
-
const transformY =
|
|
31
|
+
const transformY = innerHeight - BOX_SIZE / 2;
|
|
43
32
|
const transformX = innerWidth - BOX_SIZE / 2;
|
|
44
|
-
return (_jsxs(SpectrumPhaseTrace, {
|
|
33
|
+
return (_jsxs(SpectrumPhaseTrace, { positionUnit: "PPM", position: { x, y }, ...highligh.onHover, children: [direction === 'horizontal' && (_jsx("rect", { css: style, y: transformY, x: margin.left, width: `${innerWidth}px`, height: `${BOX_SIZE}px` })), direction === 'vertical' && (_jsx("rect", { css: style, y: margin.top, x: transformX, width: `${BOX_SIZE}px`, height: innerHeight }))] }));
|
|
45
34
|
}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
2
|
+
interface BaseComponentProps extends React.SVGAttributes<SVGGElement> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
interface SpectrumPhaseTraceProps extends BaseComponentProps {
|
|
6
|
+
positionUnit: 'PPM' | 'Pixel';
|
|
8
7
|
position: {
|
|
9
8
|
x: number;
|
|
10
9
|
y: number;
|
|
11
10
|
};
|
|
12
|
-
color: string;
|
|
13
|
-
direction: TraceDirection;
|
|
14
|
-
children?: ReactNode;
|
|
15
11
|
}
|
|
16
|
-
export declare function SpectrumPhaseTrace(props: SpectrumPhaseTraceProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function SpectrumPhaseTrace(props: SpectrumPhaseTraceProps): import("react/jsx-runtime").JSX.Element | null;
|
|
17
13
|
export {};
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Filters } from 'nmr-processing';
|
|
3
|
+
import { getSlice } from '../../../../data/data2d/Spectrum2D';
|
|
2
4
|
import { useChartData } from '../../../context/ChartContext';
|
|
5
|
+
import { useActiveSpectrum } from '../../../hooks/useActiveSpectrum';
|
|
6
|
+
import useSpectrum from '../../../hooks/useSpectrum';
|
|
3
7
|
import { PathBuilder } from '../../../utility/PathBuilder';
|
|
4
|
-
import { get2DXScale, get2DYScale, getSliceYScale, } from '../../utilities/scale';
|
|
8
|
+
import { get2DXScale, get2DYScale, getSliceYScale, useScale2DX, useScale2DY, } from '../../utilities/scale';
|
|
5
9
|
import { useActivePhaseTraces } from './useActivePhaseTraces';
|
|
6
10
|
function usePath(x, y, direction) {
|
|
7
11
|
const { width, margin, height, xDomain, yDomain, mode } = useChartData();
|
|
8
12
|
const { scaleRatio } = useActivePhaseTraces();
|
|
13
|
+
const spectrum = useSpectrum();
|
|
14
|
+
if (!spectrum)
|
|
15
|
+
return '';
|
|
9
16
|
if (direction === 'horizontal') {
|
|
10
17
|
const scaleX = get2DXScale({ margin, width, xDomain, mode });
|
|
11
|
-
const scaleY = getSliceYScale(
|
|
18
|
+
const scaleY = getSliceYScale(spectrum.data, height, 'RTL', {
|
|
12
19
|
margin: margin.top + margin.bottom,
|
|
13
20
|
scaleRatio,
|
|
14
21
|
});
|
|
@@ -20,7 +27,7 @@ function usePath(x, y, direction) {
|
|
|
20
27
|
return pathBuilder.toString();
|
|
21
28
|
}
|
|
22
29
|
const scaleX = get2DYScale({ margin, height, yDomain });
|
|
23
|
-
const scaleY = getSliceYScale(
|
|
30
|
+
const scaleY = getSliceYScale(spectrum.data, width, 'RTL', {
|
|
24
31
|
margin: margin.left + margin.right,
|
|
25
32
|
scaleRatio,
|
|
26
33
|
});
|
|
@@ -32,15 +39,57 @@ function usePath(x, y, direction) {
|
|
|
32
39
|
return pathBuilder.toString();
|
|
33
40
|
}
|
|
34
41
|
export function SpectrumPhaseTrace(props) {
|
|
35
|
-
const {
|
|
36
|
-
const { width, margin, height } = useChartData();
|
|
37
|
-
const {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
42
|
+
const { positionUnit, position, children, ...otherProps } = props;
|
|
43
|
+
const { tempData, width, margin, height } = useChartData();
|
|
44
|
+
const { activeTraceDirection: direction } = useActivePhaseTraces();
|
|
45
|
+
const scale2dX = useScale2DX();
|
|
46
|
+
const scale2dY = useScale2DY();
|
|
47
|
+
const activeSpectrum = useActiveSpectrum();
|
|
48
|
+
if (!activeSpectrum?.id) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const spectrumBeforePhasing = tempData[activeSpectrum.index];
|
|
52
|
+
let positionInPixel;
|
|
53
|
+
let positionInPPM;
|
|
54
|
+
if (positionUnit === 'Pixel') {
|
|
55
|
+
positionInPixel = position;
|
|
56
|
+
positionInPPM = {
|
|
57
|
+
x: scale2dX.invert(position.x),
|
|
58
|
+
y: scale2dY.invert(position.y),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
positionInPixel = {
|
|
63
|
+
x: scale2dX(position.x),
|
|
64
|
+
y: scale2dY(position.y),
|
|
65
|
+
};
|
|
66
|
+
positionInPPM = position;
|
|
67
|
+
}
|
|
68
|
+
const sliceData = getSlice(spectrumBeforePhasing, positionInPPM, {
|
|
69
|
+
sliceType: 'both',
|
|
70
|
+
});
|
|
71
|
+
const data = sliceData?.[direction]?.data;
|
|
72
|
+
if (!data) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const innerHeight = height - margin.top - margin.bottom;
|
|
40
76
|
const innerWidth = width - margin.left - margin.right;
|
|
41
|
-
const translateY = direction === 'horizontal' ?
|
|
42
|
-
const translateX = direction === 'vertical' ?
|
|
43
|
-
return (
|
|
44
|
-
|
|
45
|
-
|
|
77
|
+
const translateY = direction === 'horizontal' ? positionInPixel.y - innerHeight : 0;
|
|
78
|
+
const translateX = direction === 'vertical' ? positionInPixel.x - innerWidth : 0;
|
|
79
|
+
return (_jsx(InnerSpectrumPhaseTrace, { transform: `translate(${translateX} ${translateY})`, ...otherProps, data: data, children: children }));
|
|
80
|
+
}
|
|
81
|
+
function InnerSpectrumPhaseTrace(props) {
|
|
82
|
+
const { data: dataBeforePhasing, children, ...othersProps } = props;
|
|
83
|
+
const { color, activeTraceDirection: direction, ph0, ph1, } = useActivePhaseTraces();
|
|
84
|
+
const spectrum = {
|
|
85
|
+
data: dataBeforePhasing,
|
|
86
|
+
info: { isComplex: true, isFid: false },
|
|
87
|
+
};
|
|
88
|
+
Filters.phaseCorrection.apply(spectrum, {
|
|
89
|
+
ph0,
|
|
90
|
+
ph1,
|
|
91
|
+
});
|
|
92
|
+
const { x, re } = spectrum.data;
|
|
93
|
+
const path = usePath(x, re, direction);
|
|
94
|
+
return (_jsxs("g", { ...othersProps, children: [_jsx("path", { className: "line", stroke: color, strokeWidth: "1", fill: "transparent", d: path, pointerEvents: "none" }), children] }));
|
|
46
95
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare function useActivePhaseTraces(): {
|
|
2
2
|
activeTraceDirection: import("../../../reducer/Reducer").TraceDirection;
|
|
3
3
|
color: string;
|
|
4
|
+
addTracesToBothDirections: boolean;
|
|
4
5
|
spectra: import("../../../reducer/Reducer").SpectrumTrace[];
|
|
5
6
|
ph0: number;
|
|
6
7
|
ph1: number;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { COLORS } from '../../../../data/utilities/generateColor';
|
|
2
2
|
import { useChartData } from '../../../context/ChartContext';
|
|
3
3
|
export function useActivePhaseTraces() {
|
|
4
|
-
const { toolOptions: { data: { twoDimensionPhaseCorrection: { traces, activeTraceDirection }, }, }, } = useChartData();
|
|
4
|
+
const { toolOptions: { data: { twoDimensionPhaseCorrection: { traces, activeTraceDirection, addTracesToBothDirections, }, }, }, } = useChartData();
|
|
5
5
|
const color = activeTraceDirection === 'horizontal' ? COLORS[0] : COLORS[1];
|
|
6
6
|
return {
|
|
7
7
|
...traces[activeTraceDirection],
|
|
8
8
|
activeTraceDirection,
|
|
9
9
|
color,
|
|
10
|
+
addTracesToBothDirections,
|
|
10
11
|
};
|
|
11
12
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { ResponsiveChart } from 'react-d3-utils';
|
|
4
|
-
import { assert } from 'react-science/ui';
|
|
5
4
|
import BrushXY, { BRUSH_TYPE } from '../1d-2d/tools/BrushXY';
|
|
6
5
|
import CrossLinePointer from '../1d-2d/tools/CrossLinePointer';
|
|
7
6
|
import { BrushTracker, } from '../EventsTrackers/BrushTracker';
|
|
@@ -27,18 +26,18 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
27
26
|
const { getModifiersKey, primaryKeyIdentifier } = useMapKeyModifiers();
|
|
28
27
|
const spectrumData = useMemo(() => {
|
|
29
28
|
const nuclei = activeTab.split(',');
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const traces = [];
|
|
30
|
+
for (const nucleus of nuclei) {
|
|
32
31
|
const spectra = activeSpectra[nucleus];
|
|
33
32
|
if (spectra?.length === 1) {
|
|
34
33
|
const id = spectra[0].id;
|
|
35
|
-
const spectrum = data.find((datum) => datum.id === id && !datum.info.isFid);
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const spectrum = data.find((datum) => datum.id === id && !datum.info.isFid && datum.info.dimension === 1);
|
|
35
|
+
if (spectrum) {
|
|
36
|
+
traces.push(spectrum);
|
|
37
|
+
}
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
.filter((d) => d !== null);
|
|
39
|
+
}
|
|
40
|
+
return traces;
|
|
42
41
|
}, [activeTab, data, activeSpectra]);
|
|
43
42
|
const DIMENSION = get2DDimensionLayout(state);
|
|
44
43
|
function handelBrush(brushData) {
|
|
@@ -109,16 +108,18 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
109
108
|
dispatch({ type: 'FULL_ZOOM_OUT', payload: { trackID } });
|
|
110
109
|
}
|
|
111
110
|
}, [DIMENSION, dispatch]);
|
|
112
|
-
const handleZoom = (
|
|
113
|
-
const { x: startX, y: startY, shiftKey } =
|
|
111
|
+
const handleZoom = (options) => {
|
|
112
|
+
const { x: startX, y: startY, shiftKey } = options;
|
|
114
113
|
const trackID = getLayoutID(DIMENSION, { startX, startY });
|
|
115
114
|
if (trackID) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
const isZoomWithScroll = trackID === 'CENTER_2D' && shiftKey && selectedTool === 'zoom';
|
|
116
|
+
const isMouseOver1DTrace = trackID !== 'CENTER_2D';
|
|
117
|
+
const isTraceZoomActive = selectedTool === 'phaseCorrectionTwoDimensions' && !shiftKey;
|
|
118
|
+
if (isZoomWithScroll || isMouseOver1DTrace || isTraceZoomActive) {
|
|
119
|
+
dispatch({ type: 'SET_ZOOM', payload: { options, trackID } });
|
|
119
120
|
}
|
|
120
121
|
else {
|
|
121
|
-
dispatch({ type: 'SET_2D_LEVEL', payload:
|
|
122
|
+
dispatch({ type: 'SET_2D_LEVEL', payload: { options } });
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
};
|
|
@@ -5,7 +5,7 @@ import { memo, useMemo, useRef } from 'react';
|
|
|
5
5
|
import { drawContours, getDefaultContoursLevel, } from '../../../data/data2d/Spectrum2D/contours';
|
|
6
6
|
import { useChartData } from '../../context/ChartContext';
|
|
7
7
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
8
|
-
import {
|
|
8
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
9
9
|
import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
|
|
10
10
|
import { PathBuilder } from '../../utility/PathBuilder';
|
|
11
11
|
import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
|
|
@@ -53,9 +53,12 @@ function ContoursPaths({ id: spectrumID, sign, color, spectrum, onTimeout, }) {
|
|
|
53
53
|
return (_jsx("path", { fill: "none", "data-testid": "spectrum-line", stroke: color, strokeWidth: "1", opacity: opacity, d: path }));
|
|
54
54
|
}
|
|
55
55
|
function ContoursInner({ spectra, displayerKey }) {
|
|
56
|
-
const
|
|
56
|
+
const toaster = useToaster();
|
|
57
57
|
const debounceAlert = useRef(debounce(() => {
|
|
58
|
-
|
|
58
|
+
toaster.show({
|
|
59
|
+
message: 'Too many contour lines, only showing the first ones',
|
|
60
|
+
intent: 'danger',
|
|
61
|
+
});
|
|
59
62
|
}, 2000));
|
|
60
63
|
function timeoutHandler() {
|
|
61
64
|
debounceAlert.current();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NmrData2D } from 'cheminfo-types';
|
|
1
2
|
import { Margin, SpectraDirection } from '../../reducer/Reducer';
|
|
2
3
|
import { Layout } from './DimensionLayout';
|
|
3
4
|
interface Scale2DXOptions {
|
|
@@ -38,5 +39,5 @@ interface SliceYScaleOptions {
|
|
|
38
39
|
margin?: number;
|
|
39
40
|
scaleRatio?: number;
|
|
40
41
|
}
|
|
41
|
-
declare function getSliceYScale(data:
|
|
42
|
+
declare function getSliceYScale(data: NmrData2D, size: number, mode: SpectraDirection, options?: SliceYScaleOptions): import("d3-scale").ScaleLinear<number, number, never>;
|
|
42
43
|
export { get2DXScale, getSliceYScale, get2DYScale, get1DXScale, get1DYScale, useScale2DX, useScale2DY, use1DTraceYScale, };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { scaleLinear } from 'd3';
|
|
2
|
-
import { xMaxValue } from 'ml-spectra-processing';
|
|
3
2
|
import { useChartData } from '../../context/ChartContext';
|
|
4
3
|
import { LAYOUT } from './DimensionLayout';
|
|
5
4
|
function get2DXScale(options, reverse) {
|
|
@@ -48,9 +47,20 @@ function use1DTraceYScale(SpectrumId, height, verticalMargin) {
|
|
|
48
47
|
const { yDomains } = useChartData();
|
|
49
48
|
return get1DYScale(yDomains[SpectrumId], height, verticalMargin);
|
|
50
49
|
}
|
|
50
|
+
function getMax(data) {
|
|
51
|
+
let max;
|
|
52
|
+
for (const key in data) {
|
|
53
|
+
const { minZ, maxZ } = data[key];
|
|
54
|
+
const innerMax = Math.max(Math.abs(minZ), Math.max(maxZ));
|
|
55
|
+
if (max === undefined || max > innerMax) {
|
|
56
|
+
max = innerMax;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return max;
|
|
60
|
+
}
|
|
51
61
|
function getSliceYScale(data, size, mode, options = {}) {
|
|
52
62
|
const { margin = 10, scaleRatio = 1 } = options;
|
|
53
|
-
const max =
|
|
63
|
+
const max = getMax(data);
|
|
54
64
|
size = mode === 'RTL' ? size : size / 2;
|
|
55
65
|
return scaleLinear([0, max * scaleRatio], [
|
|
56
66
|
size - margin,
|
|
@@ -13,13 +13,15 @@ export interface BrushTrackerContext {
|
|
|
13
13
|
type MouseButton = 'main' | 'secondary' | 'unknown';
|
|
14
14
|
export declare const BrushContext: import("react").Context<BrushTrackerContext>;
|
|
15
15
|
export declare function useBrushTracker(): BrushTrackerContext;
|
|
16
|
-
interface Position {
|
|
16
|
+
export interface Position {
|
|
17
17
|
x: number;
|
|
18
18
|
y: number;
|
|
19
19
|
}
|
|
20
|
-
export type
|
|
20
|
+
export type ClickOptions = React.MouseEvent & Position;
|
|
21
|
+
export type OnClick = (element: ClickOptions) => void;
|
|
21
22
|
export type { OnClick as OnDoubleClick };
|
|
22
|
-
export type
|
|
23
|
+
export type ZoomOptions = Pick<React.WheelEvent, 'deltaY' | 'shiftKey' | 'deltaMode' | 'altKey'> & Position;
|
|
24
|
+
export type OnZoom = (options: ZoomOptions) => void;
|
|
23
25
|
export type OnBrush = (state: BrushTrackerContext) => void;
|
|
24
26
|
interface BrushTrackerProps {
|
|
25
27
|
children: ReactNode;
|
|
@@ -104,8 +104,8 @@ export function BrushTracker({ children, className, style, onBrushEnd, onBrush,
|
|
|
104
104
|
const boundingRect = event.currentTarget.getBoundingClientRect();
|
|
105
105
|
const x = event.clientX - boundingRect.x;
|
|
106
106
|
const y = event.clientY - boundingRect.y;
|
|
107
|
-
const { deltaY, deltaX, shiftKey, deltaMode } = event;
|
|
108
|
-
onZoom({ deltaY: deltaY || deltaX, shiftKey, deltaMode, x, y });
|
|
107
|
+
const { deltaY, deltaX, shiftKey, altKey, deltaMode } = event;
|
|
108
|
+
onZoom({ deltaY: deltaY || deltaX, shiftKey, altKey, deltaMode, x, y });
|
|
109
109
|
}, [onZoom]);
|
|
110
110
|
useEffect(() => {
|
|
111
111
|
const { step, startX, endX, startY, endY } = state;
|
|
@@ -2,5 +2,5 @@ import { RefObject } from 'react';
|
|
|
2
2
|
interface KeysListenerTrackerProps {
|
|
3
3
|
mainDivRef: RefObject<HTMLDivElement>;
|
|
4
4
|
}
|
|
5
|
-
declare function KeysListenerTracker(props: KeysListenerTrackerProps):
|
|
5
|
+
declare function KeysListenerTracker(props: KeysListenerTrackerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export default KeysListenerTracker;
|