@roomle/web-sdk 3.6.0 → 3.7.0-alpha.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 (105) hide show
  1. package/lib/{BufferGeometry-DLEagG41.mjs → BufferGeometry-BLeRuMkh.mjs} +1 -1
  2. package/lib/{BufferGeometry-DLEagG41.mjs.map → BufferGeometry-BLeRuMkh.mjs.map} +1 -1
  3. package/lib/ConfiguratorKernel.js +54 -73
  4. package/lib/ConfiguratorKernel.wasm +0 -0
  5. package/lib/{GLTFExporter-D8qsdwDK.mjs → GLTFExporter-CFXCqoLa.mjs} +141 -141
  6. package/lib/{GLTFExporter-D8qsdwDK.mjs.map → GLTFExporter-CFXCqoLa.mjs.map} +1 -1
  7. package/lib/{PointLightHelper-BnjxGaOG.mjs → PointLightHelper-BEJEy6l_.mjs} +2 -2
  8. package/lib/{PointLightHelper-BnjxGaOG.mjs.map → PointLightHelper-BEJEy6l_.mjs.map} +1 -1
  9. package/lib/RoomleCore.js +59 -79
  10. package/lib/RoomleCore.wasm +0 -0
  11. package/lib/RoomleToolsCore.js +54 -74
  12. package/lib/RoomleToolsCore.wasm +0 -0
  13. package/lib/{SpotLightHelper-DqsfqCrs.mjs → SpotLightHelper-aXFW8qaJ.mjs} +2 -2
  14. package/lib/{SpotLightHelper-DqsfqCrs.mjs.map → SpotLightHelper-aXFW8qaJ.mjs.map} +1 -1
  15. package/lib/{USDZExporter-DxIqi8St.mjs → USDZExporter-B4hsiwhd.mjs} +2 -2
  16. package/lib/{USDZExporter-DxIqi8St.mjs.map → USDZExporter-B4hsiwhd.mjs.map} +1 -1
  17. package/lib/{api-xDJ-Uyom.mjs → api-C2-6Jm5W.mjs} +2 -2
  18. package/lib/{api-xDJ-Uyom.mjs.map → api-C2-6Jm5W.mjs.map} +1 -1
  19. package/lib/{banana-for-scale-C_iNmlCT.mjs → banana-for-scale-BV_na-g3.mjs} +4 -4
  20. package/lib/banana-for-scale-BV_na-g3.mjs.map +1 -0
  21. package/lib/chunk-C97zSiVS.mjs +20 -0
  22. package/lib/{common-utils-DMSTohiS.mjs → common-utils-qErzZAiR.mjs} +2 -2
  23. package/lib/common-utils-qErzZAiR.mjs.map +1 -0
  24. package/lib/{component-dimensioning-CvRmUja4.mjs → component-dimensioning-DCQTqssC.mjs} +49 -49
  25. package/lib/{component-dimensioning-CvRmUja4.mjs.map → component-dimensioning-DCQTqssC.mjs.map} +1 -1
  26. package/lib/{component-raycast-helper-CEp7wy9c.mjs → component-raycast-helper-B3WXp3oq.mjs} +20 -24
  27. package/lib/component-raycast-helper-B3WXp3oq.mjs.map +1 -0
  28. package/lib/configurator-CrNkzBp9.mjs +2 -0
  29. package/lib/configurator-Dx6kcXY_.mjs +45 -0
  30. package/lib/{configurator-CmuhFgC9.mjs.map → configurator-Dx6kcXY_.mjs.map} +1 -1
  31. package/lib/{continuous-drawing-helper-v_5UAM9A.mjs → continuous-drawing-helper-DzULJ9d1.mjs} +12 -12
  32. package/lib/continuous-drawing-helper-DzULJ9d1.mjs.map +1 -0
  33. package/lib/{decorate-C1QnXPYw.mjs → decorate-BIflHDAa.mjs} +1 -1
  34. package/lib/{decorate-C1QnXPYw.mjs.map → decorate-BIflHDAa.mjs.map} +1 -1
  35. package/lib/{dimensioning-helper-Fwpt1HTT.mjs → dimensioning-helper-Cj20VTW0.mjs} +66 -57
  36. package/lib/{dimensioning-helper-Fwpt1HTT.mjs.map → dimensioning-helper-Cj20VTW0.mjs.map} +1 -1
  37. package/lib/{glb-viewer-BzNA9-zH.mjs → glb-viewer-BqFcaUlb.mjs} +52 -52
  38. package/lib/glb-viewer-BqFcaUlb.mjs.map +1 -0
  39. package/lib/glb-viewer-FYw7R-ya.mjs +2 -0
  40. package/lib/{homag-intelligence-BwGjJEws.mjs → homag-intelligence-Dkz0AhB4.mjs} +3 -3
  41. package/lib/{homag-intelligence-BwGjJEws.mjs.map → homag-intelligence-Dkz0AhB4.mjs.map} +1 -1
  42. package/lib/{imos-ix-poc-export-helper-CQh94HsO.mjs → imos-ix-poc-export-helper-BjIgAfUu.mjs} +4 -3
  43. package/lib/imos-ix-poc-export-helper-BjIgAfUu.mjs.map +1 -0
  44. package/lib/kernel-BAQSG9r5.mjs.map +1 -1
  45. package/lib/{kernel-utils-H74uNY1h.mjs → kernel-utils-CfGzR_WC.mjs} +15 -15
  46. package/lib/{kernel-utils-H74uNY1h.mjs.map → kernel-utils-CfGzR_WC.mjs.map} +1 -1
  47. package/lib/{layer-C_JtkhdO.mjs → layer-CFAr2mK_.mjs} +1 -1
  48. package/lib/{layer-C_JtkhdO.mjs.map → layer-CFAr2mK_.mjs.map} +1 -1
  49. package/lib/{main-CtVIB52l.mjs → main-DMIVdAcT.mjs} +14471 -14300
  50. package/lib/main-DMIVdAcT.mjs.map +1 -0
  51. package/lib/{material-viewer-Bq4smZ6f.mjs → material-viewer-BkwvhHbQ.mjs} +40 -40
  52. package/lib/material-viewer-BkwvhHbQ.mjs.map +1 -0
  53. package/lib/planner-BPlxsTRJ.mjs +44 -0
  54. package/lib/{planner-CVw_xzGh.mjs.map → planner-BPlxsTRJ.mjs.map} +1 -1
  55. package/lib/planner-oj08ktHE.mjs +2 -0
  56. package/lib/{plugin-system-D9K46xJk.mjs → plugin-system-XhOJU1MI.mjs} +3 -3
  57. package/lib/{plugin-system-D9K46xJk.mjs.map → plugin-system-XhOJU1MI.mjs.map} +1 -1
  58. package/lib/roomle-renderer-BwPvUqSW.mjs +49 -0
  59. package/lib/roomle-renderer-BwPvUqSW.mjs.map +1 -0
  60. package/lib/roomle-sdk.d.ts +114 -1116
  61. package/lib/roomle-sdk.js +6 -6
  62. package/lib/roomle-webgpu-renderer-CSC5zFdC.mjs +217 -0
  63. package/lib/roomle-webgpu-renderer-CSC5zFdC.mjs.map +1 -0
  64. package/lib/{scene-renderer-D8HkTFeZ.mjs → scene-renderer-DWY_zPvU.mjs} +496 -513
  65. package/lib/scene-renderer-DWY_zPvU.mjs.map +1 -0
  66. package/lib/{script-loader-D8xCRzTr.mjs → script-loader-CA-XHFKN.mjs} +3 -3
  67. package/lib/{script-loader-D8xCRzTr.mjs.map → script-loader-CA-XHFKN.mjs.map} +1 -1
  68. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/package.json +1 -1
  69. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/configuratorCoreInterface.d.ts +0 -1
  70. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/plannerCoreInterface.d.ts +3 -3
  71. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/ConfiguratorKernel.js +54 -73
  72. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
  73. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleCore.js +59 -79
  74. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
  75. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleToolsCore.js +54 -74
  76. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
  77. package/lib/{stats-helper-HM0TaIM5.mjs → stats-helper-C954Cfgh.mjs} +4 -3
  78. package/lib/{stats-helper-HM0TaIM5.mjs.map → stats-helper-C954Cfgh.mjs.map} +1 -1
  79. package/lib/{three.core-CLIofecG.mjs → three.core-mM-jZdgg.mjs} +926 -926
  80. package/lib/{three.core-CLIofecG.mjs.map → three.core-mM-jZdgg.mjs.map} +1 -1
  81. package/lib/{three.module-C4Q1skJQ.mjs → three.module-Bmy3sVQ-.mjs} +1210 -1210
  82. package/lib/{three.module-C4Q1skJQ.mjs.map → three.module-Bmy3sVQ-.mjs.map} +1 -1
  83. package/lib/{three.webgpu-dFspy2yF.mjs → three.webgpu-0l2TztLa.mjs} +5355 -2935
  84. package/lib/{three.webgpu-dFspy2yF.mjs.map → three.webgpu-0l2TztLa.mjs.map} +1 -1
  85. package/lib/{threejs-utils-jEzvlJF1.mjs → threejs-utils-8zlxt158.mjs} +430 -431
  86. package/lib/threejs-utils-8zlxt158.mjs.map +1 -0
  87. package/lib/{tools-core-Bf9WsK5v.mjs → tools-core-BzhFD2Wk.mjs} +3 -3
  88. package/lib/{tools-core-Bf9WsK5v.mjs.map → tools-core-BzhFD2Wk.mjs.map} +1 -1
  89. package/package.json +1 -1
  90. package/lib/banana-for-scale-C_iNmlCT.mjs.map +0 -1
  91. package/lib/common-utils-DMSTohiS.mjs.map +0 -1
  92. package/lib/component-raycast-helper-CEp7wy9c.mjs.map +0 -1
  93. package/lib/configurator-BaUt4_LF.mjs +0 -2
  94. package/lib/configurator-CmuhFgC9.mjs +0 -45
  95. package/lib/continuous-drawing-helper-v_5UAM9A.mjs.map +0 -1
  96. package/lib/dimensioning-helper-DTcW85Oq.mjs +0 -2
  97. package/lib/glb-viewer-BzNA9-zH.mjs.map +0 -1
  98. package/lib/glb-viewer-DOxBD5k-.mjs +0 -2
  99. package/lib/imos-ix-poc-export-helper-CQh94HsO.mjs.map +0 -1
  100. package/lib/main-CtVIB52l.mjs.map +0 -1
  101. package/lib/material-viewer-Bq4smZ6f.mjs.map +0 -1
  102. package/lib/planner-CVw_xzGh.mjs +0 -44
  103. package/lib/planner-si70gWA2.mjs +0 -2
  104. package/lib/scene-renderer-D8HkTFeZ.mjs.map +0 -1
  105. package/lib/threejs-utils-jEzvlJF1.mjs.map +0 -1
@@ -1,9 +1,10 @@
1
- import { Lr as e, Nt as t, Rr as n, Xt as r, Y as i, _t as a, c as o, gt as s, l as c, o as l, vt as u } from "./three.core-CLIofecG.mjs";
2
- import { a as d } from "./kernel-utils-H74uNY1h.mjs";
3
- import { n as f, r as p, t as m } from "./decorate-C1QnXPYw.mjs";
4
- import { t as h } from "./layer-C_JtkhdO.mjs";
1
+ import { n as e } from "./chunk-C97zSiVS.mjs";
2
+ import { Bt as t, Rt as n, bi as r, d as i, m as a, on as o, p as s, pt as c, wn as l, xi as u, zt as d } from "./three.core-mM-jZdgg.mjs";
3
+ import { a as f } from "./kernel-utils-CfGzR_WC.mjs";
4
+ import { n as p, r as m, t as h } from "./decorate-BIflHDAa.mjs";
5
+ import { t as g } from "./layer-CFAr2mK_.mjs";
5
6
  //#region packages/common-core/src/async-guard.ts
