nmrium 0.21.0 → 0.22.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/ExclusionZonesAnnotations.js +1 -2
- package/lib/component/1d/Integral.js +1 -6
- package/lib/component/1d/Viewer1D.js +4 -4
- package/lib/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib/component/1d/utilities/scale.d.ts +1 -1
- package/lib/component/1d/utilities/scale.js +7 -6
- package/lib/component/2d/Viewer2D.js +5 -5
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/elements/EditableColumn.d.ts +1 -1
- package/lib/component/header/Header.js +3 -7
- package/lib/component/{1d/utilities → hooks}/useIntegralPath.d.ts +0 -0
- package/lib/component/hooks/useIntegralPath.js +53 -0
- package/lib/component/hooks/useToolsFunctions.js +4 -5
- package/lib/component/hooks/useXScale.d.ts +2 -0
- package/lib/component/hooks/useXScale.js +7 -0
- package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib/component/modal/editZone/EditPathLengthFormik.d.ts +5 -0
- package/lib/component/modal/editZone/EditPathLengthFormik.js +72 -0
- package/lib/component/modal/editZone/EditZoneModal.d.ts +8 -0
- package/lib/component/modal/editZone/EditZoneModal.js +96 -0
- package/lib/component/modal/editZone/SignalFormTab.d.ts +6 -0
- package/lib/component/modal/editZone/SignalFormTab.js +6 -0
- package/lib/component/modal/editZone/SignalsForm.d.ts +2 -0
- package/lib/component/modal/editZone/SignalsForm.js +62 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.d.ts +534 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.js +17 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.d.ts +3 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.js +7 -0
- package/lib/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.d.ts +1 -2
- package/lib/component/modal/setting/GeneralSettings.js +13 -5
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.d.ts +2 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +13 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +7 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +38 -0
- package/lib/component/panels/Panels.d.ts +1 -1
- package/lib/component/panels/Panels.js +10 -14
- package/lib/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.d.ts +1 -6
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -7
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +24 -30
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +8 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +89 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -42
- package/lib/component/panels/SummaryPanel/utilities/IsInView.d.ts +6 -0
- package/lib/component/panels/SummaryPanel/utilities/IsInView.js +16 -0
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +29 -0
- package/lib/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +155 -19
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +1 -0
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +26 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +12 -4
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +3 -2
- package/lib/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib/component/reducer/IgnoreActions.js +2 -1
- package/lib/component/reducer/Reducer.d.ts +9 -23
- package/lib/component/reducer/Reducer.js +7 -8
- package/lib/component/reducer/actions/DatabaseActions.js +1 -1
- package/lib/component/reducer/actions/DomainActions.d.ts +3 -1
- package/lib/component/reducer/actions/DomainActions.js +20 -1
- package/lib/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib/component/reducer/actions/LoadActions.js +22 -1
- package/lib/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib/component/reducer/actions/RangesActions.js +3 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +31 -27
- package/lib/component/reducer/actions/ZonesActions.d.ts +3 -1
- package/lib/component/reducer/actions/ZonesActions.js +33 -2
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +17 -21
- package/lib/component/reducer/helper/Zoom1DManager.js +53 -69
- package/lib/component/reducer/preferencesReducer.d.ts +1 -8
- package/lib/component/reducer/preferencesReducer.js +11 -1
- package/lib/component/reducer/types/Types.d.ts +3 -1
- package/lib/component/reducer/types/Types.js +3 -1
- package/lib/data/constants/DefaultPathLengths.d.ts +6 -0
- package/lib/data/constants/DefaultPathLengths.js +8 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +4 -0
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +11 -0
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +11 -0
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +9 -0
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +7 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +29 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +14 -0
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib-cjs/component/1d/Integral.js +1 -6
- package/lib-cjs/component/1d/Viewer1D.js +4 -4
- package/lib-cjs/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib-cjs/component/1d/utilities/scale.js +7 -6
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/header/Header.js +3 -7
- package/lib-cjs/component/hooks/useIntegralPath.js +56 -0
- package/lib-cjs/component/hooks/useToolsFunctions.js +4 -5
- package/lib-cjs/component/hooks/useXScale.js +11 -0
- package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib-cjs/component/modal/editZone/EditPathLengthFormik.js +77 -0
- package/lib-cjs/component/modal/editZone/EditZoneModal.js +101 -0
- package/lib-cjs/component/modal/editZone/SignalFormTab.js +11 -0
- package/lib-cjs/component/modal/editZone/SignalsForm.js +67 -0
- package/lib-cjs/component/modal/editZone/validation/EditZoneValidation.js +38 -0
- package/lib-cjs/component/modal/editZone/validation/isDefaultPathLength.js +12 -0
- package/lib-cjs/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralSettings.js +12 -4
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +18 -0
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +43 -0
- package/lib-cjs/component/panels/Panels.js +11 -15
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -8
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +43 -30
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +94 -0
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +38 -41
- package/lib-cjs/component/panels/SummaryPanel/utilities/IsInView.js +18 -0
- package/lib-cjs/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +157 -19
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +24 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -4
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib-cjs/component/reducer/IgnoreActions.js +2 -1
- package/lib-cjs/component/reducer/Reducer.js +7 -8
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -2
- package/lib-cjs/component/reducer/actions/DomainActions.js +21 -1
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +22 -1
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib-cjs/component/reducer/actions/RangesActions.js +2 -0
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +2 -2
- package/lib-cjs/component/reducer/actions/ToolsActions.js +38 -34
- package/lib-cjs/component/reducer/actions/ZonesActions.js +35 -2
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +55 -73
- package/lib-cjs/component/reducer/preferencesReducer.js +12 -2
- package/lib-cjs/component/reducer/types/Types.js +6 -4
- package/lib-cjs/data/constants/DefaultPathLengths.js +10 -0
- package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +8 -0
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +18 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +14 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +36 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +21 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +1 -1
- package/lib/component/1d/utilities/useIntegralPath.js +0 -63
- package/lib/component/panels/SummaryPanel/Utilities.d.ts +0 -25
- package/lib/component/reducer/actions/Zoom.d.ts +0 -16
- package/lib/component/reducer/actions/Zoom.js +0 -92
- package/lib-cjs/component/1d/utilities/useIntegralPath.js +0 -66
- package/lib-cjs/component/reducer/actions/Zoom.js +0 -116
|
@@ -1,73 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return (id) => {
|
|
38
|
-
initZoomManager(Zoom1DObject, id, defaultScale);
|
|
39
|
-
return Zoom1DObject.scales[id];
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function prepareSetScale(Zoom1DObject, defaultScale) {
|
|
43
|
-
return (newScale, spectrumID) => {
|
|
44
|
-
initZoomManager(Zoom1DObject, spectrumID, defaultScale);
|
|
45
|
-
Zoom1DObject.scales[spectrumID] = newScale;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function prepareWheel(Zoom1DObject, defaultScale) {
|
|
49
|
-
return (deltaY, id) => {
|
|
50
|
-
initZoomManager(Zoom1DObject, id, defaultScale);
|
|
51
|
-
return wheel(Zoom1DObject, deltaY, id);
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function wheel(Zoom1DObject, deltaY, id) {
|
|
55
|
-
const { options: { slowZoomStep, fastZoomStep, speedThreshold }, } = Zoom1DObject;
|
|
56
|
-
const deltaYValue = Math.abs(deltaY).toString().length === 1
|
|
57
|
-
? Math.abs(deltaY)
|
|
58
|
-
: Math.abs(deltaY) / 100;
|
|
59
|
-
const LOW_STEP = 0.01 * slowZoomStep;
|
|
60
|
-
const FAST_STEP = 0.05 * fastZoomStep;
|
|
61
|
-
let ZOOM_STEP = deltaYValue <= speedThreshold ? LOW_STEP : FAST_STEP;
|
|
62
|
-
const direction = Math.sign(deltaY);
|
|
63
|
-
const _scale = direction === -1
|
|
64
|
-
? Zoom1DObject.scales[id] + ZOOM_STEP
|
|
65
|
-
: Zoom1DObject.scales[id] - ZOOM_STEP;
|
|
66
|
-
if (_scale >= 0) {
|
|
67
|
-
Zoom1DObject.scales[id] = _scale;
|
|
1
|
+
import { zoomIdentity, scaleLinear } from 'd3';
|
|
2
|
+
export const ZoomType = {
|
|
3
|
+
HORIZONTAL: 'HORIZONTAL',
|
|
4
|
+
VERTICAL: 'VERTICAL',
|
|
5
|
+
STEP_HORIZONTAL: 'STEP_HORIZONTAL',
|
|
6
|
+
FULL: 'FULL',
|
|
7
|
+
};
|
|
8
|
+
function wheelZoom(event, domain, zoomOptions = {}) {
|
|
9
|
+
const { factor = 1, invert = false } = zoomOptions;
|
|
10
|
+
const deltaY = Math.abs(event.deltaY) < 100 ? event.deltaY * 100 : event.deltaY;
|
|
11
|
+
const delta = deltaY * (invert ? -0.001 : 0.001) * factor;
|
|
12
|
+
const ratio = delta < 0 ? -1 / (delta - 1) : 1 + delta;
|
|
13
|
+
const [min, max] = domain;
|
|
14
|
+
return [min * ratio, max * ratio];
|
|
15
|
+
}
|
|
16
|
+
function setZoom(draft, options = {}) {
|
|
17
|
+
const { height, margin, activeSpectrum } = draft;
|
|
18
|
+
const { scale = 1, spectrumID = null } = options;
|
|
19
|
+
if (activeSpectrum === null && spectrumID === null) {
|
|
20
|
+
const { shareYDomain, yDomain, yDomains } = draft.originDomain;
|
|
21
|
+
draft.yDomains = Object.keys(draft.yDomains).reduce((acc, id) => {
|
|
22
|
+
const _scale = scaleLinear(shareYDomain ? yDomain : yDomains[id], [
|
|
23
|
+
height - margin.bottom,
|
|
24
|
+
margin.top,
|
|
25
|
+
]);
|
|
26
|
+
const [min, max] = shareYDomain ? yDomain : yDomains[id];
|
|
27
|
+
const maxPoint = Math.max(Math.abs(max), Math.abs(min));
|
|
28
|
+
const scalePoint = maxPoint === max ? 0 : min;
|
|
29
|
+
const t = zoomIdentity
|
|
30
|
+
.translate(0, Math.sign(scalePoint) >= 0 ? _scale(scalePoint) : _scale(scalePoint))
|
|
31
|
+
.scale(scale)
|
|
32
|
+
.translate(0, -_scale(0));
|
|
33
|
+
const newYDomain = t.rescaleY(_scale).domain();
|
|
34
|
+
acc[id] = newYDomain;
|
|
35
|
+
return acc;
|
|
36
|
+
}, {});
|
|
68
37
|
}
|
|
69
38
|
else {
|
|
70
|
-
|
|
39
|
+
const spectrumId = spectrumID || activeSpectrum?.id;
|
|
40
|
+
if (spectrumId) {
|
|
41
|
+
const _scale = scaleLinear(draft.originDomain.yDomains[spectrumId], [
|
|
42
|
+
height - margin.bottom,
|
|
43
|
+
margin.top,
|
|
44
|
+
]);
|
|
45
|
+
const t = zoomIdentity
|
|
46
|
+
.translate(0, _scale(0))
|
|
47
|
+
.scale(scale)
|
|
48
|
+
.translate(0, -_scale(0));
|
|
49
|
+
const yDomain = t.rescaleY(_scale).domain();
|
|
50
|
+
draft.yDomains = {
|
|
51
|
+
...draft.yDomains,
|
|
52
|
+
[spectrumId]: yDomain,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
71
55
|
}
|
|
72
|
-
return Zoom1DObject.scales[id];
|
|
73
56
|
}
|
|
57
|
+
export { setZoom, wheelZoom };
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
export declare const INIT_PREFERENCES = "INIT_PREFERENCES";
|
|
2
2
|
export declare const SET_PREFERENCES = "SET_PREFERENCES";
|
|
3
|
+
export declare const RESET_PREFERENCES = "RESET_PREFERENCES";
|
|
3
4
|
export declare const SET_PANELS_PREFERENCES = "SET_PANELS_PREFERENCES";
|
|
4
5
|
export interface PreferencesState {
|
|
5
6
|
basePreferences: any;
|
|
6
7
|
display: any;
|
|
7
8
|
controllers: {
|
|
8
|
-
mws: {
|
|
9
|
-
low: number;
|
|
10
|
-
high: number;
|
|
11
|
-
};
|
|
12
9
|
dimmedSpectraTransparency: number;
|
|
13
10
|
};
|
|
14
11
|
formatting: {
|
|
@@ -29,10 +26,6 @@ declare const preferencesReducer: (base: {
|
|
|
29
26
|
readonly basePreferences: any;
|
|
30
27
|
readonly display: any;
|
|
31
28
|
readonly controllers: {
|
|
32
|
-
readonly mws: {
|
|
33
|
-
readonly low: number;
|
|
34
|
-
readonly high: number;
|
|
35
|
-
};
|
|
36
29
|
readonly dimmedSpectraTransparency: number;
|
|
37
30
|
};
|
|
38
31
|
readonly formatting: {
|
|
@@ -5,6 +5,7 @@ import { getLocalStorage, removeData, storeData, } from '../utility/LocalStorage
|
|
|
5
5
|
import workspaces from '../workspaces';
|
|
6
6
|
export const INIT_PREFERENCES = 'INIT_PREFERENCES';
|
|
7
7
|
export const SET_PREFERENCES = 'SET_PREFERENCES';
|
|
8
|
+
export const RESET_PREFERENCES = 'RESET_PREFERENCES';
|
|
8
9
|
export const SET_PANELS_PREFERENCES = 'SET_PANELS_PREFERENCES';
|
|
9
10
|
const LOCAL_STORAGE_VERSION = 3;
|
|
10
11
|
function getPreferencesByWorkspace(workspace) {
|
|
@@ -21,7 +22,6 @@ export const preferencesInitialState = {
|
|
|
21
22
|
basePreferences: {},
|
|
22
23
|
display: workspaces.basic.display,
|
|
23
24
|
controllers: {
|
|
24
|
-
mws: { low: 2, high: 20 },
|
|
25
25
|
dimmedSpectraTransparency: 0.1,
|
|
26
26
|
},
|
|
27
27
|
formatting: {
|
|
@@ -135,6 +135,14 @@ function handleSetPanelsPreferences(draft, action) {
|
|
|
135
135
|
draft.formatting.panels[key] = value;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
+
function handleResetPreferences(draft) {
|
|
139
|
+
let localData = getLocalStorage('nmr-general-settings');
|
|
140
|
+
const hiddenFeatures = getTruthyObjectValues(draft.basePreferences.display);
|
|
141
|
+
const workSpaceDisplayPreferences = lodashMerge({}, getPreferencesByWorkspace(draft.workspace).display, hiddenFeatures);
|
|
142
|
+
localData.workspaces[draft.workspace].display = workSpaceDisplayPreferences;
|
|
143
|
+
draft.display = workSpaceDisplayPreferences;
|
|
144
|
+
storeData('nmr-general-settings', JSON.stringify(localData));
|
|
145
|
+
}
|
|
138
146
|
function innerPreferencesReducer(draft, action) {
|
|
139
147
|
switch (action.type) {
|
|
140
148
|
case INIT_PREFERENCES:
|
|
@@ -143,6 +151,8 @@ function innerPreferencesReducer(draft, action) {
|
|
|
143
151
|
return handleSetPreferences(draft, action);
|
|
144
152
|
case SET_PANELS_PREFERENCES:
|
|
145
153
|
return handleSetPanelsPreferences(draft, action);
|
|
154
|
+
case RESET_PREFERENCES:
|
|
155
|
+
return handleResetPreferences(draft);
|
|
146
156
|
default:
|
|
147
157
|
return draft;
|
|
148
158
|
}
|
|
@@ -27,7 +27,7 @@ export declare const CHANGE_SPECTRUM_COLOR = "CHANGE_SPECTRUM_COLOR";
|
|
|
27
27
|
export declare const ADD_INTEGRAL = "ADD_INTEGRAL";
|
|
28
28
|
export declare const DELETE_INTEGRAL = "DELETE_INTEGRAL";
|
|
29
29
|
export declare const TOGGLE_REAL_IMAGINARY_VISIBILITY = "TOGGLE_REAL_IMAGINARY_VISIBILITY";
|
|
30
|
-
export declare const
|
|
30
|
+
export declare const SET_ZOOM = "SET_ZOOM";
|
|
31
31
|
export declare const ADD_MOLECULE = "ADD_MOLECULE";
|
|
32
32
|
export declare const SET_MOLECULE = "SET_MOLECULE";
|
|
33
33
|
export declare const DELETE_MOLECULE = "DELETE_MOLECULE";
|
|
@@ -76,6 +76,7 @@ export declare const SET_2D_LEVEL = "SET_2D_LEVEL";
|
|
|
76
76
|
export declare const ADD_2D_ZONE = "ADD_2D_ZONE";
|
|
77
77
|
export declare const DELETE_2D_ZONE = "DELETE_2D_ZONE";
|
|
78
78
|
export declare const DELETE_2D_SIGNAL = "DELETE_2D_SIGNAL";
|
|
79
|
+
export declare const SET_2D_SIGNAL_PATH_LENGTH = "SET_2D_SIGNAL_PATH_LENGTH";
|
|
79
80
|
export declare const ADD_MISSING_PROJECTION = "ADD_MISSING_PROJECTION";
|
|
80
81
|
export declare const SET_FILTER_SNAPSHOT = "SET_FILTER_SNAPSHOT";
|
|
81
82
|
export declare const CHANGE_RANGE_RELATIVE = "CHANGE_RANGE_RELATIVE";
|
|
@@ -93,6 +94,7 @@ export declare const FILTER_SPECTRA_COLUMN = "FILTER_SPECTRA_COLUMN";
|
|
|
93
94
|
export declare const ALIGN_SPECTRA = "ALIGN_SPECTRA";
|
|
94
95
|
export declare const CHANGE_ZONE_SIGNAL_VALUE = "CHANGE_ZONE_SIGNAL_VALUE";
|
|
95
96
|
export declare const CHANGE_ZONE_SIGNAL_KIND = "CHANGE_ZONE_SIGNAL_KIND";
|
|
97
|
+
export declare const SAVE_EDITED_ZONE = "SAVE_EDITED_ZONE";
|
|
96
98
|
export declare const UNLINK_ZONE = "UNLINK_ZONE";
|
|
97
99
|
export declare const SET_DIAID_ZONE = "SET_DIAID_ZONE";
|
|
98
100
|
export declare const PREDICT_SPECTRA = "PREDICT_SPECTRA";
|
|
@@ -27,7 +27,7 @@ export const CHANGE_SPECTRUM_COLOR = 'CHANGE_SPECTRUM_COLOR';
|
|
|
27
27
|
export const ADD_INTEGRAL = 'ADD_INTEGRAL';
|
|
28
28
|
export const DELETE_INTEGRAL = 'DELETE_INTEGRAL';
|
|
29
29
|
export const TOGGLE_REAL_IMAGINARY_VISIBILITY = 'TOGGLE_REAL_IMAGINARY_VISIBILITY';
|
|
30
|
-
export const
|
|
30
|
+
export const SET_ZOOM = 'SET_ZOOM';
|
|
31
31
|
export const ADD_MOLECULE = 'ADD_MOLECULE';
|
|
32
32
|
export const SET_MOLECULE = 'SET_MOLECULE';
|
|
33
33
|
export const DELETE_MOLECULE = 'DELETE_MOLECULE';
|
|
@@ -76,6 +76,7 @@ export const SET_2D_LEVEL = 'SET_2D_LEVEL';
|
|
|
76
76
|
export const ADD_2D_ZONE = 'ADD_2D_ZONE';
|
|
77
77
|
export const DELETE_2D_ZONE = 'DELETE_2D_ZONE';
|
|
78
78
|
export const DELETE_2D_SIGNAL = 'DELETE_2D_SIGNAL';
|
|
79
|
+
export const SET_2D_SIGNAL_PATH_LENGTH = 'SET_2D_SIGNAL_PATH_LENGTH';
|
|
79
80
|
export const ADD_MISSING_PROJECTION = 'ADD_MISSING_PROJECTION';
|
|
80
81
|
export const SET_FILTER_SNAPSHOT = 'SET_FILTER_SNAPSHOT';
|
|
81
82
|
export const CHANGE_RANGE_RELATIVE = 'CHANGE_RANGE_RELATIVE';
|
|
@@ -93,6 +94,7 @@ export const FILTER_SPECTRA_COLUMN = 'FILTER_SPECTRA_COLUMN';
|
|
|
93
94
|
export const ALIGN_SPECTRA = 'ALIGN_SPECTRA';
|
|
94
95
|
export const CHANGE_ZONE_SIGNAL_VALUE = 'CHANGE_ZONE_SIGNAL_VALUE';
|
|
95
96
|
export const CHANGE_ZONE_SIGNAL_KIND = 'CHANGE_ZONE_SIGNAL_KIND';
|
|
97
|
+
export const SAVE_EDITED_ZONE = 'SAVE_EDITED_ZONE';
|
|
96
98
|
export const UNLINK_ZONE = 'UNLINK_ZONE';
|
|
97
99
|
export const SET_DIAID_ZONE = 'SET_DIAID_ZONE';
|
|
98
100
|
export const PREDICT_SPECTRA = 'PREDICT_SPECTRA';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
1
|
import * as FiltersTypes from '../../Filters';
|
|
3
2
|
import * as FiltersManager from '../../FiltersManager';
|
|
4
3
|
import generateID from '../../utilities/generateID';
|
|
5
4
|
import get1dColor from '../../utilities/getColor';
|
|
5
|
+
import { initiateIntegrals } from './integrals/initiateIntegrals';
|
|
6
|
+
import { initiatePeaks } from './peaks/initiatePeaks';
|
|
7
|
+
import { initiateRanges } from './ranges/initiateRanges';
|
|
6
8
|
export function initiateDatum1D(options, usedColors = {}) {
|
|
7
9
|
const datum = {};
|
|
8
10
|
datum.id = options.id || generateID();
|
|
@@ -35,27 +37,13 @@ export function initiateDatum1D(options, usedColors = {}) {
|
|
|
35
37
|
im: [],
|
|
36
38
|
}, options.data);
|
|
37
39
|
datum.originalData = datum.data;
|
|
38
|
-
datum.
|
|
40
|
+
datum.filters = Object.assign([], options.filters); //array of object {name: "FilterName", options: FilterOptions = {value | object} }
|
|
41
|
+
datum.peaks = initiatePeaks(options, datum);
|
|
39
42
|
// array of object {index: xIndex, xShift}
|
|
40
43
|
// in case the peak does not exactly correspond to the point value
|
|
41
44
|
// we can think about a second attributed `xShift`
|
|
42
|
-
datum.integrals =
|
|
43
|
-
|
|
44
|
-
options: {
|
|
45
|
-
sum: undefined,
|
|
46
|
-
isSumConstant: true,
|
|
47
|
-
sumAuto: true,
|
|
48
|
-
},
|
|
49
|
-
}, options.integrals); // array of object (from: xIndex, to: xIndex)
|
|
50
|
-
datum.filters = Object.assign([], options.filters); //array of object {name: "FilterName", options: FilterOptions = {value | object} }
|
|
51
|
-
datum.ranges = merge({
|
|
52
|
-
values: [],
|
|
53
|
-
options: {
|
|
54
|
-
sum: undefined,
|
|
55
|
-
isSumConstant: true,
|
|
56
|
-
sumAuto: true,
|
|
57
|
-
},
|
|
58
|
-
}, options.ranges);
|
|
45
|
+
datum.integrals = initiateIntegrals(options); // array of object (from: xIndex, to: xIndex)
|
|
46
|
+
datum.ranges = initiateRanges(options, datum);
|
|
59
47
|
//reapply filters after load the original data
|
|
60
48
|
FiltersManager.reapplyFilters(datum);
|
|
61
49
|
preprocessing(datum);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Integrals } from '../../../types/data1d';
|
|
2
|
+
export declare function initiateIntegrals(options: Partial<{
|
|
3
|
+
integrals: Integrals;
|
|
4
|
+
}>): {
|
|
5
|
+
values: never[];
|
|
6
|
+
options: {
|
|
7
|
+
sum: undefined;
|
|
8
|
+
isSumConstant: boolean;
|
|
9
|
+
sumAuto: boolean;
|
|
10
|
+
};
|
|
11
|
+
} & Integrals;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import median from 'ml-array-median';
|
|
2
2
|
import { xyAutoPeaksPicking } from 'nmr-processing';
|
|
3
|
-
import
|
|
4
|
-
import { getShiftX } from '../shift/getShiftX';
|
|
3
|
+
import { mapPeaks } from './mapPeaks';
|
|
5
4
|
export function autoPeakPicking(datum1D, options) {
|
|
6
5
|
const { minMaxRatio, maxNumberOfPeaks, noiseFactor, lookNegative, windowFromIndex, windowToIndex, } = options;
|
|
7
6
|
// we calculate the noise but this could be improved
|
|
8
7
|
const noise = median(datum1D.data.re.map((y) => Math.abs(y)));
|
|
9
8
|
let { re, x } = datum1D.data;
|
|
10
|
-
let { values: currentPeaks = [] } = datum1D.peaks || {};
|
|
11
9
|
if (windowFromIndex !== undefined && windowToIndex !== undefined) {
|
|
12
10
|
x = x.slice(windowFromIndex, windowToIndex);
|
|
13
11
|
re = re.slice(windowFromIndex, windowToIndex);
|
|
@@ -23,22 +21,5 @@ export function autoPeakPicking(datum1D, options) {
|
|
|
23
21
|
peaks.sort((a, b) => b.y - a.y);
|
|
24
22
|
if (maxNumberOfPeaks < peaks.length)
|
|
25
23
|
peaks = peaks.slice(0, maxNumberOfPeaks);
|
|
26
|
-
|
|
27
|
-
const error = (x[x.length - 1] - x[0]) / 10000;
|
|
28
|
-
return peaks.reduce((acc, newPeak) => {
|
|
29
|
-
// check if the peak is already exists
|
|
30
|
-
for (const { x } of currentPeaks) {
|
|
31
|
-
if (Math.abs(newPeak.x - x) < error) {
|
|
32
|
-
return acc;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
acc.push({
|
|
36
|
-
id: generateID(),
|
|
37
|
-
originalX: newPeak.x - shiftX,
|
|
38
|
-
x: newPeak.x,
|
|
39
|
-
y: newPeak.y,
|
|
40
|
-
width: newPeak.width,
|
|
41
|
-
});
|
|
42
|
-
return acc;
|
|
43
|
-
}, []);
|
|
24
|
+
return mapPeaks(peaks, datum1D);
|
|
44
25
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import generateID from '../../../utilities/generateID';
|
|
2
|
+
import { getSpectrumErrorValue } from '../getSpectrumErrorValue';
|
|
3
|
+
import { getShiftX } from '../shift/getShiftX';
|
|
4
|
+
function checkPeak(peak, datum, error) {
|
|
5
|
+
// check if the Peak is already exists
|
|
6
|
+
for (const { x } of datum.peaks?.values || []) {
|
|
7
|
+
if (Math.abs(peak.x - x) < error) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
export function mapPeaks(peaks, datum) {
|
|
14
|
+
const shiftX = getShiftX(datum);
|
|
15
|
+
const error = getSpectrumErrorValue(datum);
|
|
16
|
+
return peaks.reduce((acc, newPeak) => {
|
|
17
|
+
// check if the peak is already exists
|
|
18
|
+
if (checkPeak(newPeak, datum, error))
|
|
19
|
+
return acc;
|
|
20
|
+
acc.push({
|
|
21
|
+
id: newPeak?.id || generateID(),
|
|
22
|
+
originalX: newPeak.x - shiftX,
|
|
23
|
+
x: newPeak.x,
|
|
24
|
+
y: newPeak.y,
|
|
25
|
+
width: newPeak.width,
|
|
26
|
+
});
|
|
27
|
+
return acc;
|
|
28
|
+
}, []);
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Datum1D, Ranges } from '../../../types/data1d';
|
|
2
|
+
export declare function initiateRanges(options: Partial<{
|
|
3
|
+
ranges: Ranges;
|
|
4
|
+
}>, datum: Datum1D): {
|
|
5
|
+
values: never[];
|
|
6
|
+
options: {
|
|
7
|
+
sum: undefined;
|
|
8
|
+
isSumConstant: boolean;
|
|
9
|
+
sumAuto: boolean;
|
|
10
|
+
};
|
|
11
|
+
} & Ranges & {
|
|
12
|
+
values: import("../../../types/data1d").Range[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import merge from 'lodash/merge';
|
|
2
|
+
import { mapRanges } from './mapRanges';
|
|
3
|
+
export function initiateRanges(options, datum) {
|
|
4
|
+
return merge({
|
|
5
|
+
values: [],
|
|
6
|
+
options: {
|
|
7
|
+
sum: undefined,
|
|
8
|
+
isSumConstant: true,
|
|
9
|
+
sumAuto: true,
|
|
10
|
+
},
|
|
11
|
+
}, options.ranges, {
|
|
12
|
+
values: mapRanges(options?.ranges?.values || [], datum),
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { xyIntegration } from 'ml-spectra-processing';
|
|
2
2
|
import { DatumKind } from '../../../constants/SignalsKinds';
|
|
3
3
|
import generateID from '../../../utilities/generateID';
|
|
4
|
+
import { getSpectrumErrorValue } from '../getSpectrumErrorValue';
|
|
4
5
|
import { getShiftX } from '../shift/getShiftX';
|
|
6
|
+
function checkRange(range, datum, error) {
|
|
7
|
+
// check if the range is already exists
|
|
8
|
+
for (const { from, to } of datum.ranges?.values || []) {
|
|
9
|
+
if (Math.abs(range.from - from) < error &&
|
|
10
|
+
Math.abs(range.to - to) < error) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
5
15
|
export function mapRanges(ranges, datum) {
|
|
6
16
|
const { x, re } = datum.data;
|
|
7
17
|
const shiftX = getShiftX(datum);
|
|
8
|
-
const error = (
|
|
18
|
+
const error = getSpectrumErrorValue(datum);
|
|
9
19
|
return ranges.reduce((acc, newRange) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (Math.abs(newRange.from - from) < error &&
|
|
13
|
-
Math.abs(newRange.to - to) < error) {
|
|
14
|
-
return acc;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
20
|
+
if (checkRange(newRange, datum, error))
|
|
21
|
+
return acc;
|
|
17
22
|
const absolute = xyIntegration({ x, y: re }, { from: newRange.from, to: newRange.to, reverse: true });
|
|
18
23
|
const signals = newRange.signals.map((signal) => {
|
|
19
24
|
const { kind = null, id, ...resSignal } = signal;
|
package/lib/versionInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v0.
|
|
1
|
+
export default { version: 'v0.22.0' };
|
|
@@ -47,6 +47,5 @@ function ExclusionZonesAnnotations() {
|
|
|
47
47
|
}
|
|
48
48
|
exports.default = ExclusionZonesAnnotations;
|
|
49
49
|
function getExclusionZones(data) {
|
|
50
|
-
return (data.filters.find((filter) => filter.name === Filters.exclusionZones.id)
|
|
51
|
-
?.value || []);
|
|
50
|
+
return (data.filters.find((filter) => filter.name === Filters.exclusionZones.id && filter.flag)?.value || []);
|
|
52
51
|
}
|
|
@@ -4,26 +4,21 @@ 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
|
-
// import { xyReduce, xyIntegral } from 'ml-spectra-processing';
|
|
8
7
|
const react_1 = require("react");
|
|
9
|
-
const ChartContext_1 = require("../context/ChartContext");
|
|
10
8
|
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
9
|
+
const useIntegralPath_1 = __importDefault(require("../hooks/useIntegralPath"));
|
|
11
10
|
const defaultValues_1 = require("../panels/extra/preferences/defaultValues");
|
|
12
11
|
const LocalStorage_1 = require("../utility/LocalStorage");
|
|
13
12
|
const IntegralResizable_1 = __importDefault(require("./IntegralResizable"));
|
|
14
|
-
const useIntegralPath_1 = __importDefault(require("./utilities/useIntegralPath"));
|
|
15
13
|
function Integral({ integral, isActive }) {
|
|
16
14
|
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
17
15
|
const path = (0, useIntegralPath_1.default)(integral);
|
|
18
|
-
const { height, margin } = (0, ChartContext_1.useChartData)();
|
|
19
16
|
const integralSettings = (0, react_1.useMemo)(() => {
|
|
20
17
|
let { color = defaultValues_1.integralDefaultValues.color, strokeWidth = defaultValues_1.integralDefaultValues.strokeWidth, } = (0, LocalStorage_1.getValue)(preferences, 'formatting.panels.integrals') || {};
|
|
21
18
|
return { color, strokeWidth };
|
|
22
19
|
}, [preferences]);
|
|
23
20
|
return ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("path", { className: "line", stroke: integralSettings.color, strokeWidth: integralSettings.strokeWidth, fill: "none", style: {
|
|
24
|
-
transformOrigin: 'center top',
|
|
25
21
|
opacity: isActive ? 1 : 0.2,
|
|
26
|
-
transform: `translateY(-${margin.bottom + height * 0.3}px)`,
|
|
27
22
|
}, d: path }, void 0), (0, jsx_runtime_1.jsx)(IntegralResizable_1.default, { integralData: integral }, void 0)] }, void 0));
|
|
28
23
|
}
|
|
29
24
|
exports.default = Integral;
|
|
@@ -38,7 +38,7 @@ const Alert_1 = require("../elements/popup/Alert");
|
|
|
38
38
|
const Modal_1 = require("../elements/popup/Modal");
|
|
39
39
|
const Spinner_1 = __importDefault(require("../loader/Spinner"));
|
|
40
40
|
const MultipletAnalysisModal_1 = __importDefault(require("../modal/MultipletAnalysisModal"));
|
|
41
|
-
const
|
|
41
|
+
const Zoom1DManager_1 = require("../reducer/helper/Zoom1DManager");
|
|
42
42
|
const getRange_1 = __importDefault(require("../reducer/helper/getRange"));
|
|
43
43
|
const scaleReducer_1 = __importStar(require("../reducer/scaleReducer"));
|
|
44
44
|
const Types_1 = require("../reducer/types/Types");
|
|
@@ -187,7 +187,7 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
187
187
|
}, [
|
|
188
188
|
scaleState,
|
|
189
189
|
selectedTool,
|
|
190
|
-
general
|
|
190
|
+
general?.disableMultipletAnalysis,
|
|
191
191
|
modal,
|
|
192
192
|
data,
|
|
193
193
|
activeSpectrum,
|
|
@@ -196,10 +196,10 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
196
196
|
alert,
|
|
197
197
|
]);
|
|
198
198
|
const handelOnDoubleClick = (0, react_1.useCallback)(() => {
|
|
199
|
-
dispatch({ type: Types_1.FULL_ZOOM_OUT, zoomType:
|
|
199
|
+
dispatch({ type: Types_1.FULL_ZOOM_OUT, zoomType: Zoom1DManager_1.ZoomType.STEP_HORIZONTAL });
|
|
200
200
|
}, [dispatch]);
|
|
201
201
|
const handleZoom = (0, react_1.useCallback)((event) => {
|
|
202
|
-
dispatch({ type: Types_1.
|
|
202
|
+
dispatch({ type: Types_1.SET_ZOOM, event, selectedTool });
|
|
203
203
|
}, [dispatch, selectedTool]);
|
|
204
204
|
const mouseClick = (0, react_1.useCallback)((position) => {
|
|
205
205
|
const propagateEvent = () => {
|
|
@@ -4,13 +4,9 @@ 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
|
|
8
|
-
const useIntegralPath_1 = __importDefault(require("../utilities/useIntegralPath"));
|
|
7
|
+
const useIntegralPath_1 = __importDefault(require("../../hooks/useIntegralPath"));
|
|
9
8
|
function RangeIntegral({ range }) {
|
|
10
9
|
const path = (0, useIntegralPath_1.default)(range);
|
|
11
|
-
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)("path", { className: "line", stroke: "black", strokeWidth: "1", fill: "none", style: {
|
|
13
|
-
transform: `translateY(-${margin.bottom + height * 0.3}px)`,
|
|
14
|
-
}, d: path }, void 0));
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)("path", { className: "line", stroke: "black", strokeWidth: "1", fill: "none", d: path }, void 0));
|
|
15
11
|
}
|
|
16
12
|
exports.default = RangeIntegral;
|
|
@@ -25,13 +25,14 @@ function getYScale(state, spectrumId = null) {
|
|
|
25
25
|
return (0, d3_1.scaleLinear)(domainY, [_height, margin.top]);
|
|
26
26
|
}
|
|
27
27
|
exports.getYScale = getYScale;
|
|
28
|
-
function getIntegralYScale(state
|
|
29
|
-
const { height, margin, verticalAlign, integralsYDomains } = state;
|
|
28
|
+
function getIntegralYScale(state) {
|
|
29
|
+
const { height, margin, verticalAlign, integralsYDomains, activeSpectrum } = state;
|
|
30
30
|
const _height = verticalAlign.align === 'center' ? height / 2 : height;
|
|
31
|
-
return (0, d3_1.scaleLinear)(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
return (0, d3_1.scaleLinear)(activeSpectrum?.id &&
|
|
32
|
+
integralsYDomains &&
|
|
33
|
+
integralsYDomains[activeSpectrum?.id]
|
|
34
|
+
? integralsYDomains[activeSpectrum?.id]
|
|
35
|
+
: [0, 0], [_height * 0.3, margin.top + _height * 0.1]);
|
|
35
36
|
}
|
|
36
37
|
exports.getIntegralYScale = getIntegralYScale;
|
|
37
38
|
function reScaleY(scale, { domain, height, margin }) {
|
|
@@ -104,15 +104,15 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
104
104
|
dispatch({ type: Types_1.FULL_ZOOM_OUT, trackID });
|
|
105
105
|
}
|
|
106
106
|
}, [DIMENSION, dispatch]);
|
|
107
|
-
const handleZoom = (
|
|
108
|
-
const { x: startX, y: startY } =
|
|
107
|
+
const handleZoom = (event) => {
|
|
108
|
+
const { x: startX, y: startY } = event;
|
|
109
109
|
const trackID = (0, DimensionLayout_1.getLayoutID)(DIMENSION, { startX, startY });
|
|
110
110
|
if (trackID) {
|
|
111
111
|
if (trackID === 'CENTER_2D') {
|
|
112
|
-
dispatch({ type: Types_1.SET_2D_LEVEL, ...
|
|
112
|
+
dispatch({ type: Types_1.SET_2D_LEVEL, ...event });
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
|
-
dispatch({ type: Types_1.
|
|
115
|
+
dispatch({ type: Types_1.SET_ZOOM, event, trackID });
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
};
|