nmrium 0.40.1 → 0.41.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/FooterBanner.js +5 -4
- package/lib/component/1d/Viewer1D.js +121 -104
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
- package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +1 -1
- package/lib/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
- package/lib/component/1d/multiplicityTree/TreeColors.d.ts +1 -1
- package/lib/component/1d/multiplicityTree/TreeColors.js +1 -6
- package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +7 -4
- package/lib/component/1d/tool/PeakPointer.js +1 -1
- package/lib/component/1d/utilities/scale.js +1 -3
- package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
- package/lib/component/1d-2d/tools/BrushXY.js +10 -7
- package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
- package/lib/component/2d/FooterBanner.js +3 -2
- package/lib/component/2d/Viewer2D.js +51 -29
- package/lib/component/2d/XAxis.js +1 -1
- package/lib/component/2d/YAxis.js +1 -1
- package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
- package/lib/component/2d/utilities/scale.d.ts +5 -5
- package/lib/component/2d/zones/Signal.js +1 -2
- package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
- package/lib/component/EventsTrackers/BrushTracker.js +21 -6
- package/lib/component/NMRium.d.ts +2 -2
- package/lib/component/NMRium.js +39 -26
- package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
- package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
- package/lib/component/elements/InputRange.js +1 -1
- package/lib/component/elements/MenuButton.d.ts +1 -1
- package/lib/component/elements/MoleculeSelection.d.ts +1 -1
- package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
- package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
- package/lib/component/elements/ToolbarMenu.d.ts +1 -1
- package/lib/component/elements/accordion/Accordion.d.ts +1 -1
- package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
- package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
- package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
- package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
- package/lib/component/elements/formik/SelectBox.d.ts +1 -1
- package/lib/component/elements/popup/Alert/AlertBlock.d.ts +3 -2
- package/lib/component/elements/popup/Alert/AlertBlock.js +21 -15
- package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
- package/lib/component/elements/popup/Alert/Context.js +6 -2
- package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
- package/lib/component/elements/popup/Alert/Provider.js +3 -3
- package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
- package/lib/component/elements/popup/Modal/Provider.js +3 -1
- package/lib/component/elements/popup/options.d.ts +22 -19
- package/lib/component/elements/resizer/Resizer.d.ts +2 -2
- package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
- package/lib/component/elements/toggle/ToggleButton.js +1 -1
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
- package/lib/component/highlight/index.d.ts +1 -1
- package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
- package/lib/component/hooks/useExport.js +2 -1
- package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
- package/lib/component/hooks/usePanelPreferences.js +2 -2
- package/lib/component/hooks/useXScale.d.ts +1 -1
- package/lib/component/hooks/useXYReduce.d.ts +2 -2
- package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
- package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
- package/lib/component/modal/AlignSpectraModal.js +11 -1
- package/lib/component/modal/MultipletAnalysisModal.js +2 -1
- package/lib/component/modal/PredictSpectraModal.d.ts +1 -2
- package/lib/component/modal/PredictSpectraModal.js +25 -28
- package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -1
- package/lib/component/modal/editZone/SignalsForm.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
- package/lib/component/modal/setting/settingsValidation.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -7
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
- package/lib/component/panels/Panels.js +13 -0
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
- package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
- package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
- package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
- package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
- package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
- package/lib/component/reducer/Reducer.d.ts +13 -12
- package/lib/component/reducer/Reducer.js +251 -239
- package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
- package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
- package/lib/component/reducer/actions/DatabaseActions.js +2 -1
- package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
- package/lib/component/reducer/actions/DomainActions.js +30 -1
- package/lib/component/reducer/actions/FiltersActions.js +4 -4
- package/lib/component/reducer/actions/LoadActions.js +1 -1
- package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -0
- package/lib/component/reducer/actions/MoleculeActions.js +51 -2
- package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
- package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
- package/lib/component/reducer/actions/ToolsActions.js +2 -2
- package/lib/component/reducer/actions/ZonesActions.js +1 -1
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
- package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
- package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
- package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
- package/lib/component/toolbar/ToolTypes.d.ts +4 -4
- package/lib/component/utility/export.js +9 -9
- package/lib/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib/component/utility/getUniqueNuclei.js +1 -1
- package/lib/component/utility/jpathToArray.js +1 -1
- package/lib/component/workspaces/index.d.ts +1 -0
- package/lib/component/workspaces/index.js +2 -0
- package/lib/component/workspaces/simulation.d.ts +2 -0
- package/lib/component/workspaces/simulation.js +68 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
- package/lib/data/PredictionManager.d.ts +8 -7
- package/lib/data/PredictionManager.js +95 -22
- package/lib/data/SpectraManager.js +1 -1
- package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
- package/lib/data/constants/SignalsKinds.d.ts +2 -2
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
- package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
- package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
- package/lib/data/data1d/database.d.ts +5 -5
- package/lib/data/data1d/database.js +3 -3
- package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
- package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
- package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
- package/lib/data/data1d/spectrumSimulation.js +53 -0
- package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
- package/lib/data/data2d/Spectrum2D/contours.js +7 -1
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
- package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
- package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
- package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
- package/lib/data/matrixGeneration.js +1 -1
- package/lib/data/molecules/MoleculeManager.d.ts +1 -1
- package/lib/data/molecules/MoleculeManager.js +7 -7
- package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
- package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
- package/lib/data/utilities/FindUtilities.js +4 -4
- package/lib/data/utilities/RangeUtilities.d.ts +1 -1
- package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
- package/lib/data/utilities/calculateSanPlot.js +3 -3
- package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
- package/lib/utils/clipboard/clipboard.d.ts +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +5 -4
- package/lib-cjs/component/1d/Viewer1D.js +120 -103
- package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
- package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
- package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
- package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
- package/lib-cjs/component/1d/utilities/scale.js +1 -3
- package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
- package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
- package/lib-cjs/component/2d/FooterBanner.js +3 -2
- package/lib-cjs/component/2d/Viewer2D.js +50 -28
- package/lib-cjs/component/2d/XAxis.js +1 -1
- package/lib-cjs/component/2d/YAxis.js +1 -1
- package/lib-cjs/component/2d/zones/Signal.js +1 -2
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
- package/lib-cjs/component/NMRium.js +37 -24
- package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
- package/lib-cjs/component/elements/InputRange.js +1 -1
- package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
- package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +21 -15
- package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
- package/lib-cjs/component/elements/popup/Alert/Provider.js +2 -2
- package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
- package/lib-cjs/component/hooks/useExport.js +2 -1
- package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
- package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
- package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
- package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
- package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
- package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
- package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
- package/lib-cjs/component/panels/Panels.js +13 -0
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
- package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
- package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
- package/lib-cjs/component/reducer/Reducer.js +251 -239
- package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
- package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
- package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
- package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +54 -2
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
- package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
- package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
- package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
- package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
- package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
- package/lib-cjs/component/utility/export.js +9 -9
- package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
- package/lib-cjs/component/utility/jpathToArray.js +1 -1
- package/lib-cjs/component/workspaces/index.js +2 -0
- package/lib-cjs/component/workspaces/simulation.js +71 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -0
- package/lib-cjs/data/PredictionManager.js +96 -22
- package/lib-cjs/data/SpectraManager.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
- package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
- package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
- package/lib-cjs/data/data1d/database.js +3 -3
- package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
- package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
- package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
- package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
- package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
- package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
- package/lib-cjs/data/matrixGeneration.js +1 -1
- package/lib-cjs/data/molecules/MoleculeManager.js +7 -7
- package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
- package/lib-cjs/data/utilities/FindUtilities.js +4 -4
- package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
- package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +21 -20
|
@@ -76,8 +76,8 @@ const styles = css `
|
|
|
76
76
|
}
|
|
77
77
|
`;
|
|
78
78
|
function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, activeTab, }) {
|
|
79
|
-
|
|
80
|
-
const { startX, endX, step } = useBrushTracker();
|
|
79
|
+
const position = useMouseTracker();
|
|
80
|
+
const { startX, endX, step, mouseButton } = useBrushTracker();
|
|
81
81
|
const { scaleX } = useScaleChecked();
|
|
82
82
|
const format = useFormatNumberByNucleus(activeTab);
|
|
83
83
|
if (!position ||
|
|
@@ -102,8 +102,9 @@ function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, ac
|
|
|
102
102
|
}
|
|
103
103
|
return 1;
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
const isBrushing = step === 'brushing' && mouseButton === 'main';
|
|
106
|
+
return (_jsxs("div", { css: styles, children: [_jsx(BsCursor, {}), _jsxs("div", { children: [_jsx("span", { className: "label", children: " \uD835\uDEC5: " }), _jsx("span", { className: "value", children: format(scaleX().invert(position.x)) }), _jsx("span", { className: "unit", children: "ppm" }), activeSpectrum && spectrum?.info?.originFrequency && (_jsxs(_Fragment, { children: [_jsxs("span", { className: "value", children: ["\u00A0(", format(scaleX().invert(position.x) * spectrum?.info?.originFrequency, 'hz')] }), _jsx("span", { className: "unit", children: "Hz" }), _jsx("span", { className: "value", children: ") " }), _jsxs("span", { className: "small-width-none", children: [_jsx("span", { children: "," }), _jsx("span", { className: "label", children: " Index: " }), _jsx("span", { className: "value", children: getXIndex(position.x) })] })] }))] }), isBrushing && (_jsxs("div", { className: "flex-row small-width-none", children: [_jsx("span", { className: "label", children: " \u0394ppm: " }), _jsx("span", { className: "value", children: (scaleX().invert(startX) - scaleX().invert(endX)).toPrecision(6) })] })), activeSpectrum && (_jsxs("div", { className: " flex-row small-width-none", children: [spectrum?.info?.originFrequency && isBrushing && (_jsxs("div", { children: [_jsx("span", { className: "label", children: " \u0394Hz: " }), _jsx("span", { className: "value", children: ((scaleX().invert(startX) - scaleX().invert(endX)) *
|
|
107
|
+
spectrum?.info?.originFrequency).toPrecision(5) })] })), isBrushing && (_jsxs("div", { children: [_jsx("span", { className: "label", children: " ratio :" }), _jsxs("span", { className: "value", children: [((getYValue(startX) / (getYValue(endX) || Number.MIN_VALUE)) *
|
|
107
108
|
100).toFixed(2), "%"] })] }))] })), activeSpectrum && (_jsxs("div", { className: "flex-row small-width-none", children: [_jsx("div", { className: "separator" }), _jsx(IoPulseSharp, {}), _jsxs("div", { children: [_jsx("span", { className: "label", children: "Intensity: " }), _jsx("span", { className: "value y-value", children: format(getYValue(position.x)) })] })] }))] }));
|
|
108
109
|
}
|
|
109
110
|
const MemoizedFooterBanner = memo(FooterBannerInner);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { xGetFromToIndex } from 'ml-spectra-processing';
|
|
3
|
-
import { useCallback, useEffect, useReducer } from 'react';
|
|
3
|
+
import { useCallback, useEffect, useReducer, useRef } from 'react';
|
|
4
4
|
import { ResponsiveChart } from 'react-d3-utils';
|
|
5
5
|
import { MAX_LENGTH } from '../../data/data1d/Spectrum1D/ranges/detectSignal';
|
|
6
6
|
import BrushXY, { BRUSH_TYPE } from '../1d-2d/tools/BrushXY';
|
|
@@ -28,9 +28,11 @@ import FooterBanner from './FooterBanner';
|
|
|
28
28
|
import PeakPointer from './tool/PeakPointer';
|
|
29
29
|
import VerticalIndicator from './tool/VerticalIndicator';
|
|
30
30
|
import XLabelPointer from './tool/XLabelPointer';
|
|
31
|
+
import { getXScale } from './utilities/scale';
|
|
31
32
|
function Viewer1D({ emptyText = undefined }) {
|
|
32
33
|
const state = useChartData();
|
|
33
34
|
const { toolOptions: { selectedTool }, isLoading, data, mode, width: widthProp, height: heightProp, margin, xDomain, xDomains, yDomain, yDomains, displayerKey, view: { spectra: { activeTab }, }, } = state;
|
|
35
|
+
const brushStartRef = useRef(null);
|
|
34
36
|
const verticalAlign = useVerticalAlign();
|
|
35
37
|
const activeSpectrum = useActiveSpectrum();
|
|
36
38
|
const dispatch = useDispatch();
|
|
@@ -66,123 +68,138 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
66
68
|
yDomain,
|
|
67
69
|
yDomains,
|
|
68
70
|
]);
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const endXPPM = scaleState.scaleX().invert(endX);
|
|
76
|
-
Events.emit('brushEnd', {
|
|
77
|
-
...brushData,
|
|
78
|
-
range: [startXPPM, endXPPM].sort((a, b) => a - b),
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
if (brushData.altKey) {
|
|
82
|
-
switch (selectedTool) {
|
|
83
|
-
case options.rangePicking.id: {
|
|
84
|
-
modal.show(_jsx(MultipletAnalysisModal, { data: data, activeSpectrum: activeSpectrum, scaleX: scaleState.scaleX, ...brushData }), {
|
|
85
|
-
onClose: () => {
|
|
86
|
-
modal.close();
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
default:
|
|
92
|
-
break;
|
|
71
|
+
function handelBrush(brushData) {
|
|
72
|
+
const { startX: startXInPixel, endX: endXInPixel, mouseButton } = brushData;
|
|
73
|
+
if (mouseButton === 'secondary') {
|
|
74
|
+
const scaleX = getXScale(state);
|
|
75
|
+
if (!brushStartRef.current) {
|
|
76
|
+
brushStartRef.current = scaleX.invert(startXInPixel);
|
|
93
77
|
}
|
|
78
|
+
const shiftX = scaleX.invert(endXInPixel) - brushStartRef.current;
|
|
79
|
+
dispatch({ type: 'MOVE', payload: { shiftX, shiftY: 0 } });
|
|
94
80
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
81
|
+
}
|
|
82
|
+
const handelBrushEnd = useCallback((brushData) => {
|
|
83
|
+
//reset the brush start
|
|
84
|
+
brushStartRef.current = null;
|
|
85
|
+
if (brushData.mouseButton === 'main') {
|
|
86
|
+
const propagateEvent = () => {
|
|
87
|
+
if (!scaleState.scaleX || !scaleState.scaleY)
|
|
88
|
+
return;
|
|
89
|
+
const { startX, endX } = brushData;
|
|
90
|
+
const startXPPM = scaleState.scaleX().invert(startX);
|
|
91
|
+
const endXPPM = scaleState.scaleX().invert(endX);
|
|
92
|
+
Events.emit('brushEnd', {
|
|
93
|
+
...brushData,
|
|
94
|
+
range: [startXPPM, endXPPM].sort((a, b) => a - b),
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
if (brushData.altKey) {
|
|
98
|
+
switch (selectedTool) {
|
|
99
|
+
case options.rangePicking.id: {
|
|
100
|
+
modal.show(_jsx(MultipletAnalysisModal, { data: data, activeSpectrum: activeSpectrum, scaleX: scaleState.scaleX, ...brushData }), {
|
|
101
|
+
onClose: () => {
|
|
102
|
+
modal.close();
|
|
103
|
+
},
|
|
104
|
+
});
|
|
109
105
|
break;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
}
|
|
107
|
+
default:
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else if (brushData.shiftKey) {
|
|
112
|
+
switch (selectedTool) {
|
|
113
|
+
case options.integral.id:
|
|
113
114
|
dispatch({
|
|
114
|
-
type: '
|
|
115
|
+
type: 'ADD_INTEGRAL',
|
|
115
116
|
payload: brushData,
|
|
116
117
|
});
|
|
118
|
+
break;
|
|
119
|
+
case options.rangePicking.id: {
|
|
120
|
+
const [from, to] = getRange(state, {
|
|
121
|
+
startX: brushData.startX,
|
|
122
|
+
endX: brushData.endX,
|
|
123
|
+
});
|
|
124
|
+
if (!activeSpectrum)
|
|
125
|
+
break;
|
|
126
|
+
const { data: { x }, } = data[activeSpectrum.index];
|
|
127
|
+
const { fromIndex, toIndex } = xGetFromToIndex(x, { from, to });
|
|
128
|
+
if (toIndex - fromIndex <= MAX_LENGTH) {
|
|
129
|
+
dispatch({
|
|
130
|
+
type: 'ADD_RANGE',
|
|
131
|
+
payload: brushData,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
alert.error(`Advanced peak picking only available for area up to ${MAX_LENGTH} points`);
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
117
138
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
139
|
+
case options.multipleSpectraAnalysis.id:
|
|
140
|
+
if (scaleState.scaleX) {
|
|
141
|
+
const { startX, endX } = brushData;
|
|
142
|
+
const start = scaleState.scaleX().invert(startX);
|
|
143
|
+
const end = scaleState.scaleX().invert(endX);
|
|
144
|
+
dispatchPreferences({
|
|
145
|
+
type: 'ANALYZE_SPECTRA',
|
|
146
|
+
payload: {
|
|
147
|
+
start,
|
|
148
|
+
end,
|
|
149
|
+
nucleus: activeTab,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
case options.peakPicking.id:
|
|
155
|
+
dispatch({
|
|
156
|
+
type: 'ADD_PEAKS',
|
|
157
|
+
payload: brushData,
|
|
158
|
+
});
|
|
159
|
+
break;
|
|
160
|
+
case options.baselineCorrection.id:
|
|
161
|
+
dispatch({
|
|
162
|
+
type: 'ADD_BASE_LINE_ZONE',
|
|
163
|
+
payload: {
|
|
164
|
+
startX: brushData.startX,
|
|
165
|
+
endX: brushData.endX,
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
break;
|
|
169
|
+
case options.exclusionZones.id:
|
|
170
|
+
dispatch({
|
|
171
|
+
type: 'ADD_EXCLUSION_ZONE',
|
|
172
|
+
payload: { startX: brushData.startX, endX: brushData.endX },
|
|
173
|
+
});
|
|
174
|
+
break;
|
|
175
|
+
case options.matrixGenerationExclusionZones.id: {
|
|
176
|
+
const [from, to] = getRange(state, {
|
|
177
|
+
startX: brushData.startX,
|
|
178
|
+
endX: brushData.endX,
|
|
179
|
+
});
|
|
128
180
|
dispatchPreferences({
|
|
129
|
-
type: '
|
|
181
|
+
type: 'ADD_MATRIX_GENERATION_EXCLUSION_ZONE',
|
|
130
182
|
payload: {
|
|
131
|
-
|
|
132
|
-
end,
|
|
183
|
+
zone: { from, to },
|
|
133
184
|
nucleus: activeTab,
|
|
185
|
+
range: { from: xDomain[0], to: xDomain[1] },
|
|
134
186
|
},
|
|
135
187
|
});
|
|
188
|
+
break;
|
|
136
189
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
type: 'ADD_PEAKS',
|
|
141
|
-
payload: brushData,
|
|
142
|
-
});
|
|
143
|
-
break;
|
|
144
|
-
case options.baselineCorrection.id:
|
|
145
|
-
dispatch({
|
|
146
|
-
type: 'ADD_BASE_LINE_ZONE',
|
|
147
|
-
payload: {
|
|
148
|
-
startX: brushData.startX,
|
|
149
|
-
endX: brushData.endX,
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
break;
|
|
153
|
-
case options.exclusionZones.id:
|
|
154
|
-
dispatch({
|
|
155
|
-
type: 'ADD_EXCLUSION_ZONE',
|
|
156
|
-
payload: { startX: brushData.startX, endX: brushData.endX },
|
|
157
|
-
});
|
|
158
|
-
break;
|
|
159
|
-
case options.matrixGenerationExclusionZones.id: {
|
|
160
|
-
const [from, to] = getRange(state, {
|
|
161
|
-
startX: brushData.startX,
|
|
162
|
-
endX: brushData.endX,
|
|
163
|
-
});
|
|
164
|
-
dispatchPreferences({
|
|
165
|
-
type: 'ADD_MATRIX_GENERATION_EXCLUSION_ZONE',
|
|
166
|
-
payload: {
|
|
167
|
-
zone: { from, to },
|
|
168
|
-
nucleus: activeTab,
|
|
169
|
-
range: { from: xDomain[0], to: xDomain[1] },
|
|
170
|
-
},
|
|
171
|
-
});
|
|
172
|
-
break;
|
|
190
|
+
default:
|
|
191
|
+
propagateEvent();
|
|
192
|
+
break;
|
|
173
193
|
}
|
|
174
|
-
default:
|
|
175
|
-
propagateEvent();
|
|
176
|
-
break;
|
|
177
194
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
195
|
+
else {
|
|
196
|
+
switch (selectedTool) {
|
|
197
|
+
default:
|
|
198
|
+
if (selectedTool != null) {
|
|
199
|
+
dispatch({ type: 'BRUSH_END', payload: brushData });
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
186
203
|
}
|
|
187
204
|
}
|
|
188
205
|
}, [
|
|
@@ -249,7 +266,7 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
249
266
|
return (_jsx(ScaleProvider, { value: scaleState, children: _jsx(ResponsiveChart, { children: ({ height, width }) => (_jsx(ViewerResponsiveWrapper, { height: height, width: width, children: _jsxs("div", { style: { height: '100%', position: 'relative' }, children: [_jsx(Spinner, { isLoading: isLoading, emptyText: emptyText }), scaleState.scaleX &&
|
|
250
267
|
scaleState.scaleY &&
|
|
251
268
|
data &&
|
|
252
|
-
data.length > 0 && (_jsx(BrushTracker, { onBrush: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
|
|
269
|
+
data.length > 0 && (_jsx(BrushTracker, { onBrush: handelBrush, onBrushEnd: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
|
|
253
270
|
width: '100%',
|
|
254
271
|
height: '100%',
|
|
255
272
|
margin: 'auto',
|
|
@@ -24,7 +24,7 @@ function ResurrectedDatabaseRanges() {
|
|
|
24
24
|
const blockHight = fullHeight / 4;
|
|
25
25
|
const translateY = fullHeight - blockHight - marginBottom;
|
|
26
26
|
const { ranges = [] } = highlight.sourceData.extra || {};
|
|
27
|
-
|
|
27
|
+
const yDomain = [0, 0];
|
|
28
28
|
const spectra = ranges.map((range) => {
|
|
29
29
|
const { from, to } = range;
|
|
30
30
|
const diff = Math.abs(from - to) / 2;
|
|
@@ -10,7 +10,7 @@ export default function JsCouplingLinks(props) {
|
|
|
10
10
|
if (!scaleY)
|
|
11
11
|
return '';
|
|
12
12
|
const { from, to, couplings } = link;
|
|
13
|
-
|
|
13
|
+
const paths = [];
|
|
14
14
|
for (const coupling of couplings) {
|
|
15
15
|
paths.push(`M${scaleX()(from)},${scaleY(coupling.coupling)} L${scaleX()(to)},${scaleY(coupling.coupling)}`);
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const TREE_LEVEL_COLORS:
|
|
1
|
+
export declare const TREE_LEVEL_COLORS: string[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function BaseLineZones(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
1
|
+
declare function BaseLineZones(): import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
2
2
|
export default BaseLineZones;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { useChartData } from '../../context/ChartContext';
|
|
@@ -26,13 +26,16 @@ const styles = css `
|
|
|
26
26
|
}
|
|
27
27
|
`;
|
|
28
28
|
function BaseLineZones() {
|
|
29
|
-
const { toolOptions } = useChartData();
|
|
29
|
+
const { toolOptions: { selectedTool, data: { baselineCorrection }, }, } = useChartData();
|
|
30
30
|
const { scaleX } = useScaleChecked();
|
|
31
31
|
const dispatch = useDispatch();
|
|
32
32
|
const deleteRangeHandler = (id) => {
|
|
33
33
|
dispatch({ type: 'DELETE_BASE_LINE_ZONE', payload: { id } });
|
|
34
34
|
};
|
|
35
|
-
const baseLineZones =
|
|
36
|
-
|
|
35
|
+
const baseLineZones = baselineCorrection.zones;
|
|
36
|
+
if (selectedTool !== 'baselineCorrection' || baseLineZones.length === 0) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return (_jsx("g", { children: baselineCorrection.zones.map((zone) => (_jsxs("g", { transform: `translate(${scaleX()(zone.to)},0)`, css: styles, children: [_jsx(DeleteButton, { x: -20, y: 10, onDelete: () => deleteRangeHandler(zone.id) }), _jsx("rect", { x: "0", width: `${scaleX()(zone.from) - scaleX()(zone.to)}`, className: "zone-area" })] }, zone.id))) }));
|
|
37
40
|
}
|
|
38
41
|
export default BaseLineZones;
|
|
@@ -19,7 +19,7 @@ function PeakPointer() {
|
|
|
19
19
|
const { height, width, margin, data, mode, toolOptions: { selectedTool }, } = useChartData();
|
|
20
20
|
const { scaleX, scaleY, shiftY } = useScaleChecked();
|
|
21
21
|
const activeSpectrum = useActiveSpectrum();
|
|
22
|
-
|
|
22
|
+
const position = useMouseTracker();
|
|
23
23
|
const brushState = useBrushTracker();
|
|
24
24
|
const [closePeakPosition, setPosition] = useState();
|
|
25
25
|
useEffect(() => {
|
|
@@ -23,9 +23,7 @@ function getYScale(state, spectrumId = null) {
|
|
|
23
23
|
function getIntegralYScale(state) {
|
|
24
24
|
const { height, margin, verticalAlign, integralsYDomains, activeSpectrum } = state;
|
|
25
25
|
const _height = verticalAlign === 'center' ? height / 2 : height;
|
|
26
|
-
return scaleLinear(activeSpectrum?.id &&
|
|
27
|
-
integralsYDomains &&
|
|
28
|
-
integralsYDomains[activeSpectrum?.id]
|
|
26
|
+
return scaleLinear(activeSpectrum?.id && integralsYDomains?.[activeSpectrum?.id]
|
|
29
27
|
? integralsYDomains[activeSpectrum?.id]
|
|
30
28
|
: [0, 0], [_height * 0.3, margin.top + _height * 0.1]);
|
|
31
29
|
}
|
|
@@ -4,7 +4,7 @@ import { DISPLAYER_MODE } from '../../../reducer/core/Constants';
|
|
|
4
4
|
interface FloatMoleculeStructuresProps {
|
|
5
5
|
zones: Zones;
|
|
6
6
|
ranges: Ranges;
|
|
7
|
-
molecules:
|
|
7
|
+
molecules: StateMoleculeExtended[];
|
|
8
8
|
moleculesView: MoleculesView;
|
|
9
9
|
activeTab: string;
|
|
10
10
|
displayerMode: DISPLAYER_MODE;
|
|
@@ -38,10 +38,13 @@ const defaultDimensionBorder = {
|
|
|
38
38
|
startY: 0,
|
|
39
39
|
};
|
|
40
40
|
export default function BrushXY({ brushType = BRUSH_TYPE.XY, dimensionBorder = defaultDimensionBorder, width: widthProps, height: heightProps, }) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const { width, height, toolOptions: { selectedTool }, } = useChartData();
|
|
42
|
+
const brushTracker = useBrushTracker();
|
|
43
|
+
const { step, mouseButton } = brushTracker;
|
|
44
|
+
let { startX, endX, startY, endY } = brushTracker;
|
|
43
45
|
if (!allowTools.has(selectedTool) ||
|
|
44
46
|
step !== 'brushing' ||
|
|
47
|
+
mouseButton !== 'main' ||
|
|
45
48
|
!dimensionBorder ||
|
|
46
49
|
(dimensionBorder.startX && startX < dimensionBorder.startX) ||
|
|
47
50
|
(dimensionBorder.startY && startY < dimensionBorder.startY) ||
|
|
@@ -55,8 +58,8 @@ export default function BrushXY({ brushType = BRUSH_TYPE.XY, dimensionBorder = d
|
|
|
55
58
|
: endY < dimensionBorder.startY))) {
|
|
56
59
|
return null;
|
|
57
60
|
}
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
const finalWidth = widthProps || width;
|
|
62
|
+
const finalHeight = heightProps || height;
|
|
60
63
|
endX =
|
|
61
64
|
dimensionBorder.endX && endX > dimensionBorder.endX
|
|
62
65
|
? dimensionBorder.endX
|
|
@@ -70,12 +73,12 @@ export default function BrushXY({ brushType = BRUSH_TYPE.XY, dimensionBorder = d
|
|
|
70
73
|
? dimensionBorder.startY
|
|
71
74
|
: endY;
|
|
72
75
|
const scaleX = brushType === BRUSH_TYPE.X || brushType === BRUSH_TYPE.XY
|
|
73
|
-
? (endX - startX) /
|
|
76
|
+
? (endX - startX) / finalWidth
|
|
74
77
|
: 1;
|
|
75
78
|
startX =
|
|
76
79
|
brushType === BRUSH_TYPE.X || brushType === BRUSH_TYPE.XY ? startX : 0;
|
|
77
80
|
const scaleY = brushType === BRUSH_TYPE.Y || brushType === BRUSH_TYPE.XY
|
|
78
|
-
? (endY - startY) /
|
|
81
|
+
? (endY - startY) / finalHeight
|
|
79
82
|
: 1;
|
|
80
83
|
startY =
|
|
81
84
|
brushType === BRUSH_TYPE.Y || brushType === BRUSH_TYPE.XY ? startY : 0;
|
|
@@ -83,5 +86,5 @@ export default function BrushXY({ brushType = BRUSH_TYPE.XY, dimensionBorder = d
|
|
|
83
86
|
...styles.container,
|
|
84
87
|
transform: `translate(${startX}px, ${startY}px) scale(${scaleX},${scaleY})`,
|
|
85
88
|
willChange: 'transform',
|
|
86
|
-
}, children: _jsx("svg", { width:
|
|
89
|
+
}, children: _jsx("svg", { width: finalWidth, height: finalHeight, children: _jsx("rect", { x: "0", y: "0", width: finalWidth, height: finalHeight, fill: "gray", opacity: "0.2" }) }) }));
|
|
87
90
|
}
|
|
@@ -29,7 +29,7 @@ const allowTools = new Set([
|
|
|
29
29
|
]);
|
|
30
30
|
function CrossLinePointer() {
|
|
31
31
|
const { height, width, margin, toolOptions: { selectedTool }, } = useChartData();
|
|
32
|
-
|
|
32
|
+
const position = useMouseTracker();
|
|
33
33
|
const brushState = useBrushTracker();
|
|
34
34
|
if (!allowTools.has(selectedTool) ||
|
|
35
35
|
brushState.step === 'brushing' ||
|
|
@@ -56,7 +56,7 @@ const styles = css `
|
|
|
56
56
|
`;
|
|
57
57
|
function FooterBanner({ layout, data1D }) {
|
|
58
58
|
const position = useMouseTracker();
|
|
59
|
-
const { startX, endX, startY, endY, step } = useBrushTracker();
|
|
59
|
+
const { startX, endX, startY, endY, step, mouseButton } = useBrushTracker();
|
|
60
60
|
const { margin, width, height, xDomain, yDomain, yDomains, view: { spectra: { activeTab }, }, data, toolOptions: { selectedTool }, } = useChartData();
|
|
61
61
|
const activeSpectrum = useActiveSpectrum();
|
|
62
62
|
const trackID = position &&
|
|
@@ -212,6 +212,7 @@ function FooterBanner({ layout, data1D }) {
|
|
|
212
212
|
}
|
|
213
213
|
return 0;
|
|
214
214
|
};
|
|
215
|
-
|
|
215
|
+
const isBrushing = step === 'brushing' && mouseButton === 'main';
|
|
216
|
+
return (_jsxs("div", { css: styles, children: [_jsxs("div", { children: [_jsxs("span", { className: "label", children: [getLabel('F2', 'X', nuclei[0]), " :"] }), _jsx("span", { className: "value", children: formatX(getXValue()) }), _jsx("span", { className: "unit", children: "ppm" })] }), _jsxs("div", { children: [_jsxs("span", { className: "label", children: [getLabel('F1', 'Y', nuclei[1]), " :"] }), _jsx("span", { className: "value", children: formatY(getYValue()) }), _jsx("span", { className: "unit", children: "ppm" })] }), _jsxs("div", { className: "small-width-none", children: [_jsx("span", { className: "label", children: "Intensity :" }), _jsx("span", { className: "value", children: getZValue() })] }), isBrushing && (_jsxs("div", { className: "small-width-none", children: [_jsx("span", { className: "label", children: " \u0394ppm :" }), _jsx("span", { className: "value", children: getDeltaX() })] })), isBrushing && (_jsxs("div", { className: "small-width-none", children: [_jsx("span", { className: "label", children: " ratio :" }), _jsxs("span", { className: "value", children: [getRation(), "%"] })] }))] }));
|
|
216
217
|
}
|
|
217
218
|
export default FooterBanner;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useMemo } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { ResponsiveChart } from 'react-d3-utils';
|
|
4
4
|
import BrushXY, { BRUSH_TYPE } from '../1d-2d/tools/BrushXY';
|
|
5
5
|
import CrossLinePointer from '../1d-2d/tools/CrossLinePointer';
|
|
@@ -15,10 +15,12 @@ import FooterBanner from './FooterBanner';
|
|
|
15
15
|
import SlicingView from './SlicingView';
|
|
16
16
|
import XYLabelPointer from './tools/XYLabelPointer';
|
|
17
17
|
import { get2DDimensionLayout, getLayoutID } from './utilities/DimensionLayout';
|
|
18
|
+
import { get2DXScale, get2DYScale } from './utilities/scale';
|
|
18
19
|
function Viewer2D({ emptyText = undefined }) {
|
|
19
20
|
const state = useChartData();
|
|
20
21
|
const { toolOptions: { selectedTool }, isLoading, data, margin, view: { spectra: { activeSpectra, activeTab }, }, } = state;
|
|
21
22
|
const dispatch = useDispatch();
|
|
23
|
+
const brushStartRef = useRef(null);
|
|
22
24
|
const spectrumData = useMemo(() => {
|
|
23
25
|
const nuclei = activeTab.split(',');
|
|
24
26
|
return nuclei.map((nucleus) => {
|
|
@@ -33,36 +35,56 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
33
35
|
});
|
|
34
36
|
}, [activeTab, data, activeSpectra]);
|
|
35
37
|
const DIMENSION = get2DDimensionLayout(state);
|
|
38
|
+
function handelBrush(brushData) {
|
|
39
|
+
const { startX: startXInPixel, endX: endXInPixel, startY: startYInPixel, endY: endYInPixel, mouseButton, } = brushData;
|
|
40
|
+
if (mouseButton === 'secondary') {
|
|
41
|
+
const scaleX = get2DXScale(state);
|
|
42
|
+
const scaleY = get2DYScale(state);
|
|
43
|
+
if (!brushStartRef.current) {
|
|
44
|
+
const x = scaleX.invert(startXInPixel);
|
|
45
|
+
const y = scaleY.invert(startYInPixel);
|
|
46
|
+
brushStartRef.current = { x, y };
|
|
47
|
+
}
|
|
48
|
+
const { x, y } = brushStartRef.current;
|
|
49
|
+
const shiftX = scaleX.invert(endXInPixel) - x;
|
|
50
|
+
const shiftY = scaleY.invert(endYInPixel) - y;
|
|
51
|
+
dispatch({ type: 'MOVE', payload: { shiftX, shiftY } });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
36
54
|
const handelBrushEnd = useCallback((brushData) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
//reset the brush start
|
|
56
|
+
brushStartRef.current = null;
|
|
57
|
+
if (brushData.mouseButton === 'main') {
|
|
58
|
+
const trackID = getLayoutID(DIMENSION, brushData);
|
|
59
|
+
if (trackID) {
|
|
60
|
+
if (brushData.altKey) {
|
|
61
|
+
switch (selectedTool) {
|
|
62
|
+
default:
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
43
65
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
66
|
+
else if (brushData.shiftKey) {
|
|
67
|
+
switch (selectedTool) {
|
|
68
|
+
case options.zonePicking.id:
|
|
69
|
+
dispatch({ type: 'ADD_2D_ZONE', payload: brushData });
|
|
70
|
+
break;
|
|
71
|
+
default:
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
52
74
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
75
|
+
else {
|
|
76
|
+
switch (selectedTool) {
|
|
77
|
+
default:
|
|
78
|
+
if (selectedTool != null) {
|
|
79
|
+
return dispatch({
|
|
80
|
+
type: 'BRUSH_END',
|
|
81
|
+
payload: {
|
|
82
|
+
...brushData,
|
|
83
|
+
trackID: getLayoutID(DIMENSION, brushData),
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
66
88
|
}
|
|
67
89
|
}
|
|
68
90
|
}
|
|
@@ -94,7 +116,7 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
94
116
|
break;
|
|
95
117
|
}
|
|
96
118
|
}, [selectedTool]);
|
|
97
|
-
return (_jsx(ResponsiveChart, { children: ({ width, height }) => (_jsxs(ViewerResponsiveWrapper, { width: width, height: height, children: [_jsx(Spinner, { isLoading: isLoading, emptyText: emptyText }), data && data.length > 0 && (_jsx(BrushTracker, { onBrush: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
|
|
119
|
+
return (_jsx(ResponsiveChart, { children: ({ width, height }) => (_jsxs(ViewerResponsiveWrapper, { width: width, height: height, children: [_jsx(Spinner, { isLoading: isLoading, emptyText: emptyText }), data && data.length > 0 && (_jsx(BrushTracker, { onBrush: handelBrush, onBrushEnd: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
|
|
98
120
|
width: '100%',
|
|
99
121
|
height: '100%',
|
|
100
122
|
margin: 'auto',
|
|
@@ -27,7 +27,7 @@ function YAxis(props) {
|
|
|
27
27
|
useEffect(() => {
|
|
28
28
|
if (!show || !yDomain)
|
|
29
29
|
return;
|
|
30
|
-
|
|
30
|
+
const scaleY = get2DYScale({ height, yDomain, margin }, !!spectrum?.info?.isFid);
|
|
31
31
|
const axis = d3.axisRight(scaleY).ticks(8).tickFormat(d3.format('0'));
|
|
32
32
|
// @ts-expect-error well typed
|
|
33
33
|
d3.select(refAxis.current).call(axis);
|