@crystaldesign/real-time-viewer 25.1.0-beta.2 → 25.1.0-beta.20

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 (47) hide show
  1. package/build/esm/index.js +300 -123
  2. package/build/types/real-time-viewer/src/caching/index.d.ts.map +1 -1
  3. package/build/types/real-time-viewer/src/context.d.ts.map +1 -1
  4. package/build/types/real-time-viewer/src/controls/index.d.ts.map +1 -1
  5. package/build/types/real-time-viewer/src/index.d.ts +4 -3
  6. package/build/types/real-time-viewer/src/index.d.ts.map +1 -1
  7. package/build/types/real-time-viewer/src/parser/createCams/index.d.ts.map +1 -1
  8. package/build/types/real-time-viewer/src/parser/findAssets/index.d.ts.map +1 -1
  9. package/build/types/real-time-viewer/src/parser/index.d.ts.map +1 -1
  10. package/build/types/real-time-viewer/src/store/UIStore.d.ts +11 -6
  11. package/build/types/real-time-viewer/src/store/UIStore.d.ts.map +1 -1
  12. package/build/types/real-time-viewer/src/store/UtilStore.d.ts +1 -1
  13. package/build/types/real-time-viewer/src/types.d.ts +6 -3
  14. package/build/types/real-time-viewer/src/types.d.ts.map +1 -1
  15. package/build/umd/1499.real-time-viewer.umd.min.js +1 -1
  16. package/build/umd/1781.real-time-viewer.umd.min.js +1 -1
  17. package/build/umd/2439.real-time-viewer.umd.min.js +1 -1
  18. package/build/umd/2871.real-time-viewer.umd.min.js +1 -1
  19. package/build/umd/4602.real-time-viewer.umd.min.js +1 -1
  20. package/build/umd/4661.real-time-viewer.umd.min.js +1 -1
  21. package/build/umd/4823.real-time-viewer.umd.min.js +1 -1
  22. package/build/umd/615.real-time-viewer.umd.min.js +1 -1
  23. package/build/umd/653.real-time-viewer.umd.min.js +1 -1
  24. package/build/umd/6829.real-time-viewer.umd.min.js +1 -1
  25. package/build/umd/7142.real-time-viewer.umd.min.js +1 -1
  26. package/build/umd/7751.real-time-viewer.umd.min.js +1 -1
  27. package/build/umd/815.real-time-viewer.umd.min.js +1 -1
  28. package/build/umd/8333.real-time-viewer.umd.min.js +1 -1
  29. package/build/umd/8620.real-time-viewer.umd.min.js +1 -1
  30. package/build/umd/9473.real-time-viewer.umd.min.js +2 -0
  31. package/build/umd/9473.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
  32. package/build/umd/9884.real-time-viewer.umd.min.js +1 -1
  33. package/build/umd/real-time-viewer.umd.min.js +1 -1
  34. package/build/umd/report.html +1 -1
  35. package/package.json +2 -2
  36. package/build/umd/1731.real-time-viewer.umd.min.js +0 -2
  37. package/build/umd/1731.real-time-viewer.umd.min.js.LICENSE.txt +0 -1
  38. package/build/umd/3631.real-time-viewer.umd.min.js +0 -2
  39. package/build/umd/3631.real-time-viewer.umd.min.js.LICENSE.txt +0 -1
  40. package/build/umd/3956.real-time-viewer.umd.min.js +0 -2
  41. package/build/umd/3956.real-time-viewer.umd.min.js.LICENSE.txt +0 -1
  42. package/build/umd/6373.real-time-viewer.umd.min.js +0 -2
  43. package/build/umd/6373.real-time-viewer.umd.min.js.LICENSE.txt +0 -1
  44. package/build/umd/6912.real-time-viewer.umd.min.js +0 -2
  45. package/build/umd/6912.real-time-viewer.umd.min.js.LICENSE.txt +0 -1
  46. package/build/umd/9334.real-time-viewer.umd.min.js +0 -2
  47. package/build/umd/9334.real-time-viewer.umd.min.js.LICENSE.txt +0 -1
@@ -26,7 +26,17 @@ import { Tools, Observable, WebRequest } from '@babylonjs/core/Misc';
26
26
  import { SceneOptimizerOptions, ShadowsOptimization, RenderTargetsOptimization, SceneOptimizer } from '@babylonjs/core/Misc/sceneOptimizer';
27
27
  import { getLogger, DivaError } from '@crystaldesign/diva-core';
28
28
  import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
29
- import { Ellipse, Rectangle, Button, AdvancedDynamicTexture, TextBlock, Image } from '@babylonjs/gui';
29
+ import { AdvancedDynamicTexture } from '@babylonjs/gui/2D/advancedDynamicTexture';
30
+ import { Button } from '@babylonjs/gui/2D/controls/button';
31
+ import { Ellipse } from '@babylonjs/gui/2D/controls/ellipse';
32
+ import { Rectangle } from '@babylonjs/gui/2D/controls/rectangle';
33
+ import { TextBlock } from '@babylonjs/gui/2D/controls/textBlock';
34
+ import { Mesh } from '@babylonjs/core/Meshes/mesh';
35
+ import { Axis } from '@babylonjs/core/Maths/math.axis';
36
+ import { HighlightLayer } from '@babylonjs/core/Layers/';
37
+ import { StandardMaterial } from '@babylonjs/core/Materials/standardMaterial';
38
+ import { Texture } from '@babylonjs/core/Materials/Textures/texture';
39
+ import { Constants } from '@babylonjs/core/Engines/constants';
30
40
  import { Matrix as Matrix$1, Vector3 as Vector3$1 } from '@babylonjs/core/Maths/math';
31
41
  import { Engine } from '@babylonjs/core/Engines/engine';
32
42
  import { Scene } from '@babylonjs/core/scene';
