nmrium 0.31.0 → 0.33.0-pre.1667632695
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/FooterBanner.js +17 -10
- package/lib/component/1d/LinesSeries.js +1 -1
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +1 -1
- package/lib/component/1d/XAxis.js +1 -1
- package/lib/component/1d/database/DatabaseSpectrum.js +2 -1
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
- package/lib/component/1d/{Integral.d.ts → integral/Integral.d.ts} +0 -0
- package/lib/component/1d/{Integral.js → integral/Integral.js} +2 -2
- package/lib/component/1d/integral/IntegralIndicator.d.ts +9 -0
- package/lib/component/1d/integral/IntegralIndicator.js +27 -0
- package/lib/component/1d/{IntegralResizable.d.ts → integral/IntegralResizable.d.ts} +0 -0
- package/lib/component/1d/integral/IntegralResizable.js +69 -0
- package/lib/component/1d/{IntegralsSeries.d.ts → integral/IntegralsSeries.d.ts} +0 -0
- package/lib/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
- package/lib/component/1d/multiplicityTree/buildTreeNode.js +3 -3
- package/lib/component/1d/peaks/PeakAnnotation.js +1 -1
- package/lib/component/1d/peaks/usePeakShapesPath.js +10 -6
- package/lib/component/1d/ranges/Range.js +27 -50
- package/lib/component/1d/tool/PeakPointer.js +1 -1
- package/lib/component/1d/utilities/scale.js +2 -2
- package/lib/component/2d/Contours.js +61 -42
- package/lib/component/2d/FooterBanner.js +2 -2
- package/lib/component/2d/Left1DChart.js +1 -1
- package/lib/component/2d/Top1DChart.js +1 -1
- package/lib/component/2d/Viewer2D.js +11 -14
- package/lib/component/2d/tools/XYLabelPointer.js +2 -2
- package/lib/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
- package/lib/component/2d/zones/IndicationLines.js +5 -8
- package/lib/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -15
- package/lib/component/NMRium.d.ts +1 -1
- package/lib/component/NMRium.js +6 -6
- package/lib/component/SplitPaneWrapper.js +1 -1
- package/lib/component/assignment/actions/initAssignment.js +17 -17
- package/lib/component/assignment/index.js +2 -2
- package/lib/component/context/PreferencesContext.js +3 -6
- package/lib/component/elements/Button.js +1 -1
- package/lib/component/elements/CheckBoxCell.js +1 -1
- package/lib/component/elements/ContextMenu.js +2 -2
- package/lib/component/elements/EditableColumn.d.ts +3 -1
- package/lib/component/elements/EditableColumn.js +21 -8
- package/lib/component/elements/GroupPane.d.ts +12 -0
- package/lib/component/elements/GroupPane.js +14 -0
- package/lib/component/elements/Input.js +7 -4
- package/lib/component/elements/IsotopesViewer.js +1 -1
- package/lib/component/elements/Label.js +1 -2
- package/lib/component/elements/MolecularFormulaInput.js +2 -0
- package/lib/component/elements/NumberInput.js +2 -2
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
- package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -1
- package/lib/component/elements/ReactTable/ReactTable.js +72 -38
- package/lib/component/elements/ReactTable/ReactTableFlexLayout.d.ts +3 -2
- package/lib/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
- package/lib/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
- package/lib/component/elements/ReactTable/utility/useRowSpan.js +3 -7
- package/lib/component/elements/accordion/Accordion.js +2 -2
- package/lib/component/elements/draggble/useDraggable.js +1 -3
- package/lib/component/elements/dropDownButton/DropDownList.js +1 -2
- package/lib/component/elements/formik/FormikCheckBox.js +1 -1
- package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
- package/lib/component/elements/formik/FormikColorPicker.js +5 -8
- package/lib/component/elements/formik/FormikErrorsSummary.js +2 -2
- package/lib/component/elements/formik/FormikForm.js +2 -2
- package/lib/component/elements/formik/FormikInput.d.ts +0 -1
- package/lib/component/elements/formik/FormikInput.js +12 -20
- package/lib/component/elements/formik/FormikOnChange.d.ts +1 -1
- package/lib/component/elements/formik/FormikOnChange.js +13 -10
- package/lib/component/elements/formik/FormikSelect.js +1 -1
- package/lib/component/elements/formik/FormikSlider.d.ts +2 -4
- package/lib/component/elements/formik/FormikSlider.js +8 -11
- package/lib/component/elements/formik/FormikTextarea.js +1 -1
- package/lib/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
- package/lib/component/elements/popup/Alert/Provider.js +7 -7
- package/lib/component/elements/popup/Alert/index.d.ts +3 -4
- package/lib/component/elements/popup/Alert/index.js +3 -4
- package/lib/component/elements/popup/Modal/ModalContent.js +3 -1
- package/lib/component/elements/popup/Modal/Provider.js +16 -31
- package/lib/component/elements/popup/Modal/index.d.ts +4 -5
- package/lib/component/elements/popup/Modal/index.js +4 -5
- package/lib/component/header/Header.js +1 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib/component/hooks/useCombinedRefs.js +2 -2
- package/lib/component/hooks/useExport.d.ts +1 -1
- package/lib/component/hooks/useExport.js +9 -6
- package/lib/component/hooks/useFormatNumberByNucleus.js +1 -1
- package/lib/component/hooks/usePanelPreferences.js +9 -7
- package/lib/component/loader/DropZone.js +10 -2
- package/lib/component/modal/AlignSpectraModal.js +1 -1
- package/lib/component/modal/ExportAsMatrixModal.js +1 -1
- package/lib/component/modal/LoadJCAMPModal.js +2 -2
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
- package/lib/component/modal/MultipletAnalysisModal.js +3 -3
- package/lib/component/modal/PredictSpectraModal.js +5 -5
- package/lib/component/modal/editRange/EditRangeModal.js +4 -4
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
- package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
- package/lib/component/modal/setting/DatabasesTabContent.js +25 -20
- package/lib/component/modal/setting/DisplayTabContent.js +21 -27
- package/lib/component/modal/setting/FormattingTabContent.js +10 -10
- package/lib/component/modal/setting/GeneralSettings.js +11 -14
- package/lib/component/modal/setting/GeneralTabContent.js +3 -1
- package/lib/component/modal/setting/ToolsTabContent.js +18 -19
- package/lib/component/modal/setting/WorkspaceItem.d.ts +2 -1
- package/lib/component/modal/setting/WorkspaceItem.js +36 -48
- package/lib/component/modal/setting/settingsValidation.d.ts +58 -57
- package/lib/component/modal/setting/settingsValidation.js +14 -12
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
- package/lib/component/panels/InformationPanel.js +52 -56
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/Utilities.js +6 -6
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
- package/lib/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +2 -2
- package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +1 -3
- package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
- package/lib/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
- package/lib/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
- package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +5 -5
- package/lib/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
- package/lib/component/panels/ZonesPanel/ZonesTable.js +8 -8
- package/lib/component/panels/databasePanel/DatabasePanel.js +5 -4
- package/lib/component/panels/databasePanel/DatabaseTable.d.ts +2 -1
- package/lib/component/panels/databasePanel/DatabaseTable.js +20 -5
- package/lib/component/panels/extra/preferences/ColumnsHelper.js +5 -2
- package/lib/component/panels/extra/utilities/MultiplicityUtilities.d.ts +2 -2
- package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +3 -3
- package/lib/component/reducer/Reducer.d.ts +26 -45
- package/lib/component/reducer/Reducer.js +13 -12
- package/lib/component/reducer/actions/CorrelationsActions.js +4 -4
- package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
- package/lib/component/reducer/actions/DomainActions.js +52 -69
- package/lib/component/reducer/actions/FiltersActions.js +15 -6
- package/lib/component/reducer/actions/HistoryActions.js +5 -5
- package/lib/component/reducer/actions/IntegralsActions.js +6 -5
- package/lib/component/reducer/actions/LoadActions.js +12 -0
- package/lib/component/reducer/actions/PeaksActions.js +7 -6
- package/lib/component/reducer/actions/PreferencesActions.js +20 -38
- package/lib/component/reducer/actions/RangesActions.d.ts +1 -1
- package/lib/component/reducer/actions/RangesActions.js +28 -24
- package/lib/component/reducer/actions/SpectrumsActions.js +13 -6
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +28 -41
- package/lib/component/reducer/actions/ZonesActions.js +11 -10
- package/lib/component/reducer/core/Constants.js +1 -1
- package/lib/component/reducer/helper/GetClosestNumber.js +2 -1
- package/lib/component/reducer/helper/Zoom1DManager.js +11 -10
- package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
- package/lib/component/reducer/helper/getSpectrum.js +3 -5
- package/lib/component/reducer/helper/getStrongestPeak.d.ts +1 -1
- package/lib/component/reducer/helper/getStrongestPeak.js +2 -3
- package/lib/component/reducer/preferences/actions/removeWorkspace.js +3 -10
- package/lib/component/reducer/preferences/actions/setPreferences.js +5 -6
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
- package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +1 -4
- package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
- package/lib/component/tool/BrushX.js +3 -3
- package/lib/component/tool/BrushXY.js +5 -5
- package/lib/component/tool/CrossLinePointer.js +3 -3
- package/lib/component/toolbar/BasicToolBar.js +9 -8
- package/lib/component/utility/Evaluate.js +2 -2
- package/lib/component/utility/FileUtility.d.ts +2 -9
- package/lib/component/utility/FileUtility.js +11 -28
- package/lib/component/utility/GroupByInfoKey.d.ts +1 -1
- package/lib/component/utility/GroupByInfoKey.js +11 -13
- package/lib/component/utility/PathBuilder.js +1 -1
- package/lib/component/utility/PreferencesHelper.js +2 -3
- package/lib/component/utility/{Export.d.ts → export.d.ts} +0 -0
- package/lib/component/utility/{Export.js → export.js} +54 -73
- package/lib/component/utility/formatNumber.d.ts +6 -1
- package/lib/component/utility/formatNumber.js +5 -4
- package/lib/component/workspaces/Workspace.d.ts +1 -1
- package/lib/component/workspaces/exercise.js +4 -4
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/data/Filters.d.ts +16 -18
- package/lib/data/Filters.js +16 -18
- package/lib/data/FiltersManager.js +4 -3
- package/lib/data/PredictionManager.js +8 -10
- package/lib/data/SpectraManager.d.ts +1 -2
- package/lib/data/SpectraManager.js +25 -60
- package/lib/data/data1d/MultipleAnalysis.js +74 -70
- package/lib/data/data1d/Spectrum1D/SumManager.js +1 -1
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
- package/lib/data/data1d/Spectrum1D/index.d.ts +24 -25
- package/lib/data/data1d/Spectrum1D/index.js +24 -25
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
- package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
- package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +35 -1
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +35 -1
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
- package/lib/data/data1d/database.js +45 -28
- package/lib/data/data1d/filter1d/apodization.js +2 -1
- package/lib/data/data1d/filter1d/fft.js +24 -7
- package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
- package/lib/data/data1d/filter1d/zeroFilling.js +1 -1
- package/lib/data/data2d/Processing2D.d.ts +3 -3
- package/lib/data/data2d/Processing2D.js +10 -20
- package/lib/data/data2d/Spectrum2D/contours.d.ts +40 -0
- package/lib/data/data2d/Spectrum2D/contours.js +132 -0
- package/lib/data/data2d/Spectrum2D/index.d.ts +10 -11
- package/lib/data/data2d/Spectrum2D/index.js +10 -11
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
- package/lib/data/data2d/Spectrum2D/shift/getShift.js +4 -5
- package/lib/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
- package/lib/data/molecules/MoleculeManager.js +1 -1
- package/lib/data/types/common/Source.d.ts +1 -0
- package/lib/data/types/data1d/index.d.ts +12 -13
- package/lib/data/types/data2d/Data2D.d.ts +2 -0
- package/lib/data/types/data2d/Datum2D.d.ts +0 -1
- package/lib/data/types/data2d/index.d.ts +8 -9
- package/lib/data/utilities/RangeUtilities.js +13 -9
- package/lib/data/utilities/ZoneUtilities.js +17 -13
- package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
- package/lib/data/utilities/calculateSanPlot.js +31 -0
- package/lib/data/utilities/checkModifierKeyActivated.js +1 -2
- package/lib/data/utilities/generateChar.js +8 -6
- package/lib/data/utilities/getAtom.js +1 -1
- package/lib/data/utilities/getAtomsFromMF.js +2 -2
- package/lib/data/utilities/getColor.js +3 -3
- package/lib/data/utilities/getSum.js +6 -3
- package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +16 -9
- package/lib-cjs/component/1d/LinesSeries.js +1 -1
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +1 -1
- package/lib-cjs/component/1d/XAxis.js +1 -1
- package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -1
- package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
- package/lib-cjs/component/1d/{Integral.js → integral/Integral.js} +2 -2
- package/lib-cjs/component/1d/integral/IntegralIndicator.js +31 -0
- package/lib-cjs/component/1d/integral/IntegralResizable.js +74 -0
- package/lib-cjs/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
- package/lib-cjs/component/1d/multiplicityTree/buildTreeNode.js +3 -3
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +1 -1
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +10 -6
- package/lib-cjs/component/1d/ranges/Range.js +27 -50
- package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
- package/lib-cjs/component/1d/utilities/scale.js +2 -2
- package/lib-cjs/component/2d/Contours.js +60 -41
- package/lib-cjs/component/2d/FooterBanner.js +2 -2
- package/lib-cjs/component/2d/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/Top1DChart.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +11 -14
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
- package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +5 -8
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +14 -15
- package/lib-cjs/component/NMRium.js +7 -7
- package/lib-cjs/component/SplitPaneWrapper.js +1 -1
- package/lib-cjs/component/assignment/actions/initAssignment.js +17 -17
- package/lib-cjs/component/assignment/index.js +2 -2
- package/lib-cjs/component/context/PreferencesContext.js +3 -6
- package/lib-cjs/component/elements/Button.js +1 -1
- package/lib-cjs/component/elements/CheckBoxCell.js +1 -1
- package/lib-cjs/component/elements/ContextMenu.js +2 -2
- package/lib-cjs/component/elements/EditableColumn.js +21 -8
- package/lib-cjs/component/elements/GroupPane.js +18 -0
- package/lib-cjs/component/elements/Input.js +7 -4
- package/lib-cjs/component/elements/IsotopesViewer.js +1 -1
- package/lib-cjs/component/elements/Label.js +1 -2
- package/lib-cjs/component/elements/MolecularFormulaInput.js +2 -0
- package/lib-cjs/component/elements/NumberInput.js +2 -2
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
- package/lib-cjs/component/elements/ReactTable/ReactTable.js +71 -37
- package/lib-cjs/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
- package/lib-cjs/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
- package/lib-cjs/component/elements/ReactTable/utility/useRowSpan.js +3 -7
- package/lib-cjs/component/elements/accordion/Accordion.js +2 -2
- package/lib-cjs/component/elements/draggble/useDraggable.js +1 -3
- package/lib-cjs/component/elements/dropDownButton/DropDownList.js +1 -2
- package/lib-cjs/component/elements/formik/FormikCheckBox.js +1 -1
- package/lib-cjs/component/elements/formik/FormikColorPicker.js +4 -7
- package/lib-cjs/component/elements/formik/FormikErrorsSummary.js +2 -2
- package/lib-cjs/component/elements/formik/FormikForm.js +2 -2
- package/lib-cjs/component/elements/formik/FormikInput.js +12 -20
- package/lib-cjs/component/elements/formik/FormikOnChange.js +13 -10
- package/lib-cjs/component/elements/formik/FormikSelect.js +1 -1
- package/lib-cjs/component/elements/formik/FormikSlider.js +7 -10
- package/lib-cjs/component/elements/formik/FormikTextarea.js +1 -1
- package/lib-cjs/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
- package/lib-cjs/component/elements/popup/Alert/Provider.js +8 -8
- package/lib-cjs/component/elements/popup/Alert/index.js +5 -5
- package/lib-cjs/component/elements/popup/Modal/ModalContent.js +3 -1
- package/lib-cjs/component/elements/popup/Modal/Provider.js +16 -31
- package/lib-cjs/component/elements/popup/Modal/index.js +7 -7
- package/lib-cjs/component/header/Header.js +1 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib-cjs/component/hooks/useCombinedRefs.js +2 -2
- package/lib-cjs/component/hooks/useExport.js +14 -11
- package/lib-cjs/component/hooks/useFormatNumberByNucleus.js +1 -1
- package/lib-cjs/component/hooks/usePanelPreferences.js +9 -7
- package/lib-cjs/component/loader/DropZone.js +10 -2
- package/lib-cjs/component/modal/AlignSpectraModal.js +1 -1
- package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -2
- package/lib-cjs/component/modal/LoadJCAMPModal.js +2 -2
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
- package/lib-cjs/component/modal/MultipletAnalysisModal.js +3 -3
- package/lib-cjs/component/modal/PredictSpectraModal.js +5 -5
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +4 -4
- package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
- package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
- package/lib-cjs/component/modal/setting/DatabasesTabContent.js +25 -20
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +21 -27
- package/lib-cjs/component/modal/setting/FormattingTabContent.js +10 -10
- package/lib-cjs/component/modal/setting/GeneralSettings.js +11 -14
- package/lib-cjs/component/modal/setting/GeneralTabContent.js +3 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +18 -19
- package/lib-cjs/component/modal/setting/WorkspaceItem.js +37 -49
- package/lib-cjs/component/modal/setting/settingsValidation.js +14 -12
- package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
- package/lib-cjs/component/panels/InformationPanel.js +51 -55
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -4
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +6 -6
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -2
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +1 -3
- package/lib-cjs/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +6 -6
- package/lib-cjs/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
- package/lib-cjs/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -8
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -4
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +20 -5
- package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +5 -2
- package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +1 -1
- package/lib-cjs/component/reducer/IgnoreActions.js +3 -3
- package/lib-cjs/component/reducer/Reducer.js +12 -11
- package/lib-cjs/component/reducer/actions/CorrelationsActions.js +4 -4
- package/lib-cjs/component/reducer/actions/DomainActions.js +52 -69
- package/lib-cjs/component/reducer/actions/FiltersActions.js +15 -6
- package/lib-cjs/component/reducer/actions/HistoryActions.js +5 -5
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +6 -5
- package/lib-cjs/component/reducer/actions/LoadActions.js +12 -0
- package/lib-cjs/component/reducer/actions/PeaksActions.js +7 -6
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +20 -38
- package/lib-cjs/component/reducer/actions/RangesActions.js +28 -24
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +12 -5
- package/lib-cjs/component/reducer/actions/ToolsActions.js +28 -41
- package/lib-cjs/component/reducer/actions/ZonesActions.js +11 -10
- package/lib-cjs/component/reducer/core/Constants.js +1 -1
- package/lib-cjs/component/reducer/helper/GetClosestNumber.js +2 -1
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +11 -10
- package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
- package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -5
- package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -3
- package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +3 -10
- package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +5 -9
- package/lib-cjs/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
- package/lib-cjs/component/tool/BrushX.js +3 -3
- package/lib-cjs/component/tool/BrushXY.js +5 -5
- package/lib-cjs/component/tool/CrossLinePointer.js +3 -3
- package/lib-cjs/component/toolbar/BasicToolBar.js +8 -7
- package/lib-cjs/component/utility/Evaluate.js +2 -2
- package/lib-cjs/component/utility/FileUtility.js +11 -29
- package/lib-cjs/component/utility/GroupByInfoKey.js +11 -13
- package/lib-cjs/component/utility/PathBuilder.js +1 -1
- package/lib-cjs/component/utility/PreferencesHelper.js +2 -3
- package/lib-cjs/component/utility/{Export.js → export.js} +78 -74
- package/lib-cjs/component/utility/formatNumber.js +5 -4
- package/lib-cjs/component/workspaces/exercise.js +4 -4
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib-cjs/data/Filters.js +17 -35
- package/lib-cjs/data/FiltersManager.js +4 -3
- package/lib-cjs/data/PredictionManager.js +8 -10
- package/lib-cjs/data/SpectraManager.js +26 -62
- package/lib-cjs/data/data1d/MultipleAnalysis.js +74 -70
- package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/index.js +25 -25
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
- package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
- package/lib-cjs/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
- package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
- package/lib-cjs/data/data1d/database.js +45 -28
- package/lib-cjs/data/data1d/filter1d/apodization.js +2 -1
- package/lib-cjs/data/data1d/filter1d/fft.js +23 -6
- package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
- package/lib-cjs/data/data1d/filter1d/zeroFilling.js +1 -1
- package/lib-cjs/data/data2d/Processing2D.js +10 -20
- package/lib-cjs/data/data2d/Spectrum2D/contours.js +138 -0
- package/lib-cjs/data/data2d/Spectrum2D/index.js +11 -11
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
- package/lib-cjs/data/data2d/Spectrum2D/shift/getShift.js +4 -5
- package/lib-cjs/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
- package/lib-cjs/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
- package/lib-cjs/data/molecules/MoleculeManager.js +1 -1
- package/lib-cjs/data/utilities/RangeUtilities.js +13 -9
- package/lib-cjs/data/utilities/ZoneUtilities.js +17 -13
- package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
- package/lib-cjs/data/utilities/checkModifierKeyActivated.js +1 -2
- package/lib-cjs/data/utilities/generateChar.js +8 -6
- package/lib-cjs/data/utilities/getAtom.js +1 -1
- package/lib-cjs/data/utilities/getAtomsFromMF.js +2 -2
- package/lib-cjs/data/utilities/getColor.js +3 -3
- package/lib-cjs/data/utilities/getSum.js +6 -3
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +36 -31
- package/lib/component/1d/IntegralResizable.js +0 -72
- package/lib/component/elements/popup/helpers.d.ts +0 -1
- package/lib/component/elements/popup/helpers.js +0 -9
- package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +0 -1
- package/lib/component/panels/RangesPanel/TableColumns/format.js +0 -8
- package/lib/data/data1d/Data1DManager.d.ts +0 -3
- package/lib/data/data1d/Data1DManager.js +0 -98
- package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
- package/lib/data/data1d/filter1d/absolute.js +0 -26
- package/lib/data/data2d/Data2DManager.d.ts +0 -3
- package/lib/data/data2d/Data2DManager.js +0 -34
- package/lib/data/types/data2d/Contour.d.ts +0 -4
- package/lib/data/types/data2d/Contour.js +0 -1
- package/lib/data/types/data2d/Contours.d.ts +0 -2
- package/lib/data/types/data2d/Contours.js +0 -1
- package/lib-cjs/component/1d/IntegralResizable.js +0 -77
- package/lib-cjs/component/elements/popup/helpers.js +0 -13
- package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +0 -14
- package/lib-cjs/data/data1d/Data1DManager.js +0 -104
- package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
- package/lib-cjs/data/data2d/Data2DManager.js +0 -40
- package/lib-cjs/data/types/data2d/Contour.js +0 -2
- package/lib-cjs/data/types/data2d/Contours.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
2
1
|
import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
3
2
|
import nucleusToString from '../../utility/nucleusToString';
|
|
4
3
|
import { DEFAULT_YAXIS_SHIFT_VALUE, DISPLAYER_MODE } from '../core/Constants';
|
|
4
|
+
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
5
5
|
import { setDomain } from './DomainActions';
|
|
6
6
|
function changeSpectrumVerticalAlignment(draft, options) {
|
|
7
7
|
function stack(spectra = []) {
|
|
@@ -53,18 +53,14 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
function setKeyPreferencesHandler(draft, keyCode) {
|
|
56
|
-
const { data, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, view, } = draft;
|
|
57
|
-
const
|
|
58
|
-
|
|
56
|
+
const { data, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, view, keysPreferences, } = draft;
|
|
57
|
+
const { spectra: { activeTab }, } = view;
|
|
58
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
59
|
+
if (activeTab) {
|
|
59
60
|
const groupByNucleus = groupByInfoKey('nucleus');
|
|
60
61
|
const spectrumsGroupsList = groupByNucleus(data);
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
acc[datum.id] = datum.processingController.getLevel();
|
|
64
|
-
return acc;
|
|
65
|
-
}, {})
|
|
66
|
-
: null;
|
|
67
|
-
draft.keysPreferences[keyCode] = {
|
|
62
|
+
const spectra = spectrumsGroupsList[activeTab];
|
|
63
|
+
keysPreferences[keyCode] = {
|
|
68
64
|
activeSpectrum,
|
|
69
65
|
displayerMode,
|
|
70
66
|
view,
|
|
@@ -74,29 +70,25 @@ function setKeyPreferencesHandler(draft, keyCode) {
|
|
|
74
70
|
yDomain,
|
|
75
71
|
yDomains,
|
|
76
72
|
originDomain,
|
|
77
|
-
level,
|
|
78
73
|
margin,
|
|
79
|
-
data:
|
|
80
|
-
acc[datum.id] = {
|
|
81
|
-
display: {
|
|
82
|
-
color: datum.display.color,
|
|
83
|
-
isVisible: datum.display.isVisible,
|
|
84
|
-
isPeaksMarkersVisible: datum.display.isPeaksMarkersVisible,
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
return acc;
|
|
88
|
-
}, {}),
|
|
74
|
+
data: spectra,
|
|
89
75
|
};
|
|
90
76
|
}
|
|
91
77
|
}
|
|
78
|
+
function setSpectraDisplayPreferences(draft, preferences) {
|
|
79
|
+
for (const [index, datum] of draft.data.entries()) {
|
|
80
|
+
if (nucleusToString(datum.info.nucleus) === preferences.activeTab) {
|
|
81
|
+
draft.data[index].display = {
|
|
82
|
+
...datum.display,
|
|
83
|
+
...preferences.data[datum.id].display,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
92
88
|
function applyKeyPreferencesHandler(draft, keyCode) {
|
|
93
89
|
const preferences = draft.keysPreferences[keyCode];
|
|
94
90
|
if (preferences) {
|
|
95
|
-
draft
|
|
96
|
-
if (nucleusToString(datum.info.nucleus) === preferences.activeTab) {
|
|
97
|
-
draft.data[index].display = Object.assign(cloneDeep(datum.display), preferences.data[datum.id].display);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
91
|
+
setSpectraDisplayPreferences(draft, preferences);
|
|
100
92
|
draft.view = preferences.view;
|
|
101
93
|
draft.displayerMode = preferences.displayerMode;
|
|
102
94
|
draft.margin = preferences.margin;
|
|
@@ -106,17 +98,7 @@ function applyKeyPreferencesHandler(draft, keyCode) {
|
|
|
106
98
|
draft.yDomain = preferences.yDomain;
|
|
107
99
|
draft.originDomain = preferences.originDomain;
|
|
108
100
|
draft.yDomains = preferences.yDomains;
|
|
109
|
-
if (draft.displayerMode
|
|
110
|
-
for (const datumID of Object.keys(preferences.level)) {
|
|
111
|
-
const { levelPositive, levelNegative } = preferences.level[datumID];
|
|
112
|
-
const index = draft.data.findIndex((datum) => datum.id === datumID);
|
|
113
|
-
const processController = draft.data[index]
|
|
114
|
-
.processingController;
|
|
115
|
-
processController.setLevel(levelPositive, levelNegative);
|
|
116
|
-
draft.contours[datumID] = processController.drawContours();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
101
|
+
if (draft.displayerMode !== DISPLAYER_MODE.DM_2D) {
|
|
120
102
|
draft.zoom = preferences.zoom;
|
|
121
103
|
}
|
|
122
104
|
}
|
|
@@ -13,7 +13,7 @@ declare function handleChangeRangeSum(draft: Draft<State>, options: any): void;
|
|
|
13
13
|
declare function handleAddRange(draft: Draft<State>, action: any): void;
|
|
14
14
|
declare function handleChangeRangeRelativeValue(draft: any, action: any): void;
|
|
15
15
|
declare function handleChangeRangeSignalValue(draft: any, action: any): void;
|
|
16
|
-
declare function handleChangeRangesSumFlag(draft:
|
|
16
|
+
declare function handleChangeRangesSumFlag(draft: Draft<State>, action: any): void;
|
|
17
17
|
declare function handleUpdateRange(draft: Draft<State>, action: any): void;
|
|
18
18
|
declare function handleShowMultiplicityTrees(draft: Draft<State>, action: any): void;
|
|
19
19
|
declare function handleShowRangesIntegrals(draft: Draft<State>, action: any): void;
|
|
@@ -9,20 +9,21 @@ import { addRange, changeRangeSignal, detectRanges, updateRangesRelativeValues,
|
|
|
9
9
|
import { setSumOptions } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
10
10
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/RangeUtilities';
|
|
11
11
|
import { rangeStateInit } from '../Reducer';
|
|
12
|
+
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
12
13
|
import getRange from '../helper/getRange';
|
|
13
14
|
import { handleUpdateCorrelations } from './CorrelationsActions';
|
|
14
15
|
import { setDomain, setIntegralsYDomain } from './DomainActions';
|
|
15
16
|
import { resetSelectedTool } from './ToolsActions';
|
|
16
17
|
function handleAutoRangesDetection(draft, options) {
|
|
17
|
-
const { data, xDomain, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
18
|
-
const activeSpectrum = draft
|
|
18
|
+
const { data, xDomain, molecules, view: { spectra: { activeTab: nucleus }, ranges, }, } = draft;
|
|
19
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
19
20
|
if (activeSpectrum?.id) {
|
|
20
21
|
const { index, id } = activeSpectrum;
|
|
21
22
|
const datum = data[index];
|
|
22
23
|
// add range intial state
|
|
23
|
-
const range =
|
|
24
|
+
const range = ranges.find((r) => r.spectrumID === id);
|
|
24
25
|
if (!range) {
|
|
25
|
-
|
|
26
|
+
ranges.push({
|
|
26
27
|
spectrumID: id,
|
|
27
28
|
...rangeStateInit,
|
|
28
29
|
});
|
|
@@ -72,7 +73,7 @@ function getRangeIndex(draft, spectrumIndex, rangeID) {
|
|
|
72
73
|
return draft.data[spectrumIndex].ranges.values.findIndex((range) => range.id === rangeID);
|
|
73
74
|
}
|
|
74
75
|
function handleDeleteRange(draft, action) {
|
|
75
|
-
const activeSpectrum = draft
|
|
76
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
76
77
|
if (activeSpectrum?.id) {
|
|
77
78
|
const { index } = activeSpectrum;
|
|
78
79
|
const { data, resetSelectTool = false } = action.payload;
|
|
@@ -96,7 +97,7 @@ function handleDeleteRange(draft, action) {
|
|
|
96
97
|
}
|
|
97
98
|
function handleChangeRangeSignalKind(draft, action) {
|
|
98
99
|
const state = original(draft);
|
|
99
|
-
const activeSpectrum = state
|
|
100
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
100
101
|
if (activeSpectrum?.id) {
|
|
101
102
|
const { index } = activeSpectrum;
|
|
102
103
|
const { rowData, value } = action.payload.data;
|
|
@@ -114,7 +115,7 @@ function handleChangeRangeSignalKind(draft, action) {
|
|
|
114
115
|
}
|
|
115
116
|
function handleSaveEditedRange(draft, action) {
|
|
116
117
|
const state = original(draft);
|
|
117
|
-
const activeSpectrum = state
|
|
118
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
118
119
|
if (activeSpectrum?.id) {
|
|
119
120
|
const { index } = activeSpectrum;
|
|
120
121
|
const { editedRowData, assignmentData } = action.payload;
|
|
@@ -157,7 +158,7 @@ function handleDeleteSignal(draft, action) {
|
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
function handleUnlinkRange(draft, action) {
|
|
160
|
-
const activeSpectrum = draft
|
|
161
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
161
162
|
if (activeSpectrum?.id) {
|
|
162
163
|
const { index } = activeSpectrum;
|
|
163
164
|
const { assignmentData, rangeData = null, signalIndex = -1, } = action.payload;
|
|
@@ -192,7 +193,7 @@ function handleUnlinkRange(draft, action) {
|
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
195
|
function handleSetDiaIDRange(draft, action) {
|
|
195
|
-
const activeSpectrum = draft
|
|
196
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
196
197
|
if (activeSpectrum?.id) {
|
|
197
198
|
const { index } = activeSpectrum;
|
|
198
199
|
const { rangeData, diaIDs, signalIndex, nbAtoms } = action.payload;
|
|
@@ -211,7 +212,7 @@ function handleSetDiaIDRange(draft, action) {
|
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
function handleResizeRange(draft, action) {
|
|
214
|
-
const activeSpectrum = draft
|
|
215
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
215
216
|
if (activeSpectrum?.id) {
|
|
216
217
|
const { index } = activeSpectrum;
|
|
217
218
|
changeRange(draft.data[index], action.data);
|
|
@@ -219,7 +220,7 @@ function handleResizeRange(draft, action) {
|
|
|
219
220
|
}
|
|
220
221
|
function handleChangeRangeSum(draft, options) {
|
|
221
222
|
const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
222
|
-
const activeSpectrum = draft
|
|
223
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
223
224
|
if (activeSpectrum?.id) {
|
|
224
225
|
const { index } = activeSpectrum;
|
|
225
226
|
const datum = data[index];
|
|
@@ -230,20 +231,20 @@ function handleChangeRangeSum(draft, options) {
|
|
|
230
231
|
function addNewRange(draft, props) {
|
|
231
232
|
const { startX, endX, id } = props;
|
|
232
233
|
const range = getRange(draft, { startX, endX });
|
|
233
|
-
const { view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
|
|
234
|
-
const activeSpectrum = draft
|
|
234
|
+
const { data, view: { spectra: { activeTab: nucleus }, ranges, }, molecules, } = draft;
|
|
235
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
235
236
|
if (activeSpectrum?.id) {
|
|
236
237
|
const { index } = activeSpectrum;
|
|
237
238
|
const [from, to] = range;
|
|
238
239
|
// add range intial state
|
|
239
|
-
const rangeState =
|
|
240
|
+
const rangeState = ranges.find((r) => r.spectrumID === activeSpectrum.id);
|
|
240
241
|
if (!rangeState) {
|
|
241
|
-
|
|
242
|
+
ranges.push({
|
|
242
243
|
spectrumID: activeSpectrum.id,
|
|
243
244
|
...rangeStateInit,
|
|
244
245
|
});
|
|
245
246
|
}
|
|
246
|
-
addRange(
|
|
247
|
+
addRange(data[index], {
|
|
247
248
|
from,
|
|
248
249
|
to,
|
|
249
250
|
id,
|
|
@@ -251,7 +252,7 @@ function addNewRange(draft, props) {
|
|
|
251
252
|
molecules,
|
|
252
253
|
});
|
|
253
254
|
handleOnChangeRangesData(draft);
|
|
254
|
-
setIntegralsYDomain(draft,
|
|
255
|
+
setIntegralsYDomain(draft, data[index]);
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
function handleAddRange(draft, action) {
|
|
@@ -268,15 +269,17 @@ function handleAddRange(draft, action) {
|
|
|
268
269
|
}
|
|
269
270
|
function handleChangeRangeRelativeValue(draft, action) {
|
|
270
271
|
const data = action.payload.data;
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
273
|
+
if (activeSpectrum?.id) {
|
|
274
|
+
const { index } = activeSpectrum;
|
|
273
275
|
changeRangeRelativeValue(draft.data[index], data);
|
|
274
276
|
}
|
|
275
277
|
}
|
|
276
278
|
function handleChangeRangeSignalValue(draft, action) {
|
|
277
279
|
const { rangeID, signalID, value } = action.payload;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
281
|
+
if (activeSpectrum?.id) {
|
|
282
|
+
const { index } = activeSpectrum;
|
|
280
283
|
const shift = changeRangeSignal(draft.data[index], {
|
|
281
284
|
rangeID,
|
|
282
285
|
signalID,
|
|
@@ -295,14 +298,15 @@ function handleOnChangeRangesData(draft) {
|
|
|
295
298
|
}
|
|
296
299
|
function handleChangeRangesSumFlag(draft, action) {
|
|
297
300
|
const flag = action.payload;
|
|
298
|
-
|
|
299
|
-
|
|
301
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
302
|
+
if (activeSpectrum?.id) {
|
|
303
|
+
const { index } = activeSpectrum;
|
|
300
304
|
draft.data[index].ranges.options.isSumConstant = !flag;
|
|
301
305
|
}
|
|
302
306
|
}
|
|
303
307
|
function handleUpdateRange(draft, action) {
|
|
304
308
|
const { range, resetSelectTool = false } = action.payload;
|
|
305
|
-
const activeSpectrum = draft
|
|
309
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
306
310
|
if (activeSpectrum?.id && range.id) {
|
|
307
311
|
const datum = draft.data[activeSpectrum?.index];
|
|
308
312
|
const index = datum.ranges.values.findIndex((_range) => _range.id === range.id);
|
|
@@ -2,10 +2,12 @@ import { original } from 'immer';
|
|
|
2
2
|
import * as Filters from '../../../data/Filters';
|
|
3
3
|
import { applyFilter } from '../../../data/FiltersManager';
|
|
4
4
|
import { generateSpectrumFromPublicationString, getReferenceShift, } from '../../../data/data1d/Spectrum1D';
|
|
5
|
-
import { getMissingProjection } from '../../../data/data2d/Spectrum2D';
|
|
5
|
+
import { getMissingProjection, isSpectrum2D, } from '../../../data/data2d/Spectrum2D';
|
|
6
|
+
import { contoursManager } from '../../../data/data2d/Spectrum2D/contours';
|
|
6
7
|
import { options } from '../../toolbar/ToolTypes';
|
|
7
8
|
import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
8
9
|
import { setZoom } from '../helper/Zoom1DManager';
|
|
10
|
+
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
9
11
|
import { setDomain, setMode } from './DomainActions';
|
|
10
12
|
import { resetSpectrumByFilter } from './FiltersActions';
|
|
11
13
|
import { setTab, setActiveTab } from './ToolsActions';
|
|
@@ -65,7 +67,7 @@ function handleChangePeaksMarkersVisibility(draft, data) {
|
|
|
65
67
|
}
|
|
66
68
|
function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
67
69
|
let refreshDomain = false;
|
|
68
|
-
const currentActiveSpectrum = draft
|
|
70
|
+
const currentActiveSpectrum = getActiveSpectrum(draft);
|
|
69
71
|
if (activeSpectrum) {
|
|
70
72
|
const newIndex = draft.data.findIndex((d) => d.id === activeSpectrum.id);
|
|
71
73
|
const oldIndex = draft.data.findIndex((d) => d.id === currentActiveSpectrum?.id);
|
|
@@ -114,10 +116,15 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
function changeSpectrumSetting(draft, { id, display }) {
|
|
117
|
-
const
|
|
118
|
-
const index = state.data.findIndex((d) => d.id === id);
|
|
119
|
+
const index = draft.data.findIndex((d) => d.id === id);
|
|
119
120
|
if (index !== -1) {
|
|
120
|
-
draft.data[index]
|
|
121
|
+
const spectrum = draft.data[index];
|
|
122
|
+
spectrum.display = display;
|
|
123
|
+
if (isSpectrum2D(spectrum)) {
|
|
124
|
+
const contoursLevels = draft.view.zoom.levels;
|
|
125
|
+
const { checkLevel } = contoursManager(spectrum.id, contoursLevels, spectrum.display.contourOptions);
|
|
126
|
+
contoursLevels[spectrum.id] = checkLevel();
|
|
127
|
+
}
|
|
121
128
|
}
|
|
122
129
|
}
|
|
123
130
|
function handleChangeSpectrumColor(draft, { id, color, key }) {
|
|
@@ -144,7 +151,7 @@ function handleDeleteSpectra(draft, action) {
|
|
|
144
151
|
function addMissingProjectionHandler(draft, action) {
|
|
145
152
|
const state = original(draft);
|
|
146
153
|
const { nucleus } = action;
|
|
147
|
-
const activeSpectrum = draft
|
|
154
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
148
155
|
if (activeSpectrum?.id) {
|
|
149
156
|
const { index } = activeSpectrum;
|
|
150
157
|
for (let n of nucleus) {
|
|
@@ -11,7 +11,7 @@ declare function handleAddBaseLineZone(draft: Draft<State>, { from, to }: {
|
|
|
11
11
|
to: any;
|
|
12
12
|
}): void;
|
|
13
13
|
declare function handleDeleteBaseLineZone(draft: Draft<State>, id: any): void;
|
|
14
|
-
declare function handleToggleRealImaginaryVisibility(draft:
|
|
14
|
+
declare function handleToggleRealImaginaryVisibility(draft: Draft<State>): void;
|
|
15
15
|
declare function handleBrushEnd(draft: Draft<State>, action: any): void;
|
|
16
16
|
declare function setVerticalIndicatorXPosition(draft: Draft<State>, position: any): void;
|
|
17
17
|
declare function handleZoom(draft: Draft<State>, action: any): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { v4 } from '@lukeed/uuid';
|
|
2
2
|
import { original } from 'immer';
|
|
3
3
|
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
4
|
+
import { contoursManager } from '../../../data/data2d/Spectrum2D/contours';
|
|
4
5
|
import { getYScale, getXScale } from '../../1d/utilities/scale';
|
|
5
6
|
import { LAYOUT } from '../../2d/utilities/DimensionLayout';
|
|
6
7
|
import { get2DYScale } from '../../2d/utilities/scale';
|
|
@@ -10,7 +11,9 @@ import { rangeStateInit } from '../Reducer';
|
|
|
10
11
|
import { DISPLAYER_MODE, MARGIN } from '../core/Constants';
|
|
11
12
|
import { setZoom, wheelZoom, ZoomType } from '../helper/Zoom1DManager';
|
|
12
13
|
import zoomHistoryManager from '../helper/ZoomHistoryManager';
|
|
14
|
+
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
13
15
|
import { getActiveSpectrumOrFail } from '../helper/getActiveSpectrumOrFail';
|
|
16
|
+
import { getSpectrum } from '../helper/getSpectrum';
|
|
14
17
|
import { setDomain, setIntegralsYDomain, setMode, } from './DomainActions';
|
|
15
18
|
import { calculateBaseLineCorrection, resetSpectrumByFilter, setFilterChanges, } from './FiltersActions';
|
|
16
19
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
@@ -112,10 +115,11 @@ function handleDeleteBaseLineZone(draft, id) {
|
|
|
112
115
|
calculateBaseLineCorrection(draft);
|
|
113
116
|
}
|
|
114
117
|
function handleToggleRealImaginaryVisibility(draft) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
119
|
+
if (activeSpectrum != null) {
|
|
120
|
+
const { index } = activeSpectrum;
|
|
121
|
+
const datum = draft.data[index];
|
|
122
|
+
datum.display.isRealSpectrumVisible = !datum.display.isRealSpectrumVisible;
|
|
119
123
|
setDomain(draft);
|
|
120
124
|
}
|
|
121
125
|
}
|
|
@@ -157,7 +161,7 @@ function handleBrushEnd(draft, action) {
|
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
function setVerticalIndicatorXPosition(draft, position) {
|
|
160
|
-
const activeSpectrum = draft
|
|
164
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
161
165
|
if (activeSpectrum?.id) {
|
|
162
166
|
const scaleX = getXScale(draft);
|
|
163
167
|
const value = scaleX.invert(position);
|
|
@@ -172,8 +176,8 @@ function getSpectrumID(draft, index) {
|
|
|
172
176
|
}
|
|
173
177
|
function handleZoom(draft, action) {
|
|
174
178
|
const { event, trackID, selectedTool } = action;
|
|
175
|
-
const { view: { ranges: rangeState }, displayerMode, } = draft;
|
|
176
|
-
const activeSpectrum = draft
|
|
179
|
+
const { view: { ranges: rangeState }, displayerMode, yDomains, integralsYDomains, } = draft;
|
|
180
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
177
181
|
const { showRangesIntegrals } = rangeState.find((r) => r.spectrumID === activeSpectrum?.id) ||
|
|
178
182
|
rangeStateInit;
|
|
179
183
|
if (displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
@@ -181,26 +185,26 @@ function handleZoom(draft, action) {
|
|
|
181
185
|
if (index !== null) {
|
|
182
186
|
const id = getSpectrumID(draft, index);
|
|
183
187
|
if (id) {
|
|
184
|
-
const domain =
|
|
185
|
-
|
|
188
|
+
const domain = yDomains[id];
|
|
189
|
+
yDomains[id] = wheelZoom(event, domain);
|
|
186
190
|
}
|
|
187
191
|
}
|
|
188
192
|
}
|
|
189
193
|
else if (activeSpectrum?.id) {
|
|
190
194
|
if ((showRangesIntegrals || selectedTool === options.integral.id) &&
|
|
191
195
|
event.shiftKey) {
|
|
192
|
-
const domain =
|
|
193
|
-
|
|
196
|
+
const domain = integralsYDomains[activeSpectrum?.id];
|
|
197
|
+
integralsYDomains[activeSpectrum?.id] = wheelZoom(event, domain);
|
|
194
198
|
}
|
|
195
199
|
else {
|
|
196
|
-
const domain =
|
|
197
|
-
|
|
200
|
+
const domain = yDomains[activeSpectrum?.id];
|
|
201
|
+
yDomains[activeSpectrum?.id] = wheelZoom(event, domain);
|
|
198
202
|
}
|
|
199
203
|
}
|
|
200
204
|
else {
|
|
201
|
-
for (const key of Object.keys(
|
|
202
|
-
const domain =
|
|
203
|
-
|
|
205
|
+
for (const key of Object.keys(yDomains)) {
|
|
206
|
+
const domain = yDomains[key];
|
|
207
|
+
yDomains[key] = wheelZoom(event, domain);
|
|
204
208
|
}
|
|
205
209
|
}
|
|
206
210
|
}
|
|
@@ -273,15 +277,6 @@ function setMargin(draft) {
|
|
|
273
277
|
draft.margin = MARGIN['1D'];
|
|
274
278
|
}
|
|
275
279
|
}
|
|
276
|
-
function processing2DData(draft, data) {
|
|
277
|
-
if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
278
|
-
let _data = {};
|
|
279
|
-
for (const datum of data[draft.view.spectra.activeTab]) {
|
|
280
|
-
_data[datum.id] = datum.processingController.drawContours();
|
|
281
|
-
}
|
|
282
|
-
draft.contours = _data;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
280
|
function setDisplayerMode(draft, data) {
|
|
286
281
|
draft.displayerMode =
|
|
287
282
|
data && data.some((d) => d.info.dimension === 2)
|
|
@@ -352,7 +347,6 @@ function setActiveTab(draft, options) {
|
|
|
352
347
|
const currentTab = !tab || !tabs.includes(tab || '') ? tabs[0] : tab;
|
|
353
348
|
setTab(draft, dataGroupByNucleus, currentTab, refreshActiveTab);
|
|
354
349
|
resetTool(draft);
|
|
355
|
-
processing2DData(draft, dataGroupByNucleus);
|
|
356
350
|
setDomain(draft, domainOptions);
|
|
357
351
|
setIntegralsYDomain(draft, dataGroupByNucleus[currentTab]);
|
|
358
352
|
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
|
|
@@ -369,25 +363,18 @@ function handelSetActiveTab(draft, tab) {
|
|
|
369
363
|
}
|
|
370
364
|
}
|
|
371
365
|
function levelChangeHandler(draft, { deltaY, shiftKey }) {
|
|
372
|
-
const activeSpectrum = draft
|
|
366
|
+
const activeSpectrum = getSpectrum(draft);
|
|
373
367
|
try {
|
|
374
368
|
if (activeSpectrum?.id) {
|
|
375
|
-
const {
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
processingController.shiftWheel(deltaY);
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
processingController.wheel(deltaY);
|
|
383
|
-
}
|
|
384
|
-
const contours = Object.freeze(processingController.drawContours());
|
|
385
|
-
draft.contours[id] = contours;
|
|
369
|
+
const { levels } = draft.view.zoom;
|
|
370
|
+
const contourOptions = activeSpectrum.display.contourOptions;
|
|
371
|
+
const zoom = contoursManager(activeSpectrum.id, levels, contourOptions);
|
|
372
|
+
levels[activeSpectrum.id] = zoom.wheel(deltaY, shiftKey);
|
|
386
373
|
}
|
|
387
374
|
}
|
|
388
|
-
catch (
|
|
389
|
-
//
|
|
390
|
-
|
|
375
|
+
catch (error) {
|
|
376
|
+
// TODO: handle error.
|
|
377
|
+
reportError(error);
|
|
391
378
|
}
|
|
392
379
|
}
|
|
393
380
|
function setSpectraSameTopHandler(draft) {
|
|
@@ -8,13 +8,14 @@ import { changeZoneSignal, detectZones, detectZonesManual, updateShift, } from '
|
|
|
8
8
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/ZoneUtilities';
|
|
9
9
|
import { zoneStateInit } from '../Reducer';
|
|
10
10
|
import get2DRange from '../helper/get2DRange';
|
|
11
|
+
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
11
12
|
import { handleUpdateCorrelations } from './CorrelationsActions';
|
|
12
13
|
import { setDomain } from './DomainActions';
|
|
13
14
|
function changeZonesFactorHandler(draft, action) {
|
|
14
15
|
draft.toolOptions.data.zonesNoiseFactor = action.payload;
|
|
15
16
|
}
|
|
16
17
|
function add2dZoneHandler(draft, action) {
|
|
17
|
-
const activeSpectrum = draft
|
|
18
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
18
19
|
if (activeSpectrum?.id) {
|
|
19
20
|
const { index } = activeSpectrum;
|
|
20
21
|
const drawnZone = get2DRange(draft, action);
|
|
@@ -29,7 +30,7 @@ function add2dZoneHandler(draft, action) {
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
function handleAutoZonesDetection(draft, detectionOptions) {
|
|
32
|
-
const activeSpectrum = draft
|
|
33
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
33
34
|
if (activeSpectrum?.id) {
|
|
34
35
|
const { index } = activeSpectrum;
|
|
35
36
|
const [fromX, toX] = draft.xDomain;
|
|
@@ -57,7 +58,7 @@ function handleAutoSpectraZonesDetection(draft) {
|
|
|
57
58
|
}
|
|
58
59
|
function changeZoneSignalDelta(draft, action) {
|
|
59
60
|
const { zoneID, signal } = action.payload;
|
|
60
|
-
const activeSpectrum = draft
|
|
61
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
61
62
|
if (activeSpectrum?.id) {
|
|
62
63
|
const { index } = activeSpectrum;
|
|
63
64
|
const { xShift, yShift } = changeZoneSignal(draft.data[index], zoneID, signal);
|
|
@@ -79,7 +80,7 @@ function getZoneIndex(state, spectrumIndex, zoneID) {
|
|
|
79
80
|
}
|
|
80
81
|
function handleChangeZoneSignalKind(draft, action) {
|
|
81
82
|
const state = original(draft);
|
|
82
|
-
const activeSpectrum = state
|
|
83
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
83
84
|
if (activeSpectrum?.id) {
|
|
84
85
|
const { index } = activeSpectrum;
|
|
85
86
|
const { rowData, value } = action.payload;
|
|
@@ -94,7 +95,7 @@ function handleChangeZoneSignalKind(draft, action) {
|
|
|
94
95
|
}
|
|
95
96
|
function handleDeleteZone(draft, action) {
|
|
96
97
|
const state = original(draft);
|
|
97
|
-
const activeSpectrum = state
|
|
98
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
98
99
|
if (activeSpectrum?.id) {
|
|
99
100
|
const { index } = activeSpectrum;
|
|
100
101
|
const { id, assignmentData } = action.payload;
|
|
@@ -149,7 +150,7 @@ function handleSetSignalPathLength(draft, action) {
|
|
|
149
150
|
}
|
|
150
151
|
function handleUnlinkZone(draft, action) {
|
|
151
152
|
const state = original(draft);
|
|
152
|
-
const activeSpectrum = state
|
|
153
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
153
154
|
if (activeSpectrum?.id) {
|
|
154
155
|
const { index } = activeSpectrum;
|
|
155
156
|
const { zoneData = null, assignmentData, isOnZoneLevel = undefined, signalIndex = -1, axis = undefined, } = action.payload;
|
|
@@ -172,7 +173,7 @@ function handleUnlinkZone(draft, action) {
|
|
|
172
173
|
}
|
|
173
174
|
function handleSetDiaIDZone(draft, action) {
|
|
174
175
|
const state = original(draft);
|
|
175
|
-
const activeSpectrum = state
|
|
176
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
176
177
|
if (activeSpectrum?.id) {
|
|
177
178
|
const { index } = activeSpectrum;
|
|
178
179
|
const { zoneData, diaIDs, axis, signalIndex, nbAtoms } = action.payload;
|
|
@@ -191,7 +192,7 @@ function handleSetDiaIDZone(draft, action) {
|
|
|
191
192
|
}
|
|
192
193
|
function handleSaveEditedZone(draft, action) {
|
|
193
194
|
const state = original(draft);
|
|
194
|
-
const activeSpectrum = state
|
|
195
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
195
196
|
if (activeSpectrum?.id) {
|
|
196
197
|
const { index } = activeSpectrum;
|
|
197
198
|
const { editedRowData } = action.payload;
|
|
@@ -199,9 +200,9 @@ function handleSaveEditedZone(draft, action) {
|
|
|
199
200
|
const zoneIndex = getZoneIndex(state, index, editedRowData.id);
|
|
200
201
|
draft.data[index].zones.values[zoneIndex] = editedRowData;
|
|
201
202
|
if (editedRowData.signals) {
|
|
202
|
-
editedRowData.signals
|
|
203
|
+
for (const signal of editedRowData.signals) {
|
|
203
204
|
setPathLength(draft.correlations.values, signal.id, signal.j?.pathLength);
|
|
204
|
-
}
|
|
205
|
+
}
|
|
205
206
|
}
|
|
206
207
|
handleOnChangeZonesData(draft);
|
|
207
208
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
function getClosestNumber(array = [], goal = 0) {
|
|
2
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
2
3
|
const closest = array.reduce((prev, curr) => {
|
|
3
4
|
return Math.abs(curr - goal) < Math.abs(prev - goal) ? curr : prev;
|
|
4
|
-
});
|
|
5
|
+
}, Number.POSITIVE_INFINITY);
|
|
5
6
|
return closest;
|
|
6
7
|
}
|
|
7
8
|
export default getClosestNumber;
|
|
@@ -14,12 +14,12 @@ function wheelZoom(event, domain, zoomOptions = {}) {
|
|
|
14
14
|
return [min * ratio, max * ratio];
|
|
15
15
|
}
|
|
16
16
|
function setZoom(draft, options = {}) {
|
|
17
|
-
const { height, margin } = draft;
|
|
18
|
-
const activeSpectrum =
|
|
17
|
+
const { height, margin, view, originDomain, yDomains } = draft;
|
|
18
|
+
const activeSpectrum = view.spectra.activeSpectra[view.spectra.activeTab];
|
|
19
19
|
const { scale = 1, spectrumID = null } = options;
|
|
20
20
|
if (activeSpectrum === null && spectrumID === null) {
|
|
21
|
-
const { shareYDomain, yDomain, yDomains } =
|
|
22
|
-
draft.yDomains = Object.keys(
|
|
21
|
+
const { shareYDomain, yDomain, yDomains } = originDomain;
|
|
22
|
+
draft.yDomains = Object.fromEntries(Object.keys(yDomains).map((id) => {
|
|
23
23
|
const _scale = scaleLinear(shareYDomain ? yDomain : yDomains[id], [
|
|
24
24
|
height - margin.bottom,
|
|
25
25
|
margin.top,
|
|
@@ -28,18 +28,19 @@ function setZoom(draft, options = {}) {
|
|
|
28
28
|
const maxPoint = Math.max(Math.abs(max), Math.abs(min));
|
|
29
29
|
const scalePoint = maxPoint === max ? 0 : min;
|
|
30
30
|
const t = zoomIdentity
|
|
31
|
-
.translate(0, Math.sign(scalePoint) >= 0
|
|
31
|
+
.translate(0, Math.sign(scalePoint) >= 0
|
|
32
|
+
? _scale(scalePoint)
|
|
33
|
+
: _scale(scalePoint))
|
|
32
34
|
.scale(scale)
|
|
33
35
|
.translate(0, -_scale(0));
|
|
34
36
|
const newYDomain = t.rescaleY(_scale).domain();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, {});
|
|
37
|
+
return [id, newYDomain];
|
|
38
|
+
}));
|
|
38
39
|
}
|
|
39
40
|
else {
|
|
40
41
|
const spectrumId = spectrumID || activeSpectrum?.id;
|
|
41
42
|
if (spectrumId) {
|
|
42
|
-
const _scale = scaleLinear(
|
|
43
|
+
const _scale = scaleLinear(originDomain.yDomains[spectrumId], [
|
|
43
44
|
height - margin.bottom,
|
|
44
45
|
margin.top,
|
|
45
46
|
]);
|
|
@@ -49,7 +50,7 @@ function setZoom(draft, options = {}) {
|
|
|
49
50
|
.translate(0, -_scale(0));
|
|
50
51
|
const yDomain = t.rescaleY(_scale).domain();
|
|
51
52
|
draft.yDomains = {
|
|
52
|
-
...
|
|
53
|
+
...yDomains,
|
|
53
54
|
[spectrumId]: yDomain,
|
|
54
55
|
};
|
|
55
56
|
}
|