6
- var g = class {
7
+ var _ = class {
7
8
  constructor(e) {
8
9
  this.info = e, this._init();
9
10
  }
@@ -24,9 +25,9 @@ var g = class {
24
25
  reset() {
25
26
  this._init();
26
27
  }
27
- }, _ = class extends r {
28
- constructor(t = document.createElement("div")) {
29
- super(), this.isCSS2DObject = !0, this.element = t, this.element.style.position = "absolute", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.center = new e(.5, .5), this.addEventListener("removed", function() {
28
+ }, v = class extends l {
29
+ constructor(e = document.createElement("div")) {
30
+ super(), this.isCSS2DObject = !0, this.element = e, this.element.style.position = "absolute", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.center = new r(.5, .5), this.addEventListener("removed", function() {
30
31
  this.traverse(function(e) {
31
32
  e.element && e.element instanceof e.element.ownerDocument.defaultView.Element && e.element.parentNode !== null && e.element.remove();
32
33
  });
@@ -35,7 +36,7 @@ var g = class {
35
36
  copy(e, t) {
36
37
  return super.copy(e, t), this.element = e.element.cloneNode(!0), this.center = e.center, this;
37
38
  }
38
- }, v = new n(), y = new t(), b = new t(), x = new n(), S = new n(), C = class {
39
+ }, y = new u(), b = new o(), x = new o(), S = new u(), C = new u(), w = class {
39
40
  constructor(e = {}) {
40
41
  let t = this, n, r, i, a, o = { objects: /* @__PURE__ */ new WeakMap() }, s = e.element === void 0 ? document.createElement("div") : e.element;
41
42
  s.style.overflow = "hidden", this.domElement = s, this.sortObjects = !0, this.getSize = function() {
@@ -44,7 +45,7 @@ var g = class {
44
45
  height: r
45
46
  };
46
47
  }, this.render = function(e, t) {
47
- e.matrixWorldAutoUpdate === !0 && e.updateMatrixWorld(), t.parent === null && t.matrixWorldAutoUpdate === !0 && t.updateMatrixWorld(), y.copy(t.matrixWorldInverse), b.multiplyMatrices(t.projectionMatrix, y), l(e, e, t), this.sortObjects && f(e);
48
+ e.matrixWorldAutoUpdate === !0 && e.updateMatrixWorld(), t.parent === null && t.matrixWorldAutoUpdate === !0 && t.updateMatrixWorld(), b.copy(t.matrixWorldInverse), x.multiplyMatrices(t.projectionMatrix, b), l(e, e, t), this.sortObjects && f(e);
48
49
  }, this.setSize = function(e, t) {
49
50
  n = e, r = t, i = n / 2, a = r / 2, s.style.width = e + "px", s.style.height = t + "px";
50
51
  };
@@ -58,16 +59,16 @@ var g = class {
58
59
  return;
59
60
  }
60
61
  if (e.isCSS2DObject) {
61
- v.setFromMatrixPosition(e.matrixWorld), v.applyMatrix4(b);
62
- let c = v.z >= -1 && v.z <= 1 && e.layers.test(r.layers) === !0, l = e.element;
63
- l.style.display = c === !0 ? "" : "none", c === !0 && (e.onBeforeRender(t, n, r), l.style.transform = "translate(" + -100 * e.center.x + "%," + -100 * e.center.y + "%)translate(" + (v.x * i + i) + "px," + (-v.y * a + a) + "px)", l.parentNode !== s && s.appendChild(l), e.onAfterRender(t, n, r));
62
+ y.setFromMatrixPosition(e.matrixWorld), y.applyMatrix4(x);
63
+ let c = y.z >= -1 && y.z <= 1 && e.layers.test(r.layers) === !0, l = e.element;
64
+ l.style.display = c === !0 ? "" : "none", c === !0 && (e.onBeforeRender(t, n, r), l.style.transform = "translate(" + -100 * e.center.x + "%," + -100 * e.center.y + "%)translate(" + (y.x * i + i) + "px," + (-y.y * a + a) + "px)", l.parentNode !== s && s.appendChild(l), e.onAfterRender(t, n, r));
64
65
  let d = { distanceToCameraSquared: u(r, e) };
65
66
  o.objects.set(e, d);
66
67
  }
67
68
  for (let t = 0, i = e.children.length; t < i; t++) l(e.children[t], n, r);
68
69
  }
69
70
  function u(e, t) {
70
- return x.setFromMatrixPosition(e.matrixWorld), S.setFromMatrixPosition(t.matrixWorld), x.distanceToSquared(S);
71
+ return S.setFromMatrixPosition(e.matrixWorld), C.setFromMatrixPosition(t.matrixWorld), S.distanceToSquared(C);
71
72
  }
72
73
  function d(e) {
73
74
  let t = [];
@@ -82,28 +83,36 @@ var g = class {
82
83
  for (let e = 0, r = t.length; e < r; e++) t[e].element.style.zIndex = n - e;
83
84
  }
84
85
  }
85
- }, w = "dimensioning", T = .08, E = 1.2, D = .03, O = 3618615;
86
- function k(e) {
87
- return new A(e);
86
+ }, T = /* @__PURE__ */ e({
87
+ DIMENSIONING_GEOMETRY: () => E,
88
+ DIMENSION_LINE_OFFSET: () => D,
89
+ EXTENSION_LINE_LENGTH_RATIO: () => k,
90
+ FADE_DISTANCE_RATIO: () => 2,
91
+ MIN_CAMERA_DISTANCE_RATIO: () => O,
92
+ createDimensioningHelper: () => j,
93
+ default: () => M
94
+ }), E = "dimensioning", D = .08, O = 1.2, k = .03, A = 3618615;
95
+ function j(e) {
96
+ return new M(e);
88
97
  }
89
- var A = class {
98
+ var M = class {
90
99
  constructor(e) {
91
- this._cameraPosition = new n(), this._initialized = new g(), this._enabled = !1, this._dimensionsVisible = !1, this._dimensionLineGroup = new i(), this._creator_ = e, this._lineMaterial = new u({
92
- color: O,
100
+ this._cameraPosition = new u(), this._initialized = new _(), this._enabled = !1, this._dimensionsVisible = !1, this._dimensionLineGroup = new c(), this._creator_ = e, this._lineMaterial = new t({
101
+ color: A,
93
102
  linewidth: 2
94
- }), this._mainLineMaterial = new u({
95
- color: O,
103
+ }), this._mainLineMaterial = new t({
104
+ color: A,
96
105
  linewidth: .001,
97
106
  transparent: !0,
98
107
  opacity: 1
99
- }), this._dimensionLineGroup.name = w, this._widthLineGroup = this._createLineGroup("width"), this._heightLineGroup = this._createLineGroup("height"), this._depthLineGroup = this._createLineGroup("depth"), this._dimensionLineGroup.add(this._widthLineGroup), this._dimensionLineGroup.add(this._heightLineGroup), this._dimensionLineGroup.add(this._depthLineGroup), this.update(!1), this._initialized.resolve();
108
+ }), this._dimensionLineGroup.name = E, this._widthLineGroup = this._createLineGroup("width"), this._heightLineGroup = this._createLineGroup("height"), this._depthLineGroup = this._createLineGroup("depth"), this._dimensionLineGroup.add(this._widthLineGroup), this._dimensionLineGroup.add(this._heightLineGroup), this._dimensionLineGroup.add(this._depthLineGroup), this.update(!1), this._initialized.resolve();
100
109
  }
101
110
  _createLineGroup(e) {
102
- let t = new i();
103
- return t.name = w, t.userData.ignoreComponentRaycast = !0, t;
111
+ let t = new c();
112
+ return t.name = E, t.userData.ignoreComponentRaycast = !0, t;
104
113
  }
105
114
  _createLineFromConfig(e, t) {
106
- let n = new c(), r = [
115
+ let r = new a(), i = [
107
116
  e.start.x,
108
117
  e.start.y,
109
118
  e.start.z,
@@ -111,9 +120,9 @@ var A = class {
111
120
  e.end.y,
112
121
  e.end.z
113
122
  ];
114
- n.setAttribute("position", new o(new Float32Array(r), 3));
115
- let i = new s(n, t);
116
- return i.name = w, i.userData.ignoreComponentRaycast = !0, i.layers.set(h.DIMENSIONS), i;
123
+ r.setAttribute("position", new s(new Float32Array(i), 3));
124
+ let o = new n(r, t);
125
+ return o.name = E, o.userData.ignoreComponentRaycast = !0, o.layers.set(g.DIMENSIONS), o;
117
126
  }
118
127
  addLinesToLineGroup(e, t, n, r) {
119
128
  t.extensionLines.forEach((t) => {
@@ -123,7 +132,7 @@ var A = class {
123
132
  clearLineGroup(e) {
124
133
  for (; e.children.length > 0;) {
125
134
  let t = e.children[0];
126
- t instanceof s && t.geometry.dispose(), e.remove(t);
135
+ t instanceof n && t.geometry.dispose(), e.remove(t);
127
136
  }
128
137
  }
129
138
  addLabelToLineGroup(e, t, n) {
@@ -131,32 +140,32 @@ var A = class {
131
140
  r.classList.add("dimension-label", "dimension-label--primary", "dimension-label--disabled");
132
141
  let i = document.createElement("span");
133
142
  i.classList.add("dimension-label__value"), i.innerHTML = t, r.appendChild(i);
134
- let a = new _(r), o = this._dimensionLineGroup.worldToLocal(n);
143
+ let a = new v(r), o = this._dimensionLineGroup.worldToLocal(n);
135
144
  a.position.copy(o), e.add(a);
136
145
  }
137
146
  _getWidthLineConfig() {
138
- let e = T, t = D, r = this._dimensions.y + e, i = this._getLocalCameraPosition().z < this._dimensions.z / 2 ? 0 : this._dimensions.z;
147
+ let e = D, t = k, n = this._dimensions.y + e, r = this._getLocalCameraPosition().z < this._dimensions.z / 2 ? 0 : this._dimensions.z;
139
148
  return {
140
- mainLine: new a(new n(0, r, i), new n(this._dimensions.x, r, i)),
141
- extensionLines: [new a(new n(0, r - t, i), new n(0, r + t, i)), new a(new n(this._dimensions.x, r - t, i), new n(this._dimensions.x, r + t, i))]
149
+ mainLine: new d(new u(0, n, r), new u(this._dimensions.x, n, r)),
150
+ extensionLines: [new d(new u(0, n - t, r), new u(0, n + t, r)), new d(new u(this._dimensions.x, n - t, r), new u(this._dimensions.x, n + t, r))]
142
151
  };
143
152
  }
144
153
  _getDepthLineConfig() {
145
- let e = T, t = D, r = this._getLocalCameraPosition().x < this._dimensions.x / 2 ? -e : this._dimensions.x + e;
154
+ let e = D, t = k, n = this._getLocalCameraPosition().x < this._dimensions.x / 2 ? -e : this._dimensions.x + e;
146
155
  return {
147
- mainLine: new a(new n(r, 0, this._dimensions.z), new n(r, 0, 0)),
148
- extensionLines: [new a(new n(r - t, 0, 0), new n(r + t, 0, 0)), new a(new n(r - t, 0, this._dimensions.z), new n(r + t, 0, this._dimensions.z))]
156
+ mainLine: new d(new u(n, 0, this._dimensions.z), new u(n, 0, 0)),
157
+ extensionLines: [new d(new u(n - t, 0, 0), new u(n + t, 0, 0)), new d(new u(n - t, 0, this._dimensions.z), new u(n + t, 0, this._dimensions.z))]
149
158
  };
150
159
  }
151
160
  _getHeightLineConfig() {
152
- let e = T, t = D, r = this._getLocalCameraPosition(), i = r.x < this._dimensions.x / 2 ? -e : this._dimensions.x + e, o = r.z < this._dimensions.z / 2 ? 0 : this._dimensions.z;
161
+ let e = D, t = k, n = this._getLocalCameraPosition(), r = n.x < this._dimensions.x / 2 ? -e : this._dimensions.x + e, i = n.z < this._dimensions.z / 2 ? 0 : this._dimensions.z;
153
162
  return {
154
- mainLine: new a(new n(i, 0, o), new n(i, this._dimensions.y, o)),
155
- extensionLines: [new a(new n(i - t, 0, o), new n(i + t, 0, o)), new a(new n(i - t, this._dimensions.y, o), new n(i + t, this._dimensions.y, o))]
163
+ mainLine: new d(new u(r, 0, i), new u(r, this._dimensions.y, i)),
164
+ extensionLines: [new d(new u(r - t, 0, i), new u(r + t, 0, i)), new d(new u(r - t, this._dimensions.y, i), new u(r + t, this._dimensions.y, i))]
156
165
  };
157
166
  }
158
167
  _getLocalCameraPosition() {
159
- return !this._cameraPosition || !this._dimensionLineGroup || !this._dimensions ? new n(0, 0, 0) : this._dimensionLineGroup.worldToLocal(this._cameraPosition.clone());
168
+ return !this._cameraPosition || !this._dimensionLineGroup || !this._dimensions ? new u(0, 0, 0) : this._dimensionLineGroup.worldToLocal(this._cameraPosition.clone());
160
169
  }
161
170
  _getCameraDistanceInfo() {
162
171
  if (!this._object || !this._cameraPosition || !this._dimensions) return {
@@ -164,14 +173,14 @@ var A = class {
164
173
  opacity: 1,
165
174
  distance: Infinity
166
175
  };
167
- let e = this._object.getWorldPosition(new n()), t = this._cameraPosition.distanceTo(e), r = Math.max(this._dimensions.x, this._dimensions.y, this._dimensions.z) / 2, i = r * E, a = r * 2;
168
- if (t < i) return {
176
+ let e = this._object.getWorldPosition(new u()), t = this._cameraPosition.distanceTo(e), n = Math.max(this._dimensions.x, this._dimensions.y, this._dimensions.z) / 2, r = n * O, i = n * 2;
177
+ if (t < r) return {
169
178
  tooClose: !0,
170
179
  opacity: 0,
171
180
  distance: t
172
181
  };
173
- if (t < a) {
174
- let e = (t - i) / (a - i);
182
+ if (t < i) {
183
+ let e = (t - r) / (i - r);
175
184
  return {
176
185
  tooClose: !1,
177
186
  opacity: Math.max(0, Math.min(1, e)),
@@ -191,7 +200,7 @@ var A = class {
191
200
  this._enabled && !this._dimensionsVisible && (this._dimensionsVisible = !0, this._visibilityChangedCallback()), this._performUpdate(e);
192
201
  }
193
202
  updateSize(e) {
194
- this._origin = d(e.origin), this._dimensionLineGroup.position.x = this._origin.x - this._object.position.x, this._dimensionLineGroup.position.y = this._origin.y - this._object.position.y, this._dimensionLineGroup.position.z = this._origin.z - this._object.position.z, this._dimensions = d(e.size), this.update();
203
+ this._origin = f(e.origin), this._dimensionLineGroup.position.x = this._origin.x - this._object.position.x, this._dimensionLineGroup.position.y = this._origin.y - this._object.position.y, this._dimensionLineGroup.position.z = this._origin.z - this._object.position.z, this._dimensions = f(e.size), this.update();
195
204
  }
196
205
  removeFromObject(e) {
197
206
  e && e.remove(this._dimensionLineGroup);
@@ -227,7 +236,7 @@ var A = class {
227
236
  this._heightLineGroup.visible = !0, this.disableDimensions();
228
237
  }
229
238
  getBoundingBox() {
230
- let e = new l();
239
+ let e = new i();
231
240
  return e.expandByObject(this._dimensionLineGroup), e;
232
241
  }
233
242
  moveCameraStart(e) {
@@ -239,17 +248,17 @@ var A = class {
239
248
  _performUpdate(e) {
240
249
  if (!this._enabled && !e || !this._dimensions) return;
241
250
  let t = 1;
242
- if (this._object && this._cameraPosition && !this._cameraPosition.equals(new n(0, 0, 0))) {
251
+ if (this._object && this._cameraPosition && !this._cameraPosition.equals(new u(0, 0, 0))) {
243
252
  let e = this._getCameraDistanceInfo();
244
253
  e.tooClose ? this._dimensionLineGroup.visible = !1 : (this._dimensionLineGroup.visible = !0, t = e.opacity, this._mainLineMaterial.opacity = t);
245
254
  }
246
255
  this._dimensionLineGroup.updateMatrixWorld(!0);
247
- let r = this._getWidthLineConfig(), i = this._unitFormatter.formatMMValueToUnitString(this._dimensions.x * 1e3), a = this._dimensionLineGroup.localToWorld(r.mainLine.getCenter(new n()));
248
- this.clearLineGroup(this._widthLineGroup), this.addLinesToLineGroup(this._widthLineGroup, r, this._mainLineMaterial, this._mainLineMaterial), this.addLabelToLineGroup(this._widthLineGroup, i, a);
249
- let o = this._getHeightLineConfig(), s = this._unitFormatter.formatMMValueToUnitString(this._dimensions.y * 1e3), c = this._dimensionLineGroup.localToWorld(o.mainLine.getCenter(new n()));
250
- this.clearLineGroup(this._heightLineGroup), this.addLinesToLineGroup(this._heightLineGroup, o, this._mainLineMaterial, this._mainLineMaterial), this.addLabelToLineGroup(this._heightLineGroup, s, c);
251
- let l = this._getDepthLineConfig(), u = this._unitFormatter.formatMMValueToUnitString(this._dimensions.z * -1e3), d = this._dimensionLineGroup.localToWorld(l.mainLine.getCenter(new n()));
252
- this.clearLineGroup(this._depthLineGroup), this.addLinesToLineGroup(this._depthLineGroup, l, this._mainLineMaterial, this._mainLineMaterial), this.addLabelToLineGroup(this._depthLineGroup, u, d);
256
+ let n = this._getWidthLineConfig(), r = this._unitFormatter.formatMMValueToUnitString(this._dimensions.x * 1e3), i = this._dimensionLineGroup.localToWorld(n.mainLine.getCenter(new u()));
257
+ this.clearLineGroup(this._widthLineGroup), this.addLinesToLineGroup(this._widthLineGroup, n, this._mainLineMaterial, this._mainLineMaterial), r !== null && this.addLabelToLineGroup(this._widthLineGroup, r, i);
258
+ let a = this._getHeightLineConfig(), o = this._unitFormatter.formatMMValueToUnitString(this._dimensions.y * 1e3), s = this._dimensionLineGroup.localToWorld(a.mainLine.getCenter(new u()));
259
+ this.clearLineGroup(this._heightLineGroup), this.addLinesToLineGroup(this._heightLineGroup, a, this._mainLineMaterial, this._mainLineMaterial), o !== null && this.addLabelToLineGroup(this._heightLineGroup, o, s);
260
+ let c = this._getDepthLineConfig(), l = this._unitFormatter.formatMMValueToUnitString(this._dimensions.z * -1e3), d = this._dimensionLineGroup.localToWorld(c.mainLine.getCenter(new u()));
261
+ this.clearLineGroup(this._depthLineGroup), this.addLinesToLineGroup(this._depthLineGroup, c, this._mainLineMaterial, this._mainLineMaterial), l !== null && this.addLabelToLineGroup(this._depthLineGroup, l, d);
253
262
  }
254
263
  _clear() {
255
264
  this._lineMaterial.dispose(), this._mainLineMaterial.dispose(), [
@@ -261,8 +270,8 @@ var A = class {
261
270
  });
262
271
  }
263
272
  };
264
- m([p, f("design:type", Object)], A.prototype, "_unitFormatter", void 0);
273
+ h([m, p("design:type", Object)], M.prototype, "_unitFormatter", void 0);
265
274
  //#endregion
266
- export { E as a, C as c, D as i, g as l, T as n, k as o, A as r, _ as s, w as t };
275
+ export { _ as a, w as i, T as n, v as r, E as t };
267
276
 
268
- //# sourceMappingURL=dimensioning-helper-Fwpt1HTT.mjs.map
277
+ //# sourceMappingURL=dimensioning-helper-Cj20VTW0.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dimensioning-helper-Fwpt1HTT.mjs","names":[],"sources":["../../packages/common-core/src/async-guard.ts","../../../../node_modules/three/examples/jsm/renderers/CSS2DRenderer.js","../../packages/configurator-core/src/utils/dimensioning-helper.ts"],"sourcesContent":["export default class AsyncGuard<T> {\n public info: any;\n private _promise: Promise<T>;\n private _resolve: (value?: T | PromiseLike<T>) => void;\n private _reject: (error: Error) => void;\n\n constructor(info?: any) {\n this.info = info;\n this._init();\n }\n\n private _init() {\n this._promise = new Promise<T>((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n }\n\n public resolve(value?: any): void {\n if (value) {\n this._resolve(value);\n }\n this._resolve();\n }\n\n public reject(e: Error): void {\n this._reject(e);\n }\n\n public wait(): Promise<T> {\n return this._promise;\n }\n\n public reset() {\n this._init();\n }\n}\n","import {\n\tMatrix4,\n\tObject3D,\n\tVector2,\n\tVector3\n} from 'three';\n\n/**\n * The only type of 3D object that is supported by {@link CSS2DRenderer}.\n *\n * @augments Object3D\n * @three_import import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js';\n */\nclass CSS2DObject extends Object3D {\n\n\t/**\n\t * Constructs a new CSS2D object.\n\t *\n\t * @param {HTMLElement} [element] - The DOM element.\n\t */\n\tconstructor( element = document.createElement( 'div' ) ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCSS2DObject = true;\n\n\t\t/**\n\t\t * The DOM element which defines the appearance of this 3D object.\n\t\t *\n\t\t * @type {HTMLElement}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.element = element;\n\n\t\tthis.element.style.position = 'absolute';\n\t\tthis.element.style.userSelect = 'none';\n\n\t\tthis.element.setAttribute( 'draggable', false );\n\n\t\t/**\n\t\t * The 3D objects center point.\n\t\t * `( 0, 0 )` is the lower left, `( 1, 1 )` is the top right.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (0.5,0.5)\n\t\t */\n\t\tthis.center = new Vector2( 0.5, 0.5 );\n\n\t\tthis.addEventListener( 'removed', function () {\n\n\t\t\tthis.traverse( function ( object ) {\n\n\t\t\t\tif (\n\t\t\t\t\tobject.element &&\n\t\t\t\t\tobject.element instanceof object.element.ownerDocument.defaultView.Element &&\n\t\t\t\t\tobject.element.parentNode !== null\n\t\t\t\t) {\n\n\t\t\t\t\tobject.element.remove();\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t} );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.element = source.element.cloneNode( true );\n\n\t\tthis.center = source.center;\n\n\t\treturn this;\n\n\t}\n\n}\n\n//\n\nconst _vector = new Vector3();\nconst _viewMatrix = new Matrix4();\nconst _viewProjectionMatrix = new Matrix4();\nconst _a = new Vector3();\nconst _b = new Vector3();\n\n/**\n * This renderer is a simplified version of {@link CSS3DRenderer}. The only transformation that is\n * supported is translation.\n *\n * The renderer is very useful if you want to combine HTML based labels with 3D objects. Here too,\n * the respective DOM elements are wrapped into an instance of {@link CSS2DObject} and added to the\n * scene graph. All other types of renderable 3D objects (like meshes or point clouds) are ignored.\n *\n * `CSS2DRenderer` only supports 100% browser and display zoom.\n *\n * @three_import import { CSS2DRenderer } from 'three/addons/renderers/CSS2DRenderer.js';\n */\nclass CSS2DRenderer {\n\n\t/**\n\t * Constructs a new CSS2D renderer.\n\t *\n\t * @param {CSS2DRenderer~Parameters} [parameters] - The parameters.\n\t */\n\tconstructor( parameters = {} ) {\n\n\t\tconst _this = this;\n\n\t\tlet _width, _height;\n\t\tlet _widthHalf, _heightHalf;\n\n\t\tconst cache = {\n\t\t\tobjects: new WeakMap()\n\t\t};\n\n\t\tconst domElement = parameters.element !== undefined ? parameters.element : document.createElement( 'div' );\n\n\t\tdomElement.style.overflow = 'hidden';\n\n\t\t/**\n\t\t * The DOM where the renderer appends its child-elements.\n\t\t *\n\t\t * @type {HTMLElement}\n\t\t */\n\t\tthis.domElement = domElement;\n\n\t\t/**\n\t\t * Controls whether the renderer assigns `z-index` values to CSS2DObject DOM elements.\n\t\t * If set to `true`, z-index values are assigned first based on the `renderOrder`\n\t\t * and secondly - the distance to the camera. If set to `false`, no z-index values are assigned.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.sortObjects = true;\n\n\t\t/**\n\t\t * Returns an object containing the width and height of the renderer.\n\t\t *\n\t\t * @return {{width:number,height:number}} The size of the renderer.\n\t\t */\n\t\tthis.getSize = function () {\n\n\t\t\treturn {\n\t\t\t\twidth: _width,\n\t\t\t\theight: _height\n\t\t\t};\n\n\t\t};\n\n\t\t/**\n\t\t * Renders the given scene using the given camera.\n\t\t *\n\t\t * @param {Object3D} scene - A scene or any other type of 3D object.\n\t\t * @param {Camera} camera - The camera.\n\t\t */\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tif ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();\n\t\t\tif ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();\n\n\t\t\t_viewMatrix.copy( camera.matrixWorldInverse );\n\t\t\t_viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, _viewMatrix );\n\n\t\t\trenderObject( scene, scene, camera );\n\t\t\tif ( this.sortObjects ) zOrder( scene );\n\n\t\t};\n\n\t\t/**\n\t\t * Resizes the renderer to the given width and height.\n\t\t *\n\t\t * @param {number} width - The width of the renderer.\n\t\t * @param {number} height - The height of the renderer.\n\t\t */\n\t\tthis.setSize = function ( width, height ) {\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\t_widthHalf = _width / 2;\n\t\t\t_heightHalf = _height / 2;\n\n\t\t\tdomElement.style.width = width + 'px';\n\t\t\tdomElement.style.height = height + 'px';\n\n\t\t};\n\n\t\tfunction hideObject( object ) {\n\n\t\t\tif ( object.isCSS2DObject ) object.element.style.display = 'none';\n\n\t\t\tfor ( let i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\t\thideObject( object.children[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderObject( object, scene, camera ) {\n\n\t\t\tif ( object.visible === false ) {\n\n\t\t\t\thideObject( object );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( object.isCSS2DObject ) {\n\n\t\t\t\t_vector.setFromMatrixPosition( object.matrixWorld );\n\t\t\t\t_vector.applyMatrix4( _viewProjectionMatrix );\n\n\t\t\t\tconst visible = ( _vector.z >= - 1 && _vector.z <= 1 ) && ( object.layers.test( camera.layers ) === true );\n\n\t\t\t\tconst element = object.element;\n\t\t\t\telement.style.display = visible === true ? '' : 'none';\n\n\t\t\t\tif ( visible === true ) {\n\n\t\t\t\t\tobject.onBeforeRender( _this, scene, camera );\n\n\t\t\t\t\telement.style.transform = 'translate(' + ( - 100 * object.center.x ) + '%,' + ( - 100 * object.center.y ) + '%)' + 'translate(' + ( _vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - _vector.y * _heightHalf + _heightHalf ) + 'px)';\n\n\t\t\t\t\tif ( element.parentNode !== domElement ) {\n\n\t\t\t\t\t\tdomElement.appendChild( element );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tobject.onAfterRender( _this, scene, camera );\n\n\t\t\t\t}\n\n\t\t\t\tconst objectData = {\n\t\t\t\t\tdistanceToCameraSquared: getDistanceToSquared( camera, object )\n\t\t\t\t};\n\n\t\t\t\tcache.objects.set( object, objectData );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\t\trenderObject( object.children[ i ], scene, camera );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction getDistanceToSquared( object1, object2 ) {\n\n\t\t\t_a.setFromMatrixPosition( object1.matrixWorld );\n\t\t\t_b.setFromMatrixPosition( object2.matrixWorld );\n\n\t\t\treturn _a.distanceToSquared( _b );\n\n\t\t}\n\n\t\tfunction filterAndFlatten( scene ) {\n\n\t\t\tconst result = [];\n\n\t\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\t\tif ( object.isCSS2DObject ) result.push( object );\n\n\t\t\t} );\n\n\t\t\treturn result;\n\n\t\t}\n\n\t\tfunction zOrder( scene ) {\n\n\t\t\tconst sorted = filterAndFlatten( scene ).sort( function ( a, b ) {\n\n\t\t\t\tif ( a.renderOrder !== b.renderOrder ) {\n\n\t\t\t\t\treturn b.renderOrder - a.renderOrder;\n\n\t\t\t\t}\n\n\t\t\t\tconst distanceA = cache.objects.get( a ).distanceToCameraSquared;\n\t\t\t\tconst distanceB = cache.objects.get( b ).distanceToCameraSquared;\n\n\t\t\t\treturn distanceA - distanceB;\n\n\t\t\t} );\n\n\t\t\tconst zMax = sorted.length;\n\n\t\t\tfor ( let i = 0, l = sorted.length; i < l; i ++ ) {\n\n\t\t\t\tsorted[ i ].element.style.zIndex = zMax - i;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Constructor parameters of `CSS2DRenderer`.\n *\n * @typedef {Object} CSS2DRenderer~Parameters\n * @property {HTMLElement} [element] - A DOM element where the renderer appends its child-elements.\n * If not passed in here, a new div element will be created.\n **/\n\nexport { CSS2DObject, CSS2DRenderer };\n","import inject from '../../../common-core/src/di/inject';\nimport AsyncGuard from '../../../common-core/src/async-guard';\nimport type { Object3D } from 'three';\nimport { Group, type Scene } from 'three';\nimport { Box3 } from 'three';\nimport {\n BufferAttribute,\n BufferGeometry,\n Line,\n Line3,\n LineBasicMaterial,\n Vector3,\n} from 'three';\nimport { type KernelCube } from '../../../typings/kernel';\nimport { convertToTHREE } from '../../../common-core/src/utils/kernel-utils';\nimport type UnitFormatter from '../services/unit-formatter';\nimport { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer.js';\nimport { LAYER } from '../../../common-core/src/webgl/layer';\n\nexport const DIMENSIONING_GEOMETRY = 'dimensioning';\nexport const DIMENSION_LINE_OFFSET = 0.08;\nexport const MIN_CAMERA_DISTANCE_RATIO = 1.2;\nexport const FADE_DISTANCE_RATIO = 2.0;\nexport const EXTENSION_LINE_LENGTH_RATIO = 0.03;\n\nexport interface DimensionLineConfig {\n mainLine: Line3;\n extensionLines: Line3[];\n}\n\nconst LINE_COLOR = 0x373737;\n\nexport function createDimensioningHelper(creator: string): DimensioningHelper {\n return new DimensioningHelper(creator);\n}\n\nexport default class DimensioningHelper {\n public _creator_: string;\n\n @inject\n private _unitFormatter: UnitFormatter;\n\n private _object: Object3D;\n private _cameraPosition: Vector3 = new Vector3();\n private _onVisibilityChange: (visible: boolean) => void;\n private _initialized: AsyncGuard<void> = new AsyncGuard();\n\n private _origin: Vector3;\n private _dimensions: Vector3;\n\n private _lineMaterial: LineBasicMaterial;\n private readonly _mainLineMaterial: LineBasicMaterial;\n\n private readonly _widthLineGroup: Group;\n private readonly _heightLineGroup: Group;\n private readonly _depthLineGroup: Group;\n\n private _enabled: boolean = false;\n private _dimensionsVisible = false;\n\n private _dimensionLineGroup = new Group();\n\n constructor(creator: string) {\n this._creator_ = creator;\n\n this._lineMaterial = new LineBasicMaterial({\n color: LINE_COLOR,\n linewidth: 2,\n });\n\n this._mainLineMaterial = new LineBasicMaterial({\n color: LINE_COLOR,\n linewidth: 0.001,\n transparent: true,\n opacity: 1.0,\n });\n\n this._dimensionLineGroup.name = DIMENSIONING_GEOMETRY;\n\n this._widthLineGroup = this._createLineGroup('width');\n this._heightLineGroup = this._createLineGroup('height');\n this._depthLineGroup = this._createLineGroup('depth');\n\n this._dimensionLineGroup.add(this._widthLineGroup);\n this._dimensionLineGroup.add(this._heightLineGroup);\n this._dimensionLineGroup.add(this._depthLineGroup);\n\n this.update(false);\n this._initialized.resolve();\n }\n\n private _createLineGroup(_name: string): Group {\n const group = new Group();\n group.name = DIMENSIONING_GEOMETRY;\n group.userData.ignoreComponentRaycast = true;\n return group;\n }\n\n private _createLineFromConfig(\n config: Line3,\n material: LineBasicMaterial,\n ): Line {\n const geometry = new BufferGeometry();\n const vertices = [\n config.start.x,\n config.start.y,\n config.start.z,\n config.end.x,\n config.end.y,\n config.end.z,\n ];\n geometry.setAttribute(\n 'position',\n new BufferAttribute(new Float32Array(vertices), 3),\n );\n const line = new Line(geometry, material);\n line.name = DIMENSIONING_GEOMETRY;\n line.userData.ignoreComponentRaycast = true;\n line.layers.set(LAYER.DIMENSIONS);\n return line;\n }\n\n private addLinesToLineGroup(\n group: Group,\n config: DimensionLineConfig,\n mainMaterial: LineBasicMaterial,\n extMaterial: LineBasicMaterial,\n ) {\n config.extensionLines.forEach((extLine) => {\n group.add(this._createLineFromConfig(extLine, extMaterial));\n });\n\n group.add(this._createLineFromConfig(config.mainLine, mainMaterial));\n }\n\n private clearLineGroup(group: Group) {\n while (group.children.length > 0) {\n const child = group.children[0];\n if (child instanceof Line) {\n child.geometry.dispose();\n }\n group.remove(child);\n }\n }\n\n private addLabelToLineGroup(\n group: Group,\n labelText: string,\n labelWorldPosition: Vector3,\n ): void {\n const labelHtmlDiv = document.createElement('div');\n labelHtmlDiv.classList.add(\n 'dimension-label',\n 'dimension-label--primary',\n 'dimension-label--disabled',\n );\n const labelHtmlSpan = document.createElement('span');\n labelHtmlSpan.classList.add('dimension-label__value');\n labelHtmlSpan.innerHTML = labelText;\n labelHtmlDiv.appendChild(labelHtmlSpan);\n\n const labelObject = new CSS2DObject(labelHtmlDiv);\n const labelLocalPosition =\n this._dimensionLineGroup.worldToLocal(labelWorldPosition);\n labelObject.position.copy(labelLocalPosition);\n\n group.add(labelObject);\n }\n\n private _getWidthLineConfig(): DimensionLineConfig {\n const offset = DIMENSION_LINE_OFFSET;\n const extLength = EXTENSION_LINE_LENGTH_RATIO;\n const y = this._dimensions.y + offset;\n const localCam = this._getLocalCameraPosition();\n const z = localCam.z < this._dimensions.z / 2 ? 0 : this._dimensions.z;\n\n return {\n mainLine: new Line3(\n new Vector3(0, y, z),\n new Vector3(this._dimensions.x, y, z),\n ),\n extensionLines: [\n new Line3(\n new Vector3(0, y - extLength, z),\n new Vector3(0, y + extLength, z),\n ),\n new Line3(\n new Vector3(this._dimensions.x, y - extLength, z),\n new Vector3(this._dimensions.x, y + extLength, z),\n ),\n ],\n };\n }\n\n private _getDepthLineConfig(): DimensionLineConfig {\n const offset = DIMENSION_LINE_OFFSET;\n const extLength = EXTENSION_LINE_LENGTH_RATIO;\n const y = 0;\n const localCam = this._getLocalCameraPosition();\n const x =\n localCam.x < this._dimensions.x / 2\n ? -offset\n : this._dimensions.x + offset;\n\n return {\n mainLine: new Line3(\n new Vector3(x, y, this._dimensions.z),\n new Vector3(x, y, 0),\n ),\n extensionLines: [\n new Line3(\n new Vector3(x - extLength, y, 0),\n new Vector3(x + extLength, y, 0),\n ),\n new Line3(\n new Vector3(x - extLength, y, this._dimensions.z),\n new Vector3(x + extLength, y, this._dimensions.z),\n ),\n ],\n };\n }\n\n private _getHeightLineConfig(): DimensionLineConfig {\n const offset = DIMENSION_LINE_OFFSET;\n const extLength = EXTENSION_LINE_LENGTH_RATIO;\n const localCam = this._getLocalCameraPosition();\n const x =\n localCam.x < this._dimensions.x / 2\n ? -offset\n : this._dimensions.x + offset;\n const z = localCam.z < this._dimensions.z / 2 ? 0 : this._dimensions.z;\n\n return {\n mainLine: new Line3(\n new Vector3(x, 0, z),\n new Vector3(x, this._dimensions.y, z),\n ),\n extensionLines: [\n new Line3(\n new Vector3(x - extLength, 0, z),\n new Vector3(x + extLength, 0, z),\n ),\n new Line3(\n new Vector3(x - extLength, this._dimensions.y, z),\n new Vector3(x + extLength, this._dimensions.y, z),\n ),\n ],\n };\n }\n\n private _getLocalCameraPosition(): Vector3 {\n if (\n !this._cameraPosition ||\n !this._dimensionLineGroup ||\n !this._dimensions\n ) {\n return new Vector3(0, 0, 0);\n }\n return this._dimensionLineGroup.worldToLocal(this._cameraPosition.clone());\n }\n\n private _getCameraDistanceInfo(): {\n tooClose: boolean;\n opacity: number;\n distance: number;\n } {\n if (!this._object || !this._cameraPosition || !this._dimensions) {\n return { tooClose: false, opacity: 1.0, distance: Infinity };\n }\n const objPos = this._object.getWorldPosition(new Vector3());\n const distance = this._cameraPosition.distanceTo(objPos);\n const objectRadius =\n Math.max(this._dimensions.x, this._dimensions.y, this._dimensions.z) / 2;\n const minThreshold = objectRadius * MIN_CAMERA_DISTANCE_RATIO;\n const fadeThreshold = objectRadius * FADE_DISTANCE_RATIO;\n\n if (distance < minThreshold) {\n return { tooClose: true, opacity: 0, distance };\n }\n if (distance < fadeThreshold) {\n const opacity =\n (distance - minThreshold) / (fadeThreshold - minThreshold);\n return {\n tooClose: false,\n opacity: Math.max(0, Math.min(1, opacity)),\n distance,\n };\n }\n return { tooClose: false, opacity: 1.0, distance };\n }\n\n private _visibilityChangedCallback() {\n if (this._onVisibilityChange) {\n this._onVisibilityChange(this._dimensionsVisible);\n }\n }\n\n public update(force: boolean = false) {\n if (this._enabled && !this._dimensionsVisible) {\n this._dimensionsVisible = true;\n this._visibilityChangedCallback();\n }\n this._performUpdate(force);\n }\n\n public updateSize(boxForMeasurement: KernelCube) {\n this._origin = convertToTHREE(boxForMeasurement.origin);\n this._dimensionLineGroup.position.x =\n this._origin.x - this._object.position.x;\n this._dimensionLineGroup.position.y =\n this._origin.y - this._object.position.y;\n this._dimensionLineGroup.position.z =\n this._origin.z - this._object.position.z;\n this._dimensions = convertToTHREE(boxForMeasurement.size);\n this.update();\n }\n\n public removeFromObject(object: Object3D) {\n if (object) {\n object.remove(this._dimensionLineGroup);\n }\n }\n\n public onDimensionsVisibilityChanged(handler: (visible: boolean) => void) {\n this._onVisibilityChange = handler;\n }\n\n public setObject(object: Object3D): void {\n this._object = object;\n }\n\n public isInitialized(): Promise<void> {\n return this._initialized.wait();\n }\n\n public areDimensionsEnabled(): boolean {\n return this._enabled;\n }\n\n public clearScene(_scene: Scene): void {\n this._clear();\n }\n\n public addToObject(object: Object3D): void {\n if (!object || !this._dimensionLineGroup) {\n return;\n }\n object.add(this._dimensionLineGroup);\n }\n\n public enableDimensions(): void {\n this._enabled = true;\n this.addToObject(this._object);\n this.update(true);\n }\n\n public disableDimensions(): void {\n this._enabled = false;\n if (this._dimensionsVisible) {\n this._dimensionsVisible = false;\n this._visibilityChangedCallback();\n }\n this._clear();\n this.removeFromObject(this._object);\n }\n\n public enableTopDimensions(): void {\n this.enableDimensions();\n this._heightLineGroup.visible = false;\n this.update(true);\n }\n\n public disableTopDimensions(): void {\n this._heightLineGroup.visible = true;\n this.disableDimensions();\n }\n\n public getBoundingBox(): Box3 {\n const bbox = new Box3();\n bbox.expandByObject(this._dimensionLineGroup);\n return bbox;\n }\n\n public moveCameraStart(position: Vector3): void {\n this._cameraPosition = position;\n this.update();\n }\n\n public moveCameraEnd(position: Vector3): void {\n this._cameraPosition = position;\n this.update();\n }\n\n private _performUpdate(force: boolean): void {\n if (!this._enabled && !force) {\n return;\n }\n if (!this._dimensions) {\n return;\n }\n\n let opacity = 1.0;\n\n if (\n this._object &&\n this._cameraPosition &&\n !this._cameraPosition.equals(new Vector3(0, 0, 0))\n ) {\n const distanceCheck = this._getCameraDistanceInfo();\n if (distanceCheck.tooClose) {\n this._dimensionLineGroup.visible = false;\n } else {\n this._dimensionLineGroup.visible = true;\n opacity = distanceCheck.opacity;\n this._mainLineMaterial.opacity = opacity;\n }\n }\n\n this._dimensionLineGroup.updateMatrixWorld(true);\n\n const widthConfig = this._getWidthLineConfig();\n const widthLabelText = this._unitFormatter.formatMMValueToUnitString(\n this._dimensions.x * 1000,\n );\n const widthPos = this._dimensionLineGroup.localToWorld(\n widthConfig.mainLine.getCenter(new Vector3()),\n );\n this.clearLineGroup(this._widthLineGroup);\n this.addLinesToLineGroup(\n this._widthLineGroup,\n widthConfig,\n this._mainLineMaterial,\n this._mainLineMaterial,\n );\n this.addLabelToLineGroup(this._widthLineGroup, widthLabelText, widthPos);\n\n const heightConfig = this._getHeightLineConfig();\n const heightLabelText = this._unitFormatter.formatMMValueToUnitString(\n this._dimensions.y * 1000,\n );\n const heightPos = this._dimensionLineGroup.localToWorld(\n heightConfig.mainLine.getCenter(new Vector3()),\n );\n this.clearLineGroup(this._heightLineGroup);\n this.addLinesToLineGroup(\n this._heightLineGroup,\n heightConfig,\n this._mainLineMaterial,\n this._mainLineMaterial,\n );\n this.addLabelToLineGroup(this._heightLineGroup, heightLabelText, heightPos);\n\n const depthConfig = this._getDepthLineConfig();\n const depthLabelText = this._unitFormatter.formatMMValueToUnitString(\n this._dimensions.z * -1000,\n );\n const depthPos = this._dimensionLineGroup.localToWorld(\n depthConfig.mainLine.getCenter(new Vector3()),\n );\n this.clearLineGroup(this._depthLineGroup);\n this.addLinesToLineGroup(\n this._depthLineGroup,\n depthConfig,\n this._mainLineMaterial,\n this._mainLineMaterial,\n );\n this.addLabelToLineGroup(this._depthLineGroup, depthLabelText, depthPos);\n }\n\n private _clear(): void {\n this._lineMaterial.dispose();\n this._mainLineMaterial.dispose();\n [this._widthLineGroup, this._heightLineGroup, this._depthLineGroup].forEach(\n (group) => {\n this.clearLineGroup(group);\n },\n );\n }\n}\n"],"x_google_ignoreList":[1],"mappings":";;;;;AAAA,IAAqB,IAArB,MAAmC;CAMjC,YAAY,GAAY;AAEtB,EADA,KAAK,OAAO,GACZ,KAAK,OAAO;;CAGd,QAAgB;AACd,OAAK,WAAW,IAAI,SAAY,GAAS,MAAW;AAElD,GADA,KAAK,WAAW,GAChB,KAAK,UAAU;IACf;;CAGJ,QAAe,GAAmB;AAIhC,EAHI,KACF,K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AAQD,EAPA,KAAK,eAAe,KAAK,gBAAgB,EACzC,KAAK,oBACH,KAAK,iBACL,GACA,KAAK,mBACL,KAAK,kBACN,EACD,KAAK,oBAAoB,KAAK,iBAAiB,GAAgB,EAAS;EAExE,IAAM,IAAe,KAAK,sBAAsB,EAC1C,IAAkB,KAAK,eAAe,0BAC1C,KAAK,YAAY,IAAI,IACtB,EACK,IAAY,KAAK,oBAAoB,aACzC,EAAa,SAAS,UAAU,IAAI,GAAS,CAAC,CAC/C;AAQD,EAPA,KAAK,eAAe,KAAK,iBAAiB,EAC1C,KAAK,oBACH,KAAK,kBACL,GACA,KAAK,mBACL,KAAK,kBACN,EACD,KAAK,oBAAoB,KAAK,kBAAkB,GAAiB,EAAU;EAE3E,IAAM,IAAc,KAAK,qBAAqB,EACxC,IAAiB,KAAK,eAAe,0BACzC,KAAK,YAAY,IAAI,KACtB,EACK,IAAW,KAAK,oBAAoB,aACxC,EAAY,SAAS,UAAU,IAAI,GAAS,CAAC,CAC9C;AAQD,EAPA,KAAK,eAAe,KAAK,gBAAgB,EACzC,KAAK,oBACH,KAAK,iBACL,GACA,KAAK,mBACL,KAAK,kBACN,EACD,KAAK,oBAAoB,KAAK,iBAAiB,GAAgB,EAAS;;CAG1E,SAAuB;AAGrB,EAFA,KAAK,cAAc,SAAS,EAC5B,KAAK,kBAAkB,SAAS,EAChC;GAAC,KAAK;GAAiB,KAAK;GAAkB,KAAK;GAAgB,CAAC,SACjE,MAAU;AACT,QAAK,eAAe,EAAM;IAE7B;;;GArbF,GAAA,EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,kBAAA,KAAA,EAAA"}
1
+ {"version":3,"file":"dimensioning-helper-Cj20VTW0.mjs","names":[],"sources":["../../packages/common-core/src/async-guard.ts","../../../../node_modules/three/examples/jsm/renderers/CSS2DRenderer.js","../../packages/configurator-core/src/utils/dimensioning-helper.ts"],"sourcesContent":["export default class AsyncGuard<T> {\n public info: any;\n private _promise: Promise<T>;\n private _resolve: (value?: T | PromiseLike<T>) => void;\n private _reject: (error: Error) => void;\n\n constructor(info?: any) {\n this.info = info;\n this._init();\n }\n\n private _init() {\n this._promise = new Promise<T>((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n }\n\n public resolve(value?: any): void {\n if (value) {\n this._resolve(value);\n }\n this._resolve();\n }\n\n public reject(e: Error): void {\n this._reject(e);\n }\n\n public wait(): Promise<T> {\n return this._promise;\n }\n\n public reset() {\n this._init();\n }\n}\n","import {\n\tMatrix4,\n\tObject3D,\n\tVector2,\n\tVector3\n} from 'three';\n\n/**\n * The only type of 3D object that is supported by {@link CSS2DRenderer}.\n *\n * @augments Object3D\n * @three_import import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js';\n */\nclass CSS2DObject extends Object3D {\n\n\t/**\n\t * Constructs a new CSS2D object.\n\t *\n\t * @param {HTMLElement} [element] - The DOM element.\n\t */\n\tconstructor( element = document.createElement( 'div' ) ) {\n\n\t\tsuper();\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isCSS2DObject = true;\n\n\t\t/**\n\t\t * The DOM element which defines the appearance of this 3D object.\n\t\t *\n\t\t * @type {HTMLElement}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.element = element;\n\n\t\tthis.element.style.position = 'absolute';\n\t\tthis.element.style.userSelect = 'none';\n\n\t\tthis.element.setAttribute( 'draggable', false );\n\n\t\t/**\n\t\t * The 3D objects center point.\n\t\t * `( 0, 0 )` is the lower left, `( 1, 1 )` is the top right.\n\t\t *\n\t\t * @type {Vector2}\n\t\t * @default (0.5,0.5)\n\t\t */\n\t\tthis.center = new Vector2( 0.5, 0.5 );\n\n\t\tthis.addEventListener( 'removed', function () {\n\n\t\t\tthis.traverse( function ( object ) {\n\n\t\t\t\tif (\n\t\t\t\t\tobject.element &&\n\t\t\t\t\tobject.element instanceof object.element.ownerDocument.defaultView.Element &&\n\t\t\t\t\tobject.element.parentNode !== null\n\t\t\t\t) {\n\n\t\t\t\t\tobject.element.remove();\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t} );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.element = source.element.cloneNode( true );\n\n\t\tthis.center = source.center;\n\n\t\treturn this;\n\n\t}\n\n}\n\n//\n\nconst _vector = new Vector3();\nconst _viewMatrix = new Matrix4();\nconst _viewProjectionMatrix = new Matrix4();\nconst _a = new Vector3();\nconst _b = new Vector3();\n\n/**\n * This renderer is a simplified version of {@link CSS3DRenderer}. The only transformation that is\n * supported is translation.\n *\n * The renderer is very useful if you want to combine HTML based labels with 3D objects. Here too,\n * the respective DOM elements are wrapped into an instance of {@link CSS2DObject} and added to the\n * scene graph. All other types of renderable 3D objects (like meshes or point clouds) are ignored.\n *\n * `CSS2DRenderer` only supports 100% browser and display zoom.\n *\n * @three_import import { CSS2DRenderer } from 'three/addons/renderers/CSS2DRenderer.js';\n */\nclass CSS2DRenderer {\n\n\t/**\n\t * Constructs a new CSS2D renderer.\n\t *\n\t * @param {CSS2DRenderer~Parameters} [parameters] - The parameters.\n\t */\n\tconstructor( parameters = {} ) {\n\n\t\tconst _this = this;\n\n\t\tlet _width, _height;\n\t\tlet _widthHalf, _heightHalf;\n\n\t\tconst cache = {\n\t\t\tobjects: new WeakMap()\n\t\t};\n\n\t\tconst domElement = parameters.element !== undefined ? parameters.element : document.createElement( 'div' );\n\n\t\tdomElement.style.overflow = 'hidden';\n\n\t\t/**\n\t\t * The DOM where the renderer appends its child-elements.\n\t\t *\n\t\t * @type {HTMLElement}\n\t\t */\n\t\tthis.domElement = domElement;\n\n\t\t/**\n\t\t * Controls whether the renderer assigns `z-index` values to CSS2DObject DOM elements.\n\t\t * If set to `true`, z-index values are assigned first based on the `renderOrder`\n\t\t * and secondly - the distance to the camera. If set to `false`, no z-index values are assigned.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.sortObjects = true;\n\n\t\t/**\n\t\t * Returns an object containing the width and height of the renderer.\n\t\t *\n\t\t * @return {{width:number,height:number}} The size of the renderer.\n\t\t */\n\t\tthis.getSize = function () {\n\n\t\t\treturn {\n\t\t\t\twidth: _width,\n\t\t\t\theight: _height\n\t\t\t};\n\n\t\t};\n\n\t\t/**\n\t\t * Renders the given scene using the given camera.\n\t\t *\n\t\t * @param {Object3D} scene - A scene or any other type of 3D object.\n\t\t * @param {Camera} camera - The camera.\n\t\t */\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tif ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();\n\t\t\tif ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();\n\n\t\t\t_viewMatrix.copy( camera.matrixWorldInverse );\n\t\t\t_viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, _viewMatrix );\n\n\t\t\trenderObject( scene, scene, camera );\n\t\t\tif ( this.sortObjects ) zOrder( scene );\n\n\t\t};\n\n\t\t/**\n\t\t * Resizes the renderer to the given width and height.\n\t\t *\n\t\t * @param {number} width - The width of the renderer.\n\t\t * @param {number} height - The height of the renderer.\n\t\t */\n\t\tthis.setSize = function ( width, height ) {\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\t_widthHalf = _width / 2;\n\t\t\t_heightHalf = _height / 2;\n\n\t\t\tdomElement.style.width = width + 'px';\n\t\t\tdomElement.style.height = height + 'px';\n\n\t\t};\n\n\t\tfunction hideObject( object ) {\n\n\t\t\tif ( object.isCSS2DObject ) object.element.style.display = 'none';\n\n\t\t\tfor ( let i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\t\thideObject( object.children[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderObject( object, scene, camera ) {\n\n\t\t\tif ( object.visible === false ) {\n\n\t\t\t\thideObject( object );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( object.isCSS2DObject ) {\n\n\t\t\t\t_vector.setFromMatrixPosition( object.matrixWorld );\n\t\t\t\t_vector.applyMatrix4( _viewProjectionMatrix );\n\n\t\t\t\tconst visible = ( _vector.z >= - 1 && _vector.z <= 1 ) && ( object.layers.test( camera.layers ) === true );\n\n\t\t\t\tconst element = object.element;\n\t\t\t\telement.style.display = visible === true ? '' : 'none';\n\n\t\t\t\tif ( visible === true ) {\n\n\t\t\t\t\tobject.onBeforeRender( _this, scene, camera );\n\n\t\t\t\t\telement.style.transform = 'translate(' + ( - 100 * object.center.x ) + '%,' + ( - 100 * object.center.y ) + '%)' + 'translate(' + ( _vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - _vector.y * _heightHalf + _heightHalf ) + 'px)';\n\n\t\t\t\t\tif ( element.parentNode !== domElement ) {\n\n\t\t\t\t\t\tdomElement.appendChild( element );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tobject.onAfterRender( _this, scene, camera );\n\n\t\t\t\t}\n\n\t\t\t\tconst objectData = {\n\t\t\t\t\tdistanceToCameraSquared: getDistanceToSquared( camera, object )\n\t\t\t\t};\n\n\t\t\t\tcache.objects.set( object, objectData );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\t\trenderObject( object.children[ i ], scene, camera );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction getDistanceToSquared( object1, object2 ) {\n\n\t\t\t_a.setFromMatrixPosition( object1.matrixWorld );\n\t\t\t_b.setFromMatrixPosition( object2.matrixWorld );\n\n\t\t\treturn _a.distanceToSquared( _b );\n\n\t\t}\n\n\t\tfunction filterAndFlatten( scene ) {\n\n\t\t\tconst result = [];\n\n\t\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\t\tif ( object.isCSS2DObject ) result.push( object );\n\n\t\t\t} );\n\n\t\t\treturn result;\n\n\t\t}\n\n\t\tfunction zOrder( scene ) {\n\n\t\t\tconst sorted = filterAndFlatten( scene ).sort( function ( a, b ) {\n\n\t\t\t\tif ( a.renderOrder !== b.renderOrder ) {\n\n\t\t\t\t\treturn b.renderOrder - a.renderOrder;\n\n\t\t\t\t}\n\n\t\t\t\tconst distanceA = cache.objects.get( a ).distanceToCameraSquared;\n\t\t\t\tconst distanceB = cache.objects.get( b ).distanceToCameraSquared;\n\n\t\t\t\treturn distanceA - distanceB;\n\n\t\t\t} );\n\n\t\t\tconst zMax = sorted.length;\n\n\t\t\tfor ( let i = 0, l = sorted.length; i < l; i ++ ) {\n\n\t\t\t\tsorted[ i ].element.style.zIndex = zMax - i;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Constructor parameters of `CSS2DRenderer`.\n *\n * @typedef {Object} CSS2DRenderer~Parameters\n * @property {HTMLElement} [element] - A DOM element where the renderer appends its child-elements.\n * If not passed in here, a new div element will be created.\n **/\n\nexport { CSS2DObject, CSS2DRenderer };\n","import inject from '../../../common-core/src/di/inject';\nimport AsyncGuard from '../../../common-core/src/async-guard';\nimport type { Object3D } from 'three';\nimport { Group, type Scene } from 'three';\nimport { Box3 } from 'three';\nimport {\n BufferAttribute,\n BufferGeometry,\n Line,\n Line3,\n LineBasicMaterial,\n Vector3,\n} from 'three';\nimport { type KernelCube } from '../../../typings/kernel';\nimport { convertToTHREE } from '../../../common-core/src/utils/kernel-utils';\nimport type UnitFormatter from '../services/unit-formatter';\nimport { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer.js';\nimport { LAYER } from '../../../common-core/src/webgl/layer';\n\nexport const DIMENSIONING_GEOMETRY = 'dimensioning';\nexport const DIMENSION_LINE_OFFSET = 0.08;\nexport const MIN_CAMERA_DISTANCE_RATIO = 1.2;\nexport const FADE_DISTANCE_RATIO = 2.0;\nexport const EXTENSION_LINE_LENGTH_RATIO = 0.03;\n\nexport interface DimensionLineConfig {\n mainLine: Line3;\n extensionLines: Line3[];\n}\n\nconst LINE_COLOR = 0x373737;\n\nexport function createDimensioningHelper(creator: string): DimensioningHelper {\n return new DimensioningHelper(creator);\n}\n\nexport default class DimensioningHelper {\n public _creator_: string;\n\n @inject\n private _unitFormatter: UnitFormatter;\n\n private _object: Object3D;\n private _cameraPosition: Vector3 = new Vector3();\n private _onVisibilityChange: (visible: boolean) => void;\n private _initialized: AsyncGuard<void> = new AsyncGuard();\n\n private _origin: Vector3;\n private _dimensions: Vector3;\n\n private _lineMaterial: LineBasicMaterial;\n private readonly _mainLineMaterial: LineBasicMaterial;\n\n private readonly _widthLineGroup: Group;\n private readonly _heightLineGroup: Group;\n private readonly _depthLineGroup: Group;\n\n private _enabled: boolean = false;\n private _dimensionsVisible = false;\n\n private _dimensionLineGroup = new Group();\n\n constructor(creator: string) {\n this._creator_ = creator;\n\n this._lineMaterial = new LineBasicMaterial({\n color: LINE_COLOR,\n linewidth: 2,\n });\n\n this._mainLineMaterial = new LineBasicMaterial({\n color: LINE_COLOR,\n linewidth: 0.001,\n transparent: true,\n opacity: 1.0,\n });\n\n this._dimensionLineGroup.name = DIMENSIONING_GEOMETRY;\n\n this._widthLineGroup = this._createLineGroup('width');\n this._heightLineGroup = this._createLineGroup('height');\n this._depthLineGroup = this._createLineGroup('depth');\n\n this._dimensionLineGroup.add(this._widthLineGroup);\n this._dimensionLineGroup.add(this._heightLineGroup);\n this._dimensionLineGroup.add(this._depthLineGroup);\n\n this.update(false);\n this._initialized.resolve();\n }\n\n private _createLineGroup(_name: string): Group {\n const group = new Group();\n group.name = DIMENSIONING_GEOMETRY;\n group.userData.ignoreComponentRaycast = true;\n return group;\n }\n\n private _createLineFromConfig(\n config: Line3,\n material: LineBasicMaterial,\n ): Line {\n const geometry = new BufferGeometry();\n const vertices = [\n config.start.x,\n config.start.y,\n config.start.z,\n config.end.x,\n config.end.y,\n config.end.z,\n ];\n geometry.setAttribute(\n 'position',\n new BufferAttribute(new Float32Array(vertices), 3),\n );\n const line = new Line(geometry, material);\n line.name = DIMENSIONING_GEOMETRY;\n line.userData.ignoreComponentRaycast = true;\n line.layers.set(LAYER.DIMENSIONS);\n return line;\n }\n\n private addLinesToLineGroup(\n group: Group,\n config: DimensionLineConfig,\n mainMaterial: LineBasicMaterial,\n extMaterial: LineBasicMaterial,\n ) {\n config.extensionLines.forEach((extLine) => {\n group.add(this._createLineFromConfig(extLine, extMaterial));\n });\n\n group.add(this._createLineFromConfig(config.mainLine, mainMaterial));\n }\n\n private clearLineGroup(group: Group) {\n while (group.children.length > 0) {\n const child = group.children[0];\n if (child instanceof Line) {\n child.geometry.dispose();\n }\n group.remove(child);\n }\n }\n\n private addLabelToLineGroup(\n group: Group,\n labelText: string,\n labelWorldPosition: Vector3,\n ): void {\n const labelHtmlDiv = document.createElement('div');\n labelHtmlDiv.classList.add(\n 'dimension-label',\n 'dimension-label--primary',\n 'dimension-label--disabled',\n );\n const labelHtmlSpan = document.createElement('span');\n labelHtmlSpan.classList.add('dimension-label__value');\n labelHtmlSpan.innerHTML = labelText;\n labelHtmlDiv.appendChild(labelHtmlSpan);\n\n const labelObject = new CSS2DObject(labelHtmlDiv);\n const labelLocalPosition =\n this._dimensionLineGroup.worldToLocal(labelWorldPosition);\n labelObject.position.copy(labelLocalPosition);\n\n group.add(labelObject);\n }\n\n private _getWidthLineConfig(): DimensionLineConfig {\n const offset = DIMENSION_LINE_OFFSET;\n const extLength = EXTENSION_LINE_LENGTH_RATIO;\n const y = this._dimensions.y + offset;\n const localCam = this._getLocalCameraPosition();\n const z = localCam.z < this._dimensions.z / 2 ? 0 : this._dimensions.z;\n\n return {\n mainLine: new Line3(\n new Vector3(0, y, z),\n new Vector3(this._dimensions.x, y, z),\n ),\n extensionLines: [\n new Line3(\n new Vector3(0, y - extLength, z),\n new Vector3(0, y + extLength, z),\n ),\n new Line3(\n new Vector3(this._dimensions.x, y - extLength, z),\n new Vector3(this._dimensions.x, y + extLength, z),\n ),\n ],\n };\n }\n\n private _getDepthLineConfig(): DimensionLineConfig {\n const offset = DIMENSION_LINE_OFFSET;\n const extLength = EXTENSION_LINE_LENGTH_RATIO;\n const y = 0;\n const localCam = this._getLocalCameraPosition();\n const x =\n localCam.x < this._dimensions.x / 2\n ? -offset\n : this._dimensions.x + offset;\n\n return {\n mainLine: new Line3(\n new Vector3(x, y, this._dimensions.z),\n new Vector3(x, y, 0),\n ),\n extensionLines: [\n new Line3(\n new Vector3(x - extLength, y, 0),\n new Vector3(x + extLength, y, 0),\n ),\n new Line3(\n new Vector3(x - extLength, y, this._dimensions.z),\n new Vector3(x + extLength, y, this._dimensions.z),\n ),\n ],\n };\n }\n\n private _getHeightLineConfig(): DimensionLineConfig {\n const offset = DIMENSION_LINE_OFFSET;\n const extLength = EXTENSION_LINE_LENGTH_RATIO;\n const localCam = this._getLocalCameraPosition();\n const x =\n localCam.x < this._dimensions.x / 2\n ? -offset\n : this._dimensions.x + offset;\n const z = localCam.z < this._dimensions.z / 2 ? 0 : this._dimensions.z;\n\n return {\n mainLine: new Line3(\n new Vector3(x, 0, z),\n new Vector3(x, this._dimensions.y, z),\n ),\n extensionLines: [\n new Line3(\n new Vector3(x - extLength, 0, z),\n new Vector3(x + extLength, 0, z),\n ),\n new Line3(\n new Vector3(x - extLength, this._dimensions.y, z),\n new Vector3(x + extLength, this._dimensions.y, z),\n ),\n ],\n };\n }\n\n private _getLocalCameraPosition(): Vector3 {\n if (\n !this._cameraPosition ||\n !this._dimensionLineGroup ||\n !this._dimensions\n ) {\n return new Vector3(0, 0, 0);\n }\n return this._dimensionLineGroup.worldToLocal(this._cameraPosition.clone());\n }\n\n private _getCameraDistanceInfo(): {\n tooClose: boolean;\n opacity: number;\n distance: number;\n } {\n if (!this._object || !this._cameraPosition || !this._dimensions) {\n return { tooClose: false, opacity: 1.0, distance: Infinity };\n }\n const objPos = this._object.getWorldPosition(new Vector3());\n const distance = this._cameraPosition.distanceTo(objPos);\n const objectRadius =\n Math.max(this._dimensions.x, this._dimensions.y, this._dimensions.z) / 2;\n const minThreshold = objectRadius * MIN_CAMERA_DISTANCE_RATIO;\n const fadeThreshold = objectRadius * FADE_DISTANCE_RATIO;\n\n if (distance < minThreshold) {\n return { tooClose: true, opacity: 0, distance };\n }\n if (distance < fadeThreshold) {\n const opacity =\n (distance - minThreshold) / (fadeThreshold - minThreshold);\n return {\n tooClose: false,\n opacity: Math.max(0, Math.min(1, opacity)),\n distance,\n };\n }\n return { tooClose: false, opacity: 1.0, distance };\n }\n\n private _visibilityChangedCallback() {\n if (this._onVisibilityChange) {\n this._onVisibilityChange(this._dimensionsVisible);\n }\n }\n\n public update(force: boolean = false) {\n if (this._enabled && !this._dimensionsVisible) {\n this._dimensionsVisible = true;\n this._visibilityChangedCallback();\n }\n this._performUpdate(force);\n }\n\n public updateSize(boxForMeasurement: KernelCube) {\n this._origin = convertToTHREE(boxForMeasurement.origin);\n this._dimensionLineGroup.position.x =\n this._origin.x - this._object.position.x;\n this._dimensionLineGroup.position.y =\n this._origin.y - this._object.position.y;\n this._dimensionLineGroup.position.z =\n this._origin.z - this._object.position.z;\n this._dimensions = convertToTHREE(boxForMeasurement.size);\n this.update();\n }\n\n public removeFromObject(object: Object3D) {\n if (object) {\n object.remove(this._dimensionLineGroup);\n }\n }\n\n public onDimensionsVisibilityChanged(handler: (visible: boolean) => void) {\n this._onVisibilityChange = handler;\n }\n\n public setObject(object: Object3D): void {\n this._object = object;\n }\n\n public isInitialized(): Promise<void> {\n return this._initialized.wait();\n }\n\n public areDimensionsEnabled(): boolean {\n return this._enabled;\n }\n\n public clearScene(_scene: Scene): void {\n this._clear();\n }\n\n public addToObject(object: Object3D): void {\n if (!object || !this._dimensionLineGroup) {\n return;\n }\n object.add(this._dimensionLineGroup);\n }\n\n public enableDimensions(): void {\n this._enabled = true;\n this.addToObject(this._object);\n this.update(true);\n }\n\n public disableDimensions(): void {\n this._enabled = false;\n if (this._dimensionsVisible) {\n this._dimensionsVisible = false;\n this._visibilityChangedCallback();\n }\n this._clear();\n this.removeFromObject(this._object);\n }\n\n public enableTopDimensions(): void {\n this.enableDimensions();\n this._heightLineGroup.visible = false;\n this.update(true);\n }\n\n public disableTopDimensions(): void {\n this._heightLineGroup.visible = true;\n this.disableDimensions();\n }\n\n public getBoundingBox(): Box3 {\n const bbox = new Box3();\n bbox.expandByObject(this._dimensionLineGroup);\n return bbox;\n }\n\n public moveCameraStart(position: Vector3): void {\n this._cameraPosition = position;\n this.update();\n }\n\n public moveCameraEnd(position: Vector3): void {\n this._cameraPosition = position;\n this.update();\n }\n\n private _performUpdate(force: boolean): void {\n if (!this._enabled && !force) {\n return;\n }\n if (!this._dimensions) {\n return;\n }\n\n let opacity = 1.0;\n\n if (\n this._object &&\n this._cameraPosition &&\n !this._cameraPosition.equals(new Vector3(0, 0, 0))\n ) {\n const distanceCheck = this._getCameraDistanceInfo();\n if (distanceCheck.tooClose) {\n this._dimensionLineGroup.visible = false;\n } else {\n this._dimensionLineGroup.visible = true;\n opacity = distanceCheck.opacity;\n this._mainLineMaterial.opacity = opacity;\n }\n }\n\n this._dimensionLineGroup.updateMatrixWorld(true);\n\n const widthConfig = this._getWidthLineConfig();\n const widthLabelText = this._unitFormatter.formatMMValueToUnitString(\n this._dimensions.x * 1000,\n );\n const widthPos = this._dimensionLineGroup.localToWorld(\n widthConfig.mainLine.getCenter(new Vector3()),\n );\n this.clearLineGroup(this._widthLineGroup);\n this.addLinesToLineGroup(\n this._widthLineGroup,\n widthConfig,\n this._mainLineMaterial,\n this._mainLineMaterial,\n );\n if (widthLabelText !== null) {\n this.addLabelToLineGroup(this._widthLineGroup, widthLabelText, widthPos);\n }\n\n const heightConfig = this._getHeightLineConfig();\n const heightLabelText = this._unitFormatter.formatMMValueToUnitString(\n this._dimensions.y * 1000,\n );\n const heightPos = this._dimensionLineGroup.localToWorld(\n heightConfig.mainLine.getCenter(new Vector3()),\n );\n this.clearLineGroup(this._heightLineGroup);\n this.addLinesToLineGroup(\n this._heightLineGroup,\n heightConfig,\n this._mainLineMaterial,\n this._mainLineMaterial,\n );\n if (heightLabelText !== null) {\n this.addLabelToLineGroup(\n this._heightLineGroup,\n heightLabelText,\n heightPos,\n );\n }\n\n const depthConfig = this._getDepthLineConfig();\n const depthLabelText = this._unitFormatter.formatMMValueToUnitString(\n this._dimensions.z * -1000,\n );\n const depthPos = this._dimensionLineGroup.localToWorld(\n depthConfig.mainLine.getCenter(new Vector3()),\n );\n this.clearLineGroup(this._depthLineGroup);\n this.addLinesToLineGroup(\n this._depthLineGroup,\n depthConfig,\n this._mainLineMaterial,\n this._mainLineMaterial,\n );\n if (depthLabelText !== null) {\n this.addLabelToLineGroup(this._depthLineGroup, depthLabelText, depthPos);\n }\n }\n\n private _clear(): void {\n this._lineMaterial.dispose();\n this._mainLineMaterial.dispose();\n [this._widthLineGroup, this._heightLineGroup, this._depthLineGroup].forEach(\n (group) => {\n this.clearLineGroup(group);\n },\n );\n }\n}\n"],"x_google_ignoreList":[1],"mappings":";;;;;;AAAA,IAAqB,IAArB,MAAmC;CAMjC,YAAY,GAAY;AAEtB,EADA,KAAK,OAAO,GACZ,KAAK,OAAO;;CAGd,QAAgB;AACd,OAAK,WAAW,IAAI,SAAY,GAAS,MAAW;AAElD,GADA,KAAK,WAAW,GAChB,KAAK,UAAU;IACf;;CAGJ,QAAe,GAAmB;AAIhC,EAHI,KACF,KAAK,SAAS,EAAM,EAEtB,KAAK,UAAU;;CAGjB,OAAc,GAAgB;AAC5B,OAAK,QAAQ,EAAE;;CAGjB,OAA0B;AACxB,SAAO,KAAK;;CAGd,QAAe;AACb,OAAK,OAAO;;GCrBV,IAAN,cAA0B,EAAS;CAOlC,YAAa,IAAU,SAAS,cAAe,MAAO,EAAG;AAoCxD,EAlCA,OAAO,EASP,KAAK,gBAAgB,IASrB,KAAK,UAAU,GAEf,KAAK,QAAQ,MAAM,WAAW,YAC9B,KAAK,QAAQ,MAAM,aAAa,QAEhC,KAAK,QAAQ,aAAc,aAAa,GAAO,EAS/C,KAAK,SAAS,IAAI,EAAS,IAAK,GAAK,EAErC,KAAK,iBAAkB,WAAW,WAAY;AAE7C,Q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AAK,kBACL,GACA,EACD;EAGH,IAAM,IAAc,KAAK,qBAAqB,EACxC,IAAiB,KAAK,eAAe,0BACzC,KAAK,YAAY,IAAI,KACtB,EACK,IAAW,KAAK,oBAAoB,aACxC,EAAY,SAAS,UAAU,IAAI,GAAS,CAAC,CAC9C;AAQD,EAPA,KAAK,eAAe,KAAK,gBAAgB,EACzC,KAAK,oBACH,KAAK,iBACL,GACA,KAAK,mBACL,KAAK,kBACN,EACG,MAAmB,QACrB,KAAK,oBAAoB,KAAK,iBAAiB,GAAgB,EAAS;;CAI5E,SAAuB;AAGrB,EAFA,KAAK,cAAc,SAAS,EAC5B,KAAK,kBAAkB,SAAS,EAChC;GAAC,KAAK;GAAiB,KAAK;GAAkB,KAAK;GAAgB,CAAC,SACjE,MAAU;AACT,QAAK,eAAe,EAAM;IAE7B;;;GA/bF,GAAA,EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,kBAAA,KAAA,EAAA"}
@@ -1,19 +1,19 @@
1
- import { $t as e, L as t, Rr as n, h as r, n as i, o as a, on as o, sr as s } from "./three.core-CLIofecG.mjs";
2
- import { r as c } from "./three.module-C4Q1skJQ.mjs";
3
- import { E as l, h as u } from "./threejs-utils-jEzvlJF1.mjs";
4
- import { g as d, v as f } from "./common-utils-DMSTohiS.mjs";
5
- import { n as p, r as m, t as h } from "./decorate-C1QnXPYw.mjs";
6
- import { $ as g, B as _, C as v, E as y, H as b, J as x, Q as S, Y as C, Z as w, et as T, m as E, n as D, p as O, q as k, r as A, t as j, u as M, w as N } from "./main-CtVIB52l.mjs";
7
- import { t as P } from "./script-loader-D8xCRzTr.mjs";
1
+ import { C as e, Dn as t, In as n, d as r, n as i, tt as a, xi as o, zr as s } from "./three.core-mM-jZdgg.mjs";
2
+ import { r as c } from "./three.module-Bmy3sVQ-.mjs";
3
+ import { E as l, h as u } from "./threejs-utils-8zlxt158.mjs";
4
+ import { g as d, v as f } from "./common-utils-qErzZAiR.mjs";
5
+ import { n as p, r as m, t as h } from "./decorate-BIflHDAa.mjs";
6
+ import { $ as g, H as _, J as v, N as y, Q as b, S as x, Y as S, Z as C, c as w, d as T, et as E, f as D, n as O, q as k, r as A, t as j, w as M, x as N } from "./main-DMIVdAcT.mjs";
7
+ import { t as P } from "./script-loader-CA-XHFKN.mjs";
8
8
  //#region packages/glb-viewer-core/src/camera-control/adjustable-camera-control-3d.ts
9
- var F = class extends v {
9
+ var F = class extends N {
10
10
  constructor(...e) {
11
11
  super(...e), this.shouldIgnoreStandardBehavior = !1;
12
12
  }
13
- adjust(e, r, i, s, c) {
14
- this._boundingBox = new a(new n(-e.x / 2, 0, -e.z / 2), new n(e.x / 2, e.y, e.z / 2));
15
- let l = new t(-Math.PI / 2 + s, i, 0, "ZYX"), u = new o().setFromEuler(l);
16
- this._camera.updateProjectionMatrix(), this._camera.quaternion.copy(u), this._camera.position.copy(r);
13
+ adjust(e, t, i, s, c) {
14
+ this._boundingBox = new r(new o(-e.x / 2, 0, -e.z / 2), new o(e.x / 2, e.y, e.z / 2));
15
+ let l = new a(-Math.PI / 2 + s, i, 0, "ZYX"), u = new n().setFromEuler(l);
16
+ this._camera.updateProjectionMatrix(), this._camera.quaternion.copy(u), this._camera.position.copy(t);
17
17
  }
18
18
  _update(e) {
19
19
  this.shouldIgnoreStandardBehavior ? this._saveYawAndPitch() : super._update(e);
@@ -21,9 +21,9 @@ var F = class extends v {
21
21
  animateCamera(e) {
22
22
  return this.shouldIgnoreStandardBehavior ? !0 : super.animateCamera(e);
23
23
  }
24
- }, I = class extends y {
25
- constructor(e, t) {
26
- super(e, t), this._params = { ambientLight: { color: "#ffffff" } }, this._ambientLight = new i(new r(this._params.ambientLight.color), .5), this.addToScene();
24
+ }, I = class extends M {
25
+ constructor(t, n) {
26
+ super(t, n), this._params = { ambientLight: { color: "#ffffff" } }, this._ambientLight = new i(new e(this._params.ambientLight.color), .5), this.addToScene();
27
27
  }
28
28
  addToScene() {
29
29
  this._scene.add(this._ambientLight);
@@ -35,23 +35,23 @@ var F = class extends v {
35
35
  this.removeFromScene(), this.addToScene();
36
36
  }
37
37
  showGUI() {
38
- let e = l();
39
- if (e && this._ambientLight) {
40
- let t = e.addFolder("Ambient Light");
41
- t.add(this._ambientLight, "visible"), t.add(this._ambientLight, "intensity").min(0).max(5).step(.1), t.addColor(this._params.ambientLight, "color").onChange((e) => {
42
- this._ambientLight.color = new r(e);
38
+ let t = l();
39
+ if (t && this._ambientLight) {
40
+ let n = t.addFolder("Ambient Light");
41
+ n.add(this._ambientLight, "visible"), n.add(this._ambientLight, "intensity").min(0).max(5).step(.1), n.addColor(this._params.ambientLight, "color").onChange((t) => {
42
+ this._ambientLight.color = new e(t);
43
43
  });
44
44
  }
45
45
  }
46
- }, L = class extends E {
46
+ }, L = class extends D {
47
47
  constructor(e, t) {
48
- if (super(e, t, b.GLB, g.CAMERA_3D), this._itemsCount = 0, this._standardSceneBackgroundColor = this._scene.background, this._initData.legacyLight && !this._initData.featureFlags.webGpu) if (this._renderer.capabilities.maxTextures > 8) {
49
- let e = x.createDynamicLightSettingSource(null, C.CAMERA);
48
+ if (super(e, t, _.GLB, g.CAMERA_3D), this._itemsCount = 0, this._standardSceneBackgroundColor = this._scene.background, this._initData.legacyLight && this._renderer instanceof c) if (this._renderer.capabilities.maxTextures > 8) {
49
+ let e = v.createDynamicLightSettingSource(null, S.CAMERA);
50
50
  e && this.loadDynamicLightSetting(e);
51
51
  } else console.warn("this device has a maximum of 8 texture units thus we are using a simpler light setting"), this._lightSetting = new I(this._scene);
52
52
  }
53
53
  createCameraControl(e, t) {
54
- this._changeCameraBehaviour(new M(new F(this._creator_, this._getInputManager(), void 0), this._cameraBehaviourState));
54
+ this._changeCameraBehaviour(new w(new F(this._creator_, this._getInputManager(), void 0), this._cameraBehaviourState));
55
55
  }
56
56
  _getInputManager() {
57
57
  return this._glbInputManager;
@@ -62,24 +62,24 @@ var F = class extends v {
62
62
  let r = f(n);
63
63
  return r ? this.loadGLB(r, !0, void 0, t) : Promise.reject(/* @__PURE__ */ Error("GLB Url not detected"));
64
64
  }
65
- loadGLB(e, t = !0, r = new n(1, 1, 1), i) {
66
- return this.clearScene(), new Promise((o, s) => {
67
- this._loadGLB(e, new n(0, 0, 0), 0, void 0, r, void 0, void 0, i).then((e) => {
65
+ loadGLB(e, t = !0, n = new o(1, 1, 1), i) {
66
+ return this.clearScene(), new Promise((a, s) => {
67
+ this._loadGLB(e, new o(0, 0, 0), 0, void 0, n, void 0, void 0, i).then((e) => {
68
68
  this._currentGLB = e, this._scene.add(this._currentGLB);
69
- let n = new a().setFromObject(this._currentGLB);
70
- t && this.cameraBehaviour.cameraControl instanceof F && this.glbViewerCameraBehaviour.updateCameraOnItemLoaded(n), this._updateBounds(n, void 0, !0), this._readyForRender(), o();
69
+ let n = new r().setFromObject(this._currentGLB);
70
+ t && this.cameraBehaviour.cameraControl instanceof F && this.glbViewerCameraBehaviour.updateCameraOnItemLoaded(n), this._updateBounds(n, void 0, !0), this._readyForRender(), a();
71
71
  }, s);
72
72
  });
73
73
  }
74
- preparePerspectiveImage(t, n = 1e3, r = 1e3) {
74
+ preparePerspectiveImage(e, n = 1e3, r = 1e3) {
75
75
  return new Promise((i, a) => {
76
- t || (t = new c({ antialias: !0 }), t.setSize(n, r), t.outputColorSpace = s, t.autoClear = !1, t.shadowMap.enabled = !0, t.shadowMap.type = 0);
76
+ e || (e = new c({ antialias: !0 }), e.setSize(n, r), e.outputColorSpace = s, e.autoClear = !1, e.shadowMap.enabled = !0, e.shadowMap.type = 0);
77
77
  let o = this.cameraBehaviour.cameraControl.getCamera().clone();
78
- o instanceof e && (o.aspect = n / r, o.updateProjectionMatrix()), this._lightSetting?.removeFromScene();
79
- let l = new O(this._scene);
80
- t.render(this._scene, o);
81
- let u = t.domElement.toDataURL();
82
- t.domElement.toBlob((e) => {
78
+ o instanceof t && (o.aspect = n / r, o.updateProjectionMatrix()), this._lightSetting?.removeFromScene();
79
+ let l = new T(this._scene);
80
+ e.render(this._scene, o);
81
+ let u = e.domElement.toDataURL();
82
+ e.domElement.toBlob((e) => {
83
83
  if (e === null) {
84
84
  a(/* @__PURE__ */ Error("Failed to create blob from canvas"));
85
85
  return;
@@ -93,10 +93,10 @@ var F = class extends v {
93
93
  }, "image/png"), l.removeFromScene(), this._lightSetting?.addToScene();
94
94
  });
95
95
  }
96
- adjustCamera(e, t, r, i) {
96
+ adjustCamera(e, t, n, i) {
97
97
  if (this.cameraBehaviour.cameraControl instanceof F) {
98
- let o = new a().setFromObject(this._scene).getSize(new n());
99
- this.cameraBehaviour.cameraControl.adjust(o, e, t, r, i), this._requestRender();
98
+ let a = new r().setFromObject(this._scene).getSize(new o());
99
+ this.cameraBehaviour.cameraControl.adjust(a, e, t, n, i), this._requestRender();
100
100
  }
101
101
  }
102
102
  onStart(e) {
@@ -116,7 +116,7 @@ var F = class extends v {
116
116
  }
117
117
  sceneChanged() {}
118
118
  getBounds() {
119
- return this._currentGLB ? new a().setFromObject(this._currentGLB) : null;
119
+ return this._currentGLB ? new r().setFromObject(this._currentGLB) : null;
120
120
  }
121
121
  get glbViewerCameraBehaviour() {
122
122
  return this.cameraBehaviour;
@@ -125,9 +125,9 @@ var F = class extends v {
125
125
  return null;
126
126
  }
127
127
  cameraBehaviourChanged(e = !0) {
128
- super.cameraBehaviourChanged(e), this.cameraBehaviour.cameraControl.addEventListener(N.ZOOM_IN, () => {
128
+ super.cameraBehaviourChanged(e), this.cameraBehaviour.cameraControl.addEventListener(x.ZOOM_IN, () => {
129
129
  this._requestRender();
130
- }, this), this.cameraBehaviour.cameraControl.addEventListener(N.ZOOM_OUT, () => {
130
+ }, this), this.cameraBehaviour.cameraControl.addEventListener(x.ZOOM_OUT, () => {
131
131
  this._requestRender();
132
132
  }, this);
133
133
  }
@@ -165,7 +165,7 @@ var R = class {
165
165
  return {
166
166
  name: e.path.replace(".glb", ".png"),
167
167
  url: this._prefix + e.path,
168
- position: new n(e.camera.position.x, e.camera.position.z, -e.camera.position.y),
168
+ position: new o(e.camera.position.x, e.camera.position.z, -e.camera.position.y),
169
169
  fov: e.camera.fieldOfView * 2,
170
170
  yaw: e.camera.rotation.z,
171
171
  pitch: e.camera.rotation.x
@@ -209,8 +209,8 @@ var R = class {
209
209
  clearScene() {
210
210
  this._sceneManager.clearScene();
211
211
  }
212
- loadGLB(e, t = 1, r) {
213
- return this._currentIdOrUrl = e, this._rapiAccess.trackView(e), this._sceneManager.loadGLB(e, !0, new n(t, t, t), r);
212
+ loadGLB(e, t = 1, n) {
213
+ return this._currentIdOrUrl = e, this._rapiAccess.trackView(e), this._sceneManager.loadGLB(e, !0, new o(t, t, t), n);
214
214
  }
215
215
  loadStaticItem(e, t) {
216
216
  return this._currentIdOrUrl = e, this._rapiAccess.trackView(e), this._sceneManager.loadStaticItem(e, t);
@@ -283,12 +283,12 @@ var R = class {
283
283
  h([m, p("design:type", Object)], B.prototype, "_rapiAccess", void 0), h([m, p("design:type", Object)], B.prototype, "_domHelper", void 0), h([m, p("design:type", Object)], B.prototype, "_scriptLoader", void 0), h([m, p("design:type", Object)], B.prototype, "_lifeCycleManager", void 0), h([m, p("design:type", Object)], B.prototype, "_initData", void 0), h([m, p("design:type", Object)], B.prototype, "_globalInitData", void 0), h([m, p("design:type", Object)], B.prototype, "_globalCallback", void 0), h([m, p("design:type", Object)], B.prototype, "_unitFormatter", void 0), h([m, p("design:type", Object)], B.prototype, "_idbManager", void 0);
284
284
  //#endregion
285
285
  //#region packages/glb-viewer-core/src/input/glb-input-manager.ts
286
- var V = class extends _ {}, H = [
287
- new S("script-loader", P),
288
- new S("glb-input-manager", V, w.CONTEXT),
289
- new S("logger", k),
290
- new S("rapi-access", T)
291
- ], U = class extends D {
286
+ var V = class extends y {}, H = [
287
+ new b("script-loader", P),
288
+ new b("glb-input-manager", V, C.CONTEXT),
289
+ new b("logger", k),
290
+ new b("rapi-access", E)
291
+ ], U = class extends O {
292
292
  setupGlobals() {}
293
293
  setupDependencies() {
294
294
  A.setup(H), this.lookup("logger", this._context);
@@ -312,4 +312,4 @@ var V = class extends _ {}, H = [
312
312
  //#endregion
313
313
  export { B as n, U as t };
314
314
 
315
- //# sourceMappingURL=glb-viewer-BzNA9-zH.mjs.map
315
+ //# sourceMappingURL=glb-viewer-BqFcaUlb.mjs.map