@@ -60,7 +70,6 @@ function GetCameraControls(camera) {
60
70
  function renderLoop() {
61
71
  var _sceneStore$updateCam;
62
72
  if (!sceneStore.doRenderControlLoop || sceneStore.isInitializing || uistore.isStaticBg) return;
63
- if (sceneStore.cameraTargetPosition.x == 0 && sceneStore.cameraTargetPosition.y == 0 && sceneStore.cameraTargetPosition.z == 0) sceneStore.setCameraTarget();
64
73
  uistore.onMove();
65
74
  var stopRender = true;
66
75
  var delta = sceneStore.scene.getEngine().getDeltaTime();
@@ -883,12 +892,13 @@ function createCams(scene, viewpoint) {
883
892
  pos = _ref.pos,
884
893
  rot = _ref.rot,
885
894
  isEnabled = _ref.isEnabled,
886
- parent = _ref.parent;
895
+ parent = _ref.parent,
896
+ target = _ref.target;
887
897
  var existingCam = scene.getCameraByName(name);
888
898
  if (existingCam) return existingCam;
889
899
  var camera = new UniversalCamera(name, pos, scene);
890
900
  camera.rotation = degreesToRadians(rot);
891
- camera.minZ = 0.1;
901
+ camera.minZ = 0.01;
892
902
  camera.fov = 0.418879;
893
903
  if (isEnabled) scene.activeCamera = camera;
894
904
  if (parent) camera.parent = parent;
@@ -901,6 +911,7 @@ function createCams(scene, viewpoint) {
901
911
  if (isEnabled) {
902
912
  camera.attachControl(canvas, true);
903
913
  }
914
+ if (target) camera.target = target;
904
915
  return camera;
905
916
  }
906
917
  function createDefaultCam() {
@@ -912,6 +923,7 @@ function createCams(scene, viewpoint) {
912
923
  parent: undefined
913
924
  })];
914
925
  }
926
+ if (scene.activeCamera) return [scene.activeCamera];
915
927
  if (!viewpoint) return createDefaultCam();
916
928
  return [createCam({
917
929
  name: 'defaultCam',
@@ -920,6 +932,7 @@ function createCams(scene, viewpoint) {
920
932
  rot: vector3ToBVector3(_objectSpread(_objectSpread({}, viewpoint.rot), {}, {
921
933
  x: -viewpoint.rot.x
922
934
  })),
935
+ target: vector3ToBVector3(viewpoint.targetPos).multiply(new Vector3(-0.01, 0.01, 0.01)),
923
936
  parent: undefined
924
937
  })];
925
938
  }
@@ -929,7 +942,12 @@ function updateCam(camera, scene) {
929
942
  var utilStore = useUtilStoreContext();
930
943
  var sceneStore = useSceneStoreContext();
931
944
  var cam = scene.getCameraByName('defaultCam');
932
- if (!cam) return;
945
+ if (!cam) {
946
+ var _cam = createCams(scene, camera)[0];
947
+ sceneStore.targetCameraPosition = _cam.position;
948
+ sceneStore.cameraTargetPosition = _cam.target;
949
+ return;
950
+ }
933
951
  if (camera.pos.x == cam.position.x && camera.pos.y == cam.position.y && camera.pos.z == camera.pos.z) return;
934
952
  var newPos = utilStore.vector3ToBVector3(camera.pos).multiply(new Vector3(-0.01, 0.01, 0.01));
935
953
  cam.position = newPos;
@@ -1656,22 +1674,25 @@ function SelHandler (_ref) {
1656
1674
  };
1657
1675
  }
1658
1676
 
1677
+ var arrowLeft = "data:image/svg+xml,%3Csvg%20width%3D%2214%22%20height%3D%2225%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1.477%2013.12c-.325-.33-.487-.496-.487-.7%200-.205.162-.37.487-.7L11.825%201.174C12.553.434%2012.917.063%2013.228.19c.311.127.311.647.311%201.686v21.088c0%201.04%200%201.559-.31%201.686-.312.127-.676-.244-1.404-.986L1.477%2013.12Z%22%20fill%3D%22%234A4A4A%22%20stroke%3D%22%23fff%22%20stroke-width%3D%220%2C5px%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E";
1678
+
1659
1679
  function _createForOfIteratorHelper$5(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$5(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1660
1680
  function _unsupportedIterableToArray$5(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$5(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$5(r, a) : void 0; } }
1661
1681
  function _arrayLikeToArray$5(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1682
+
1662
1683
  /*
1663
1684
  UIStore
1664
1685
  */
1665
1686
 
1666
1687
  var UIStore = /*#__PURE__*/function () {
1667
- function UIStore(scene, enableSSAO, utilStore, uiConfig, requestNewOverlayImage, _overlayImage) {
1688
+ function UIStore(scene, enableSSAO, utilStore, uiConfig, requestNewOverlayImage, _overlayImage, onElementCopy) {
1668
1689
  var _this = this;
1669
1690
  _classCallCheck(this, UIStore);
1670
1691
  _defineProperty(this, "_utilStore", void 0);
1671
1692
  _defineProperty(this, "_uiConfig", void 0);
1672
1693
  _defineProperty(this, "_gui", void 0);
1673
- _defineProperty(this, "_overlayImage", void 0);
1674
1694
  _defineProperty(this, "_requestNewOverlayImage", void 0);
1695
+ _defineProperty(this, "_onElementCopy", void 0);
1675
1696
  _defineProperty(this, "_timeoutId", void 0);
1676
1697
  _defineProperty(this, "_latestViewpoint", void 0);
1677
1698
  _defineProperty(this, "_guiElements", []);
@@ -1687,20 +1708,43 @@ var UIStore = /*#__PURE__*/function () {
1687
1708
  _defineProperty(this, "_gridGui", void 0);
1688
1709
  _defineProperty(this, "_isStaticBg", void 0);
1689
1710
  _defineProperty(this, "_elementsInfo", void 0);
1711
+ _defineProperty(this, "_selectedHl", void 0);
1712
+ _defineProperty(this, "_diffuseTexture", void 0);
1713
+ _defineProperty(this, "_plane", void 0);
1714
+ _defineProperty(this, "_selectedMeshes", []);
1690
1715
  _defineProperty(this, "updateOverlayImage", function (overlayImage) {
1691
- var _this$_overlayImage;
1692
- if (!overlayImage || !_this._scene || ((_this$_overlayImage = _this._overlayImage) === null || _this$_overlayImage === void 0 ? void 0 : _this$_overlayImage.source) == overlayImage.base64) return;
1716
+ var _this$_diffuseTexture;
1717
+ if (!overlayImage || !_this._scene || ((_this$_diffuseTexture = _this._diffuseTexture) === null || _this$_diffuseTexture === void 0 ? void 0 : _this$_diffuseTexture.url) == overlayImage.base64) return;
1693
1718
  _this._isStaticBg = overlayImage.isStaticBg;
1694
- _this._overlayImage.source = overlayImage.base64;
1695
- _this._overlayImage.isVisible = true;
1719
+ _this._diffuseTexture.updateURL(overlayImage.base64);
1720
+ _this._plane.visibility = 1;
1696
1721
  _this._enableSSAO(false);
1697
1722
  });
1698
1723
  this._scene = scene;
1724
+ var plane = MeshBuilder.CreatePlane('overlayplane', {
1725
+ size: 0.0047
1726
+ }, scene);
1727
+ var mat = new StandardMaterial('planeMat', scene);
1728
+ this._diffuseTexture = new Texture('data:image/gif;base64,R0lGODlhAQABALMAAAAAAP///////////////////////////////////////////////////////////yH5BAEAAAEALAAAAAABAAEAAAQCMEQAOw==', scene);
1729
+ mat.diffuseTexture = this._diffuseTexture;
1730
+ mat.emissiveTexture = this._diffuseTexture;
1731
+ mat.specularColor = Color3.Black();
1732
+ this._plane = plane;
1733
+ plane.material = mat;
1734
+ var engine = this._scene.getEngine();
1735
+ plane.scaling.x = engine.getRenderingCanvas().width / engine.getRenderingCanvas().height;
1736
+ plane.position.z = 0.011;
1737
+ plane.isPickable = false;
1738
+ plane.parent = scene.activeCamera;
1739
+ this._selectedHl = new HighlightLayer('hl', this._scene);
1740
+ this._selectedHl.innerGlow = false;
1699
1741
  this._enableSSAO = enableSSAO;
1700
1742
  this._utilStore = utilStore;
1701
1743
  this._gui = AdvancedDynamicTexture.CreateFullscreenUI('UI');
1744
+ this._gui.layer.layerMask = 0x0fffffff;
1702
1745
  this._gui.renderScale = 1;
1703
1746
  this._requestNewOverlayImage = requestNewOverlayImage;
1747
+ this._onElementCopy = onElementCopy;
1704
1748
  this._uiConfig = uiConfig !== null && uiConfig !== void 0 ? uiConfig : {
1705
1749
  templateConfig: 'standard',
1706
1750
  posNumIcon: 'TOP_LEFT_BACK',
@@ -1712,13 +1756,8 @@ var UIStore = /*#__PURE__*/function () {
1712
1756
  }
1713
1757
  this._isStaticBg = _overlayImage === null || _overlayImage === void 0 ? void 0 : _overlayImage.isStaticBg;
1714
1758
  if (_overlayImage) {
1715
- this._overlayImage = new Image('overlayImage', _overlayImage.base64);
1716
- this._overlayImage.width = '100%';
1717
- this._overlayImage.height = '100%';
1718
- this._overlayImage.alpha = 1;
1719
- this._gui.addControl(this._overlayImage);
1720
- this._overlayImage.source = _overlayImage.base64;
1721
- this._overlayImage.isVisible = true;
1759
+ this._diffuseTexture.updateURL(_overlayImage.base64);
1760
+ this._plane.visibility = 1;
1722
1761
  this._enableSSAO(false);
1723
1762
  }
1724
1763
  }
@@ -1730,7 +1769,7 @@ var UIStore = /*#__PURE__*/function () {
1730
1769
  }, {
1731
1770
  key: "unityCombActive",
1732
1771
  get: function get() {
1733
- return !!this._overlayImage;
1772
+ return !!this._plane;
1734
1773
  }
1735
1774
  }, {
1736
1775
  key: "initSelectionHandler",
@@ -1753,10 +1792,25 @@ var UIStore = /*#__PURE__*/function () {
1753
1792
  return mesh.isPickable && mesh.isReady() && mesh.isEnabled() && (!_this2._scene.cameraToUseForPointers || (_this2._scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);
1754
1793
  };
1755
1794
  }
1795
+ }, {
1796
+ key: "highlightObservable",
1797
+ value: function highlightObservable(meshes) {
1798
+ var _this3 = this;
1799
+ meshes.forEach(function (m) {
1800
+ if (_this3._plane.visibility == 1) {
1801
+ m.material.depthFunction = Constants.ALWAYS;
1802
+ m.material.disableColorWrite = true;
1803
+ } else {
1804
+ m.visibility = 1;
1805
+ m.material.depthFunction = Constants.LESS;
1806
+ m.material.disableColorWrite = false;
1807
+ }
1808
+ });
1809
+ }
1756
1810
  }, {
1757
1811
  key: "createGridGui",
1758
1812
  value: function createGridGui(mesh, onClickDel) {
1759
- var _this3 = this;
1813
+ var _this4 = this;
1760
1814
  if (!this._selectionHandler || !mesh) return;
1761
1815
  this.removeGridGui();
1762
1816
  var guiElem = new TransformNode('gridGuiElem', this._scene);
@@ -1779,10 +1833,10 @@ var UIStore = /*#__PURE__*/function () {
1779
1833
  dbt.height = this._uiConfig.templateConfig == 'standard' ? '40px' : '70%';
1780
1834
  dbt.onPointerClickObservable.add(onClickDel);
1781
1835
  dtarget.onPointerEnterObservable = new Observable(function () {
1782
- return dtarget.background = _this3._colors.hoverBg;
1836
+ return dtarget.background = _this4._colors.hoverBg;
1783
1837
  });
1784
1838
  dtarget.onPointerOutObservable = new Observable(function () {
1785
- return dtarget.background = _this3._colors.defaultBg;
1839
+ return dtarget.background = _this4._colors.defaultBg;
1786
1840
  });
1787
1841
  if (this._uiConfig.templateConfig == 'standard') dtarget.linkOffsetY = -48;
1788
1842
  dtarget.addControl(dbt);
@@ -1805,7 +1859,6 @@ var UIStore = /*#__PURE__*/function () {
1805
1859
  value: function resize(scene) {
1806
1860
  this._gui = AdvancedDynamicTexture.CreateFullscreenUI('UI', true, scene);
1807
1861
  this._gui.renderScale = 1;
1808
- if (this._overlayImage) this._overlayImage.isVisible = false;
1809
1862
  if (this._latestViewpoint) this._latestViewpoint.isOutdated = true;
1810
1863
  }
1811
1864
  }, {
@@ -1813,10 +1866,198 @@ var UIStore = /*#__PURE__*/function () {
1813
1866
  value: function addElementsInfo(elementsInfo) {
1814
1867
  this._elementsInfo = elementsInfo;
1815
1868
  }
1869
+ }, {
1870
+ key: "createPosNr",
1871
+ value: function createPosNr(elementInfo, element, isBoxPlanner) {
1872
+ var _this5 = this,
1873
+ _this$_utilStore$view,
1874
+ _this$_utilStore$view2;
1875
+ var guiElem = {
1876
+ elementId: elementInfo.elementId,
1877
+ elements: []
1878
+ };
1879
+ var bbox = element.getHierarchyBoundingVectors();
1880
+ var guiElemLeftBack = null;
1881
+ var guiElemRightBack = null;
1882
+ if (!isBoxPlanner) {
1883
+ guiElemLeftBack = new TransformNode('guiElem_' + elementInfo.elementId, this._scene);
1884
+ guiElemLeftBack.position = element.absolutePosition.add(new Vector3(0, bbox.max.y, 0));
1885
+ guiElem.elements.push(guiElemLeftBack);
1886
+ guiElemRightBack = undefined;
1887
+ if (this._uiConfig.posTrashIcon == 'TOP_RIGHT_BACK' || isBoxPlanner) {
1888
+ guiElemRightBack = new TransformNode('guiElem_' + elementInfo.elementId, this._scene);
1889
+ var pos = new Vector3(bbox.min.x, bbox.max.y, bbox.min.z);
1890
+ guiElemRightBack.position = pos;
1891
+ }
1892
+ var target = this._uiConfig.templateConfig == 'standard' ? new Ellipse('posnrEllipse') : new Rectangle('posnrRectangle');
1893
+ if (this._uiConfig.templateConfig == 'gold') target.cornerRadius = 3;
1894
+ guiElem.elements.push(target);
1895
+ target.width = this._uiConfig.templateConfig == 'standard' ? '40px' : '20px';
1896
+ target.height = this._uiConfig.templateConfig == 'standard' ? '40px' : '20px';
1897
+ target.fontSize = this._uiConfig.templateConfig == 'standard' ? 50 : 20;
1898
+ target.background = this._colors.defaultBg;
1899
+ target.thickness = 0;
1900
+ if (elementInfo.active) target.background = this._colors.selectedBg;
1901
+ if (!elementInfo.selectable) target.background = '';
1902
+ this._gui.addControl(target);
1903
+ var label = new TextBlock('posnr_label');
1904
+ label.color = 'Black';
1905
+ label.fontFamily = 'Roboto';
1906
+ label.fontWeight = '100';
1907
+ if (elementInfo.active) label.color = 'White';
1908
+ if (!elementInfo.selectable) label.color = 'rgb(175, 172, 172)';
1909
+ label.text = elementInfo.posNr;
1910
+ guiElem.elements.push(label);
1911
+ target.addControl(label);
1912
+ target.linkWithMesh(guiElemLeftBack);
1913
+ } else {
1914
+ guiElemRightBack = new TransformNode('guiElem_' + elementInfo.elementId, this._scene);
1915
+ var _pos = new Vector3(bbox.min.x, bbox.max.y, bbox.min.z);
1916
+ guiElemRightBack.position = _pos;
1917
+ }
1918
+ var childMeshes = element.getChildMeshes();
1919
+ this._scene.onBeforeRenderObservable.add(function () {
1920
+ return _this5.highlightObservable(childMeshes);
1921
+ });
1922
+ if (!elementInfo.active) {
1923
+ childMeshes.forEach(function (m) {
1924
+ m.visibility = 0;
1925
+ if (!m.actionManager) m.actionManager = new ActionManager(_this5._scene);
1926
+ m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, function (ev) {
1927
+ _this5._selectedHl.removeAllMeshes();
1928
+ _this5._selectedMeshes.forEach(function (_m) {
1929
+ return _m.visibility = 0;
1930
+ });
1931
+ element.getChildMeshes().forEach(function (_m) {
1932
+ _m.visibility = 1;
1933
+ _this5._selectedHl.addMesh(_m, Color3.Black());
1934
+ });
1935
+ }));
1936
+ m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, function (ev) {
1937
+ _this5._selectedHl.removeAllMeshes();
1938
+ element.getChildMeshes().forEach(function (_m) {
1939
+ return _m.visibility = 0;
1940
+ });
1941
+ _this5._selectedMeshes.forEach(function (_m) {
1942
+ _m.visibility = 1;
1943
+ _this5._selectedHl.addMesh(_m, Color3.Black());
1944
+ });
1945
+ }));
1946
+ });
1947
+ }
1948
+ if (elementInfo.active && (((_this$_utilStore$view = this._utilStore.viewHandler) === null || _this$_utilStore$view === void 0 ? void 0 : _this$_utilStore$view.tabGroupState.curTabGroup.type) == 'PLANNER' || ((_this$_utilStore$view2 = this._utilStore.viewHandler) === null || _this$_utilStore$view2 === void 0 ? void 0 : _this$_utilStore$view2.tabGroupState.curTabGroup.type) == 'OPTION')) {
1949
+ var _guiElemRightBack;
1950
+ this._selectedMeshes = childMeshes;
1951
+ this._selectedMeshes.forEach(function (_m) {
1952
+ _m.visibility = 1;
1953
+ _this5._selectedHl.addMesh(_m, Color3.Black());
1954
+ });
1955
+ this._selectedHl.addExcludedMesh(this._plane);
1956
+ var dtarget = this._uiConfig.templateConfig == 'standard' ? new Ellipse('deleteEllipse') : new Rectangle('deleteEllipse');
1957
+ guiElem.elements.push(dtarget);
1958
+ dtarget.width = this._uiConfig.templateConfig == 'standard' ? '40px' : '35px';
1959
+ dtarget.height = this._uiConfig.templateConfig == 'standard' ? '40px' : '35px';
1960
+ dtarget.thickness = 1;
1961
+ dtarget.background = this._colors.defaultBg;
1962
+ var dbt = Button.CreateImageOnlyButton('buttond', this._uiConfig.templateConfig == 'standard' ? delButton : gdelButton);
1963
+ guiElem.elements.push(dbt);
1964
+ dbt.color = 'transparent';
1965
+ dbt.width = this._uiConfig.templateConfig == 'standard' ? '40px' : '60%';
1966
+ dbt.height = this._uiConfig.templateConfig == 'standard' ? '40px' : '70%';
1967
+ dbt.onPointerClickObservable.add(function () {
1968
+ return _this5._utilStore.onElementDeleted(elementInfo.setId, elementInfo.elementId);
1969
+ });
1970
+ if (this._uiConfig.templateConfig == 'standard' && !guiElemRightBack) dtarget.linkOffsetY = -48;
1971
+ dtarget.addControl(dbt);
1972
+ this._gui.addControl(dtarget);
1973
+ dtarget.linkWithMesh((_guiElemRightBack = guiElemRightBack) !== null && _guiElemRightBack !== void 0 ? _guiElemRightBack : guiElemLeftBack);
1974
+ }
1975
+ this._guiElements.push(guiElem);
1976
+ }
1977
+ }, {
1978
+ key: "createBoxCopyButtons",
1979
+ value: function createBoxCopyButtons(elementInfo, element) {
1980
+ var _this$_scene$activeCa,
1981
+ _this$_scene$activeCa2,
1982
+ _this6 = this,
1983
+ _this$_scene$activeCa3;
1984
+ var guiElem = {
1985
+ elementId: elementInfo.elementId,
1986
+ elements: []
1987
+ };
1988
+ var bbox = element.getHierarchyBoundingVectors();
1989
+ var guiElement = new TransformNode('boxCopyButton', this._scene);
1990
+ guiElem.elements.push(guiElement);
1991
+ guiElement.billboardMode = Mesh.BILLBOARDMODE_ALL;
1992
+ var target = Button.CreateImageOnlyButton('but', arrowLeft);
1993
+ guiElem.elements.push(target);
1994
+ target.thickness = 0;
1995
+ target.width = '20px';
1996
+ target.height = '40px';
1997
+ var dir = (_this$_scene$activeCa = this._scene.activeCamera) === null || _this$_scene$activeCa === void 0 ? void 0 : _this$_scene$activeCa.getDirection(Axis.Z);
1998
+ switch (elementInfo.type) {
1999
+ case 'BoxCopyLeft':
2000
+ guiElement.position = element.absolutePosition.add(new Vector3(0, (bbox.max.y - bbox.min.y) / 2, bbox.max.z - bbox.min.z));
2001
+ target.name = 'copyleft';
2002
+ if (dir.z > 0) {
2003
+ target.rotation = 180 * Math.PI / 180;
2004
+ } else {
2005
+ target.rotation = 0;
2006
+ }
2007
+ (_this$_scene$activeCa2 = this._scene.activeCamera) === null || _this$_scene$activeCa2 === void 0 || _this$_scene$activeCa2.onViewMatrixChangedObservable.add(function () {
2008
+ var _this6$_scene$activeC;
2009
+ var _dir = (_this6$_scene$activeC = _this6._scene.activeCamera) === null || _this6$_scene$activeC === void 0 ? void 0 : _this6$_scene$activeC.getDirection(Axis.Z);
2010
+ if (_dir.z > 0) {
2011
+ target.rotation = 180 * Math.PI / 180;
2012
+ } else {
2013
+ target.rotation = 0;
2014
+ }
2015
+ });
2016
+ target.onPointerClickObservable.add(function () {
2017
+ var _this6$_onElementCopy;
2018
+ return (_this6$_onElementCopy = _this6._onElementCopy) === null || _this6$_onElementCopy === void 0 ? void 0 : _this6$_onElementCopy.call(_this6, elementInfo.setId, elementInfo.elementId, 'LEFT');
2019
+ });
2020
+ break;
2021
+ case 'BoxCopyRight':
2022
+ if (dir.z < 0) {
2023
+ target.rotation = 180 * Math.PI / 180;
2024
+ } else {
2025
+ target.rotation = 0;
2026
+ }
2027
+ target.name = 'copyright';
2028
+ guiElement.position = element.absolutePosition.add(new Vector3(-(bbox.max.x - bbox.min.x), (bbox.max.y - bbox.min.y) / 2, bbox.max.z - bbox.min.z));
2029
+ guiElement.rotation = new Vector3(90 * Math.PI / 180, 0, 0);
2030
+ (_this$_scene$activeCa3 = this._scene.activeCamera) === null || _this$_scene$activeCa3 === void 0 || _this$_scene$activeCa3.onViewMatrixChangedObservable.add(function () {
2031
+ var _this6$_scene$activeC2;
2032
+ var _dir = (_this6$_scene$activeC2 = _this6._scene.activeCamera) === null || _this6$_scene$activeC2 === void 0 ? void 0 : _this6$_scene$activeC2.getDirection(Axis.Z);
2033
+ if (_dir.z < 0) {
2034
+ target.rotation = 180 * Math.PI / 180;
2035
+ } else {
2036
+ target.rotation = 0;
2037
+ }
2038
+ });
2039
+ target.onPointerClickObservable.add(function () {
2040
+ var _this6$_onElementCopy2;
2041
+ return (_this6$_onElementCopy2 = _this6._onElementCopy) === null || _this6$_onElementCopy2 === void 0 ? void 0 : _this6$_onElementCopy2.call(_this6, elementInfo.setId, elementInfo.elementId, 'RIGHT');
2042
+ });
2043
+ break;
2044
+ case 'BoxCopyTop':
2045
+ target.rotation = 90 * Math.PI / 180;
2046
+ guiElement.position = element.absolutePosition.add(new Vector3(-(bbox.max.x - bbox.min.x) / 2, bbox.max.y - bbox.min.y, bbox.max.z - bbox.min.z));
2047
+ target.onPointerClickObservable.add(function () {
2048
+ var _this6$_onElementCopy3;
2049
+ return (_this6$_onElementCopy3 = _this6._onElementCopy) === null || _this6$_onElementCopy3 === void 0 ? void 0 : _this6$_onElementCopy3.call(_this6, elementInfo.setId, elementInfo.elementId, 'TOP');
2050
+ });
2051
+ break;
2052
+ }
2053
+ this._gui.addControl(target);
2054
+ target.linkWithMesh(guiElement);
2055
+ this._guiElements.push(guiElem);
2056
+ }
1816
2057
  }, {
1817
2058
  key: "initGui",
1818
2059
  value: function initGui(onElSelected, elements) {
1819
- var _this4 = this;
2060
+ var _this7 = this;
1820
2061
  if (!this._selectionHandler) this.initSelectionHandler(onElSelected);
1821
2062
  if (!this._scene) return;
1822
2063
  if (!this._elementsInfo) return;
@@ -1824,36 +2065,24 @@ var UIStore = /*#__PURE__*/function () {
1824
2065
  return !!e.posNr;
1825
2066
  }).length > elements.length) return; // elementinfo update before unity -- return and wait for after buildscene
1826
2067
  this.clearGui();
1827
- var _loop = function _loop() {
1828
- var elementInfo = _this4._elementsInfo[idx];
1829
- var emnt = elements.find(function (el) {
1830
- return Number(el.bbn.name.slice(el.bbn.name.lastIndexOf('E') + 1, el.bbn.name.length)) == elementInfo.elementId;
1831
- });
1832
- if (!emnt || !elementInfo.posNr) return 0; // continue
1833
- var element = _this4._scene.getTransformNodeByName(emnt.bbn.name);
1834
- if (!element) return 0; // continue
1835
- var guiElemLeftBack = new TransformNode('guiElem_' + elementInfo.elementId, _this4._scene);
1836
- var bbox = element.getHierarchyBoundingVectors();
1837
- guiElemLeftBack.position = element.absolutePosition.add(new Vector3(0, bbox.max.y, 0));
1838
- guiElemRightBack = undefined;
1839
- if (_this4._uiConfig.posTrashIcon == 'TOP_RIGHT_BACK') {
1840
- guiElemRightBack = new TransformNode('guiElem_' + elementInfo.elementId, _this4._scene);
1841
- var pos = new Vector3(bbox.min.x, bbox.max.y, bbox.min.z);
1842
- guiElemRightBack.position = pos;
1843
- }
1844
- _this4.createGUIButton(guiElemLeftBack, elementInfo.posNr, elementInfo.active, elementInfo.selectable, element.parent.name, elementInfo.elementId, guiElemRightBack);
1845
- },
1846
- guiElemRightBack,
1847
- _ret;
1848
- for (var idx = this._elementsInfo.length - 1; idx >= 0; idx--) {
1849
- _ret = _loop();
1850
- if (_ret === 0) continue;
1851
- }
2068
+ if (this._plane.parent == null) this._plane.parent = this._scene.activeCamera;
2069
+ var isBoxPlanner = !this._elementsInfo.every(function (v) {
2070
+ return v.type == 'PosNr';
2071
+ });
2072
+ this._elementsInfo.forEach(function (elementInfo) {
2073
+ var emnt = elements.find(function (el) {
2074
+ return Number(el.bbn.name.slice(el.bbn.name.lastIndexOf('E') + 1, el.bbn.name.length)) == elementInfo.elementId;
2075
+ });
2076
+ if (!emnt) return;
2077
+ var element = _this7._scene.getTransformNodeByName(emnt.bbn.name);
2078
+ if (!element) return;
2079
+ if (elementInfo.type == 'PosNr') _this7.createPosNr(elementInfo, element, isBoxPlanner);else _this7.createBoxCopyButtons(elementInfo, element);
2080
+ });
1852
2081
  }
1853
2082
  }, {
1854
2083
  key: "selectElem",
1855
2084
  value: function selectElem(name) {
1856
- var _this5 = this;
2085
+ var _this8 = this;
1857
2086
  var _iterator = _createForOfIteratorHelper$5(this._gui.getControlsByType('ellipse')),
1858
2087
  _step;
1859
2088
  try {
@@ -1869,67 +2098,14 @@ var UIStore = /*#__PURE__*/function () {
1869
2098
  this._guiElements.forEach(function (guiElem) {
1870
2099
  return guiElem.elements.forEach(function (element) {
1871
2100
  if (element.typeName == 'label') element.color = 'Black';
1872
- if (element.typeName == 'Ellipse') element.color = _this5._colors.defaultBg;
2101
+ if (element.typeName == 'Ellipse') element.color = _this8._colors.defaultBg;
1873
2102
  if (guiElem.elementId.toString() == name) {
1874
- if (element.typeName == 'label') element.color = _this5._colors.selectedBg;
2103
+ if (element.typeName == 'label') element.color = _this8._colors.selectedBg;
1875
2104
  if (element.typeName == 'Ellipse') element.color = 'White';
1876
2105
  }
1877
2106
  });
1878
2107
  });
1879
2108
  }
1880
- }, {
1881
- key: "createGUIButton",
1882
- value: function createGUIButton(node, posNr, isSelected, isSelectable, setId, elementId, topRightNode) {
1883
- var _this$_utilStore$view,
1884
- _this6 = this;
1885
- var guiElem = {
1886
- elementId: elementId,
1887
- elements: []
1888
- };
1889
- var label = new TextBlock('posnr_label');
1890
- guiElem.elements.push(label);
1891
- label.color = 'Black';
1892
- label.fontFamily = 'Roboto';
1893
- label.fontWeight = '100';
1894
- if (isSelected) label.color = 'White';
1895
- if (!isSelectable) label.color = 'rgb(175, 172, 172)';
1896
- label.text = posNr;
1897
- var target = this._uiConfig.templateConfig == 'standard' ? new Ellipse('posnrEllipse') : new Rectangle('posnrRectangle');
1898
- if (this._uiConfig.templateConfig == 'gold') target.cornerRadius = 3;
1899
- guiElem.elements.push(target);
1900
- target.width = this._uiConfig.templateConfig == 'standard' ? '40px' : '20px';
1901
- target.height = this._uiConfig.templateConfig == 'standard' ? '40px' : '20px';
1902
- target.fontSize = this._uiConfig.templateConfig == 'standard' ? 50 : 20;
1903
- target.background = this._colors.defaultBg;
1904
- target.thickness = 0;
1905
- target.addControl(label);
1906
- if (isSelected) target.background = this._colors.selectedBg;
1907
- if (!isSelectable) target.background = '';
1908
- if (isSelected && ((_this$_utilStore$view = this._utilStore.viewHandler) === null || _this$_utilStore$view === void 0 ? void 0 : _this$_utilStore$view.tabGroupState.curTabGroup.type) == 'PLANNER') {
1909
- var dtarget = this._uiConfig.templateConfig == 'standard' ? new Ellipse('deleteEllipse') : new Rectangle('deleteEllipse');
1910
- guiElem.elements.push(dtarget);
1911
- dtarget.width = this._uiConfig.templateConfig == 'standard' ? '40px' : '35px';
1912
- dtarget.height = this._uiConfig.templateConfig == 'standard' ? '40px' : '35px';
1913
- dtarget.thickness = 1;
1914
- dtarget.background = this._colors.defaultBg;
1915
- var dbt = Button.CreateImageOnlyButton('buttond', this._uiConfig.templateConfig == 'standard' ? delButton : gdelButton);
1916
- guiElem.elements.push(dbt);
1917
- dbt.color = 'transparent';
1918
- dbt.width = this._uiConfig.templateConfig == 'standard' ? '40px' : '60%';
1919
- dbt.height = this._uiConfig.templateConfig == 'standard' ? '40px' : '70%';
1920
- dbt.onPointerClickObservable.add(function () {
1921
- return _this6._utilStore.onElementDeleted(setId, elementId);
1922
- });
1923
- if (this._uiConfig.templateConfig == 'standard') dtarget.linkOffsetY = -48;
1924
- dtarget.addControl(dbt);
1925
- this._gui.addControl(dtarget);
1926
- dtarget.linkWithMesh(topRightNode !== null && topRightNode !== void 0 ? topRightNode : node);
1927
- }
1928
- this._gui.addControl(target);
1929
- target.linkWithMesh(node);
1930
- guiElem.elements.push(node);
1931
- this._guiElements.push(guiElem);
1932
- }
1933
2109
  }, {
1934
2110
  key: "clearGui",
1935
2111
  value: function clearGui() {
@@ -1942,21 +2118,22 @@ var UIStore = /*#__PURE__*/function () {
1942
2118
  this._scene.transformNodes.forEach(function (tN) {
1943
2119
  return tN.name.startsWith('guiElem_') && tN.dispose();
1944
2120
  });
2121
+ this._selectedHl.removeAllMeshes();
1945
2122
  }
1946
2123
  }, {
1947
2124
  key: "onMove",
1948
2125
  value: function onMove() {
1949
- if (!this._overlayImage) return;
1950
- this._overlayImage.isVisible = false;
2126
+ if (!this._plane) return;
2127
+ this._plane.visibility = 0;
1951
2128
  this._enableSSAO(true);
1952
2129
  this._utilStore.updateCam = false;
1953
2130
  }
1954
2131
  }, {
1955
2132
  key: "requestNewOverlayImage",
1956
2133
  value: function requestNewOverlayImage(viewpoint, focusedElement, targetCameraPosition) {
1957
- var _this7 = this;
2134
+ var _this9 = this;
1958
2135
  //this._overlayImage exists only when unity combi is enabled
1959
- if (!this._overlayImage) return;
2136
+ if (!this._plane) return;
1960
2137
  var elementId = undefined;
1961
2138
  var setId = undefined;
1962
2139
  var ob = this._scene.getTransformNodeByName(focusedElement.name);
@@ -1970,20 +2147,21 @@ var UIStore = /*#__PURE__*/function () {
1970
2147
  clearTimeout(this._timeoutId);
1971
2148
  if (!this._latestViewpoint || this._latestViewpoint.isOutdated || Math.abs(this._latestViewpoint.pos.x - viewpoint.pos.x) > 0.05 || Math.abs(this._latestViewpoint.pos.y - viewpoint.pos.y) > 0.05 || Math.abs(this._latestViewpoint.pos.z - viewpoint.pos.z) > 0.05 || Math.abs(this._latestViewpoint.rot.x - viewpoint.rot.x) > 0.05 || Math.abs(this._latestViewpoint.rot.y - viewpoint.rot.y) > 0.05 || Math.abs(this._latestViewpoint.rot.z - viewpoint.rot.z) > 0.05) {
1972
2149
  this._timeoutId = setTimeout(function () {
1973
- var _this7$_requestNewOve;
1974
- _this7._utilStore.addOutstandingImage();
1975
- _this7._latestViewpoint = viewpoint;
1976
- (_this7$_requestNewOve = _this7._requestNewOverlayImage) === null || _this7$_requestNewOve === void 0 || _this7$_requestNewOve.call(_this7, viewpoint, {
2150
+ var _this9$_requestNewOve;
2151
+ _this9._utilStore.addOutstandingImage();
2152
+ _this9._latestViewpoint = viewpoint;
2153
+ console.log('requestNewOverlay Image');
2154
+ (_this9$_requestNewOve = _this9._requestNewOverlayImage) === null || _this9$_requestNewOve === void 0 || _this9$_requestNewOve.call(_this9, viewpoint, {
1977
2155
  adjustZoomInUnity: false,
1978
2156
  onlyAdjustZoomBBChanged: false,
1979
2157
  rotationCenter: viewpoint.targetPos,
1980
2158
  elementId: elementId,
1981
2159
  setId: setId
1982
2160
  });
1983
- _this7._utilStore.updateCam = true;
2161
+ _this9._utilStore.updateCam = true;
1984
2162
  }, 200);
1985
2163
  } else {
1986
- this._overlayImage.isVisible = true;
2164
+ this._plane.visibility = 1;
1987
2165
  }
1988
2166
  }
1989
2167
  }]);
@@ -2211,7 +2389,7 @@ var unregisterContext = function unregisterContext() {
2211
2389
  var registerContext = function registerContext(scene, hqRenderScript, apiConfig, jwt, viewHandler, onMissingGeo, requestNewOverlayImage, overlayImage, uiConfig, updateCameraInformation) {
2212
2390
  var utilStore = new UtilStore(false, viewHandler);
2213
2391
  var sceneStore = new SceneStore(scene, hqRenderScript, utilStore, apiConfig, jwt, onMissingGeo, updateCameraInformation);
2214
- var uiStore = new UIStore(scene, sceneStore.enableSSAO.bind(sceneStore), utilStore, uiConfig, requestNewOverlayImage, overlayImage);
2392
+ var uiStore = new UIStore(scene, sceneStore.enableSSAO.bind(sceneStore), utilStore, uiConfig, requestNewOverlayImage, overlayImage, viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.viewPlannerHandler.onElementCopy);
2215
2393
  return _context = {
2216
2394
  utilStore: utilStore,
2217
2395
  sceneStore: sceneStore,
@@ -2507,11 +2685,10 @@ function _findAssets() {
2507
2685
  mesh.parent = null;
2508
2686
  result.meshes[0].dispose();
2509
2687
  mesh.name = geo.name;
2510
- mesh.renderingGroupId = 0;
2511
2688
  mesh.parent = cacheGroup;
2512
2689
  return _context2.abrupt("return", mesh);
2513
- case 21:
2514
- _context2.prev = 21;
2690
+ case 20:
2691
+ _context2.prev = 20;
2515
2692
  _context2.t0 = _context2["catch"](4);
2516
2693
  (_sceneStore$onMissing = sceneStore.onMissingGeo) === null || _sceneStore$onMissing === void 0 || _sceneStore$onMissing.call(sceneStore);
2517
2694
  utilStore.setAnalyzeDataRow({
@@ -2523,11 +2700,11 @@ function _findAssets() {
2523
2700
  found: false
2524
2701
  });
2525
2702
  return _context2.abrupt("return", undefined);
2526
- case 26:
2703
+ case 25:
2527
2704
  case "end":
2528
2705
  return _context2.stop();
2529
2706
  }
2530
- }, _callee2, null, [[4, 21]]);
2707
+ }, _callee2, null, [[4, 20]]);
2531
2708
  }));
2532
2709
  return _importGeo.apply(this, arguments);
2533
2710
  };
@@ -3418,7 +3595,7 @@ function useRealTimeRenderData (_ref) {
3418
3595
  }
3419
3596
  engine = new Engine(gameCanvas.current, true, {
3420
3597
  antialias: true,
3421
- stencil: false,
3598
+ stencil: true,
3422
3599
  audioEngine: false
3423
3600
  }, true);
3424
3601
  engine.renderEvenInBackground = renderInBackground;
@@ -3449,7 +3626,6 @@ function useRealTimeRenderData (_ref) {
3449
3626
  if (sceneStore.hasPlanned) sceneStore.doRenderControlLoop = true;
3450
3627
  scene.getEngine().resize();
3451
3628
  if (uiStore) {
3452
- uiStore.onMove();
3453
3629
  uiStore.resize(scene);
3454
3630
  uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
3455
3631
  }
@@ -3497,6 +3673,7 @@ function useRealTimeRenderData (_ref) {
3497
3673
  }
3498
3674
  }, [elementsInfo, (_sceneStore3 = sceneStore) === null || _sceneStore3 === void 0 ? void 0 : _sceneStore3.elements]);
3499
3675
  useEffect(function () {
3676
+ if (!sceneStore) return;
3500
3677
  if (inBackground) {
3501
3678
  sceneStore.scene.getEngine().stopRenderLoop();
3502
3679
  } else if (sceneStore.hasRendered) {