pptx-react-viewer 4.0.0 → 4.1.1

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.
Files changed (192) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/{AiChatPanel-WMVQFNDC.js → AiChatPanel-N2FVAQRP.js} +25 -25
  3. package/dist/AiChatPanel-N2FVAQRP.js.br +0 -0
  4. package/dist/AiChatPanel-N2FVAQRP.js.gz +0 -0
  5. package/dist/{AiChatPanel-MHURGN6G.mjs → AiChatPanel-VINTTAOW.mjs} +4 -4
  6. package/dist/AiChatPanel-VINTTAOW.mjs.br +0 -0
  7. package/dist/AiChatPanel-VINTTAOW.mjs.gz +0 -0
  8. package/dist/{Area3DChartScene-IMGZEZNU.js → Area3DChartScene-TI3GRA4Y.js} +2 -2
  9. package/dist/Area3DChartScene-TI3GRA4Y.js.br +0 -0
  10. package/dist/Area3DChartScene-TI3GRA4Y.js.gz +0 -0
  11. package/dist/{Area3DChartScene-LKOWSMAU.mjs → Area3DChartScene-WNEHMOG2.mjs} +1 -1
  12. package/dist/Area3DChartScene-WNEHMOG2.mjs.br +0 -0
  13. package/dist/Area3DChartScene-WNEHMOG2.mjs.gz +0 -0
  14. package/dist/{Bar3DChartScene-VLSYVFRT.js → Bar3DChartScene-CRN5WPCZ.js} +2 -2
  15. package/dist/Bar3DChartScene-CRN5WPCZ.js.br +0 -0
  16. package/dist/Bar3DChartScene-CRN5WPCZ.js.gz +0 -0
  17. package/dist/{Bar3DChartScene-NQNSIMUL.mjs → Bar3DChartScene-E53RZRI4.mjs} +1 -1
  18. package/dist/Bar3DChartScene-E53RZRI4.mjs.br +0 -0
  19. package/dist/Bar3DChartScene-E53RZRI4.mjs.gz +0 -0
  20. package/dist/{Line3DChartScene-IWZHA563.js → Line3DChartScene-DGPE4GDN.js} +2 -2
  21. package/dist/Line3DChartScene-DGPE4GDN.js.br +0 -0
  22. package/dist/Line3DChartScene-DGPE4GDN.js.gz +0 -0
  23. package/dist/{Line3DChartScene-ANZBJYQI.mjs → Line3DChartScene-YJ2POVES.mjs} +1 -1
  24. package/dist/Line3DChartScene-YJ2POVES.mjs.br +0 -0
  25. package/dist/Line3DChartScene-YJ2POVES.mjs.gz +0 -0
  26. package/dist/{Model3DScene-Y34HTZXK.mjs → Model3DScene-MYODSOVU.mjs} +1 -1
  27. package/dist/Model3DScene-MYODSOVU.mjs.br +0 -0
  28. package/dist/Model3DScene-MYODSOVU.mjs.gz +0 -0
  29. package/dist/{Model3DScene-2L3YRAMR.js → Model3DScene-O4IOWE5S.js} +2 -2
  30. package/dist/Model3DScene-O4IOWE5S.js.br +0 -0
  31. package/dist/Model3DScene-O4IOWE5S.js.gz +0 -0
  32. package/dist/{PieChart3DScene-NE3GN5VG.js → PieChart3DScene-4S4MZENR.js} +2 -2
  33. package/dist/PieChart3DScene-4S4MZENR.js.br +0 -0
  34. package/dist/PieChart3DScene-4S4MZENR.js.gz +0 -0
  35. package/dist/{PieChart3DScene-FBRPLHLG.mjs → PieChart3DScene-YYBYC5AM.mjs} +1 -1
  36. package/dist/PieChart3DScene-YYBYC5AM.mjs.br +0 -0
  37. package/dist/PieChart3DScene-YYBYC5AM.mjs.gz +0 -0
  38. package/dist/{SmartArt3DScene-QZGIABOK.mjs → SmartArt3DScene-D4VNNPHS.mjs} +124 -19
  39. package/dist/SmartArt3DScene-D4VNNPHS.mjs.br +0 -0
  40. package/dist/SmartArt3DScene-D4VNNPHS.mjs.gz +0 -0
  41. package/dist/{SmartArt3DScene-T236GYUT.js → SmartArt3DScene-NHD7CZJ5.js} +123 -18
  42. package/dist/SmartArt3DScene-NHD7CZJ5.js.br +0 -0
  43. package/dist/SmartArt3DScene-NHD7CZJ5.js.gz +0 -0
  44. package/dist/{SurfaceChart3DScene-7HE5DA3X.mjs → SurfaceChart3DScene-FFYG6CNE.mjs} +1 -1
  45. package/dist/SurfaceChart3DScene-FFYG6CNE.mjs.br +0 -0
  46. package/dist/SurfaceChart3DScene-FFYG6CNE.mjs.gz +0 -0
  47. package/dist/{SurfaceChart3DScene-OSMAVZJC.js → SurfaceChart3DScene-RNBXINNV.js} +2 -2
  48. package/dist/SurfaceChart3DScene-RNBXINNV.js.br +0 -0
  49. package/dist/SurfaceChart3DScene-RNBXINNV.js.gz +0 -0
  50. package/dist/{chunk-I5F3XLVR.js → chunk-3LIWTQSG.js} +1961 -2161
  51. package/dist/chunk-3LIWTQSG.js.br +0 -0
  52. package/dist/chunk-3LIWTQSG.js.gz +0 -0
  53. package/dist/{chunk-L6I73WMO.js → chunk-45JD3XEM.js} +2164 -1646
  54. package/dist/chunk-45JD3XEM.js.br +0 -0
  55. package/dist/chunk-45JD3XEM.js.gz +0 -0
  56. package/dist/{chunk-33YE6E2O.mjs → chunk-7X6UCEYM.mjs} +2225 -582
  57. package/dist/chunk-7X6UCEYM.mjs.br +0 -0
  58. package/dist/chunk-7X6UCEYM.mjs.gz +0 -0
  59. package/dist/{chunk-IWHZ2DUD.mjs → chunk-FOXGVZ4A.mjs} +647 -135
  60. package/dist/chunk-FOXGVZ4A.mjs.br +0 -0
  61. package/dist/chunk-FOXGVZ4A.mjs.gz +0 -0
  62. package/dist/{chunk-GITM3RKP.mjs → chunk-ILVWZ7TN.mjs} +2 -2
  63. package/dist/chunk-ILVWZ7TN.mjs.br +0 -0
  64. package/dist/chunk-ILVWZ7TN.mjs.gz +0 -0
  65. package/dist/{chunk-LAAXFMRE.js → chunk-JLQWPRIM.js} +2231 -581
  66. package/dist/chunk-JLQWPRIM.js.br +0 -0
  67. package/dist/chunk-JLQWPRIM.js.gz +0 -0
  68. package/dist/{chunk-ZOB6ITIM.js → chunk-MVLYI7C2.js} +5 -5
  69. package/dist/chunk-MVLYI7C2.js.br +0 -0
  70. package/dist/chunk-MVLYI7C2.js.gz +0 -0
  71. package/dist/{chunk-NKACTGK5.js → chunk-NKXILGP5.js} +182 -182
  72. package/dist/chunk-NKXILGP5.js.br +0 -0
  73. package/dist/chunk-NKXILGP5.js.gz +0 -0
  74. package/dist/{chunk-M24DEOP6.js → chunk-NXGUR2DO.js} +2 -0
  75. package/dist/chunk-NXGUR2DO.js.br +0 -0
  76. package/dist/chunk-NXGUR2DO.js.gz +0 -0
  77. package/dist/{chunk-R664EPDC.mjs → chunk-PC7H3C5W.mjs} +2 -0
  78. package/dist/chunk-PC7H3C5W.mjs.br +0 -0
  79. package/dist/chunk-PC7H3C5W.mjs.gz +0 -0
  80. package/dist/{chunk-5F426BCZ.mjs → chunk-Q7MONAI4.mjs} +1 -1
  81. package/dist/chunk-Q7MONAI4.mjs.br +0 -0
  82. package/dist/chunk-Q7MONAI4.mjs.gz +0 -0
  83. package/dist/{chunk-H7J4EYXS.mjs → chunk-VC4GPWZS.mjs} +131 -329
  84. package/dist/chunk-VC4GPWZS.mjs.br +0 -0
  85. package/dist/chunk-VC4GPWZS.mjs.gz +0 -0
  86. package/dist/i18n/de.cjs +2 -0
  87. package/dist/i18n/de.cjs.br +0 -0
  88. package/dist/i18n/de.cjs.gz +0 -0
  89. package/dist/i18n/de.mjs +2 -0
  90. package/dist/i18n/de.mjs.br +0 -0
  91. package/dist/i18n/de.mjs.gz +0 -0
  92. package/dist/i18n/es.cjs +2 -0
  93. package/dist/i18n/es.cjs.br +0 -0
  94. package/dist/i18n/es.cjs.gz +0 -0
  95. package/dist/i18n/es.mjs +2 -0
  96. package/dist/i18n/es.mjs.br +0 -0
  97. package/dist/i18n/es.mjs.gz +0 -0
  98. package/dist/i18n/fr.cjs +2 -0
  99. package/dist/i18n/fr.cjs.br +0 -0
  100. package/dist/i18n/fr.cjs.gz +0 -0
  101. package/dist/i18n/fr.mjs +2 -0
  102. package/dist/i18n/fr.mjs.br +0 -0
  103. package/dist/i18n/fr.mjs.gz +0 -0
  104. package/dist/i18n/zh-CN.cjs +2 -0
  105. package/dist/i18n/zh-CN.cjs.br +0 -0
  106. package/dist/i18n/zh-CN.cjs.gz +0 -0
  107. package/dist/i18n/zh-CN.mjs +2 -0
  108. package/dist/i18n/zh-CN.mjs.br +0 -0
  109. package/dist/i18n/zh-CN.mjs.gz +0 -0
  110. package/dist/i18n.js +4 -4
  111. package/dist/i18n.js.br +0 -0
  112. package/dist/i18n.js.gz +0 -0
  113. package/dist/i18n.mjs +1 -1
  114. package/dist/i18n.mjs.br +0 -0
  115. package/dist/i18n.mjs.gz +0 -0
  116. package/dist/index.d.ts +586 -7
  117. package/dist/index.js +52 -48
  118. package/dist/index.js.br +0 -0
  119. package/dist/index.js.gz +0 -0
  120. package/dist/index.mjs +6 -6
  121. package/dist/index.mjs.br +0 -0
  122. package/dist/index.mjs.gz +0 -0
  123. package/dist/internals.d.ts +447 -13
  124. package/dist/internals.js +105 -105
  125. package/dist/internals.js.br +0 -0
  126. package/dist/internals.js.gz +0 -0
  127. package/dist/internals.mjs +4 -4
  128. package/dist/internals.mjs.br +0 -0
  129. package/dist/internals.mjs.gz +0 -0
  130. package/dist/viewer/index.js +32 -32
  131. package/dist/viewer/index.js.br +0 -0
  132. package/dist/viewer/index.js.gz +0 -0
  133. package/dist/viewer/index.mjs +6 -6
  134. package/dist/viewer/index.mjs.br +0 -0
  135. package/dist/viewer/index.mjs.gz +0 -0
  136. package/package.json +2 -2
  137. package/dist/AiChatPanel-MHURGN6G.mjs.br +0 -0
  138. package/dist/AiChatPanel-MHURGN6G.mjs.gz +0 -0
  139. package/dist/AiChatPanel-WMVQFNDC.js.br +0 -0
  140. package/dist/AiChatPanel-WMVQFNDC.js.gz +0 -0
  141. package/dist/Area3DChartScene-IMGZEZNU.js.br +0 -0
  142. package/dist/Area3DChartScene-IMGZEZNU.js.gz +0 -0
  143. package/dist/Area3DChartScene-LKOWSMAU.mjs.br +0 -0
  144. package/dist/Area3DChartScene-LKOWSMAU.mjs.gz +0 -0
  145. package/dist/Bar3DChartScene-NQNSIMUL.mjs.br +0 -0
  146. package/dist/Bar3DChartScene-NQNSIMUL.mjs.gz +0 -0
  147. package/dist/Bar3DChartScene-VLSYVFRT.js.br +0 -0
  148. package/dist/Bar3DChartScene-VLSYVFRT.js.gz +0 -0
  149. package/dist/Line3DChartScene-ANZBJYQI.mjs.br +0 -0
  150. package/dist/Line3DChartScene-ANZBJYQI.mjs.gz +0 -0
  151. package/dist/Line3DChartScene-IWZHA563.js.br +0 -0
  152. package/dist/Line3DChartScene-IWZHA563.js.gz +0 -0
  153. package/dist/Model3DScene-2L3YRAMR.js.br +0 -0
  154. package/dist/Model3DScene-2L3YRAMR.js.gz +0 -0
  155. package/dist/Model3DScene-Y34HTZXK.mjs.br +0 -0
  156. package/dist/Model3DScene-Y34HTZXK.mjs.gz +0 -0
  157. package/dist/PieChart3DScene-FBRPLHLG.mjs.br +0 -0
  158. package/dist/PieChart3DScene-FBRPLHLG.mjs.gz +0 -0
  159. package/dist/PieChart3DScene-NE3GN5VG.js.br +0 -0
  160. package/dist/PieChart3DScene-NE3GN5VG.js.gz +0 -0
  161. package/dist/SmartArt3DScene-QZGIABOK.mjs.br +0 -0
  162. package/dist/SmartArt3DScene-QZGIABOK.mjs.gz +0 -0
  163. package/dist/SmartArt3DScene-T236GYUT.js.br +0 -0
  164. package/dist/SmartArt3DScene-T236GYUT.js.gz +0 -0
  165. package/dist/SurfaceChart3DScene-7HE5DA3X.mjs.br +0 -0
  166. package/dist/SurfaceChart3DScene-7HE5DA3X.mjs.gz +0 -0
  167. package/dist/SurfaceChart3DScene-OSMAVZJC.js.br +0 -0
  168. package/dist/SurfaceChart3DScene-OSMAVZJC.js.gz +0 -0
  169. package/dist/chunk-33YE6E2O.mjs.br +0 -0
  170. package/dist/chunk-33YE6E2O.mjs.gz +0 -0
  171. package/dist/chunk-5F426BCZ.mjs.br +0 -0
  172. package/dist/chunk-5F426BCZ.mjs.gz +0 -0
  173. package/dist/chunk-GITM3RKP.mjs.br +0 -0
  174. package/dist/chunk-GITM3RKP.mjs.gz +0 -0
  175. package/dist/chunk-H7J4EYXS.mjs.br +0 -0
  176. package/dist/chunk-H7J4EYXS.mjs.gz +0 -0
  177. package/dist/chunk-I5F3XLVR.js.br +0 -0
  178. package/dist/chunk-I5F3XLVR.js.gz +0 -0
  179. package/dist/chunk-IWHZ2DUD.mjs.br +0 -0
  180. package/dist/chunk-IWHZ2DUD.mjs.gz +0 -0
  181. package/dist/chunk-L6I73WMO.js.br +0 -0
  182. package/dist/chunk-L6I73WMO.js.gz +0 -0
  183. package/dist/chunk-LAAXFMRE.js.br +0 -0
  184. package/dist/chunk-LAAXFMRE.js.gz +0 -0
  185. package/dist/chunk-M24DEOP6.js.br +0 -0
  186. package/dist/chunk-M24DEOP6.js.gz +0 -0
  187. package/dist/chunk-NKACTGK5.js.br +0 -0
  188. package/dist/chunk-NKACTGK5.js.gz +0 -0
  189. package/dist/chunk-R664EPDC.mjs.br +0 -0
  190. package/dist/chunk-R664EPDC.mjs.gz +0 -0
  191. package/dist/chunk-ZOB6ITIM.js.br +0 -0
  192. package/dist/chunk-ZOB6ITIM.js.gz +0 -0
