pptx-react-viewer 3.7.0 → 3.9.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/CHANGELOG.md +21 -0
- package/dist/{AiChatPanel-M3AHKYPS.js → AiChatPanel-3A42W7RW.js} +25 -25
- package/dist/AiChatPanel-3A42W7RW.js.br +0 -0
- package/dist/AiChatPanel-3A42W7RW.js.gz +0 -0
- package/dist/{AiChatPanel-L5QGWVZK.mjs → AiChatPanel-II6VOOAL.mjs} +4 -4
- package/dist/AiChatPanel-II6VOOAL.mjs.br +0 -0
- package/dist/AiChatPanel-II6VOOAL.mjs.gz +0 -0
- package/dist/{Area3DChartScene-AE2XYKDW.mjs → Area3DChartScene-JM3CQ3WQ.mjs} +21 -4
- package/dist/Area3DChartScene-JM3CQ3WQ.mjs.br +0 -0
- package/dist/Area3DChartScene-JM3CQ3WQ.mjs.gz +0 -0
- package/dist/{Area3DChartScene-ZQLQK6L4.js → Area3DChartScene-XJK4ZA4R.js} +21 -4
- package/dist/Area3DChartScene-XJK4ZA4R.js.br +0 -0
- package/dist/Area3DChartScene-XJK4ZA4R.js.gz +0 -0
- package/dist/{Bar3DChartScene-TZ6ADFBS.js → Bar3DChartScene-RGRZY5P6.js} +21 -4
- package/dist/Bar3DChartScene-RGRZY5P6.js.br +0 -0
- package/dist/Bar3DChartScene-RGRZY5P6.js.gz +0 -0
- package/dist/{Bar3DChartScene-FQV62XOI.mjs → Bar3DChartScene-VNFWI2QG.mjs} +21 -4
- package/dist/Bar3DChartScene-VNFWI2QG.mjs.br +0 -0
- package/dist/Bar3DChartScene-VNFWI2QG.mjs.gz +0 -0
- package/dist/{Line3DChartScene-FEUY3PCE.mjs → Line3DChartScene-GXOWGIFJ.mjs} +21 -4
- package/dist/Line3DChartScene-GXOWGIFJ.mjs.br +0 -0
- package/dist/Line3DChartScene-GXOWGIFJ.mjs.gz +0 -0
- package/dist/{Line3DChartScene-5CKPAX63.js → Line3DChartScene-MEY42DBF.js} +21 -4
- package/dist/Line3DChartScene-MEY42DBF.js.br +0 -0
- package/dist/Line3DChartScene-MEY42DBF.js.gz +0 -0
- package/dist/{Model3DScene-BLXEALM6.js → Model3DScene-MWXTGHDM.js} +2 -2
- package/dist/Model3DScene-MWXTGHDM.js.br +0 -0
- package/dist/Model3DScene-MWXTGHDM.js.gz +0 -0
- package/dist/{Model3DScene-V3DHIISV.mjs → Model3DScene-WJ3MMIZH.mjs} +1 -1
- package/dist/Model3DScene-WJ3MMIZH.mjs.br +0 -0
- package/dist/Model3DScene-WJ3MMIZH.mjs.gz +0 -0
- package/dist/{PieChart3DScene-GHHT3PDV.js → PieChart3DScene-FJJGOQIS.js} +15 -4
- package/dist/PieChart3DScene-FJJGOQIS.js.br +0 -0
- package/dist/PieChart3DScene-FJJGOQIS.js.gz +0 -0
- package/dist/{PieChart3DScene-VZI2VARG.mjs → PieChart3DScene-WXJEDYMK.mjs} +15 -4
- package/dist/PieChart3DScene-WXJEDYMK.mjs.br +0 -0
- package/dist/PieChart3DScene-WXJEDYMK.mjs.gz +0 -0
- package/dist/PowerPointViewer-Cl6jBPNw.d.ts.map +1 -1
- package/dist/{SmartArt3DScene-ZO3KFDI2.js → SmartArt3DScene-BK7QN3WT.js} +85 -23
- package/dist/SmartArt3DScene-BK7QN3WT.js.br +0 -0
- package/dist/SmartArt3DScene-BK7QN3WT.js.gz +0 -0
- package/dist/{SmartArt3DScene-XCFVGCXE.mjs → SmartArt3DScene-ODKCGJBO.mjs} +85 -23
- package/dist/SmartArt3DScene-ODKCGJBO.mjs.br +0 -0
- package/dist/SmartArt3DScene-ODKCGJBO.mjs.gz +0 -0
- package/dist/{SurfaceChart3DScene-T36E2HBA.mjs → SurfaceChart3DScene-IKPE2SVE.mjs} +19 -4
- package/dist/SurfaceChart3DScene-IKPE2SVE.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-IKPE2SVE.mjs.gz +0 -0
- package/dist/{SurfaceChart3DScene-WWIMQ65D.js → SurfaceChart3DScene-VDK3F224.js} +19 -4
- package/dist/SurfaceChart3DScene-VDK3F224.js.br +0 -0
- package/dist/SurfaceChart3DScene-VDK3F224.js.gz +0 -0
- package/dist/{audience-content-store-bR7Gs_1S.d.ts → audience-content-store-CB2WVM1K.d.ts} +12 -3
- package/dist/{audience-content-store-bR7Gs_1S.d.ts.map → audience-content-store-CB2WVM1K.d.ts.map} +1 -1
- package/dist/{chunk-TUSALM3A.js → chunk-3NIJ5HIZ.js} +3650 -2503
- package/dist/chunk-3NIJ5HIZ.js.br +0 -0
- package/dist/chunk-3NIJ5HIZ.js.gz +0 -0
- package/dist/{chunk-WKODF5ZU.mjs → chunk-3Y63XPIN.mjs} +5 -2
- package/dist/chunk-3Y63XPIN.mjs.br +0 -0
- package/dist/chunk-3Y63XPIN.mjs.gz +0 -0
- package/dist/{chunk-OBE4TB76.js → chunk-5CPGDXD6.js} +632 -579
- package/dist/chunk-5CPGDXD6.js.br +0 -0
- package/dist/chunk-5CPGDXD6.js.gz +0 -0
- package/dist/{chunk-TXY2E7VQ.mjs → chunk-76Z3X6JX.mjs} +1684 -537
- package/dist/chunk-76Z3X6JX.mjs.br +0 -0
- package/dist/chunk-76Z3X6JX.mjs.gz +0 -0
- package/dist/chunk-DNR6CH6I.js +30 -0
- package/dist/chunk-DNR6CH6I.js.br +0 -0
- package/dist/chunk-DNR6CH6I.js.gz +0 -0
- package/dist/{chunk-DCNHUEWQ.js → chunk-G3JPCRKN.js} +18490 -10327
- package/dist/chunk-G3JPCRKN.js.br +0 -0
- package/dist/chunk-G3JPCRKN.js.gz +0 -0
- package/dist/{chunk-FGTMS7LR.mjs → chunk-JBSAKP4Z.mjs} +70 -4
- package/dist/chunk-JBSAKP4Z.mjs.br +0 -0
- package/dist/chunk-JBSAKP4Z.mjs.gz +0 -0
- package/dist/{chunk-3EJFZ7TE.js → chunk-K6Q6KLA6.js} +9 -5
- package/dist/chunk-K6Q6KLA6.js.br +0 -0
- package/dist/chunk-K6Q6KLA6.js.gz +0 -0
- package/dist/{chunk-VIFDZIVX.js → chunk-LBJAVP3H.js} +206 -179
- package/dist/chunk-LBJAVP3H.js.br +0 -0
- package/dist/chunk-LBJAVP3H.js.gz +0 -0
- package/dist/{chunk-JANUSAEK.mjs → chunk-NTWFXLZX.mjs} +35 -8
- package/dist/chunk-NTWFXLZX.mjs.br +0 -0
- package/dist/chunk-NTWFXLZX.mjs.gz +0 -0
- package/dist/{chunk-PC62KGU3.mjs → chunk-PCCM7NVY.mjs} +206 -153
- package/dist/chunk-PCCM7NVY.mjs.br +0 -0
- package/dist/chunk-PCCM7NVY.mjs.gz +0 -0
- package/dist/chunk-T6GFCLSM.mjs +27 -0
- package/dist/chunk-T6GFCLSM.mjs.br +4 -0
- package/dist/chunk-T6GFCLSM.mjs.gz +0 -0
- package/dist/{chunk-W24OJ7H5.js → chunk-TEVGDXVW.js} +70 -4
- package/dist/chunk-TEVGDXVW.js.br +0 -0
- package/dist/chunk-TEVGDXVW.js.gz +0 -0
- package/dist/{chunk-NV55GU5V.mjs → chunk-VQX7G75Z.mjs} +18447 -10316
- package/dist/chunk-VQX7G75Z.mjs.br +0 -0
- package/dist/chunk-VQX7G75Z.mjs.gz +0 -0
- package/dist/i18n.js +4 -4
- package/dist/i18n.js.br +0 -0
- package/dist/i18n.js.gz +0 -0
- package/dist/i18n.mjs +1 -1
- package/dist/i18n.mjs.br +0 -0
- package/dist/i18n.mjs.gz +0 -0
- package/dist/index.d.ts +545 -81
- package/dist/index.js +47 -47
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +774 -229
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +79 -79
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +4 -4
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/pptx-viewer.css +1 -1
- package/dist/pptx-viewer.css.br +0 -0
- package/dist/pptx-viewer.css.gz +0 -0
- package/dist/types-Bzdkiakq.d.ts.map +1 -1
- package/dist/viewer/index.d.ts +488 -66
- package/dist/viewer/index.js +27 -27
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +6 -6
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +2 -2
- package/dist/AiChatPanel-L5QGWVZK.mjs.br +0 -0
- package/dist/AiChatPanel-L5QGWVZK.mjs.gz +0 -0
- package/dist/AiChatPanel-M3AHKYPS.js.br +0 -0
- package/dist/AiChatPanel-M3AHKYPS.js.gz +0 -0
- package/dist/Area3DChartScene-AE2XYKDW.mjs.br +0 -1
- package/dist/Area3DChartScene-AE2XYKDW.mjs.gz +0 -0
- package/dist/Area3DChartScene-ZQLQK6L4.js.br +0 -0
- package/dist/Area3DChartScene-ZQLQK6L4.js.gz +0 -0
- package/dist/Bar3DChartScene-FQV62XOI.mjs.br +0 -2
- package/dist/Bar3DChartScene-FQV62XOI.mjs.gz +0 -0
- package/dist/Bar3DChartScene-TZ6ADFBS.js.br +0 -0
- package/dist/Bar3DChartScene-TZ6ADFBS.js.gz +0 -0
- package/dist/Line3DChartScene-5CKPAX63.js.br +0 -0
- package/dist/Line3DChartScene-5CKPAX63.js.gz +0 -0
- package/dist/Line3DChartScene-FEUY3PCE.mjs.br +0 -1
- package/dist/Line3DChartScene-FEUY3PCE.mjs.gz +0 -0
- package/dist/Model3DScene-BLXEALM6.js.br +0 -0
- package/dist/Model3DScene-BLXEALM6.js.gz +0 -0
- package/dist/Model3DScene-V3DHIISV.mjs.br +0 -0
- package/dist/Model3DScene-V3DHIISV.mjs.gz +0 -0
- package/dist/PieChart3DScene-GHHT3PDV.js.br +0 -0
- package/dist/PieChart3DScene-GHHT3PDV.js.gz +0 -0
- package/dist/PieChart3DScene-VZI2VARG.mjs.br +0 -0
- package/dist/PieChart3DScene-VZI2VARG.mjs.gz +0 -0
- package/dist/SmartArt3DScene-XCFVGCXE.mjs.br +0 -0
- package/dist/SmartArt3DScene-XCFVGCXE.mjs.gz +0 -0
- package/dist/SmartArt3DScene-ZO3KFDI2.js.br +0 -0
- package/dist/SmartArt3DScene-ZO3KFDI2.js.gz +0 -0
- package/dist/SurfaceChart3DScene-T36E2HBA.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-T36E2HBA.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-WWIMQ65D.js.br +0 -0
- package/dist/SurfaceChart3DScene-WWIMQ65D.js.gz +0 -0
- package/dist/chunk-3EJFZ7TE.js.br +0 -0
- package/dist/chunk-3EJFZ7TE.js.gz +0 -0
- package/dist/chunk-DCNHUEWQ.js.br +0 -0
- package/dist/chunk-DCNHUEWQ.js.gz +0 -0
- package/dist/chunk-FGTMS7LR.mjs.br +0 -0
- package/dist/chunk-FGTMS7LR.mjs.gz +0 -0
- package/dist/chunk-JANUSAEK.mjs.br +0 -0
- package/dist/chunk-JANUSAEK.mjs.gz +0 -0
- package/dist/chunk-NV55GU5V.mjs.br +0 -0
- package/dist/chunk-NV55GU5V.mjs.gz +0 -0
- package/dist/chunk-OBE4TB76.js.br +0 -0
- package/dist/chunk-OBE4TB76.js.gz +0 -0
- package/dist/chunk-PC62KGU3.mjs.br +0 -0
- package/dist/chunk-PC62KGU3.mjs.gz +0 -0
- package/dist/chunk-TUSALM3A.js.br +0 -0
- package/dist/chunk-TUSALM3A.js.gz +0 -0
- package/dist/chunk-TXY2E7VQ.mjs.br +0 -0
- package/dist/chunk-TXY2E7VQ.mjs.gz +0 -0
- package/dist/chunk-VIFDZIVX.js.br +0 -0
- package/dist/chunk-VIFDZIVX.js.gz +0 -0
- package/dist/chunk-W24OJ7H5.js.br +0 -0
- package/dist/chunk-W24OJ7H5.js.gz +0 -0
- package/dist/chunk-WKODF5ZU.mjs.br +0 -0
- package/dist/chunk-WKODF5ZU.mjs.gz +0 -0
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDNR6CH6I_js = require('./chunk-DNR6CH6I.js');
|
|
4
|
+
var chunkG3JPCRKN_js = require('./chunk-G3JPCRKN.js');
|
|
4
5
|
require('./chunk-4VNS5WPM.js');
|
|
5
6
|
var react = require('react');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
|
|
8
|
-
function PieChart3DScene({
|
|
9
|
+
function PieChart3DScene({
|
|
10
|
+
options,
|
|
11
|
+
interaction,
|
|
12
|
+
selectedPart = null
|
|
13
|
+
}) {
|
|
9
14
|
const containerRef = react.useRef(null);
|
|
10
15
|
const handleRef = react.useRef(null);
|
|
16
|
+
const stableInteraction = chunkDNR6CH6I_js.useStableChart3DInteraction(interaction);
|
|
17
|
+
const selectedPartRef = chunkDNR6CH6I_js.useLatestRef(selectedPart);
|
|
11
18
|
react.useEffect(() => {
|
|
12
19
|
const container = containerRef.current;
|
|
13
20
|
if (!container) {
|
|
14
21
|
return;
|
|
15
22
|
}
|
|
16
23
|
let disposed = false;
|
|
17
|
-
void
|
|
24
|
+
void chunkG3JPCRKN_js.mountPieChart3D(container, options, stableInteraction).then((handle) => {
|
|
18
25
|
if (disposed) {
|
|
19
26
|
handle.dispose();
|
|
20
27
|
} else {
|
|
21
28
|
handleRef.current = handle;
|
|
29
|
+
handle.setSelectedPart(selectedPartRef.current);
|
|
22
30
|
}
|
|
23
31
|
return void 0;
|
|
24
32
|
});
|
|
@@ -27,10 +35,13 @@ function PieChart3DScene({ options }) {
|
|
|
27
35
|
handleRef.current?.dispose();
|
|
28
36
|
handleRef.current = null;
|
|
29
37
|
};
|
|
30
|
-
}, [options]);
|
|
38
|
+
}, [options, stableInteraction]);
|
|
31
39
|
react.useEffect(() => {
|
|
32
40
|
handleRef.current?.resize(options.width, options.height);
|
|
33
41
|
}, [options.width, options.height]);
|
|
42
|
+
react.useEffect(() => {
|
|
43
|
+
handleRef.current?.setSelectedPart(selectedPart);
|
|
44
|
+
}, [selectedPart]);
|
|
34
45
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
35
46
|
"div",
|
|
36
47
|
{
|
|
Binary file
|
|
Binary file
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useStableChart3DInteraction, useLatestRef } from './chunk-T6GFCLSM.mjs';
|
|
2
|
+
import { mountPieChart3D } from './chunk-VQX7G75Z.mjs';
|
|
2
3
|
import './chunk-XGB3TDIC.mjs';
|
|
3
4
|
import { useRef, useEffect } from 'react';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
|
-
function PieChart3DScene({
|
|
7
|
+
function PieChart3DScene({
|
|
8
|
+
options,
|
|
9
|
+
interaction,
|
|
10
|
+
selectedPart = null
|
|
11
|
+
}) {
|
|
7
12
|
const containerRef = useRef(null);
|
|
8
13
|
const handleRef = useRef(null);
|
|
14
|
+
const stableInteraction = useStableChart3DInteraction(interaction);
|
|
15
|
+
const selectedPartRef = useLatestRef(selectedPart);
|
|
9
16
|
useEffect(() => {
|
|
10
17
|
const container = containerRef.current;
|
|
11
18
|
if (!container) {
|
|
12
19
|
return;
|
|
13
20
|
}
|
|
14
21
|
let disposed = false;
|
|
15
|
-
void mountPieChart3D(container, options).then((handle) => {
|
|
22
|
+
void mountPieChart3D(container, options, stableInteraction).then((handle) => {
|
|
16
23
|
if (disposed) {
|
|
17
24
|
handle.dispose();
|
|
18
25
|
} else {
|
|
19
26
|
handleRef.current = handle;
|
|
27
|
+
handle.setSelectedPart(selectedPartRef.current);
|
|
20
28
|
}
|
|
21
29
|
return void 0;
|
|
22
30
|
});
|
|
@@ -25,10 +33,13 @@ function PieChart3DScene({ options }) {
|
|
|
25
33
|
handleRef.current?.dispose();
|
|
26
34
|
handleRef.current = null;
|
|
27
35
|
};
|
|
28
|
-
}, [options]);
|
|
36
|
+
}, [options, stableInteraction]);
|
|
29
37
|
useEffect(() => {
|
|
30
38
|
handleRef.current?.resize(options.width, options.height);
|
|
31
39
|
}, [options.width, options.height]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
handleRef.current?.setSelectedPart(selectedPart);
|
|
42
|
+
}, [selectedPart]);
|
|
32
43
|
return /* @__PURE__ */ jsx(
|
|
33
44
|
"div",
|
|
34
45
|
{
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerPointViewer-Cl6jBPNw.d.ts","names":[],"sources":["../src/viewer/utils/animation-effects.ts","../src/viewer/PowerPointViewer.tsx"],"mappings":";;;;;iBAmBgB,yBACf,QAAQ,iCACR,kBAAkB,sBAChB,MAAM;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PowerPointViewer-Cl6jBPNw.d.ts","names":[],"sources":["../src/viewer/utils/animation-effects.ts","../src/viewer/PowerPointViewer.tsx"],"mappings":";;;;;iBAmBgB,yBACf,QAAQ,iCACR,kBAAkB,sBAChB,MAAM;;;;;;;;;;;;cCgII,kCAAgB,0BAAA,wCAAA,cAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkDNR6CH6I_js = require('./chunk-DNR6CH6I.js');
|
|
3
4
|
var chunk6C2WYLZY_js = require('./chunk-6C2WYLZY.js');
|
|
4
5
|
var chunkB4QYQLZU_js = require('./chunk-B4QYQLZU.js');
|
|
5
6
|
require('./chunk-4VNS5WPM.js');
|
|
@@ -28,10 +29,17 @@ function wrapLines(ctx, text, maxWidth) {
|
|
|
28
29
|
lines.push(line);
|
|
29
30
|
return lines;
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function resolveEmphasisFont(color, emphasis) {
|
|
33
|
+
const weight = emphasis?.bold === void 0 ? "600" : emphasis.bold ? "700" : "400";
|
|
34
|
+
const italic = emphasis?.italic ? "italic " : "";
|
|
35
|
+
const scale = typeof emphasis?.fontScale === "number" && Number.isFinite(emphasis.fontScale) && emphasis.fontScale > 0 ? emphasis.fontScale : 1;
|
|
36
|
+
return { weight, italic, color: emphasis?.color ?? color, scale };
|
|
37
|
+
}
|
|
38
|
+
function makeTextTexture(text, color, fontSize, footW, footH, emphasis) {
|
|
32
39
|
if (typeof document === "undefined" || !text.trim() || footW <= 0 || footH <= 0) {
|
|
33
40
|
return null;
|
|
34
41
|
}
|
|
42
|
+
const { weight, italic, color: effectiveColor, scale } = resolveEmphasisFont(color, emphasis);
|
|
35
43
|
const worldWidth = footW * FILL;
|
|
36
44
|
const worldHeight = footH * FILL;
|
|
37
45
|
const canvas = document.createElement("canvas");
|
|
@@ -43,10 +51,11 @@ function makeTextTexture(text, color, fontSize, footW, footH) {
|
|
|
43
51
|
}
|
|
44
52
|
const family = "system-ui, -apple-system, Segoe UI, Roboto, sans-serif";
|
|
45
53
|
const maxTextWidth = canvas.width * 0.94;
|
|
46
|
-
|
|
54
|
+
const fontString = (px2) => `${italic}${weight} ${px2}px ${family}`;
|
|
55
|
+
let px = Math.max(6, fontSize) * scale * SUPERSAMPLE;
|
|
47
56
|
let lines = [];
|
|
48
57
|
for (let attempt = 0; attempt < 12; attempt++) {
|
|
49
|
-
ctx.font =
|
|
58
|
+
ctx.font = fontString(px);
|
|
50
59
|
lines = wrapLines(ctx, text, maxTextWidth);
|
|
51
60
|
const lineHeight2 = px * 1.2;
|
|
52
61
|
if (lines.length * lineHeight2 <= canvas.height * 0.96 || px <= 6 * SUPERSAMPLE) {
|
|
@@ -55,15 +64,25 @@ function makeTextTexture(text, color, fontSize, footW, footH) {
|
|
|
55
64
|
px *= 0.88;
|
|
56
65
|
}
|
|
57
66
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
58
|
-
ctx.fillStyle =
|
|
67
|
+
ctx.fillStyle = effectiveColor;
|
|
59
68
|
ctx.textAlign = "center";
|
|
60
69
|
ctx.textBaseline = "middle";
|
|
61
|
-
ctx.font =
|
|
70
|
+
ctx.font = fontString(px);
|
|
62
71
|
const lineHeight = px * 1.2;
|
|
63
72
|
const blockHeight = lines.length * lineHeight;
|
|
64
73
|
const startY = canvas.height / 2 - blockHeight / 2 + lineHeight / 2;
|
|
65
74
|
for (let i = 0; i < lines.length; i++) {
|
|
66
|
-
|
|
75
|
+
const y = startY + i * lineHeight;
|
|
76
|
+
ctx.fillText(lines[i], canvas.width / 2, y);
|
|
77
|
+
if (emphasis?.underline) {
|
|
78
|
+
const w = ctx.measureText(lines[i]).width;
|
|
79
|
+
ctx.strokeStyle = effectiveColor;
|
|
80
|
+
ctx.lineWidth = Math.max(1, px * 0.06);
|
|
81
|
+
ctx.beginPath();
|
|
82
|
+
ctx.moveTo(canvas.width / 2 - w / 2, y + px * 0.32);
|
|
83
|
+
ctx.lineTo(canvas.width / 2 + w / 2, y + px * 0.32);
|
|
84
|
+
ctx.stroke();
|
|
85
|
+
}
|
|
67
86
|
}
|
|
68
87
|
const texture = new chunkB4QYQLZU_js.CanvasTexture(canvas);
|
|
69
88
|
texture.colorSpace = chunkB4QYQLZU_js.SRGBColorSpace;
|
|
@@ -123,13 +142,20 @@ function addBlock(group, disposables, m) {
|
|
|
123
142
|
}
|
|
124
143
|
return geo;
|
|
125
144
|
}
|
|
126
|
-
function
|
|
145
|
+
function buildLabelPlane(m, textStyle) {
|
|
127
146
|
if (!m.text) {
|
|
128
|
-
return;
|
|
147
|
+
return null;
|
|
129
148
|
}
|
|
130
|
-
const tex = makeTextTexture(
|
|
149
|
+
const tex = makeTextTexture(
|
|
150
|
+
m.text,
|
|
151
|
+
m.textColor,
|
|
152
|
+
m.fontSize,
|
|
153
|
+
m.halfWidth * 2,
|
|
154
|
+
m.halfHeight * 2,
|
|
155
|
+
textStyle
|
|
156
|
+
);
|
|
131
157
|
if (!tex) {
|
|
132
|
-
return;
|
|
158
|
+
return null;
|
|
133
159
|
}
|
|
134
160
|
const planeGeo = new chunkB4QYQLZU_js.PlaneGeometry(tex.worldWidth, tex.worldHeight);
|
|
135
161
|
const planeMaterial = new chunkB4QYQLZU_js.MeshBasicMaterial({
|
|
@@ -142,8 +168,7 @@ function addLabel(group, disposables, m) {
|
|
|
142
168
|
const offset = new chunkB4QYQLZU_js.Vector3(0, 0, m.depth + m.bevel + 0.4).applyEuler(euler);
|
|
143
169
|
plane.position.set(m.position.x + offset.x, m.position.y + offset.y, m.position.z + offset.z);
|
|
144
170
|
plane.rotation.copy(euler);
|
|
145
|
-
|
|
146
|
-
disposables.push(planeGeo, planeMaterial, tex.texture);
|
|
171
|
+
return { plane, disposables: [planeGeo, planeMaterial, tex.texture] };
|
|
147
172
|
}
|
|
148
173
|
function addConnectors(group, disposables, model) {
|
|
149
174
|
for (const c of model.connectors) {
|
|
@@ -160,20 +185,48 @@ function addConnectors(group, disposables, model) {
|
|
|
160
185
|
disposables.push(geo, material);
|
|
161
186
|
}
|
|
162
187
|
}
|
|
163
|
-
function
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
for (const m of model.meshes) {
|
|
167
|
-
addBlock(group, disposables, m);
|
|
168
|
-
addLabel(group, disposables, m);
|
|
188
|
+
function clearLabel(group, entry) {
|
|
189
|
+
if (entry.plane) {
|
|
190
|
+
group.remove(entry.plane);
|
|
169
191
|
}
|
|
170
|
-
|
|
192
|
+
for (const d of entry.disposables) {
|
|
193
|
+
d.dispose();
|
|
194
|
+
}
|
|
195
|
+
entry.plane = null;
|
|
196
|
+
entry.disposables = [];
|
|
197
|
+
}
|
|
198
|
+
function buildMeshGroup(model, textStyle) {
|
|
199
|
+
const group = new chunkB4QYQLZU_js.Group();
|
|
200
|
+
const blockDisposables = [];
|
|
201
|
+
const labelEntries = model.meshes.map((m) => {
|
|
202
|
+
addBlock(group, blockDisposables, m);
|
|
203
|
+
const built = buildLabelPlane(m, textStyle);
|
|
204
|
+
if (built) {
|
|
205
|
+
group.add(built.plane);
|
|
206
|
+
}
|
|
207
|
+
return { node: m, plane: built?.plane ?? null, disposables: built?.disposables ?? [] };
|
|
208
|
+
});
|
|
209
|
+
addConnectors(group, blockDisposables, model);
|
|
171
210
|
return {
|
|
172
211
|
group,
|
|
212
|
+
setTextStyle(style) {
|
|
213
|
+
for (const entry of labelEntries) {
|
|
214
|
+
clearLabel(group, entry);
|
|
215
|
+
const built = buildLabelPlane(entry.node, style);
|
|
216
|
+
if (built) {
|
|
217
|
+
group.add(built.plane);
|
|
218
|
+
entry.plane = built.plane;
|
|
219
|
+
entry.disposables = built.disposables;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
173
223
|
dispose() {
|
|
174
|
-
for (const d of
|
|
224
|
+
for (const d of blockDisposables) {
|
|
175
225
|
d.dispose();
|
|
176
226
|
}
|
|
227
|
+
for (const entry of labelEntries) {
|
|
228
|
+
clearLabel(group, entry);
|
|
229
|
+
}
|
|
177
230
|
}
|
|
178
231
|
};
|
|
179
232
|
}
|
|
@@ -245,7 +298,7 @@ function mountSmartArt3D(canvas, model, width, height, options = {}) {
|
|
|
245
298
|
const fill = new chunkB4QYQLZU_js.DirectionalLight(16777215, 0.3);
|
|
246
299
|
fill.position.set(cx - radius, cy - radius * 0.6, cz + dist * 0.6);
|
|
247
300
|
scene.add(fill);
|
|
248
|
-
const built = buildMeshGroup(model);
|
|
301
|
+
const built = buildMeshGroup(model, options.textStyle);
|
|
249
302
|
scene.add(built.group);
|
|
250
303
|
let controls = null;
|
|
251
304
|
const enableControls = (on) => {
|
|
@@ -286,6 +339,9 @@ function mountSmartArt3D(canvas, model, width, height, options = {}) {
|
|
|
286
339
|
setInteractive(on) {
|
|
287
340
|
enableControls(on);
|
|
288
341
|
},
|
|
342
|
+
setTextStyle(style) {
|
|
343
|
+
built.setTextStyle(style);
|
|
344
|
+
},
|
|
289
345
|
dispose() {
|
|
290
346
|
disposed = true;
|
|
291
347
|
cancelAnimationFrame(frame);
|
|
@@ -299,17 +355,20 @@ function SmartArt3DScene({
|
|
|
299
355
|
model,
|
|
300
356
|
width,
|
|
301
357
|
height,
|
|
302
|
-
interactive
|
|
358
|
+
interactive,
|
|
359
|
+
textStyle
|
|
303
360
|
}) {
|
|
304
361
|
const canvasRef = react.useRef(null);
|
|
305
362
|
const handleRef = react.useRef(null);
|
|
363
|
+
const textStyleRef = chunkDNR6CH6I_js.useLatestRef(textStyle);
|
|
306
364
|
react.useEffect(() => {
|
|
307
365
|
const canvas = canvasRef.current;
|
|
308
366
|
if (!canvas) {
|
|
309
367
|
return;
|
|
310
368
|
}
|
|
311
369
|
const handle = mountSmartArt3D(canvas, model, width, height, {
|
|
312
|
-
interactive
|
|
370
|
+
interactive,
|
|
371
|
+
textStyle: textStyleRef.current
|
|
313
372
|
});
|
|
314
373
|
handleRef.current = handle;
|
|
315
374
|
return () => {
|
|
@@ -323,6 +382,9 @@ function SmartArt3DScene({
|
|
|
323
382
|
react.useEffect(() => {
|
|
324
383
|
handleRef.current?.setInteractive(interactive);
|
|
325
384
|
}, [interactive]);
|
|
385
|
+
react.useEffect(() => {
|
|
386
|
+
handleRef.current?.setTextStyle(textStyle);
|
|
387
|
+
}, [textStyle]);
|
|
326
388
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
327
389
|
"canvas",
|
|
328
390
|
{
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLatestRef } from './chunk-T6GFCLSM.mjs';
|
|
1
2
|
import { OrbitControls } from './chunk-3CBDTD46.mjs';
|
|
2
3
|
import { WebGLRenderer, Scene, Color, PerspectiveCamera, AmbientLight, DirectionalLight, Group, MeshStandardMaterial, Mesh, EdgesGeometry, LineBasicMaterial, LineSegments, PlaneGeometry, MeshBasicMaterial, Euler, Vector3, BufferGeometry, Line, Shape, ExtrudeGeometry, CanvasTexture, SRGBColorSpace, LinearFilter, RepeatWrapping } from './chunk-XBMKFZVP.mjs';
|
|
3
4
|
import './chunk-XGB3TDIC.mjs';
|
|
@@ -26,10 +27,17 @@ function wrapLines(ctx, text, maxWidth) {
|
|
|
26
27
|
lines.push(line);
|
|
27
28
|
return lines;
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function resolveEmphasisFont(color, emphasis) {
|
|
31
|
+
const weight = emphasis?.bold === void 0 ? "600" : emphasis.bold ? "700" : "400";
|
|
32
|
+
const italic = emphasis?.italic ? "italic " : "";
|
|
33
|
+
const scale = typeof emphasis?.fontScale === "number" && Number.isFinite(emphasis.fontScale) && emphasis.fontScale > 0 ? emphasis.fontScale : 1;
|
|
34
|
+
return { weight, italic, color: emphasis?.color ?? color, scale };
|
|
35
|
+
}
|
|
36
|
+
function makeTextTexture(text, color, fontSize, footW, footH, emphasis) {
|
|
30
37
|
if (typeof document === "undefined" || !text.trim() || footW <= 0 || footH <= 0) {
|
|
31
38
|
return null;
|
|
32
39
|
}
|
|
40
|
+
const { weight, italic, color: effectiveColor, scale } = resolveEmphasisFont(color, emphasis);
|
|
33
41
|
const worldWidth = footW * FILL;
|
|
34
42
|
const worldHeight = footH * FILL;
|
|
35
43
|
const canvas = document.createElement("canvas");
|
|
@@ -41,10 +49,11 @@ function makeTextTexture(text, color, fontSize, footW, footH) {
|
|
|
41
49
|
}
|
|
42
50
|
const family = "system-ui, -apple-system, Segoe UI, Roboto, sans-serif";
|
|
43
51
|
const maxTextWidth = canvas.width * 0.94;
|
|
44
|
-
|
|
52
|
+
const fontString = (px2) => `${italic}${weight} ${px2}px ${family}`;
|
|
53
|
+
let px = Math.max(6, fontSize) * scale * SUPERSAMPLE;
|
|
45
54
|
let lines = [];
|
|
46
55
|
for (let attempt = 0; attempt < 12; attempt++) {
|
|
47
|
-
ctx.font =
|
|
56
|
+
ctx.font = fontString(px);
|
|
48
57
|
lines = wrapLines(ctx, text, maxTextWidth);
|
|
49
58
|
const lineHeight2 = px * 1.2;
|
|
50
59
|
if (lines.length * lineHeight2 <= canvas.height * 0.96 || px <= 6 * SUPERSAMPLE) {
|
|
@@ -53,15 +62,25 @@ function makeTextTexture(text, color, fontSize, footW, footH) {
|
|
|
53
62
|
px *= 0.88;
|
|
54
63
|
}
|
|
55
64
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
56
|
-
ctx.fillStyle =
|
|
65
|
+
ctx.fillStyle = effectiveColor;
|
|
57
66
|
ctx.textAlign = "center";
|
|
58
67
|
ctx.textBaseline = "middle";
|
|
59
|
-
ctx.font =
|
|
68
|
+
ctx.font = fontString(px);
|
|
60
69
|
const lineHeight = px * 1.2;
|
|
61
70
|
const blockHeight = lines.length * lineHeight;
|
|
62
71
|
const startY = canvas.height / 2 - blockHeight / 2 + lineHeight / 2;
|
|
63
72
|
for (let i = 0; i < lines.length; i++) {
|
|
64
|
-
|
|
73
|
+
const y = startY + i * lineHeight;
|
|
74
|
+
ctx.fillText(lines[i], canvas.width / 2, y);
|
|
75
|
+
if (emphasis?.underline) {
|
|
76
|
+
const w = ctx.measureText(lines[i]).width;
|
|
77
|
+
ctx.strokeStyle = effectiveColor;
|
|
78
|
+
ctx.lineWidth = Math.max(1, px * 0.06);
|
|
79
|
+
ctx.beginPath();
|
|
80
|
+
ctx.moveTo(canvas.width / 2 - w / 2, y + px * 0.32);
|
|
81
|
+
ctx.lineTo(canvas.width / 2 + w / 2, y + px * 0.32);
|
|
82
|
+
ctx.stroke();
|
|
83
|
+
}
|
|
65
84
|
}
|
|
66
85
|
const texture = new CanvasTexture(canvas);
|
|
67
86
|
texture.colorSpace = SRGBColorSpace;
|
|
@@ -121,13 +140,20 @@ function addBlock(group, disposables, m) {
|
|
|
121
140
|
}
|
|
122
141
|
return geo;
|
|
123
142
|
}
|
|
124
|
-
function
|
|
143
|
+
function buildLabelPlane(m, textStyle) {
|
|
125
144
|
if (!m.text) {
|
|
126
|
-
return;
|
|
145
|
+
return null;
|
|
127
146
|
}
|
|
128
|
-
const tex = makeTextTexture(
|
|
147
|
+
const tex = makeTextTexture(
|
|
148
|
+
m.text,
|
|
149
|
+
m.textColor,
|
|
150
|
+
m.fontSize,
|
|
151
|
+
m.halfWidth * 2,
|
|
152
|
+
m.halfHeight * 2,
|
|
153
|
+
textStyle
|
|
154
|
+
);
|
|
129
155
|
if (!tex) {
|
|
130
|
-
return;
|
|
156
|
+
return null;
|
|
131
157
|
}
|
|
132
158
|
const planeGeo = new PlaneGeometry(tex.worldWidth, tex.worldHeight);
|
|
133
159
|
const planeMaterial = new MeshBasicMaterial({
|
|
@@ -140,8 +166,7 @@ function addLabel(group, disposables, m) {
|
|
|
140
166
|
const offset = new Vector3(0, 0, m.depth + m.bevel + 0.4).applyEuler(euler);
|
|
141
167
|
plane.position.set(m.position.x + offset.x, m.position.y + offset.y, m.position.z + offset.z);
|
|
142
168
|
plane.rotation.copy(euler);
|
|
143
|
-
|
|
144
|
-
disposables.push(planeGeo, planeMaterial, tex.texture);
|
|
169
|
+
return { plane, disposables: [planeGeo, planeMaterial, tex.texture] };
|
|
145
170
|
}
|
|
146
171
|
function addConnectors(group, disposables, model) {
|
|
147
172
|
for (const c of model.connectors) {
|
|
@@ -158,20 +183,48 @@ function addConnectors(group, disposables, model) {
|
|
|
158
183
|
disposables.push(geo, material);
|
|
159
184
|
}
|
|
160
185
|
}
|
|
161
|
-
function
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
for (const m of model.meshes) {
|
|
165
|
-
addBlock(group, disposables, m);
|
|
166
|
-
addLabel(group, disposables, m);
|
|
186
|
+
function clearLabel(group, entry) {
|
|
187
|
+
if (entry.plane) {
|
|
188
|
+
group.remove(entry.plane);
|
|
167
189
|
}
|
|
168
|
-
|
|
190
|
+
for (const d of entry.disposables) {
|
|
191
|
+
d.dispose();
|
|
192
|
+
}
|
|
193
|
+
entry.plane = null;
|
|
194
|
+
entry.disposables = [];
|
|
195
|
+
}
|
|
196
|
+
function buildMeshGroup(model, textStyle) {
|
|
197
|
+
const group = new Group();
|
|
198
|
+
const blockDisposables = [];
|
|
199
|
+
const labelEntries = model.meshes.map((m) => {
|
|
200
|
+
addBlock(group, blockDisposables, m);
|
|
201
|
+
const built = buildLabelPlane(m, textStyle);
|
|
202
|
+
if (built) {
|
|
203
|
+
group.add(built.plane);
|
|
204
|
+
}
|
|
205
|
+
return { node: m, plane: built?.plane ?? null, disposables: built?.disposables ?? [] };
|
|
206
|
+
});
|
|
207
|
+
addConnectors(group, blockDisposables, model);
|
|
169
208
|
return {
|
|
170
209
|
group,
|
|
210
|
+
setTextStyle(style) {
|
|
211
|
+
for (const entry of labelEntries) {
|
|
212
|
+
clearLabel(group, entry);
|
|
213
|
+
const built = buildLabelPlane(entry.node, style);
|
|
214
|
+
if (built) {
|
|
215
|
+
group.add(built.plane);
|
|
216
|
+
entry.plane = built.plane;
|
|
217
|
+
entry.disposables = built.disposables;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
171
221
|
dispose() {
|
|
172
|
-
for (const d of
|
|
222
|
+
for (const d of blockDisposables) {
|
|
173
223
|
d.dispose();
|
|
174
224
|
}
|
|
225
|
+
for (const entry of labelEntries) {
|
|
226
|
+
clearLabel(group, entry);
|
|
227
|
+
}
|
|
175
228
|
}
|
|
176
229
|
};
|
|
177
230
|
}
|
|
@@ -243,7 +296,7 @@ function mountSmartArt3D(canvas, model, width, height, options = {}) {
|
|
|
243
296
|
const fill = new DirectionalLight(16777215, 0.3);
|
|
244
297
|
fill.position.set(cx - radius, cy - radius * 0.6, cz + dist * 0.6);
|
|
245
298
|
scene.add(fill);
|
|
246
|
-
const built = buildMeshGroup(model);
|
|
299
|
+
const built = buildMeshGroup(model, options.textStyle);
|
|
247
300
|
scene.add(built.group);
|
|
248
301
|
let controls = null;
|
|
249
302
|
const enableControls = (on) => {
|
|
@@ -284,6 +337,9 @@ function mountSmartArt3D(canvas, model, width, height, options = {}) {
|
|
|
284
337
|
setInteractive(on) {
|
|
285
338
|
enableControls(on);
|
|
286
339
|
},
|
|
340
|
+
setTextStyle(style) {
|
|
341
|
+
built.setTextStyle(style);
|
|
342
|
+
},
|
|
287
343
|
dispose() {
|
|
288
344
|
disposed = true;
|
|
289
345
|
cancelAnimationFrame(frame);
|
|
@@ -297,17 +353,20 @@ function SmartArt3DScene({
|
|
|
297
353
|
model,
|
|
298
354
|
width,
|
|
299
355
|
height,
|
|
300
|
-
interactive
|
|
356
|
+
interactive,
|
|
357
|
+
textStyle
|
|
301
358
|
}) {
|
|
302
359
|
const canvasRef = useRef(null);
|
|
303
360
|
const handleRef = useRef(null);
|
|
361
|
+
const textStyleRef = useLatestRef(textStyle);
|
|
304
362
|
useEffect(() => {
|
|
305
363
|
const canvas = canvasRef.current;
|
|
306
364
|
if (!canvas) {
|
|
307
365
|
return;
|
|
308
366
|
}
|
|
309
367
|
const handle = mountSmartArt3D(canvas, model, width, height, {
|
|
310
|
-
interactive
|
|
368
|
+
interactive,
|
|
369
|
+
textStyle: textStyleRef.current
|
|
311
370
|
});
|
|
312
371
|
handleRef.current = handle;
|
|
313
372
|
return () => {
|
|
@@ -321,6 +380,9 @@ function SmartArt3DScene({
|
|
|
321
380
|
useEffect(() => {
|
|
322
381
|
handleRef.current?.setInteractive(interactive);
|
|
323
382
|
}, [interactive]);
|
|
383
|
+
useEffect(() => {
|
|
384
|
+
handleRef.current?.setTextStyle(textStyle);
|
|
385
|
+
}, [textStyle]);
|
|
324
386
|
return /* @__PURE__ */ jsx(
|
|
325
387
|
"canvas",
|
|
326
388
|
{
|
|
Binary file
|
|
Binary file
|
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useStableChart3DInteraction, useLatestRef } from './chunk-T6GFCLSM.mjs';
|
|
2
|
+
import { mountSurfaceChart3D } from './chunk-VQX7G75Z.mjs';
|
|
2
3
|
import './chunk-XGB3TDIC.mjs';
|
|
3
4
|
import { useRef, useEffect } from 'react';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
7
|
function SurfaceChart3DScene({
|
|
7
|
-
options
|
|
8
|
+
options,
|
|
9
|
+
interaction,
|
|
10
|
+
selectedPart = null,
|
|
11
|
+
textStyle
|
|
8
12
|
}) {
|
|
9
13
|
const containerRef = useRef(null);
|
|
10
14
|
const handleRef = useRef(null);
|
|
15
|
+
const stableInteraction = useStableChart3DInteraction(interaction);
|
|
16
|
+
const selectedPartRef = useLatestRef(selectedPart);
|
|
17
|
+
const textStyleRef = useLatestRef(textStyle);
|
|
11
18
|
useEffect(() => {
|
|
12
19
|
const container = containerRef.current;
|
|
13
20
|
if (!container) {
|
|
14
21
|
return;
|
|
15
22
|
}
|
|
16
23
|
let disposed = false;
|
|
17
|
-
void mountSurfaceChart3D(container, options).then((handle) => {
|
|
24
|
+
void mountSurfaceChart3D(container, options, stableInteraction).then((handle) => {
|
|
18
25
|
if (disposed) {
|
|
19
26
|
handle.dispose();
|
|
20
27
|
} else {
|
|
21
28
|
handleRef.current = handle;
|
|
29
|
+
handle.setSelectedPart(selectedPartRef.current);
|
|
30
|
+
handle.setTextStyle(textStyleRef.current);
|
|
22
31
|
}
|
|
23
32
|
return void 0;
|
|
24
33
|
});
|
|
@@ -27,10 +36,16 @@ function SurfaceChart3DScene({
|
|
|
27
36
|
handleRef.current?.dispose();
|
|
28
37
|
handleRef.current = null;
|
|
29
38
|
};
|
|
30
|
-
}, [options]);
|
|
39
|
+
}, [options, stableInteraction]);
|
|
31
40
|
useEffect(() => {
|
|
32
41
|
handleRef.current?.resize(options.width, options.height);
|
|
33
42
|
}, [options.width, options.height]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
handleRef.current?.setSelectedPart(selectedPart);
|
|
45
|
+
}, [selectedPart]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
handleRef.current?.setTextStyle(textStyle);
|
|
48
|
+
}, [textStyle]);
|
|
34
49
|
return /* @__PURE__ */ jsx(
|
|
35
50
|
"div",
|
|
36
51
|
{
|
|
Binary file
|
|
Binary file
|
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDNR6CH6I_js = require('./chunk-DNR6CH6I.js');
|
|
4
|
+
var chunkG3JPCRKN_js = require('./chunk-G3JPCRKN.js');
|
|
4
5
|
require('./chunk-4VNS5WPM.js');
|
|
5
6
|
var react = require('react');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
|
|
8
9
|
function SurfaceChart3DScene({
|
|
9
|
-
options
|
|
10
|
+
options,
|
|
11
|
+
interaction,
|
|
12
|
+
selectedPart = null,
|
|
13
|
+
textStyle
|
|
10
14
|
}) {
|
|
11
15
|
const containerRef = react.useRef(null);
|
|
12
16
|
const handleRef = react.useRef(null);
|
|
17
|
+
const stableInteraction = chunkDNR6CH6I_js.useStableChart3DInteraction(interaction);
|
|
18
|
+
const selectedPartRef = chunkDNR6CH6I_js.useLatestRef(selectedPart);
|
|
19
|
+
const textStyleRef = chunkDNR6CH6I_js.useLatestRef(textStyle);
|
|
13
20
|
react.useEffect(() => {
|
|
14
21
|
const container = containerRef.current;
|
|
15
22
|
if (!container) {
|
|
16
23
|
return;
|
|
17
24
|
}
|
|
18
25
|
let disposed = false;
|
|
19
|
-
void
|
|
26
|
+
void chunkG3JPCRKN_js.mountSurfaceChart3D(container, options, stableInteraction).then((handle) => {
|
|
20
27
|
if (disposed) {
|
|
21
28
|
handle.dispose();
|
|
22
29
|
} else {
|
|
23
30
|
handleRef.current = handle;
|
|
31
|
+
handle.setSelectedPart(selectedPartRef.current);
|
|
32
|
+
handle.setTextStyle(textStyleRef.current);
|
|
24
33
|
}
|
|
25
34
|
return void 0;
|
|
26
35
|
});
|
|
@@ -29,10 +38,16 @@ function SurfaceChart3DScene({
|
|
|
29
38
|
handleRef.current?.dispose();
|
|
30
39
|
handleRef.current = null;
|
|
31
40
|
};
|
|
32
|
-
}, [options]);
|
|
41
|
+
}, [options, stableInteraction]);
|
|
33
42
|
react.useEffect(() => {
|
|
34
43
|
handleRef.current?.resize(options.width, options.height);
|
|
35
44
|
}, [options.width, options.height]);
|
|
45
|
+
react.useEffect(() => {
|
|
46
|
+
handleRef.current?.setSelectedPart(selectedPart);
|
|
47
|
+
}, [selectedPart]);
|
|
48
|
+
react.useEffect(() => {
|
|
49
|
+
handleRef.current?.setTextStyle(textStyle);
|
|
50
|
+
}, [textStyle]);
|
|
36
51
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
52
|
"div",
|
|
38
53
|
{
|
|
Binary file
|
|
Binary file
|