nmrium 0.42.0 → 0.43.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/ApodizationLine.js +1 -1
- package/lib/component/1d/Chart1D.js +3 -2
- package/lib/component/1d/Line.js +1 -1
- package/lib/component/1d/Viewer1D.js +15 -3
- package/lib/component/1d/integral/IntegralResizable.js +4 -3
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
- package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
- package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
- package/lib/component/1d/peaks/Peaks.d.ts +1 -0
- package/lib/component/1d/peaks/Peaks.js +22 -0
- package/lib/component/1d/ranges/Range.js +3 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +11 -31
- package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
- package/lib/component/1d/utilities/intersectionResolver.js +71 -0
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib/component/2d/SlicingView.js +1 -1
- package/lib/component/2d/ft/Contours.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +47 -6
- package/lib/component/assignment/index.d.ts +6 -1
- package/lib/component/assignment/index.js +5 -1
- package/lib/component/context/DispatchContext.d.ts +1 -2
- package/lib/component/context/KeyModifierContext.d.ts +13 -0
- package/lib/component/context/KeyModifierContext.js +39 -0
- package/lib/component/context/PreferencesContext.d.ts +39 -39
- package/lib/component/elements/Button.js +2 -0
- package/lib/component/elements/NumberInput.d.ts +1 -0
- package/lib/component/elements/NumberInput.js +10 -3
- package/lib/component/elements/formik/FormikOnChange.js +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
- package/lib/component/header/Header.d.ts +10 -3
- package/lib/component/header/Header.js +5 -5
- package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
- package/lib/component/highlight/index.d.ts +1 -0
- package/lib/component/highlight/index.js +1 -0
- package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib/component/hooks/useResizerStatus.d.ts +2 -0
- package/lib/component/hooks/useResizerStatus.js +7 -0
- package/lib/component/hooks/useSpectrum.js +1 -1
- package/lib/component/main/ErrorOverlay.js +20 -0
- package/lib/component/main/InnerNMRium.d.ts +7 -0
- package/lib/component/main/InnerNMRium.js +52 -0
- package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
- package/lib/component/main/InnerNMRiumContents.js +89 -0
- package/lib/component/main/NMRium.d.ts +23 -0
- package/lib/component/main/NMRium.js +13 -0
- package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
- package/lib/component/main/NMRiumStateProvider.js +74 -0
- package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib/component/main/StateError.d.ts +4 -0
- package/lib/component/main/StateError.js +16 -0
- package/lib/component/main/index.d.ts +3 -0
- package/lib/component/main/index.js +3 -0
- package/lib/component/main/types.d.ts +18 -0
- package/lib/component/main/types.js +2 -0
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
- package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
- package/lib/component/modal/setting/GeneralSettings.js +2 -2
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
- package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +3 -3
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
- package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
- package/lib/component/panels/header/DefaultPanelHeader.js +9 -5
- package/lib/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib/component/reducer/IgnoreActions.js +0 -1
- package/lib/component/reducer/Reducer.d.ts +1 -6
- package/lib/component/reducer/Reducer.js +30 -6
- package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
- package/lib/component/reducer/actions/FiltersActions.js +96 -28
- package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
- package/lib/component/reducer/actions/IntegralsActions.js +44 -20
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
- package/lib/component/reducer/actions/PeaksActions.js +19 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
- package/lib/component/reducer/actions/RangesActions.js +31 -3
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
- package/lib/component/toolbar/FunctionToolBar.js +13 -3
- package/lib/component/toolbar/ToolTypes.d.ts +1 -0
- package/lib/component/toolbar/ToolTypes.js +36 -0
- package/lib/component/utility/export.js +7 -4
- package/lib/component/utility/filterType.d.ts +3 -0
- package/lib/component/utility/filterType.js +1 -0
- package/lib/component/workspaces/basic.js +2 -0
- package/lib/component/workspaces/embedded.js +2 -0
- package/lib/component/workspaces/exercise.js +2 -0
- package/lib/component/workspaces/prediction.js +9 -0
- package/lib/component/workspaces/process1D.js +2 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib/data/PredictionManager.d.ts +3 -3
- package/lib/data/PredictionManager.js +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
- package/lib/data/molecules/Molecule.js +2 -2
- package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
- package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -2
- package/lib-cjs/component/1d/Line.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +15 -3
- package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
- package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
- package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
- package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
- package/lib-cjs/component/1d/ranges/Range.js +3 -1
- package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
- package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib-cjs/component/2d/SlicingView.js +1 -1
- package/lib-cjs/component/2d/ft/Contours.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +46 -5
- package/lib-cjs/component/assignment/index.js +5 -1
- package/lib-cjs/component/context/KeyModifierContext.js +44 -0
- package/lib-cjs/component/elements/Button.js +2 -0
- package/lib-cjs/component/elements/NumberInput.js +12 -2
- package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
- package/lib-cjs/component/header/Header.js +5 -5
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
- package/lib-cjs/component/highlight/index.js +1 -0
- package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
- package/lib-cjs/component/hooks/useSpectrum.js +1 -1
- package/lib-cjs/component/main/ErrorOverlay.js +26 -0
- package/lib-cjs/component/main/InnerNMRium.js +82 -0
- package/lib-cjs/component/main/InnerNMRiumContents.js +96 -0
- package/lib-cjs/component/main/NMRium.js +19 -0
- package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
- package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib-cjs/component/main/StateError.js +20 -0
- package/lib-cjs/component/main/index.js +21 -0
- package/lib-cjs/component/main/types.js +3 -0
- package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
- package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
- package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +27 -3
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +11 -5
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib-cjs/component/reducer/IgnoreActions.js +0 -1
- package/lib-cjs/component/reducer/Reducer.js +29 -5
- package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
- package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
- package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
- package/lib-cjs/component/toolbar/ToolTypes.js +36 -0
- package/lib-cjs/component/utility/export.js +7 -4
- package/lib-cjs/component/utility/filterType.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +2 -0
- package/lib-cjs/component/workspaces/embedded.js +2 -0
- package/lib-cjs/component/workspaces/exercise.js +2 -0
- package/lib-cjs/component/workspaces/prediction.js +9 -0
- package/lib-cjs/component/workspaces/process1D.js +2 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib-cjs/data/PredictionManager.js +9 -9
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
- package/lib-cjs/data/molecules/Molecule.js +2 -2
- package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
- package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
- package/lib/component/ErrorOverlay.js +0 -27
- package/lib/component/NMRium.d.ts +0 -42
- package/lib/component/NMRium.js +0 -237
- package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
- package/lib/component/reducer/actions/GlobalActions.js +0 -4
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
- package/lib-cjs/component/ErrorOverlay.js +0 -30
- package/lib-cjs/component/NMRium.js +0 -267
- package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
- /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
- /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
|
@@ -54,6 +54,6 @@ function Line({ data, id, display, index }) {
|
|
|
54
54
|
}
|
|
55
55
|
}, [scaleX, scaleY, id, data, xyReduce]);
|
|
56
56
|
const { color: stroke, opacity: strokeOpacity } = (0, parseColor_1.parseColor)(display?.color || 'black');
|
|
57
|
-
return ((0, jsx_runtime_1.jsx)("path", { className: "line", "data-
|
|
57
|
+
return ((0, jsx_runtime_1.jsx)("path", { className: "line", "data-testid": "spectrum-line", stroke: stroke, fill: "none", strokeOpacity: opacity === 1 ? strokeOpacity : opacity, d: paths, transform: `translate(0,-${shiftY * index})` }, id));
|
|
58
58
|
}
|
|
59
59
|
exports.default = Line;
|
|
@@ -253,10 +253,10 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
253
253
|
dispatch({ type: 'SET_ZOOM', payload: { event, selectedTool } });
|
|
254
254
|
}, [dispatch, selectedTool]);
|
|
255
255
|
const mouseClick = (0, react_1.useCallback)((position) => {
|
|
256
|
+
if (!scaleState.scaleX)
|
|
257
|
+
return;
|
|
258
|
+
const xPPM = scaleState.scaleX().invert(position.x);
|
|
256
259
|
const propagateEvent = () => {
|
|
257
|
-
if (!scaleState.scaleX)
|
|
258
|
-
return;
|
|
259
|
-
const xPPM = scaleState.scaleX().invert(position.x);
|
|
260
260
|
Events_1.default.emit('mouseClick', {
|
|
261
261
|
...position,
|
|
262
262
|
xPPM,
|
|
@@ -273,6 +273,18 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
273
273
|
case ToolTypes_1.options.editRange.id:
|
|
274
274
|
propagateEvent();
|
|
275
275
|
break;
|
|
276
|
+
case ToolTypes_1.options.integral.id:
|
|
277
|
+
dispatch({
|
|
278
|
+
type: 'CUT_INTEGRAL',
|
|
279
|
+
payload: { cutValue: xPPM },
|
|
280
|
+
});
|
|
281
|
+
break;
|
|
282
|
+
case ToolTypes_1.options.rangePicking.id:
|
|
283
|
+
dispatch({
|
|
284
|
+
type: 'CUT_RANGE',
|
|
285
|
+
payload: { cutValue: xPPM },
|
|
286
|
+
});
|
|
287
|
+
break;
|
|
276
288
|
default:
|
|
277
289
|
break;
|
|
278
290
|
}
|
|
@@ -12,7 +12,7 @@ const GlobalContext_1 = require("../../context/GlobalContext");
|
|
|
12
12
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
13
13
|
const Resizer_1 = __importDefault(require("../../elements/resizer/Resizer"));
|
|
14
14
|
const index_1 = require("../../highlight/index");
|
|
15
|
-
const
|
|
15
|
+
const useResizerStatus_1 = require("../../hooks/useResizerStatus");
|
|
16
16
|
const IntegralIndicator_1 = require("./IntegralIndicator");
|
|
17
17
|
const stylesOnHover = (0, react_1.css) `
|
|
18
18
|
pointer-events: bounding-box;
|
|
@@ -43,7 +43,7 @@ const stylesHighlighted = (0, react_1.css) `
|
|
|
43
43
|
}
|
|
44
44
|
`;
|
|
45
45
|
function IntegralResizable({ integralData, integralFormat, }) {
|
|
46
|
-
const { height, margin
|
|
46
|
+
const { height, margin } = (0, ChartContext_1.useChartData)();
|
|
47
47
|
const { viewerRef } = (0, GlobalContext_1.useGlobal)();
|
|
48
48
|
const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
|
|
49
49
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
@@ -67,7 +67,8 @@ function IntegralResizable({ integralData, integralFormat, }) {
|
|
|
67
67
|
const from = integralData.from ? scaleX()(integralData.from) : 0;
|
|
68
68
|
const to = integralData.to ? scaleX()(integralData.to) : 0;
|
|
69
69
|
const bottom = height - margin.bottom;
|
|
70
|
-
|
|
70
|
+
const isResizeingActive = (0, useResizerStatus_1.useResizerStatus)('integral');
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)("g", { onMouseEnter: () => highlight.show(), onMouseLeave: () => highlight.hide(), children: (0, jsx_runtime_1.jsx)(Resizer_1.default, { tag: "svg", initialPosition: { x1: to, x2: from }, onEnd: handleOnStopResizing, parentElement: viewerRef, disabled: !isResizeingActive, children: ({ x1, x2 }, isActive) => {
|
|
71
72
|
const width = x2 - x1;
|
|
72
73
|
return ((0, jsx_runtime_1.jsxs)("g", { css: highlight.isActive || isActive
|
|
73
74
|
? stylesHighlighted
|
|
@@ -12,6 +12,7 @@ const PreferencesContext_1 = require("../../context/PreferencesContext");
|
|
|
12
12
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
13
13
|
const Resizer_1 = __importDefault(require("../../elements/resizer/Resizer"));
|
|
14
14
|
const highlight_1 = require("../../highlight");
|
|
15
|
+
const useResizerStatus_1 = require("../../hooks/useResizerStatus");
|
|
15
16
|
const styles = {
|
|
16
17
|
common: (0, react_1.css) `
|
|
17
18
|
pointer-events: bounding-box;
|
|
@@ -56,7 +57,8 @@ function AnalysisRange({ rangeData, columnKey, activeTab, }) {
|
|
|
56
57
|
}, [activeTab, columnKey, dispatch, scaleX]);
|
|
57
58
|
const from = scaleX()(rangeData.from);
|
|
58
59
|
const to = scaleX()(rangeData.to);
|
|
59
|
-
|
|
60
|
+
const isResizeingActive = (0, useResizerStatus_1.useResizerStatus)('multipleSpectraAnalysis');
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)("g", { ...highlight.onHover, ...highlight.onHover, children: (0, jsx_runtime_1.jsx)(Resizer_1.default, { tag: "svg", onEnd: resizeEndHandler, initialPosition: { x2: from, x1: to }, parentElement: viewerRef, disabled: !isResizeingActive, children: ({ x1, x2 }, isActive) => ((0, jsx_runtime_1.jsxs)("g", { transform: `translate(0,25)`, css: [
|
|
60
62
|
styles.common,
|
|
61
63
|
highlight.isActive || isActive
|
|
62
64
|
? styles.Highlighted
|
|
@@ -4,38 +4,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const react_1 = require("react");
|
|
8
7
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
9
8
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
9
|
+
const highlight_1 = require("../../highlight");
|
|
10
10
|
const useActiveSpectrum_1 = require("../../hooks/useActiveSpectrum");
|
|
11
|
-
const
|
|
11
|
+
const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
|
|
12
12
|
const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
|
|
13
|
-
const
|
|
13
|
+
const formatNumber_1 = require("../../utility/formatNumber");
|
|
14
|
+
const PeakEditionManager_1 = require("./PeakEditionManager");
|
|
14
15
|
const emptyData = { peaks: {}, info: {}, display: {} };
|
|
15
16
|
function PeakAnnotations() {
|
|
16
17
|
const { displayerKey } = (0, ChartContext_1.useChartData)();
|
|
17
18
|
const activeSpectrum = (0, useActiveSpectrum_1.useActiveSpectrum)();
|
|
18
|
-
const {
|
|
19
|
+
const { shiftY } = (0, ScaleContext_1.useScaleChecked)();
|
|
19
20
|
const spectrum = (0, useSpectrum_1.default)(emptyData);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
activeSpectrum?.index,
|
|
35
|
-
shiftY,
|
|
36
|
-
scaleX,
|
|
37
|
-
scaleY,
|
|
38
|
-
]);
|
|
39
|
-
return ((0, jsx_runtime_1.jsx)("g", { className: "peaks", clipPath: `url(#${displayerKey}clip-chart-1d)`, children: Peaks }));
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)("g", { className: "peaks", clipPath: `url(#${displayerKey}clip-chart-1d)`, children: (0, jsx_runtime_1.jsx)("g", { transform: `translate(0,-${(activeSpectrum?.index || 0) * shiftY})`, children: spectrum.peaks.values.map((peak) => ((0, jsx_runtime_1.jsx)(PeakAnnotation, { spectrumId: spectrum.id, peak: peak, color: "#730000", nucleus: spectrum.info.nucleus }, peak.id))) }) }));
|
|
22
|
+
}
|
|
23
|
+
function PeakAnnotation({ peak, spectrumId, color, nucleus, }) {
|
|
24
|
+
const { id, x, y } = peak;
|
|
25
|
+
const sign = Math.sign(y);
|
|
26
|
+
const { deltaPPM } = (0, usePanelPreferences_1.usePanelPreferences)('peaks', nucleus);
|
|
27
|
+
const highlight = (0, highlight_1.useHighlight)([id], {
|
|
28
|
+
type: highlight_1.HighlightEventSource.PEAK,
|
|
29
|
+
extra: { id },
|
|
30
|
+
});
|
|
31
|
+
const { scaleX, scaleY } = (0, ScaleContext_1.useScaleChecked)();
|
|
32
|
+
const sx = scaleX()(x);
|
|
33
|
+
const sy = scaleY(spectrumId)(y) - 5;
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)("g", { style: { outline: 'none' }, transform: `translate(${sx}, ${sy})`, onMouseEnter: () => highlight.show(), onMouseLeave: () => highlight.hide(), children: [(0, jsx_runtime_1.jsx)("line", { x1: "0", x2: "0", y1: sign === -1 ? 10 : 0, y2: sign === -1 ? 28 : -18, stroke: color, strokeWidth: highlight.isActive ? '3px' : '1px' }), (0, jsx_runtime_1.jsx)(PeakEditionManager_1.PeakEditionListener, { value: x, x: x, y: y, useScaleX: true, useScaleY: true, id: id, dy: sign === -1 ? 0 : -26, children: (0, jsx_runtime_1.jsx)("text", { x: "0", y: sign === -1 ? 26 : -10, dy: "0", dx: "0.35em", fontSize: "11px", fill: color, children: (0, formatNumber_1.formatNumber)(x, deltaPPM.format) }) })] }));
|
|
40
35
|
}
|
|
41
36
|
exports.default = PeakAnnotations;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const ChartContext_1 = require("../../context/ChartContext");
|
|
8
|
+
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
9
|
+
const highlight_1 = require("../../highlight");
|
|
10
|
+
const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
|
|
11
|
+
const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
|
|
12
|
+
const formatNumber_1 = require("../../utility/formatNumber");
|
|
13
|
+
const intersectionResolver_1 = require("../utilities/intersectionResolver");
|
|
14
|
+
const PeakEditionManager_1 = require("./PeakEditionManager");
|
|
15
|
+
const emptyData = { peaks: {}, info: {}, display: {} };
|
|
16
|
+
const notationWidth = 10;
|
|
17
|
+
const notationMargin = 2;
|
|
18
|
+
function getDecimalsCount(max, format) {
|
|
19
|
+
const numberOfDigits = format.replace(/\./, '').length;
|
|
20
|
+
const fractionDigits = format.split('.')[1].length;
|
|
21
|
+
return (Math.max(String(max.toFixed(0)).length, numberOfDigits - fractionDigits) +
|
|
22
|
+
fractionDigits);
|
|
23
|
+
}
|
|
24
|
+
function PeakAnnotationsTreeStyle() {
|
|
25
|
+
const { displayerKey, xDomain } = (0, ChartContext_1.useChartData)();
|
|
26
|
+
const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
|
|
27
|
+
const spectrum = (0, useSpectrum_1.default)(emptyData);
|
|
28
|
+
const { deltaPPM } = (0, usePanelPreferences_1.usePanelPreferences)('peaks', spectrum.info.nucleus);
|
|
29
|
+
const decimalsCount = getDecimalsCount(xDomain[1], deltaPPM.format);
|
|
30
|
+
const mapPeaks = spectrum.peaks.values
|
|
31
|
+
.map((peak) => ({
|
|
32
|
+
...peak,
|
|
33
|
+
scaleX: scaleX()(peak.x),
|
|
34
|
+
}))
|
|
35
|
+
.sort((p1, p2) => p2.x - p1.x);
|
|
36
|
+
if (!mapPeaks?.length)
|
|
37
|
+
return null;
|
|
38
|
+
const peaks = (0, intersectionResolver_1.resolve)(mapPeaks, {
|
|
39
|
+
key: 'scaleX',
|
|
40
|
+
width: notationWidth,
|
|
41
|
+
margin: notationMargin,
|
|
42
|
+
groupMargin: 10,
|
|
43
|
+
});
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)("g", { className: "peaks", clipPath: `url(#${displayerKey}clip-chart-1d)`, children: (0, jsx_runtime_1.jsx)("g", { transform: `translate(0,${decimalsCount * 10})`, children: peaks.map((group) => {
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)("g", { transform: `translate(${group.meta.groupStartX},0)`, children: group.group.map((item, index) => {
|
|
46
|
+
const { id, x: value, scaleX } = item;
|
|
47
|
+
const startX = index * (notationWidth + notationMargin);
|
|
48
|
+
const x = scaleX - group.meta.groupStartX;
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(PeakAnnotation, { startX: startX, x: x, id: id, value: value, format: deltaPPM.format, color: spectrum.display.color, peakEditionFieldPositon: {
|
|
50
|
+
x: group.meta.groupStartX + startX,
|
|
51
|
+
y: decimalsCount * 10,
|
|
52
|
+
} }, id));
|
|
53
|
+
}) }, group.meta.id));
|
|
54
|
+
}) }) }));
|
|
55
|
+
}
|
|
56
|
+
function PeakAnnotation(props) {
|
|
57
|
+
const { startX, format, color, id, value, x, peakEditionFieldPositon } = props;
|
|
58
|
+
const highlight = (0, highlight_1.useHighlight)([id], {
|
|
59
|
+
type: highlight_1.HighlightEventSource.PEAK,
|
|
60
|
+
extra: { id },
|
|
61
|
+
});
|
|
62
|
+
return ((0, jsx_runtime_1.jsxs)("g", { onMouseEnter: () => highlight.show(), onMouseLeave: () => highlight.hide(), children: [(0, jsx_runtime_1.jsx)(PeakEditionManager_1.PeakEditionListener, { ...peakEditionFieldPositon, id, value, children: (0, jsx_runtime_1.jsx)("text", { transform: `rotate(-90) translate(0 ${startX})`, dominantBaseline: "middle", textAnchor: "start", fontSize: "11px", fill: "black", children: (0, formatNumber_1.formatNumber)(value, format) }) }), (0, jsx_runtime_1.jsx)("path", { d: `M ${startX} 5 v 5 L ${x} 20 v 5`, stroke: color, fill: "transparent", strokeWidth: highlight.isActive ? '3px' : '1px' })] }));
|
|
63
|
+
}
|
|
64
|
+
exports.default = PeakAnnotationsTreeStyle;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.PeakEditionListener = exports.PeakEditionProvider = void 0;
|
|
30
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
|
+
const formik_1 = require("formik");
|
|
32
|
+
const react_1 = require("react");
|
|
33
|
+
const Yup = __importStar(require("yup"));
|
|
34
|
+
const ChartContext_1 = require("../../context/ChartContext");
|
|
35
|
+
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
36
|
+
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
37
|
+
const FormikNumberInput_1 = __importDefault(require("../../elements/formik/FormikNumberInput"));
|
|
38
|
+
const useActiveSpectrum_1 = require("../../hooks/useActiveSpectrum");
|
|
39
|
+
const validationSchema = Yup.object({
|
|
40
|
+
value: Yup.number().required(),
|
|
41
|
+
});
|
|
42
|
+
const InputDimension = { height: 28, width: 100 };
|
|
43
|
+
const peaksEditionContext = {
|
|
44
|
+
onEdit: () => { },
|
|
45
|
+
};
|
|
46
|
+
const PeaksEditionContext = (0, react_1.createContext)(peaksEditionContext);
|
|
47
|
+
function usePeaksEditionManager() {
|
|
48
|
+
const context = (0, react_1.useContext)(PeaksEditionContext);
|
|
49
|
+
if (!context) {
|
|
50
|
+
throw new Error('Peak edition manager context was not found');
|
|
51
|
+
}
|
|
52
|
+
return context;
|
|
53
|
+
}
|
|
54
|
+
function stopPropagation(e) {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
}
|
|
57
|
+
function PeakEditionProvider({ children }) {
|
|
58
|
+
const { scaleX, scaleY } = (0, ScaleContext_1.useScaleChecked)();
|
|
59
|
+
const { width } = (0, ChartContext_1.useChartData)();
|
|
60
|
+
const spectrum = (0, useActiveSpectrum_1.useActiveSpectrum)();
|
|
61
|
+
const [peak, setPeak] = (0, react_1.useState)(null);
|
|
62
|
+
function getPosition() {
|
|
63
|
+
let x = 0;
|
|
64
|
+
let y = 0;
|
|
65
|
+
if (!peak) {
|
|
66
|
+
return { x, y };
|
|
67
|
+
}
|
|
68
|
+
const { x: px, y: py, dx, dy, useScaleX, useScaleY } = peak;
|
|
69
|
+
x = px + dx;
|
|
70
|
+
if (useScaleX) {
|
|
71
|
+
x = scaleX()(px) + dx;
|
|
72
|
+
}
|
|
73
|
+
y = py + dy;
|
|
74
|
+
if (useScaleY) {
|
|
75
|
+
y = scaleY(spectrum?.id)(py) + dy;
|
|
76
|
+
}
|
|
77
|
+
if (x + InputDimension.width > width) {
|
|
78
|
+
x = x - InputDimension.width;
|
|
79
|
+
}
|
|
80
|
+
return { x, y };
|
|
81
|
+
}
|
|
82
|
+
const handleOnEdit = (0, react_1.useCallback)((e, peak) => {
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
if (peak) {
|
|
85
|
+
setPeak({ ...peak });
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
setPeak(null);
|
|
89
|
+
}
|
|
90
|
+
}, []);
|
|
91
|
+
const editiionManagerState = (0, react_1.useMemo)(() => ({ onEdit: handleOnEdit, id: peak?.id }), [peak?.id, handleOnEdit]);
|
|
92
|
+
const { x, y } = getPosition();
|
|
93
|
+
return ((0, jsx_runtime_1.jsx)(PeaksEditionContext.Provider, { value: editiionManagerState, children: (0, jsx_runtime_1.jsxs)("div", { onClick: () => setPeak(null), onContextMenu: () => setPeak(null), style: { position: 'relative' }, children: [peak && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
94
|
+
position: 'absolute',
|
|
95
|
+
display: 'block',
|
|
96
|
+
transform: `translate(${x}px,${y}px)`,
|
|
97
|
+
}, children: (0, jsx_runtime_1.jsx)(PeakEditionField, { value: peak.value, onClose: () => setPeak(null) }, peak.id) })), children] }) }));
|
|
98
|
+
}
|
|
99
|
+
exports.PeakEditionProvider = PeakEditionProvider;
|
|
100
|
+
function PeakEditionField({ value, onClose }) {
|
|
101
|
+
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
102
|
+
function keyDownCheck(event) {
|
|
103
|
+
if (event.key === 'Enter') {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
else if (event.key === 'Escape') {
|
|
107
|
+
onClose();
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function hanldeOnSubmit({ value: newValue }) {
|
|
112
|
+
if (value) {
|
|
113
|
+
const shift = newValue - value;
|
|
114
|
+
dispatch({ type: 'SHIFT_SPECTRUM', payload: { shift } });
|
|
115
|
+
onClose();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return ((0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: { value }, onSubmit: hanldeOnSubmit, validationSchema: validationSchema, children: ({ submitForm }) => ((0, jsx_runtime_1.jsx)(FormikNumberInput_1.default, { style: {
|
|
119
|
+
height: `${InputDimension.height}px`,
|
|
120
|
+
padding: '5px',
|
|
121
|
+
outline: 'none',
|
|
122
|
+
}, name: "value", autoSelect: true, onKeyDown: (e) => keyDownCheck(e) && submitForm(), onClick: stopPropagation, onMouseDown: stopPropagation })) }));
|
|
123
|
+
}
|
|
124
|
+
function PeakEditionListener(props) {
|
|
125
|
+
const { children, x, y, value, useScaleX = false, useScaleY = false, dx = 0, dy = -InputDimension.height, id, } = props;
|
|
126
|
+
const { onEdit, id: editingPeakId } = usePeaksEditionManager();
|
|
127
|
+
return ((0, jsx_runtime_1.jsx)("g", { onClick: (e) => onEdit(e, { x, y, value, useScaleX, useScaleY, dx, dy, id }), children: editingPeakId !== id && children }));
|
|
128
|
+
}
|
|
129
|
+
exports.PeakEditionListener = PeakEditionListener;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Peaks = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const ChartContext_1 = require("../../context/ChartContext");
|
|
9
|
+
const useActiveSpectrumPeaksViewState_1 = require("../../hooks/useActiveSpectrumPeaksViewState");
|
|
10
|
+
const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
|
|
11
|
+
const PeakAnnotations_1 = __importDefault(require("./PeakAnnotations"));
|
|
12
|
+
const PeakAnnotationsSpreadMode_1 = __importDefault(require("./PeakAnnotationsSpreadMode"));
|
|
13
|
+
const emptyData = { peaks: {}, info: {}, display: {} };
|
|
14
|
+
function Peaks() {
|
|
15
|
+
const { view: { peaks }, } = (0, ChartContext_1.useChartData)();
|
|
16
|
+
const spectrum = (0, useSpectrum_1.default)(emptyData);
|
|
17
|
+
const peaksViewState = (0, useActiveSpectrumPeaksViewState_1.useActiveSpectrumPeaksViewState)();
|
|
18
|
+
if (!spectrum?.peaks?.values ||
|
|
19
|
+
!spectrum.display.isVisible ||
|
|
20
|
+
!peaksViewState.isPeaksVisible) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const mode = peaks?.[spectrum.id]?.displayingMode || 'spread';
|
|
24
|
+
if (mode === 'spread') {
|
|
25
|
+
return (0, jsx_runtime_1.jsx)(PeakAnnotationsSpreadMode_1.default, {});
|
|
26
|
+
}
|
|
27
|
+
return (0, jsx_runtime_1.jsx)(PeakAnnotations_1.default, {});
|
|
28
|
+
}
|
|
29
|
+
exports.Peaks = Peaks;
|
|
@@ -15,6 +15,7 @@ const GlobalContext_1 = require("../../context/GlobalContext");
|
|
|
15
15
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
16
16
|
const Resizer_1 = __importDefault(require("../../elements/resizer/Resizer"));
|
|
17
17
|
const highlight_1 = require("../../highlight");
|
|
18
|
+
const useResizerStatus_1 = require("../../hooks/useResizerStatus");
|
|
18
19
|
const ToolTypes_1 = require("../../toolbar/ToolTypes");
|
|
19
20
|
const IntegralIndicator_1 = require("../integral/IntegralIndicator");
|
|
20
21
|
const MultiplicityTree_1 = require("../multiplicityTree/MultiplicityTree");
|
|
@@ -79,7 +80,8 @@ function Range({ range, showMultiplicityTrees, selectedTool, relativeFormat, })
|
|
|
79
80
|
const isNotSignal = !(0, RangeUtilities_1.checkRangeKind)(range);
|
|
80
81
|
const isHighlighted = isBlockedByEditing || highlightRange.isActive || assignmentRange.isActive;
|
|
81
82
|
const isAssigned = (0, isRangeAssigned_1.isRangeAssigned)(range);
|
|
82
|
-
|
|
83
|
+
const isResizeingActive = (0, useResizerStatus_1.useResizerStatus)('rangePicking');
|
|
84
|
+
return ((0, jsx_runtime_1.jsxs)("g", { "data-testid": "range", style: { outline: 'none' }, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, ...(!assignmentRange.isActive && { css: style }), children: [(0, jsx_runtime_1.jsx)(Resizer_1.default, { tag: "svg", initialPosition: { x1: to, x2: from }, onEnd: handleOnStopResizing, parentElement: viewerRef, disabled: !isResizeingActive, children: ({ x1, x2 }, isActive) => {
|
|
83
85
|
const width = x2 - x1;
|
|
84
86
|
return ((0, jsx_runtime_1.jsxs)("g", { children: [isAssigned && !isHighlighted && !isActive && ((0, jsx_runtime_1.jsx)("rect", { width: width, height: "10px", fill: "#ffd700", opacity: "0.35", "data-no-export": "true" })), (0, jsx_runtime_1.jsx)("rect", { width: width, height: "100%", fill: isHighlighted || isActive ? '#ff6f0057' : 'transparent', "data-no-export": "true" }), (0, jsx_runtime_1.jsx)(IntegralIndicator_1.IntegralIndicator, { value: integration, format: relativeFormat, width: width, opacity: isNotSignal ? 0.5 : 1 })] }));
|
|
85
87
|
} }, `${id}_${to}_${from}`), showMultiplicityTrees && ((0, jsx_runtime_1.jsx)(MultiplicityTree_1.MultiplicityTree, { range: range, onUnlink: unAssignHandler })), (0, jsx_runtime_1.jsx)(AssignmentActionsButtons_1.AssignmentActionsButtons, { isActive: !!(assignmentRange.isActive || diaIDs), x: from - 16, onAssign: assignHandler, onUnAssign: () => unAssignHandler() })] }, id));
|
|
@@ -1,46 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("
|
|
7
|
-
/** @jsxImportSource @emotion/react */
|
|
8
|
-
const react_1 = require("@emotion/react");
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
4
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
10
|
-
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
11
5
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
12
|
-
const
|
|
13
|
-
const styles = (0, react_1.css) `
|
|
14
|
-
pointer-events: bounding-box;
|
|
15
|
-
user-select: 'none';
|
|
16
|
-
user-select: none;
|
|
17
|
-
|
|
18
|
-
.zone-area {
|
|
19
|
-
height: 100%;
|
|
20
|
-
fill: #b8b8b857;
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.delete-button {
|
|
25
|
-
display: none;
|
|
26
|
-
cursor: pointer;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
:hover .delete-button {
|
|
30
|
-
display: block;
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
6
|
+
const highlight_1 = require("../../highlight");
|
|
33
7
|
function BaseLineZones() {
|
|
34
8
|
const { toolOptions: { selectedTool, data: { baselineCorrection }, }, } = (0, ChartContext_1.useChartData)();
|
|
35
|
-
const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
|
|
36
|
-
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
37
|
-
const deleteRangeHandler = (id) => {
|
|
38
|
-
dispatch({ type: 'DELETE_BASE_LINE_ZONE', payload: { id } });
|
|
39
|
-
};
|
|
40
9
|
const baseLineZones = baselineCorrection.zones;
|
|
41
10
|
if (selectedTool !== 'baselineCorrection' || baseLineZones.length === 0) {
|
|
42
11
|
return null;
|
|
43
12
|
}
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)("g", { children: baselineCorrection.zones.map((zone) => ((0, jsx_runtime_1.
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)("g", { children: baselineCorrection.zones.map((zone) => ((0, jsx_runtime_1.jsx)(BaseLineZone, { ...zone }, zone.id))) }));
|
|
14
|
+
}
|
|
15
|
+
function BaseLineZone(props) {
|
|
16
|
+
const { from, to, id } = props;
|
|
17
|
+
const { onHover, isActive, defaultActiveStyle: { backgroundColor: activeFill }, } = (0, highlight_1.useHighlight)([id], { type: 'BASELINE_ZONE', extra: { id } });
|
|
18
|
+
const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
|
|
19
|
+
const x = scaleX()(to);
|
|
20
|
+
const width = scaleX()(from) - scaleX()(to);
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)("g", { transform: `translate(${x},0)`, ...onHover, children: (0, jsx_runtime_1.jsx)("rect", { x: "0", width: width, height: "100%", style: { backgroundColor: 'red' }, fill: isActive ? activeFill : '#b8b8b857' }) }));
|
|
45
22
|
}
|
|
46
23
|
exports.default = BaseLineZones;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolve = void 0;
|
|
4
|
+
const uuid_1 = require("@lukeed/uuid");
|
|
5
|
+
function groupData(data, options) {
|
|
6
|
+
const { threshold, key } = options;
|
|
7
|
+
const groups = [];
|
|
8
|
+
let lastRefValue = data[0][key];
|
|
9
|
+
let groupIndex = 0;
|
|
10
|
+
for (const datum of data) {
|
|
11
|
+
if (datum[key] - lastRefValue <= threshold) {
|
|
12
|
+
if (!groups[groupIndex]) {
|
|
13
|
+
groups.push([datum]);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
groups[groupIndex].push(datum);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
lastRefValue = datum[key];
|
|
21
|
+
groupIndex++;
|
|
22
|
+
groups.push([datum]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return groups;
|
|
26
|
+
}
|
|
27
|
+
function resolveGroupsIntersection(groups, options) {
|
|
28
|
+
const { maxIteration = 3, groupMargin = 0 } = options;
|
|
29
|
+
let iteration = 1;
|
|
30
|
+
let hasIntersection = true;
|
|
31
|
+
const newGroups = JSON.parse(JSON.stringify(groups));
|
|
32
|
+
while (iteration < maxIteration && hasIntersection) {
|
|
33
|
+
iteration++;
|
|
34
|
+
hasIntersection = false;
|
|
35
|
+
let previousGroup = newGroups[0];
|
|
36
|
+
for (let i = 1; i < newGroups.length; i++) {
|
|
37
|
+
const currentGroupMeta = newGroups[i].meta;
|
|
38
|
+
if (previousGroup.meta.groupEndX > currentGroupMeta.groupStartX) {
|
|
39
|
+
const diff = Math.abs(currentGroupMeta.groupStartX - previousGroup.meta.groupEndX);
|
|
40
|
+
hasIntersection = true;
|
|
41
|
+
const shift = diff + groupMargin;
|
|
42
|
+
newGroups[i].meta = {
|
|
43
|
+
...newGroups[i].meta,
|
|
44
|
+
groupStartX: currentGroupMeta.groupStartX + shift,
|
|
45
|
+
groupEndX: currentGroupMeta.groupEndX + shift,
|
|
46
|
+
groupMidX: currentGroupMeta.groupMidX + shift,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
previousGroup = newGroups[i];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return newGroups;
|
|
53
|
+
}
|
|
54
|
+
function resolve(data, options) {
|
|
55
|
+
const { width = 10, margin = 5, groupMargin = 0, key, threshold: inputThreshold, } = options;
|
|
56
|
+
const threshold = inputThreshold || width + margin * 2;
|
|
57
|
+
const groupedData = groupData(data, { threshold, key });
|
|
58
|
+
const resolvedGroups = [];
|
|
59
|
+
for (const group of groupedData) {
|
|
60
|
+
const groupWidth = group.length * width + (group.length - 1) * margin;
|
|
61
|
+
let sum = 0;
|
|
62
|
+
for (const groupDatum of group) {
|
|
63
|
+
sum += groupDatum[key];
|
|
64
|
+
}
|
|
65
|
+
const groupMidX = sum / group.length;
|
|
66
|
+
const groupStartX = groupMidX - groupWidth / 2 + width / 2;
|
|
67
|
+
const groupEndX = groupWidth / 2 + groupMidX;
|
|
68
|
+
resolvedGroups.push({
|
|
69
|
+
group,
|
|
70
|
+
meta: { groupMidX, groupStartX, groupEndX, groupWidth, id: (0, uuid_1.v4)() },
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return resolveGroupsIntersection(resolvedGroups, { groupMargin });
|
|
74
|
+
}
|
|
75
|
+
exports.resolve = resolve;
|
|
@@ -16,6 +16,7 @@ const GlobalContext_1 = require("../../../context/GlobalContext");
|
|
|
16
16
|
const MoleculeStructureEditorModal_1 = require("../../../modal/MoleculeStructureEditorModal");
|
|
17
17
|
const useAtomAssignment_1 = __importDefault(require("../../../panels/MoleculesPanel/useAtomAssignment"));
|
|
18
18
|
const ActionsButton_1 = __importDefault(require("./ActionsButton"));
|
|
19
|
+
const AUTO_CROP_MARGIN = 30;
|
|
19
20
|
const style = (0, react_1.css) `
|
|
20
21
|
border: 1px solid transparent;
|
|
21
22
|
|
|
@@ -63,10 +64,10 @@ function DraggableStructure(props) {
|
|
|
63
64
|
}
|
|
64
65
|
if (!viewerRef)
|
|
65
66
|
return null;
|
|
66
|
-
return ((0, jsx_runtime_1.jsx)(react_rnd_1.Rnd, { default: moleculeView.floating.bounding, minWidth:
|
|
67
|
+
return ((0, jsx_runtime_1.jsx)(react_rnd_1.Rnd, { default: moleculeView.floating.bounding, minWidth: 90 + AUTO_CROP_MARGIN * 2, minHeight: 100 + AUTO_CROP_MARGIN * 2, dragHandleClassName: "handle", enableUserSelectHack: false, bounds: viewerRef, style: { zIndex: 1 }, className: "draggable-molecule", onResizeStop: (e, dir, eRef, { width, height }) => dragFloatMoleculeHandler({ width, height }), onDragStop: (e, { x, y }) => {
|
|
67
68
|
dragFloatMoleculeHandler({ x, y });
|
|
68
69
|
}, resizeHandleWrapperStyle: { backgroundColor: 'white' }, css: style, children: (0, jsx_runtime_1.jsxs)("div", { className: "content", onDoubleClick: () => openMoleculeEditor(molecule), children: [(0, jsx_runtime_1.jsx)(ActionsButton_1.default, { onFloatBtnClick: floatMoleculeHandler }), (0, jsx_runtime_1.jsx)(react_d3_utils_1.ResponsiveChart, { children: ({ width, height }) => {
|
|
69
|
-
return ((0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default,
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default, id: `molSVG${index || ''}`, autoCrop: true, autoCropMargin: AUTO_CROP_MARGIN, height: height - AUTO_CROP_MARGIN * 2, width: width - AUTO_CROP_MARGIN * 2, label: molecule.label, labelFontSize: 15, labelColor: "rgb(0,0,0)", molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
|
|
70
71
|
? currentDiaIDsToHighlight
|
|
71
72
|
: assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: (molfile) => {
|
|
72
73
|
dispatch({
|
|
@@ -17,7 +17,7 @@ function SlicingView() {
|
|
|
17
17
|
const position = (0, MouseTracker_1.useMouseTracker)();
|
|
18
18
|
const activeSpectrum = (0, useActiveSpectrum_1.useActiveSpectrum)();
|
|
19
19
|
const chart2d = (0, react_1.useMemo)(() => {
|
|
20
|
-
if (position && activeSpectrum
|
|
20
|
+
if (position && activeSpectrum?.id) {
|
|
21
21
|
const { x, y } = position;
|
|
22
22
|
const scale2dX = (0, scale_1.get2DXScale)({ margin, width, xDomain });
|
|
23
23
|
const scale2dY = (0, scale_1.get2DYScale)({ margin, height, yDomain });
|
|
@@ -58,7 +58,7 @@ function ContoursPaths({ id: spectrumID, sign, color, spectrum, onTimeout, }) {
|
|
|
58
58
|
const opacity = activeSpectrum === null || spectrumID === activeSpectrum.id
|
|
59
59
|
? '1'
|
|
60
60
|
: (0, get_1.default)(preferences.current, 'general.dimmedSpectraOpacity', 0.1);
|
|
61
|
-
return ((0, jsx_runtime_1.jsx)("path", { fill: "none", "data-
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)("path", { fill: "none", "data-testid": "spectrum-line", stroke: color, strokeWidth: "1", opacity: opacity, d: path }));
|
|
62
62
|
}
|
|
63
63
|
function ContoursInner({ spectra, displayerKey }) {
|
|
64
64
|
const alert = (0, Alert_1.useAlert)();
|