@@ -1,6 +1,6 @@
1
1
  import { useLatestRef } from './chunk-T6GFCLSM.mjs';
2
2
  import { OrbitControls } from './chunk-MV2GCDBR.mjs';
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-7TAWW5QQ.mjs';
3
+ import { WebGLRenderer, Scene, Color, PerspectiveCamera, AmbientLight, DirectionalLight, Group, MeshStandardMaterial, Mesh, EdgesGeometry, LineBasicMaterial, LineSegments, PlaneGeometry, MeshBasicMaterial, DoubleSide, Euler, Vector3, BufferGeometry, Line, Shape, ExtrudeGeometry, CanvasTexture, SRGBColorSpace, LinearFilter, RepeatWrapping } from './chunk-7TAWW5QQ.mjs';
4
4
  import './chunk-XGB3TDIC.mjs';
5
5
  import { useRef, useEffect } from 'react';
6
6
  import { jsx } from 'react/jsx-runtime';
@@ -159,9 +159,12 @@ function buildLabelPlane(m, textStyle) {
159
159
  const planeMaterial = new MeshBasicMaterial({
160
160
  map: tex.texture,
161
161
  transparent: true,
162
- depthWrite: false
162
+ depthWrite: false,
163
+ depthTest: false,
164
+ side: DoubleSide
163
165
  });
164
166
  const plane = new Mesh(planeGeo, planeMaterial);
167
+ plane.renderOrder = 1;
165
168
  const euler = new Euler(m.rotation.x, m.rotation.y, m.rotation.z);
166
169
  const offset = new Vector3(0, 0, m.depth + m.bevel + 0.4).applyEuler(euler);
167
170
  plane.position.set(m.position.x + offset.x, m.position.y + offset.y, m.position.z + offset.z);
@@ -218,6 +221,13 @@ function buildMeshGroup(model, textStyle) {
218
221
  }
219
222
  }
