@zakodium/nmrium-core-plugins-ui 0.1.54 → 0.1.56
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/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.js +24 -5
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.js.map +1 -1
- package/package.json +5 -5
- package/src/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.tsx +33 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization_chart_svg.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAS/E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iCAAiC,CAAC,6CAA6C,CAAC,+
|
|
1
|
+
{"version":3,"file":"apodization_chart_svg.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAS/E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iCAAiC,CAAC,6CAA6C,CAAC,+BA2BxF"}
|
|
@@ -8,18 +8,36 @@ import { SVGPathBuilder } from 'react-science/ui';
|
|
|
8
8
|
export function ApodizationChartSVG(props) {
|
|
9
9
|
const { spectrum, operation, width, scaleX, scaleY, indicatorLineColor } = props;
|
|
10
10
|
castSpectrum1D(spectrum);
|
|
11
|
-
const { x } = spectrum.
|
|
11
|
+
const { x } = spectrum.originalData;
|
|
12
|
+
const isFid = spectrum.info.isFid;
|
|
12
13
|
const path = useApodizationPath({
|
|
13
14
|
x,
|
|
14
15
|
width,
|
|
15
16
|
scaleX,
|
|
16
17
|
scaleY,
|
|
17
18
|
shapes: operation.settings,
|
|
19
|
+
isFid,
|
|
18
20
|
});
|
|
19
21
|
return (_jsx("path", { "data-testid": "@zakodium/nmrium-core-plugins#apodization1D#indicator", stroke: indicatorLineColor, fill: "none", strokeWidth: "2", d: path.toString() }));
|
|
20
22
|
}
|
|
21
23
|
function useApodizationPath(props) {
|
|
22
|
-
const { x, width, scaleX, scaleY, shapes } = props;
|
|
24
|
+
const { x, width, scaleX, scaleY, shapes, isFid } = props;
|
|
25
|
+
const apodizationScaleX = useMemo(() => {
|
|
26
|
+
if (isFid)
|
|
27
|
+
return scaleX;
|
|
28
|
+
const scale = scaleX.copy();
|
|
29
|
+
const [x0, xn] = scale.domain();
|
|
30
|
+
return scale.domain([xn, x0]);
|
|
31
|
+
}, [isFid, scaleX]);
|
|
32
|
+
const apodizationScaleY = useMemo(() => {
|
|
33
|
+
const scale = scaleY.copy();
|
|
34
|
+
const [dmin, dmax] = scaleY.domain();
|
|
35
|
+
if (Math.abs(dmin) === Math.abs(dmax))
|
|
36
|
+
scale.domain([-1, 1]);
|
|
37
|
+
else
|
|
38
|
+
scale.domain([0, 1]);
|
|
39
|
+
return scale;
|
|
40
|
+
}, [scaleY]);
|
|
23
41
|
return useMemo(() => {
|
|
24
42
|
const builder = new SVGPathBuilder();
|
|
25
43
|
const from = x.at(-1);
|
|
@@ -33,11 +51,12 @@ function useApodizationPath(props) {
|
|
|
33
51
|
shapes,
|
|
34
52
|
});
|
|
35
53
|
const pathPoints = xyReduce({ x, y }, { from, to, nbPoints: width * 4, optimize: true });
|
|
36
|
-
builder.moveTo(
|
|
54
|
+
builder.moveTo(apodizationScaleX(pathPoints.x[0]), apodizationScaleY(pathPoints.y[0]));
|
|
37
55
|
for (let i = 1; i < pathPoints.x.length; i++) {
|
|
38
|
-
|
|
56
|
+
const { x, y } = pathPoints;
|
|
57
|
+
builder.lineTo(apodizationScaleX(x[i]), apodizationScaleY(y[i]));
|
|
39
58
|
}
|
|
40
59
|
return builder;
|
|
41
|
-
}, [x, shapes, width,
|
|
60
|
+
}, [x, shapes, width, apodizationScaleX, apodizationScaleY]);
|
|
42
61
|
}
|
|
43
62
|
//# sourceMappingURL=apodization_chart_svg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization_chart_svg.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,UAAU,mBAAmB,CACjC,KAAuF;IAEvF,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,GACtE,KAAK,CAAC;IACR,cAAc,CAAC,QAAQ,CAAC,CAAC;IACzB,MAAM,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"apodization_chart_svg.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EA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CAAC,CAAC,CAAC,CAAC,CAAC,EAClC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACnC,CAAC;QACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7C,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,UAAU,CAAC;YAE5B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAC/D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakodium/nmrium-core-plugins-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.56",
|
|
4
4
|
"license": "CC-BY-NC-SA-4.0",
|
|
5
5
|
"description": "UI related plugins needed for cheminfo/nmrium",
|
|
6
6
|
"keywords": [],
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"@emotion/react": "^11.14.0",
|
|
30
30
|
"@emotion/styled": "^11.14.1",
|
|
31
31
|
"@tanstack/react-form": "^1.33.4",
|
|
32
|
-
"@zakodium/nmrium-core": "^0.7.
|
|
33
|
-
"@zakodium/nmrium-core-plugins": "^0.7.
|
|
32
|
+
"@zakodium/nmrium-core": "^0.7.67",
|
|
33
|
+
"@zakodium/nmrium-core-plugins": "^0.7.90",
|
|
34
34
|
"@zakodium/utils": "^0.5.1",
|
|
35
35
|
"cheminfo-font": "^1.27.0",
|
|
36
36
|
"fifo-logger": "^2.0.1",
|
|
37
37
|
"ml-spectra-processing": "^14.33.0",
|
|
38
|
-
"nmr-processing": "^22.23.
|
|
38
|
+
"nmr-processing": "^22.23.7",
|
|
39
39
|
"react": "^18.3.1",
|
|
40
40
|
"react-dom": "^18.3.1",
|
|
41
41
|
"react-science": "^23.1.1",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"volta": {
|
|
53
53
|
"extends": "../../../package.json"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "c5a58ee18d54c3a0df8d976ae14431235fd3c590"
|
|
56
56
|
}
|
|
@@ -14,7 +14,9 @@ export function ApodizationChartSVG(
|
|
|
14
14
|
const { spectrum, operation, width, scaleX, scaleY, indicatorLineColor } =
|
|
15
15
|
props;
|
|
16
16
|
castSpectrum1D(spectrum);
|
|
17
|
-
const { x } = spectrum.
|
|
17
|
+
const { x } = spectrum.originalData;
|
|
18
|
+
|
|
19
|
+
const isFid = spectrum.info.isFid;
|
|
18
20
|
|
|
19
21
|
const path = useApodizationPath({
|
|
20
22
|
x,
|
|
@@ -22,6 +24,7 @@ export function ApodizationChartSVG(
|
|
|
22
24
|
scaleX,
|
|
23
25
|
scaleY,
|
|
24
26
|
shapes: operation.settings,
|
|
27
|
+
isFid,
|
|
25
28
|
});
|
|
26
29
|
|
|
27
30
|
return (
|
|
@@ -41,10 +44,30 @@ interface UseApodizationPathProps {
|
|
|
41
44
|
scaleX: ScaleLinear<number, number>;
|
|
42
45
|
scaleY: ScaleLinear<number, number>;
|
|
43
46
|
shapes: Shapes;
|
|
47
|
+
isFid: boolean;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
function useApodizationPath(props: UseApodizationPathProps) {
|
|
47
|
-
const { x, width, scaleX, scaleY, shapes } = props;
|
|
51
|
+
const { x, width, scaleX, scaleY, shapes, isFid } = props;
|
|
52
|
+
|
|
53
|
+
const apodizationScaleX = useMemo(() => {
|
|
54
|
+
if (isFid) return scaleX;
|
|
55
|
+
|
|
56
|
+
const scale = scaleX.copy();
|
|
57
|
+
const [x0, xn] = scale.domain();
|
|
58
|
+
|
|
59
|
+
return scale.domain([xn, x0]);
|
|
60
|
+
}, [isFid, scaleX]);
|
|
61
|
+
|
|
62
|
+
const apodizationScaleY = useMemo(() => {
|
|
63
|
+
const scale = scaleY.copy();
|
|
64
|
+
|
|
65
|
+
const [dmin, dmax] = scaleY.domain();
|
|
66
|
+
if (Math.abs(dmin) === Math.abs(dmax)) scale.domain([-1, 1]);
|
|
67
|
+
else scale.domain([0, 1]);
|
|
68
|
+
|
|
69
|
+
return scale;
|
|
70
|
+
}, [scaleY]);
|
|
48
71
|
|
|
49
72
|
return useMemo(() => {
|
|
50
73
|
const builder = new SVGPathBuilder();
|
|
@@ -67,11 +90,16 @@ function useApodizationPath(props: UseApodizationPathProps) {
|
|
|
67
90
|
{ from, to, nbPoints: width * 4, optimize: true },
|
|
68
91
|
);
|
|
69
92
|
|
|
70
|
-
builder.moveTo(
|
|
93
|
+
builder.moveTo(
|
|
94
|
+
apodizationScaleX(pathPoints.x[0]),
|
|
95
|
+
apodizationScaleY(pathPoints.y[0]),
|
|
96
|
+
);
|
|
71
97
|
for (let i = 1; i < pathPoints.x.length; i++) {
|
|
72
|
-
|
|
98
|
+
const { x, y } = pathPoints;
|
|
99
|
+
|
|
100
|
+
builder.lineTo(apodizationScaleX(x[i]), apodizationScaleY(y[i]));
|
|
73
101
|
}
|
|
74
102
|
|
|
75
103
|
return builder;
|
|
76
|
-
}, [x, shapes, width,
|
|
104
|
+
}, [x, shapes, width, apodizationScaleX, apodizationScaleY]);
|
|
77
105
|
}
|