nmrium 0.41.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/1d-2d/components/SpectrumInfoBlock.js +4 -1
- 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/Input.js +1 -0
- package/lib/component/elements/NumberInput.d.ts +1 -0
- package/lib/component/elements/NumberInput.js +10 -3
- package/lib/component/elements/Scroller.d.ts +15 -0
- package/lib/component/elements/Scroller.js +31 -0
- 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/useSaveSettings.js +9 -11
- 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/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
- 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/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- 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/SpectraPreferences.js +4 -3
- 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/databasePanel/DatabasePanel.js +33 -26
- 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 +32 -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.d.ts +6 -2
- package/lib/component/reducer/actions/MoleculeActions.js +8 -2
- 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/actions/addWorkspace.js +19 -15
- 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/PathBuilder.js +11 -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 +10 -5
- 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/data1d/database.d.ts +4 -2
- package/lib/data/data1d/database.js +10 -3
- package/lib/data/molecules/Molecule.js +2 -2
- package/lib/data/molecules/MoleculeManager.d.ts +1 -0
- package/lib/data/molecules/MoleculeManager.js +14 -0
- 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/1d-2d/components/SpectrumInfoBlock.js +4 -1
- 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/Input.js +1 -0
- package/lib-cjs/component/elements/NumberInput.js +12 -2
- package/lib-cjs/component/elements/Scroller.js +35 -0
- 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/useSaveSettings.js +9 -11
- 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/AboutPredictionModal.js +1 -1
- package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +1 -1
- 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/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- 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/SpectraPreferences.js +3 -2
- 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/databasePanel/DatabasePanel.js +33 -26
- 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 +31 -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 +9 -2
- package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
- package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +19 -15
- package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
- package/lib-cjs/component/toolbar/ToolTypes.js +36 -0
- package/lib-cjs/component/utility/PathBuilder.js +11 -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 +10 -5
- package/lib-cjs/data/PredictionManager.js +9 -9
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
- package/lib-cjs/data/data1d/database.js +10 -3
- package/lib-cjs/data/molecules/Molecule.js +2 -2
- package/lib-cjs/data/molecules/MoleculeManager.js +16 -1
- 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
|
@@ -288,6 +288,42 @@ export const options = {
|
|
|
288
288
|
],
|
|
289
289
|
isToggle: false,
|
|
290
290
|
},
|
|
291
|
+
fftDimension1: {
|
|
292
|
+
id: 'fftDimension1',
|
|
293
|
+
label: 'Fourier transform dimension 1',
|
|
294
|
+
hasOptionPanel: false,
|
|
295
|
+
isFilter: true,
|
|
296
|
+
mode: DISPLAYER_MODE.DM_2D,
|
|
297
|
+
spectraOptions: [
|
|
298
|
+
{
|
|
299
|
+
info: [
|
|
300
|
+
{ key: 'isFid', value: true },
|
|
301
|
+
{ key: 'isComplex', value: true },
|
|
302
|
+
],
|
|
303
|
+
active: true,
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
isToggle: false,
|
|
307
|
+
isExperimental: true,
|
|
308
|
+
},
|
|
309
|
+
fftDimension2: {
|
|
310
|
+
id: 'fftDimension2',
|
|
311
|
+
label: 'Fourier transform dimension 2',
|
|
312
|
+
hasOptionPanel: false,
|
|
313
|
+
isFilter: true,
|
|
314
|
+
mode: DISPLAYER_MODE.DM_2D,
|
|
315
|
+
spectraOptions: [
|
|
316
|
+
{
|
|
317
|
+
info: [
|
|
318
|
+
{ key: 'isFid', value: true },
|
|
319
|
+
{ key: 'isComplex', value: true },
|
|
320
|
+
],
|
|
321
|
+
active: true,
|
|
322
|
+
},
|
|
323
|
+
],
|
|
324
|
+
isToggle: false,
|
|
325
|
+
isExperimental: true,
|
|
326
|
+
},
|
|
291
327
|
import: {
|
|
292
328
|
id: 'import',
|
|
293
329
|
label: 'Import',
|
|
@@ -3,9 +3,13 @@ export class PathBuilder {
|
|
|
3
3
|
this.array = [];
|
|
4
4
|
}
|
|
5
5
|
moveTo(x, y) {
|
|
6
|
+
x = clamp(x);
|
|
7
|
+
y = clamp(y);
|
|
6
8
|
this.array.push(`M ${x} ${y}`);
|
|
7
9
|
}
|
|
8
10
|
lineTo(x, y) {
|
|
11
|
+
x = clamp(x);
|
|
12
|
+
y = clamp(y);
|
|
9
13
|
this.array.push(`L ${x} ${y}`);
|
|
10
14
|
}
|
|
11
15
|
closePath() {
|
|
@@ -16,3 +20,10 @@ export class PathBuilder {
|
|
|
16
20
|
return this.array.join(' ');
|
|
17
21
|
}
|
|
18
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Clamp values to avoid rendering issues of the SVG.
|
|
25
|
+
* This assumes that the viewport has pixel coordinates (so the max values are outside of the visible area)
|
|
26
|
+
*/
|
|
27
|
+
function clamp(value) {
|
|
28
|
+
return Math.max(-1e5, Math.min(1e5, value));
|
|
29
|
+
}
|
|
@@ -187,14 +187,17 @@ function getBlob(rootRef, elementID) {
|
|
|
187
187
|
const blob = new Blob([svg], { type: 'image/svg+xml' });
|
|
188
188
|
return { blob, width, height };
|
|
189
189
|
}
|
|
190
|
+
function getMatrix(element) {
|
|
191
|
+
const transform = window
|
|
192
|
+
.getComputedStyle(element)
|
|
193
|
+
.getPropertyValue('transform');
|
|
194
|
+
return new DOMMatrix(transform);
|
|
195
|
+
}
|
|
190
196
|
function getMoleculesElement(rootRef) {
|
|
191
197
|
const nmriumViewer = rootRef.getRootNode().querySelector(`#nmrium-viewer`);
|
|
192
198
|
const floatingMoleculesGroup = document.createElement('g');
|
|
193
199
|
for (const element of nmriumViewer.querySelectorAll('.draggable-molecule')) {
|
|
194
|
-
const
|
|
195
|
-
.getComputedStyle(element)
|
|
196
|
-
.getPropertyValue('transform');
|
|
197
|
-
const matrix = new DOMMatrix(transform);
|
|
200
|
+
const matrix = getMatrix(element);
|
|
198
201
|
const actionHeaderElement = element.querySelector('.float-molecule-actions');
|
|
199
202
|
const molElement = element
|
|
200
203
|
.cloneNode(true)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export const prediction = {
|
|
2
2
|
version: 1,
|
|
3
3
|
label: 'Prediction',
|
|
4
|
+
general: {
|
|
5
|
+
dimmedSpectraOpacity: 0.5,
|
|
6
|
+
verticalSplitterPosition: '440px',
|
|
7
|
+
verticalSplitterCloseThreshold: 600,
|
|
8
|
+
spectraRendering: 'auto',
|
|
9
|
+
loggingLevel: 'info',
|
|
10
|
+
},
|
|
4
11
|
display: {
|
|
5
12
|
panels: {
|
|
6
13
|
spectraPanel: { display: true },
|
|
@@ -28,6 +35,8 @@ export const prediction = {
|
|
|
28
35
|
zoomOut: true,
|
|
29
36
|
zoom: true,
|
|
30
37
|
autoRangeAndZonePicking: true,
|
|
38
|
+
fftDimension1: true,
|
|
39
|
+
fftDimension2: true,
|
|
31
40
|
},
|
|
32
41
|
},
|
|
33
42
|
formatting: {
|
|
@@ -44,6 +44,8 @@ export const workspaceDefaultProperties = {
|
|
|
44
44
|
zoom: false,
|
|
45
45
|
peakPicking: false,
|
|
46
46
|
autoRangeAndZonePicking: false,
|
|
47
|
+
fftDimension1: false,
|
|
48
|
+
fftDimension2: false,
|
|
47
49
|
},
|
|
48
50
|
},
|
|
49
51
|
general: {
|
|
@@ -89,21 +91,24 @@ export const workspaceDefaultProperties = {
|
|
|
89
91
|
infoBlock: {
|
|
90
92
|
visible: false,
|
|
91
93
|
fields: [
|
|
92
|
-
{ label: 'name', jpath: ['
|
|
94
|
+
{ label: 'name', jpath: ['info', 'name'], visible: true, format: '' },
|
|
93
95
|
{
|
|
94
96
|
label: 'Number Of Scan',
|
|
95
97
|
jpath: ['info', 'numberOfScans'],
|
|
96
98
|
visible: true,
|
|
99
|
+
format: '0',
|
|
97
100
|
},
|
|
98
101
|
{
|
|
99
|
-
label: '
|
|
100
|
-
jpath: ['info', '
|
|
102
|
+
label: 'Pulse Sequence',
|
|
103
|
+
jpath: ['info', 'pulseSequence'],
|
|
101
104
|
visible: true,
|
|
105
|
+
format: '',
|
|
102
106
|
},
|
|
103
107
|
{
|
|
104
|
-
label: '
|
|
105
|
-
jpath: ['info', '
|
|
108
|
+
label: 'Frequency',
|
|
109
|
+
jpath: ['info', 'originFrequency'],
|
|
106
110
|
visible: true,
|
|
111
|
+
format: '0',
|
|
107
112
|
},
|
|
108
113
|
],
|
|
109
114
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Logger } from 'cheminfo-types';
|
|
2
2
|
import { Spectrum } from 'nmr-load-save';
|
|
3
|
-
import {
|
|
3
|
+
import { Predicted, PredictionBase1D, PredictionBase2D } from 'nmr-processing';
|
|
4
4
|
export type Experiment = 'proton' | 'carbon' | 'cosy' | 'hsqc' | 'hmbc';
|
|
5
5
|
export type SpectraPredictionOptions = Record<Experiment, boolean>;
|
|
6
|
-
export type PredictedSpectraResult = Partial<Record<Experiment,
|
|
6
|
+
export type PredictedSpectraResult = Partial<Record<Experiment, PredictionBase1D | PredictionBase2D>>;
|
|
7
7
|
export interface PredictionOptions {
|
|
8
8
|
name: string;
|
|
9
9
|
frequency: number;
|
|
@@ -34,5 +34,5 @@ export declare const FREQUENCIES: Array<{
|
|
|
34
34
|
value: number;
|
|
35
35
|
label: string;
|
|
36
36
|
}>;
|
|
37
|
-
export declare function predictSpectra(molfile: string): Promise<
|
|
37
|
+
export declare function predictSpectra(molfile: string, options: any): Promise<Predicted>;
|
|
38
38
|
export declare function generateSpectra(predictedSpectra: PredictedSpectraResult, inputOptions: PredictionOptions, color: string, logger: Logger): Spectrum[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { v4 } from '@lukeed/uuid';
|
|
2
2
|
import { xMinMaxValues } from 'ml-spectra-processing';
|
|
3
|
-
import {
|
|
3
|
+
import { predict, signalsToXY, signals2DToZ, getFrequency, signalsToRanges, } from 'nmr-processing';
|
|
4
4
|
import OCL from 'openchemlib/full';
|
|
5
5
|
import { DatumKind } from './constants/SignalsKinds';
|
|
6
6
|
import { initiateDatum1D, mapRanges, updateIntegralsRelativeValues, } from './data1d/Spectrum1D';
|
|
@@ -42,16 +42,16 @@ export const FREQUENCIES = [
|
|
|
42
42
|
{ value: 1000, label: '1000 MHz' },
|
|
43
43
|
{ value: 1200, label: '1200 MHz' },
|
|
44
44
|
];
|
|
45
|
-
|
|
46
|
-
export async function predictSpectra(molfile) {
|
|
45
|
+
export async function predictSpectra(molfile, options) {
|
|
47
46
|
const molecule = OCL.Molecule.fromMolfile(molfile);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
}
|
|
47
|
+
const predictOptions = {};
|
|
48
|
+
for (const key in options) {
|
|
49
|
+
if (!options[key])
|
|
50
|
+
continue;
|
|
51
|
+
const experiment = key === 'proton' ? 'H' : key === 'carbon' ? 'C' : key;
|
|
52
|
+
predictOptions[experiment] = {};
|
|
53
|
+
}
|
|
54
|
+
return predict(molecule, { predictOptions });
|
|
55
55
|
}
|
|
56
56
|
function generateName(name, options) {
|
|
57
57
|
const { frequency, experiment } = options;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Spectrum1D } from 'nmr-load-save';
|
|
2
2
|
import { Signal1D } from 'nmr-processing';
|
|
3
|
-
import { SumParams } from '../SumManager';
|
|
4
3
|
interface RangeOptions {
|
|
5
4
|
from: number;
|
|
6
5
|
to: number;
|
|
@@ -37,5 +36,5 @@ export declare function createRangeObj({ from, to, absolute, signal, }: RangeOpt
|
|
|
37
36
|
kind: string;
|
|
38
37
|
integration: number;
|
|
39
38
|
};
|
|
40
|
-
export declare function addRange(spectrum: Spectrum1D, options: RangeOptions
|
|
39
|
+
export declare function addRange(spectrum: Spectrum1D, options: RangeOptions): void;
|
|
41
40
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { v4 } from '@lukeed/uuid';
|
|
2
2
|
import { xyIntegration } from 'ml-spectra-processing';
|
|
3
|
-
import {
|
|
3
|
+
import { mapRanges } from 'nmr-processing';
|
|
4
4
|
import { DatumKind } from '../../../constants/SignalsKinds';
|
|
5
|
-
import { initSumOptions } from '../SumManager';
|
|
6
5
|
import detectSignal from './detectSignal';
|
|
7
6
|
export function createRangeObj({ from, to, absolute, signal, }) {
|
|
8
7
|
return {
|
|
@@ -16,7 +15,7 @@ export function createRangeObj({ from, to, absolute, signal, }) {
|
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
17
|
export function addRange(spectrum, options) {
|
|
19
|
-
const { from, to
|
|
18
|
+
const { from, to } = options;
|
|
20
19
|
const { x, re } = spectrum.data;
|
|
21
20
|
const absolute = xyIntegration({ x, y: re }, { from, to, reverse: true });
|
|
22
21
|
// detectSignal use the advance multiplet-analysis that can crash if too many points
|
|
@@ -36,12 +35,7 @@ export function addRange(spectrum, options) {
|
|
|
36
35
|
}
|
|
37
36
|
try {
|
|
38
37
|
if (range) {
|
|
39
|
-
spectrum.ranges.options = initSumOptions(spectrum.ranges.options, {
|
|
40
|
-
molecules,
|
|
41
|
-
nucleus,
|
|
42
|
-
});
|
|
43
38
|
spectrum.ranges.values = spectrum.ranges.values.concat(mapRanges([range], spectrum));
|
|
44
|
-
updateRangesRelativeValues(spectrum);
|
|
45
39
|
}
|
|
46
40
|
}
|
|
47
41
|
catch (error) {
|
|
@@ -33,8 +33,10 @@ export type PrepareDataResult = Partial<DataBaseBasic & DataBaseRange & DataBase
|
|
|
33
33
|
export interface InitiateDatabaseResult {
|
|
34
34
|
data: DatabaseNMREntry[];
|
|
35
35
|
getSolvents: () => string[];
|
|
36
|
-
search: (
|
|
37
|
-
|
|
36
|
+
search: (options: {
|
|
37
|
+
keywords?: string | string[];
|
|
38
|
+
idCode?: string;
|
|
39
|
+
}) => DatabaseNMREntry[];
|
|
38
40
|
}
|
|
39
41
|
export declare function initiateDatabase(databases: DatabaseNMREntry[], nucleus: string): InitiateDatabaseResult;
|
|
40
42
|
export declare function prepareData(data: DatabaseNMREntry[]): PrepareDataResult[];
|
|
@@ -14,9 +14,16 @@ export function initiateDatabase(databases, nucleus) {
|
|
|
14
14
|
const data = databases.filter((datum) => datum.nucleus === nucleus);
|
|
15
15
|
const moleculesDB = prepareMoleculesDB(data);
|
|
16
16
|
const getSolvents = () => prepareGetSolvents(data);
|
|
17
|
-
const search = (keywords =
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const search = ({ idCode = '', keywords = '', }) => prepareSearch({ idCode, keywords, data, moleculesDB });
|
|
18
|
+
return { data, getSolvents, search };
|
|
19
|
+
}
|
|
20
|
+
function prepareSearch(options) {
|
|
21
|
+
const { data, keywords = [], moleculesDB, idCode } = options;
|
|
22
|
+
let searchData = data;
|
|
23
|
+
if (idCode) {
|
|
24
|
+
searchData = processSearchByStructure(moleculesDB, idCode);
|
|
25
|
+
}
|
|
26
|
+
return filter(searchData, { keywords });
|
|
20
27
|
}
|
|
21
28
|
function processSearchByStructure(moleculesDB, idCode) {
|
|
22
29
|
// default format { format: 'idCode' }
|
|
@@ -4,8 +4,8 @@ import getAtomsFromMF from '../utilities/getAtomsFromMF';
|
|
|
4
4
|
export const DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT = {
|
|
5
5
|
x: 100,
|
|
6
6
|
y: 50,
|
|
7
|
-
width:
|
|
8
|
-
height:
|
|
7
|
+
width: 190,
|
|
8
|
+
height: 200,
|
|
9
9
|
};
|
|
10
10
|
export function initMolecule(options = {}) {
|
|
11
11
|
const id = options.id || v4();
|
|
@@ -5,3 +5,4 @@ export declare function setMolfile(molecules: StateMoleculeExtended[], currentMo
|
|
|
5
5
|
export declare function extractNumber(value: string): string | null;
|
|
6
6
|
export declare function extractLabelsNumbers(molecules: Array<Pick<StateMolecule, 'label'>>): number[];
|
|
7
7
|
export declare function getLabelNumber(reserveNumbers: number[]): number;
|
|
8
|
+
export declare function getMolecules(text: string): Promise<import("nmr-load-save").StateMolecule[]>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { fileCollectionFromFiles } from 'filelist-utils';
|
|
2
|
+
import { read } from 'nmr-load-save';
|
|
1
3
|
import { Molecule as OCLMolecule } from 'openchemlib/full';
|
|
2
4
|
import { initMolecule } from './Molecule';
|
|
3
5
|
export function fromJSON(mols, reservedMolecules = []) {
|
|
@@ -80,3 +82,15 @@ export function getLabelNumber(reserveNumbers) {
|
|
|
80
82
|
}
|
|
81
83
|
return 1;
|
|
82
84
|
}
|
|
85
|
+
export async function getMolecules(text) {
|
|
86
|
+
let extension = 'smi';
|
|
87
|
+
if (/v[23]000/i.test(text)) {
|
|
88
|
+
extension = 'sdf';
|
|
89
|
+
}
|
|
90
|
+
const file = new File([text], `file.${extension}`, {
|
|
91
|
+
type: 'text/plain',
|
|
92
|
+
});
|
|
93
|
+
const collection = await fileCollectionFromFiles([file]);
|
|
94
|
+
const { nmriumState: { data }, } = await read(collection);
|
|
95
|
+
return data?.molecules || [];
|
|
96
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { KeyboardEvent, MouseEvent } from 'react';
|
|
2
|
-
export default function checkModifierKeyActivated(event: KeyboardEvent | MouseEvent): boolean;
|
|
2
|
+
export default function checkModifierKeyActivated<E = HTMLDivElement>(event: KeyboardEvent<E> | MouseEvent<E>): boolean;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
+
const modifiersKeys = [
|
|
2
|
+
'Alt',
|
|
3
|
+
'AltGraph',
|
|
4
|
+
'Control',
|
|
5
|
+
'Meta',
|
|
6
|
+
'Shift',
|
|
7
|
+
];
|
|
1
8
|
export default function checkModifierKeyActivated(event) {
|
|
2
|
-
|
|
3
|
-
'Alt',
|
|
4
|
-
'AltGraph',
|
|
5
|
-
'Control',
|
|
6
|
-
'Meta',
|
|
7
|
-
'Shift',
|
|
8
|
-
];
|
|
9
|
-
for (const key of modifiersKeys) {
|
|
10
|
-
if (event.getModifierState(key)) {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
9
|
+
return modifiersKeys.some((key) => event.getModifierState(key));
|
|
15
10
|
}
|
package/lib/versionInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v0.
|
|
1
|
+
export default { version: 'v0.43.0' };
|
|
@@ -97,6 +97,6 @@ function ApodizationLine() {
|
|
|
97
97
|
return '';
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
return ((0, jsx_runtime_1.jsx)("path", { "data-
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)("path", { "data-testid": "apodization-line", stroke: "green", fill: "none", strokeWidth: "2", d: paths() }));
|
|
101
101
|
}
|
|
102
102
|
exports.default = ApodizationLine;
|
|
@@ -15,12 +15,13 @@ const DatabaseElements_1 = __importDefault(require("./database/DatabaseElements"
|
|
|
15
15
|
const IntegralsSeries_1 = __importDefault(require("./integral/IntegralsSeries"));
|
|
16
16
|
const JGraph_1 = __importDefault(require("./jCouplingGraph/JGraph"));
|
|
17
17
|
const MultiAnalysisRanges_1 = __importDefault(require("./multiAnalysis/MultiAnalysisRanges"));
|
|
18
|
-
const
|
|
18
|
+
const PeakEditionManager_1 = require("./peaks/PeakEditionManager");
|
|
19
|
+
const Peaks_1 = require("./peaks/Peaks");
|
|
19
20
|
const PeaksShapes_1 = __importDefault(require("./peaks/PeaksShapes"));
|
|
20
21
|
const Ranges_1 = __importDefault(require("./ranges/Ranges"));
|
|
21
22
|
const BaseLineZones_1 = __importDefault(require("./tool/BaseLineZones"));
|
|
22
23
|
function Chart1D({ mode, width, height, margin, displayerKey }) {
|
|
23
24
|
const { current: { general: { spectraRendering }, }, } = (0, PreferencesContext_1.usePreferences)();
|
|
24
|
-
return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", shapeRendering: spectraRendering, children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: `${displayerKey}clip-chart-1d`, children: (0, jsx_runtime_1.jsx)("rect", { width: `${width - margin.left - margin.right}`, height: `${height}`, x: `${margin.left}`, y: `${0}` }) }) }), (0, jsx_runtime_1.jsx)(LinesSeries_1.default, {}), (0, jsx_runtime_1.jsx)(ApodizationLine_1.default, {}), (0, jsx_runtime_1.jsx)(IntegralsSeries_1.default, {}), (0, jsx_runtime_1.jsx)(
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(PeakEditionManager_1.PeakEditionProvider, { children: (0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", shapeRendering: spectraRendering, children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: `${displayerKey}clip-chart-1d`, children: (0, jsx_runtime_1.jsx)("rect", { width: `${width - margin.left - margin.right}`, height: `${height}`, x: `${margin.left}`, y: `${0}` }) }) }), (0, jsx_runtime_1.jsx)(LinesSeries_1.default, {}), (0, jsx_runtime_1.jsx)(ApodizationLine_1.default, {}), (0, jsx_runtime_1.jsx)(IntegralsSeries_1.default, {}), (0, jsx_runtime_1.jsx)(Peaks_1.Peaks, {}), (0, jsx_runtime_1.jsx)(Ranges_1.default, {}), (0, jsx_runtime_1.jsx)(JGraph_1.default, {}), (0, jsx_runtime_1.jsx)(MultiAnalysisRanges_1.default, {}), (0, jsx_runtime_1.jsx)(BaseLineZones_1.default, {}), (0, jsx_runtime_1.jsx)(ExclusionZonesAnnotations_1.default, {}), (0, jsx_runtime_1.jsx)(DatabaseElements_1.default, {}), (0, jsx_runtime_1.jsx)(PeaksShapes_1.default, {}), (0, jsx_runtime_1.jsx)(SpectraLegends_1.default, {}), (0, jsx_runtime_1.jsx)(SpectrumInfoBlock_1.default, {}), (0, jsx_runtime_1.jsx)("g", { className: "container", style: { pointerEvents: 'none' }, children: (0, jsx_runtime_1.jsx)(XAxis_1.default, { showGrid: true, mode: mode }) })] }) }));
|
|
25
26
|
}
|
|
26
27
|
exports.default = Chart1D;
|
|
@@ -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;
|