220
223
  },
224
+ forEachLabelPlane(fn) {
225
+ for (const entry of labelEntries) {
226
+ if (entry.plane) {
227
+ fn(entry.plane);
228
+ }
229
+ }
230
+ },
221
231
  dispose() {
222
232
  for (const d of blockDisposables) {
223
233
  d.dispose();
@@ -229,6 +239,17 @@ function buildMeshGroup(model, textStyle) {
229
239
  };
230
240
  }
231
241
  var FOV = 42;
242
+ function expandForMesh(expand, m) {
243
+ const hx = m.halfWidth + m.bevel;
244
+ const hy = m.halfHeight + m.bevel;
245
+ const hz = m.depth / 2 + m.bevel;
246
+ const midZ = m.position.z + m.depth / 2;
247
+ const cosY = Math.cos(m.rotation.y);
248
+ const sinY = Math.sin(m.rotation.y);
249
+ const worldHalfX = Math.abs(hx * cosY) + Math.abs(hz * sinY);
250
+ const worldHalfZ = Math.abs(hx * sinY) + Math.abs(hz * cosY);
251
+ expand(m.position.x, m.position.y, midZ, worldHalfX, hy, worldHalfZ);
252
+ }
232
253
  function contentSphere(model) {
233
254
  let minX = Infinity;
234
255
  let minY = Infinity;
@@ -236,32 +257,36 @@ function contentSphere(model) {
236
257
  let maxX = -Infinity;
237
258
  let maxY = -Infinity;
238
259
  let maxZ = -Infinity;
239
- const expand = (x, y, z, r) => {
240
- minX = Math.min(minX, x - r);
241
- minY = Math.min(minY, y - r);
242
- minZ = Math.min(minZ, z - r);
243
- maxX = Math.max(maxX, x + r);
244
- maxY = Math.max(maxY, y + r);
245
- maxZ = Math.max(maxZ, z + r);
260
+ const expand = (x, y, z, rx, ry, rz) => {
261
+ minX = Math.min(minX, x - rx);
262
+ minY = Math.min(minY, y - ry);
263
+ minZ = Math.min(minZ, z - rz);
264
+ maxX = Math.max(maxX, x + rx);
265
+ maxY = Math.max(maxY, y + ry);
266
+ maxZ = Math.max(maxZ, z + rz);
246
267
  };
247
268
  for (const m of model.meshes) {
248
- const r = Math.max(m.halfWidth, m.halfHeight) + m.depth + m.bevel;
249
- expand(m.position.x, m.position.y, m.position.z, r);
269
+ expandForMesh(expand, m);
250
270
  }
251
271
  for (const c of model.connectors) {
252
272
  for (const p of c.points) {
253
- expand(p.x, p.y, p.z, 1);
273
+ expand(p.x, p.y, p.z, 1, 1, 1);
254
274
  }
255
275
  }
256
276
  if (!Number.isFinite(minX)) {
257
- const fallback = Math.max(model.bounds.width, model.bounds.height) / 2 || 1;
258
- return { cx: 0, cy: 0, cz: 0, radius: fallback };
277
+ const halfW = model.bounds.width / 2 || 1;
278
+ const halfH = model.bounds.height / 2 || 1;
279
+ const fallback = Math.max(halfW, halfH);
280
+ return { cx: 0, cy: 0, cz: 0, radius: fallback, halfW, halfH, halfD: 1 };
259
281
  }
260
282
  return {
261
283
  cx: (minX + maxX) / 2,
262
284
  cy: (minY + maxY) / 2,
263
285
  cz: (minZ + maxZ) / 2,
264
- radius: 0.5 * Math.hypot(maxX - minX, maxY - minY, maxZ - minZ) || 1
286
+ radius: 0.5 * Math.hypot(maxX - minX, maxY - minY, maxZ - minZ) || 1,
287
+ halfW: (maxX - minX) / 2,
288
+ halfH: (maxY - minY) / 2,
289
+ halfD: (maxZ - minZ) / 2
265
290
  };
266
291
  }
267
292
  function frameDistance(radius, aspect) {
@@ -270,6 +295,83 @@ function frameDistance(radius, aspect) {
270
295
  const minFov = Math.min(vFov, hFov);
271
296
  return radius / Math.sin(minFov / 2) * 1.1;
272
297
  }
298
+ var FRAME_FILL = 0.92;
299
+ function placeCamera(bounds, family, dist) {
300
+ const { cx, cy, cz, radius } = bounds;
301
+ const elevation = cameraElevation(family, radius, dist);
302
+ return {
303
+ position: [cx + radius * 0.25, cy + elevation, cz + dist],
304
+ target: [cx, cy, cz],
305
+ dist
306
+ };
307
+ }
308
+ function projectedFill(bounds, placement, aspect) {
309
+ const vFov = FOV * Math.PI / 180;
310
+ const tanV = Math.tan(vFov / 2);
311
+ const tanH = tanV * aspect;
312
+ const [px, py, pz] = placement.position;
313
+ const [tx, ty, tz] = placement.target;
314
+ let fx = tx - px, fy = ty - py, fz = tz - pz;
315
+ const fl = Math.hypot(fx, fy, fz) || 1;
316
+ fx /= fl;
317
+ fy /= fl;
318
+ fz /= fl;
319
+ let rx = -fz, rz = fx;
320
+ const rl = Math.hypot(rx, rz) || 1;
321
+ rx /= rl;
322
+ rz /= rl;
323
+ const ux = -rz * fy, uy = rz * fx - rx * fz, uz = rx * fy;
324
+ let worst = 0;
325
+ for (const sx of [-1, 1]) {
326
+ for (const sy of [-1, 1]) {
327
+ for (const sz of [-1, 1]) {
328
+ const dx = bounds.cx + sx * bounds.halfW - px;
329
+ const dy = bounds.cy + sy * bounds.halfH - py;
330
+ const dz = bounds.cz + sz * bounds.halfD - pz;
331
+ const depth = dx * fx + dy * fy + dz * fz;
332
+ if (depth <= 1e-6) {
333
+ return Infinity;
334
+ }
335
+ const x = Math.abs(dx * rx + dz * rz) / (depth * tanH);
336
+ const y = Math.abs(dx * ux + dy * uy + dz * uz) / (depth * tanV);
337
+ worst = Math.max(worst, x, y);
338
+ }
339
+ }
340
+ }
341
+ return worst;
342
+ }
343
+ function fitCamera(bounds, family, aspect) {
344
+ let dist = frameDistance(bounds.radius, aspect);
345
+ let placement = placeCamera(bounds, family, dist);
346
+ for (let step = 0; step < 8; step++) {
347
+ const fill = projectedFill(bounds, placement, aspect);
348
+ if (!Number.isFinite(fill)) {
349
+ dist *= 2;
350
+ } else {
351
+ const ratio = fill / FRAME_FILL;
352
+ if (Math.abs(ratio - 1) < 0.01) {
353
+ break;
354
+ }
355
+ dist *= ratio;
356
+ }
357
+ placement = placeCamera(bounds, family, dist);
358
+ }
359
+ return placement;
360
+ }
361
+ var CAROUSEL_ELEVATION_DEG = 34;
362
+ function cameraElevation(family, radius, dist) {
363
+ if (family === "cycle" || family === "radial") {
364
+ return dist * Math.tan(CAROUSEL_ELEVATION_DEG * Math.PI / 180);
365
+ }
366
+ return radius * 0.3;
367
+ }
368
+ function billboardLabels(built, camera) {
369
+ built.forEachLabelPlane((plane) => {
370
+ const dx = camera.position.x - plane.position.x;
371
+ const dz = camera.position.z - plane.position.z;
372
+ plane.rotation.set(0, Math.atan2(dx, dz), 0);
373
+ });
374
+ }
273
375
  function mountSmartArt3D(canvas, model, width, height, options = {}) {
274
376
  const renderer = new WebGLRenderer({ canvas, antialias: true, alpha: !options.background });
275
377
  renderer.setPixelRatio(
@@ -283,12 +385,14 @@ function mountSmartArt3D(canvas, model, width, height, options = {}) {
283
385
  if (options.background) {
284
386
  scene.background = new Color(options.background);
285
387
  }
286
- const { cx, cy, cz, radius } = contentSphere(model);
388
+ const bounds = contentSphere(model);
389
+ const { cx, cy, cz, radius } = bounds;
287
390
  const aspect = width / Math.max(1, height);
288
- const dist = frameDistance(radius, aspect);
391
+ const placement = fitCamera(bounds, model.family, aspect);
392
+ const { dist } = placement;
289
393
  const camera = new PerspectiveCamera(FOV, aspect, 0.1, dist * 8 + radius * 4);
290
- camera.position.set(cx + radius * 0.25, cy + radius * 0.3, cz + dist);
291
- camera.lookAt(cx, cy, cz);
394
+ camera.position.set(...placement.position);
395
+ camera.lookAt(...placement.target);
292
396
  scene.add(new AmbientLight(16777215, 0.62));
293
397
  const key = new DirectionalLight(16777215, 0.95);
294
398
  key.position.set(cx + radius, cy + radius * 1.4, cz + dist);
@@ -324,6 +428,7 @@ function mountSmartArt3D(canvas, model, width, height, options = {}) {
324
428
  return;
325
429
  }
326
430
  frame = requestAnimationFrame(renderLoop);
431
+ billboardLabels(built, camera);
327
432
  controls?.update();
328
433
  renderer.render(scene, camera);
329
434
  };
@@ -161,9 +161,12 @@ function buildLabelPlane(m, textStyle) {
161
161
  const planeMaterial = new chunk3N6AC4HA_js.MeshBasicMaterial({
162
162
  map: tex.texture,
163
163
  transparent: true,
164
- depthWrite: false
164
+ depthWrite: false,
165
+ depthTest: false,
166
+ side: chunk3N6AC4HA_js.DoubleSide
165
167
  });
166
168
  const plane = new chunk3N6AC4HA_js.Mesh(planeGeo, planeMaterial);
169
+ plane.renderOrder = 1;
167
170
  const euler = new chunk3N6AC4HA_js.Euler(m.rotation.x, m.rotation.y, m.rotation.z);
168
171
  const offset = new chunk3N6AC4HA_js.Vector3(0, 0, m.depth + m.bevel + 0.4).applyEuler(euler);
169
172
  plane.position.set(m.position.x + offset.x, m.position.y + offset.y, m.position.z + offset.z);
@@ -220,6 +223,13 @@ function buildMeshGroup(model, textStyle) {
220
223
  }
221
224
  }
222
225
  },
226
+ forEachLabelPlane(fn) {
227
+ for (const entry of labelEntries) {
228
+ if (entry.plane) {
229
+ fn(entry.plane);
230
+ }
231
+ }
232
+ },
223
233
  dispose() {
224
234
  for (const d of blockDisposables) {
225
235
  d.dispose();
@@ -231,6 +241,17 @@ function buildMeshGroup(model, textStyle) {
231
241
  };
232
242
  }
233
243
  var FOV = 42;
244
+ function expandForMesh(expand, m) {
245
+ const hx = m.halfWidth + m.bevel;
246
+ const hy = m.halfHeight + m.bevel;
247
+ const hz = m.depth / 2 + m.bevel;
248
+ const midZ = m.position.z + m.depth / 2;
249
+ const cosY = Math.cos(m.rotation.y);
250
+ const sinY = Math.sin(m.rotation.y);
251
+ const worldHalfX = Math.abs(hx * cosY) + Math.abs(hz * sinY);
252
+ const worldHalfZ = Math.abs(hx * sinY) + Math.abs(hz * cosY);
253
+ expand(m.position.x, m.position.y, midZ, worldHalfX, hy, worldHalfZ);
254
+ }
234
255
  function contentSphere(model) {
235
256
  let minX = Infinity;
236
257
  let minY = Infinity;
@@ -238,32 +259,36 @@ function contentSphere(model) {
238
259
  let maxX = -Infinity;
239
260
  let maxY = -Infinity;
240
261
  let maxZ = -Infinity;
241
- const expand = (x, y, z, r) => {
242
- minX = Math.min(minX, x - r);
243
- minY = Math.min(minY, y - r);
244
- minZ = Math.min(minZ, z - r);
245
- maxX = Math.max(maxX, x + r);
246
- maxY = Math.max(maxY, y + r);
247
- maxZ = Math.max(maxZ, z + r);
262
+ const expand = (x, y, z, rx, ry, rz) => {
263
+ minX = Math.min(minX, x - rx);
264
+ minY = Math.min(minY, y - ry);
265
+ minZ = Math.min(minZ, z - rz);
266
+ maxX = Math.max(maxX, x + rx);
267
+ maxY = Math.max(maxY, y + ry);
268
+ maxZ = Math.max(maxZ, z + rz);
248
269
  };
249
270
  for (const m of model.meshes) {
250
- const r = Math.max(m.halfWidth, m.halfHeight) + m.depth + m.bevel;
251
- expand(m.position.x, m.position.y, m.position.z, r);
271
+ expandForMesh(expand, m);
252
272
  }
253
273
  for (const c of model.connectors) {
254
274
  for (const p of c.points) {
255
- expand(p.x, p.y, p.z, 1);
275
+ expand(p.x, p.y, p.z, 1, 1, 1);
256
276
  }
257
277
  }
258
278
  if (!Number.isFinite(minX)) {
259
- const fallback = Math.max(model.bounds.width, model.bounds.height) / 2 || 1;
260
- return { cx: 0, cy: 0, cz: 0, radius: fallback };
279
+ const halfW = model.bounds.width / 2 || 1;
280
+ const halfH = model.bounds.height / 2 || 1;
281
+ const fallback = Math.max(halfW, halfH);
282
+ return { cx: 0, cy: 0, cz: 0, radius: fallback, halfW, halfH, halfD: 1 };
261
283
  }
262
284
  return {
263
285
  cx: (minX + maxX) / 2,
264
286
  cy: (minY + maxY) / 2,
265
287
  cz: (minZ + maxZ) / 2,
266
- radius: 0.5 * Math.hypot(maxX - minX, maxY - minY, maxZ - minZ) || 1
288
+ radius: 0.5 * Math.hypot(maxX - minX, maxY - minY, maxZ - minZ) || 1,
289
+ halfW: (maxX - minX) / 2,
290
+ halfH: (maxY - minY) / 2,
291
+ halfD: (maxZ - minZ) / 2
267
292
  };
268
293
  }
269
294
  function frameDistance(radius, aspect) {
@@ -272,6 +297,83 @@ function frameDistance(radius, aspect) {
272
297
  const minFov = Math.min(vFov, hFov);
273
298
  return radius / Math.sin(minFov / 2) * 1.1;
274
299
  }
300
+ var FRAME_FILL = 0.92;
301
+ function placeCamera(bounds, family, dist) {
302
+ const { cx, cy, cz, radius } = bounds;
303
+ const elevation = cameraElevation(family, radius, dist);
304
+ return {
305
+ position: [cx + radius * 0.25, cy + elevation, cz + dist],
306
+ target: [cx, cy, cz],
307
+ dist
308
+ };
309
+ }
310
+ function projectedFill(bounds, placement, aspect) {
311
+ const vFov = FOV * Math.PI / 180;
312
+ const tanV = Math.tan(vFov / 2);
313
+ const tanH = tanV * aspect;
314
+ const [px, py, pz] = placement.position;
315
+ const [tx, ty, tz] = placement.target;
316
+ let fx = tx - px, fy = ty - py, fz = tz - pz;
317
+ const fl = Math.hypot(fx, fy, fz) || 1;
318
+ fx /= fl;
319
+ fy /= fl;
320
+ fz /= fl;
321
+ let rx = -fz, rz = fx;
322
+ const rl = Math.hypot(rx, rz) || 1;
323
+ rx /= rl;
324
+ rz /= rl;
325
+ const ux = -rz * fy, uy = rz * fx - rx * fz, uz = rx * fy;
326
+ let worst = 0;
327
+ for (const sx of [-1, 1]) {
328
+ for (const sy of [-1, 1]) {
329
+ for (const sz of [-1, 1]) {
330
+ const dx = bounds.cx + sx * bounds.halfW - px;
331
+ const dy = bounds.cy + sy * bounds.halfH - py;
332
+ const dz = bounds.cz + sz * bounds.halfD - pz;
333
+ const depth = dx * fx + dy * fy + dz * fz;
334
+ if (depth <= 1e-6) {
335
+ return Infinity;
336
+ }
337
+ const x = Math.abs(dx * rx + dz * rz) / (depth * tanH);
338
+ const y = Math.abs(dx * ux + dy * uy + dz * uz) / (depth * tanV);
339
+ worst = Math.max(worst, x, y);
340
+ }
341
+ }
342
+ }
343
+ return worst;
344
+ }
345
+ function fitCamera(bounds, family, aspect) {
346
+ let dist = frameDistance(bounds.radius, aspect);
347
+ let placement = placeCamera(bounds, family, dist);
348
+ for (let step = 0; step < 8; step++) {
349
+ const fill = projectedFill(bounds, placement, aspect);
350
+ if (!Number.isFinite(fill)) {
351
+ dist *= 2;
352
+ } else {
353
+ const ratio = fill / FRAME_FILL;
354
+ if (Math.abs(ratio - 1) < 0.01) {
355
+ break;
356
+ }
357
+ dist *= ratio;
358
+ }
359
+ placement = placeCamera(bounds, family, dist);
360
+ }
361
+ return placement;
362
+ }
363
+ var CAROUSEL_ELEVATION_DEG = 34;
364
+ function cameraElevation(family, radius, dist) {
365
+ if (family === "cycle" || family === "radial") {
366
+ return dist * Math.tan(CAROUSEL_ELEVATION_DEG * Math.PI / 180);
367
+ }
368
+ return radius * 0.3;
369
+ }
370
+ function billboardLabels(built, camera) {
371
+ built.forEachLabelPlane((plane) => {
372
+ const dx = camera.position.x - plane.position.x;
373
+ const dz = camera.position.z - plane.position.z;
374
+ plane.rotation.set(0, Math.atan2(dx, dz), 0);
375
+ });
376
+ }
275
377
  function mountSmartArt3D(canvas, model, width, height, options = {}) {
276
378
  const renderer = new chunk3N6AC4HA_js.WebGLRenderer({ canvas, antialias: true, alpha: !options.background });
277
379
  renderer.setPixelRatio(
@@ -285,12 +387,14 @@ function mountSmartArt3D(canvas, model, width, height, options = {}) {
285
387
  if (options.background) {
286
388
  scene.background = new chunk3N6AC4HA_js.Color(options.background);
287
389
  }
288
- const { cx, cy, cz, radius } = contentSphere(model);
390
+ const bounds = contentSphere(model);
391
+ const { cx, cy, cz, radius } = bounds;
289
392
  const aspect = width / Math.max(1, height);
290
- const dist = frameDistance(radius, aspect);
393
+ const placement = fitCamera(bounds, model.family, aspect);
394
+ const { dist } = placement;
291
395
  const camera = new chunk3N6AC4HA_js.PerspectiveCamera(FOV, aspect, 0.1, dist * 8 + radius * 4);
292
- camera.position.set(cx + radius * 0.25, cy + radius * 0.3, cz + dist);
293
- camera.lookAt(cx, cy, cz);
396
+ camera.position.set(...placement.position);
397
+ camera.lookAt(...placement.target);
294
398
  scene.add(new chunk3N6AC4HA_js.AmbientLight(16777215, 0.62));
295
399
  const key = new chunk3N6AC4HA_js.DirectionalLight(16777215, 0.95);
296
400
  key.position.set(cx + radius, cy + radius * 1.4, cz + dist);
@@ -326,6 +430,7 @@ function mountSmartArt3D(canvas, model, width, height, options = {}) {
326
430
  return;
327
431
  }
328
432
  frame = requestAnimationFrame(renderLoop);
433
+ billboardLabels(built, camera);
329
434
  controls?.update();
330
435
  renderer.render(scene, camera);
331
436
  };
@@ -1,5 +1,5 @@
1
1
  import { useStableChart3DInteraction, useLatestRef } from './chunk-T6GFCLSM.mjs';
2
- import { mountSurfaceChart3D } from './chunk-33YE6E2O.mjs';
2
+ import { mountSurfaceChart3D } from './chunk-7X6UCEYM.mjs';
3
3
  import './chunk-XGB3TDIC.mjs';
4
4
  import { useRef, useEffect } from 'react';
5
5
  import { jsx } from 'react/jsx-runtime';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkDNR6CH6I_js = require('./chunk-DNR6CH6I.js');
4
- var chunkLAAXFMRE_js = require('./chunk-LAAXFMRE.js');
4
+ var chunkJLQWPRIM_js = require('./chunk-JLQWPRIM.js');
5
5
  require('./chunk-4VNS5WPM.js');
6
6
  var react = require('react');
7
7
  var jsxRuntime = require('react/jsx-runtime');
@@ -23,7 +23,7 @@ function SurfaceChart3DScene({
23
23
  return;
24
24
  }
25
25
  let disposed = false;
26
- void chunkLAAXFMRE_js.mountSurfaceChart3D(container, options, stableInteraction).then((handle) => {
26
+ void chunkJLQWPRIM_js.mountSurfaceChart3D(container, options, stableInteraction).then((handle) => {
27
27
  if (disposed) {
28
28
  handle.dispose();
29
29
  } else {