@inweb/viewer-three 27.1.0 → 27.1.2

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 (85) hide show
  1. package/dist/extensions/components/AxesHelperComponent.js +12 -11
  2. package/dist/extensions/components/AxesHelperComponent.js.map +1 -1
  3. package/dist/extensions/components/AxesHelperComponent.min.js +1 -1
  4. package/dist/extensions/components/AxesHelperComponent.module.js +12 -11
  5. package/dist/extensions/components/AxesHelperComponent.module.js.map +1 -1
  6. package/dist/extensions/components/GridHelperComponent.js +4 -6
  7. package/dist/extensions/components/GridHelperComponent.js.map +1 -1
  8. package/dist/extensions/components/GridHelperComponent.min.js +1 -1
  9. package/dist/extensions/components/GridHelperComponent.module.js +4 -6
  10. package/dist/extensions/components/GridHelperComponent.module.js.map +1 -1
  11. package/dist/extensions/components/InfoPanelComponent.js +7 -9
  12. package/dist/extensions/components/InfoPanelComponent.js.map +1 -1
  13. package/dist/extensions/components/InfoPanelComponent.min.js +1 -1
  14. package/dist/extensions/components/InfoPanelComponent.module.js +7 -9
  15. package/dist/extensions/components/InfoPanelComponent.module.js.map +1 -1
  16. package/dist/extensions/components/LightHelperComponent.js +5 -5
  17. package/dist/extensions/components/LightHelperComponent.js.map +1 -1
  18. package/dist/extensions/components/LightHelperComponent.min.js +1 -1
  19. package/dist/extensions/components/LightHelperComponent.module.js +6 -6
  20. package/dist/extensions/components/LightHelperComponent.module.js.map +1 -1
  21. package/dist/extensions/loaders/GLTFCloudLoader.js +1 -1
  22. package/dist/extensions/loaders/GLTFCloudLoader.js.map +1 -1
  23. package/dist/extensions/loaders/GLTFCloudLoader.min.js +1 -1
  24. package/dist/extensions/loaders/GLTFCloudLoader.module.js +1 -1
  25. package/dist/extensions/loaders/GLTFCloudLoader.module.js.map +1 -1
  26. package/dist/extensions/loaders/GLTFFileLoader.js +1 -1
  27. package/dist/extensions/loaders/GLTFFileLoader.js.map +1 -1
  28. package/dist/extensions/loaders/GLTFFileLoader.min.js +1 -1
  29. package/dist/extensions/loaders/GLTFFileLoader.module.js +1 -1
  30. package/dist/extensions/loaders/GLTFFileLoader.module.js.map +1 -1
  31. package/dist/extensions/loaders/IFCXLoader.js +2 -2
  32. package/dist/extensions/loaders/IFCXLoader.js.map +1 -1
  33. package/dist/extensions/loaders/IFCXLoader.min.js +1 -1
  34. package/dist/extensions/loaders/IFCXLoader.module.js +2 -2
  35. package/dist/extensions/loaders/IFCXLoader.module.js.map +1 -1
  36. package/dist/extensions/loaders/PotreeLoader.js +1 -1
  37. package/dist/extensions/loaders/PotreeLoader.js.map +1 -1
  38. package/dist/extensions/loaders/PotreeLoader.min.js +1 -1
  39. package/dist/extensions/loaders/PotreeLoader.module.js +1 -1
  40. package/dist/extensions/loaders/PotreeLoader.module.js.map +1 -1
  41. package/dist/viewer-three.js +1379 -104
  42. package/dist/viewer-three.js.map +1 -1
  43. package/dist/viewer-three.min.js +4 -4
  44. package/dist/viewer-three.module.js +133 -105
  45. package/dist/viewer-three.module.js.map +1 -1
  46. package/extensions/components/AxesHelperComponent.ts +13 -12
  47. package/extensions/components/GridHelperComponent.ts +4 -6
  48. package/extensions/components/InfoPanelComponent.ts +8 -11
  49. package/extensions/components/LightHelperComponent.ts +6 -6
  50. package/extensions/loaders/GLTFCloudLoader.ts +1 -1
  51. package/extensions/loaders/GLTFFileLoader.ts +1 -1
  52. package/extensions/loaders/IFCX/IFCXCloudLoader.ts +1 -1
  53. package/extensions/loaders/IFCX/IFCXFileLoader.ts +1 -1
  54. package/extensions/loaders/Potree/PotreeFileLoader.ts +1 -1
  55. package/lib/Viewer/Viewer.d.ts +1 -1
  56. package/lib/Viewer/commands/CreatePreview.d.ts +1 -1
  57. package/lib/Viewer/commands/SetDefaultViewPosition.d.ts +1 -1
  58. package/lib/Viewer/components/RenderLoopComponent.d.ts +1 -1
  59. package/lib/Viewer/draggers/FlyDragger.d.ts +1 -0
  60. package/lib/Viewer/draggers/WalkDragger.d.ts +1 -0
  61. package/lib/Viewer/loaders/GLTFBinaryParser.d.ts +11 -0
  62. package/lib/Viewer/loaders/GLTFFileDynamicLoader.d.ts +0 -1
  63. package/lib/Viewer/loaders/JSONStreamParser.d.ts +5 -0
  64. package/lib/Viewer/loaders/index.d.ts +2 -1
  65. package/package.json +7 -5
  66. package/src/Viewer/Viewer.ts +32 -32
  67. package/src/Viewer/commands/CreatePreview.ts +2 -2
  68. package/src/Viewer/commands/SetDefaultViewPosition.ts +3 -3
  69. package/src/Viewer/commands/ZoomTo.ts +6 -6
  70. package/src/Viewer/components/CameraComponent.ts +3 -3
  71. package/src/Viewer/components/InfoComponent.ts +4 -4
  72. package/src/Viewer/components/LightComponent.ts +5 -8
  73. package/src/Viewer/components/RenderLoopComponent.ts +2 -2
  74. package/src/Viewer/components/SelectionComponent.ts +3 -1
  75. package/src/Viewer/draggers/CuttingPlaneDragger.ts +6 -6
  76. package/src/Viewer/draggers/FlyDragger.ts +9 -2
  77. package/src/Viewer/draggers/MeasureLineDragger.ts +10 -7
  78. package/src/Viewer/draggers/WalkDragger.ts +9 -2
  79. package/src/Viewer/loaders/DynamicGltfLoader/GltfStructure.js +7 -1
  80. package/src/Viewer/loaders/{GLTFBinaryExtension.ts → GLTFBinaryParser.ts} +34 -29
  81. package/src/Viewer/loaders/GLTFCloudDynamicLoader.ts +12 -11
  82. package/src/Viewer/loaders/GLTFFileDynamicLoader.ts +11 -10
  83. package/src/Viewer/loaders/JSONStreamParser.ts +38 -0
  84. package/src/Viewer/loaders/index.ts +2 -1
  85. package/lib/Viewer/loaders/GLTFBinaryExtension.d.ts +0 -5
@@ -1 +1 @@
1
- {"version":3,"file":"LightHelperComponent.js","sources":["../../../extensions/components/LightHelperComponent.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { DirectionalLightHelper, HemisphereLightHelper, PointLightHelper, Sphere } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass LightHelperComponent implements IComponent {\n private viewer: Viewer;\n private lightHelpers: (DirectionalLightHelper | HemisphereLightHelper | PointLightHelper)[];\n\n constructor(viewer: Viewer) {\n this.lightHelpers = [];\n this.viewer = viewer;\n this.viewer.addEventListener(\"geometryend\", this.syncHelper);\n this.viewer.addEventListener(\"clear\", this.syncHelper);\n }\n\n dispose() {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n this.viewer.removeEventListener(\"geometryend\", this.syncHelper);\n this.viewer.removeEventListener(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere()).radius * 2;\n const size = extentsSize / 20;\n\n this.viewer.scene.traverse((object: any) => {\n let helper: DirectionalLightHelper | HemisphereLightHelper | PointLightHelper;\n\n if (object.isDirectionalLight) helper = new DirectionalLightHelper(object, size, \"#aa0000\");\n else if (object.isHemisphereLight) helper = new HemisphereLightHelper(object, size, \"#ff9800\");\n else if (object.isPointLight) helper = new PointLightHelper(object, size, \"#ff9800\");\n\n if (helper) {\n this.lightHelpers.push(helper);\n this.viewer.helpers.add(helper);\n }\n });\n };\n}\n\ncomponents.registerComponent(\"LightHelperComponent\", (viewer) => new LightHelperComponent(viewer));\n"],"names":["Sphere","DirectionalLightHelper","HemisphereLightHelper","PointLightHelper","components"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BA,MAAM,oBAAoB,CAAA;IAIxB,IAAA,WAAA,CAAY,MAAc,EAAA;YAkB1B,IAAA,CAAA,UAAU,GAAG,MAAK;gBAChB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,KAAI;oBACnC,MAAM,CAAC,gBAAgB,EAAE;oBACzB,MAAM,CAAC,OAAO,EAAE;IAClB,YAAA,CAAC,CAAC;IACF,YAAA,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;IAE5B,YAAA,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAIA,YAAM,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;IAClF,YAAA,MAAM,IAAI,GAAG,WAAW,GAAG,EAAE;gBAE7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAW,KAAI;IACzC,gBAAA,IAAI,MAAyE;oBAE7E,IAAI,MAAM,CAAC,kBAAkB;wBAAE,MAAM,GAAG,IAAIC,4BAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC;yBACtF,IAAI,MAAM,CAAC,iBAAiB;wBAAE,MAAM,GAAG,IAAIC,2BAAqB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC;yBACzF,IAAI,MAAM,CAAC,YAAY;wBAAE,MAAM,GAAG,IAAIC,sBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC;oBAEpF,IAAI,MAAM,EAAE;IACV,oBAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;wBAC9B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;oBACjC;IACF,YAAA,CAAC,CAAC;IACJ,QAAA,CAAC;IAvCC,QAAA,IAAI,CAAC,YAAY,GAAG,EAAE;IACtB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;YACpB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC;YAC5D,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;QACxD;QAEA,OAAO,GAAA;YACL,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,KAAI;gBACnC,MAAM,CAAC,gBAAgB,EAAE;gBACzB,MAAM,CAAC,OAAO,EAAE;IAClB,QAAA,CAAC,CAAC;IACF,QAAA,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;YAE5B,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC;YAC/D,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;QAC3D;IAyBD;AAEDC,0BAAU,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,MAAM,KAAK,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;;;;;;"}
1
+ {"version":3,"file":"LightHelperComponent.js","sources":["../../../extensions/components/LightHelperComponent.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { DirectionalLightHelper, HemisphereLightHelper, PointLightHelper, Vector3 } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass LightHelperComponent implements IComponent {\n private viewer: Viewer;\n private lightHelpers: (DirectionalLightHelper | HemisphereLightHelper | PointLightHelper)[];\n\n constructor(viewer: Viewer) {\n this.lightHelpers = [];\n this.viewer = viewer;\n this.viewer.addEventListener(\"geometryend\", this.syncHelper);\n this.viewer.addEventListener(\"clear\", this.syncHelper);\n }\n\n dispose() {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n this.viewer.removeEventListener(\"geometryend\", this.syncHelper);\n this.viewer.removeEventListener(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n const extentsSize = this.viewer.extents.getSize(new Vector3()).length() || 1;\n const helperSize = extentsSize / 20;\n\n this.viewer.scene.traverse((object: any) => {\n let helper: DirectionalLightHelper | HemisphereLightHelper | PointLightHelper;\n\n if (object.isDirectionalLight) helper = new DirectionalLightHelper(object, helperSize, \"#aa0000\");\n else if (object.isHemisphereLight) helper = new HemisphereLightHelper(object, helperSize, \"#ff9800\");\n else if (object.isPointLight) helper = new PointLightHelper(object, helperSize, \"#ff9800\");\n\n if (helper) {\n this.lightHelpers.push(helper);\n this.viewer.helpers.add(helper);\n }\n });\n };\n}\n\ncomponents.registerComponent(\"LightHelperComponent\", (viewer) => new LightHelperComponent(viewer));\n"],"names":["Vector3","DirectionalLightHelper","HemisphereLightHelper","PointLightHelper","components"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BA,MAAM,o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BAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC;YAC5D,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;QACxD;QAEA,OAAO,GAAA;YACL,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,KAAI;gBACnC,MAAM,CAAC,gBAAgB,EAAE;gBACzB,MAAM,CAAC,OAAO,EAAE;IAClB,QAAA,CAAC,CAAC;IACF,QAAA,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;YAE5B,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC;YAC/D,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;QAC3D;IAyBD;AAEDC,0BAAU,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,MAAM,KAAK,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;;;;;;"}
@@ -21,4 +21,4 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- !function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(require("three"),require("@inweb/viewer-three")):"function"==typeof define&&define.amd?define(["three","@inweb/viewer-three"],i):i((e="undefined"!=typeof globalThis?globalThis:e||self).THREE,e.ODA.Three)}(this,function(e,i){"use strict";class t{constructor(i){this.syncHelper=()=>{this.lightHelpers.forEach(e=>{e.removeFromParent(),e.dispose()}),this.lightHelpers.length=0;const i=2*this.viewer.extents.getBoundingSphere(new e.Sphere).radius/20;this.viewer.scene.traverse(t=>{let r;t.isDirectionalLight?r=new e.DirectionalLightHelper(t,i,"#aa0000"):t.isHemisphereLight?r=new e.HemisphereLightHelper(t,i,"#ff9800"):t.isPointLight&&(r=new e.PointLightHelper(t,i,"#ff9800")),r&&(this.lightHelpers.push(r),this.viewer.helpers.add(r))})},this.lightHelpers=[],this.viewer=i,this.viewer.addEventListener("geometryend",this.syncHelper),this.viewer.addEventListener("clear",this.syncHelper)}dispose(){this.lightHelpers.forEach(e=>{e.removeFromParent(),e.dispose()}),this.lightHelpers.length=0,this.viewer.removeEventListener("geometryend",this.syncHelper),this.viewer.removeEventListener("clear",this.syncHelper)}}i.components.registerComponent("LightHelperComponent",e=>new t(e))});
24
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("three"),require("@inweb/viewer-three")):"function"==typeof define&&define.amd?define(["three","@inweb/viewer-three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).THREE,e.ODA.Three)}(this,function(e,t){"use strict";class i{constructor(t){this.syncHelper=()=>{this.lightHelpers.forEach(e=>{e.removeFromParent(),e.dispose()}),this.lightHelpers.length=0;const t=(this.viewer.extents.getSize(new e.Vector3).length()||1)/20;this.viewer.scene.traverse(i=>{let r;i.isDirectionalLight?r=new e.DirectionalLightHelper(i,t,"#aa0000"):i.isHemisphereLight?r=new e.HemisphereLightHelper(i,t,"#ff9800"):i.isPointLight&&(r=new e.PointLightHelper(i,t,"#ff9800")),r&&(this.lightHelpers.push(r),this.viewer.helpers.add(r))})},this.lightHelpers=[],this.viewer=t,this.viewer.addEventListener("geometryend",this.syncHelper),this.viewer.addEventListener("clear",this.syncHelper)}dispose(){this.lightHelpers.forEach(e=>{e.removeFromParent(),e.dispose()}),this.lightHelpers.length=0,this.viewer.removeEventListener("geometryend",this.syncHelper),this.viewer.removeEventListener("clear",this.syncHelper)}}t.components.registerComponent("LightHelperComponent",e=>new i(e))});
@@ -21,7 +21,7 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Sphere, DirectionalLightHelper, HemisphereLightHelper, PointLightHelper } from 'three';
24
+ import { Vector3, DirectionalLightHelper, HemisphereLightHelper, PointLightHelper } from 'three';
25
25
  import { components } from '@inweb/viewer-three';
26
26
 
27
27
  class LightHelperComponent {
@@ -32,16 +32,16 @@ class LightHelperComponent {
32
32
  helper.dispose();
33
33
  });
34
34
  this.lightHelpers.length = 0;
35
- const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere()).radius * 2;
36
- const size = extentsSize / 20;
35
+ const extentsSize = this.viewer.extents.getSize(new Vector3()).length() || 1;
36
+ const helperSize = extentsSize / 20;
37
37
  this.viewer.scene.traverse((object) => {
38
38
  let helper;
39
39
  if (object.isDirectionalLight)
40
- helper = new DirectionalLightHelper(object, size, "#aa0000");
40
+ helper = new DirectionalLightHelper(object, helperSize, "#aa0000");
41
41
  else if (object.isHemisphereLight)
42
- helper = new HemisphereLightHelper(object, size, "#ff9800");
42
+ helper = new HemisphereLightHelper(object, helperSize, "#ff9800");
43
43
  else if (object.isPointLight)
44
- helper = new PointLightHelper(object, size, "#ff9800");
44
+ helper = new PointLightHelper(object, helperSize, "#ff9800");
45
45
  if (helper) {
46
46
  this.lightHelpers.push(helper);
47
47
  this.viewer.helpers.add(helper);
@@ -1 +1 @@
1
- {"version":3,"file":"LightHelperComponent.module.js","sources":["../../../extensions/components/LightHelperComponent.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { DirectionalLightHelper, HemisphereLightHelper, PointLightHelper, Sphere } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass LightHelperComponent implements IComponent {\n private viewer: Viewer;\n private lightHelpers: (DirectionalLightHelper | HemisphereLightHelper | PointLightHelper)[];\n\n constructor(viewer: Viewer) {\n this.lightHelpers = [];\n this.viewer = viewer;\n this.viewer.addEventListener(\"geometryend\", this.syncHelper);\n this.viewer.addEventListener(\"clear\", this.syncHelper);\n }\n\n dispose() {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n this.viewer.removeEventListener(\"geometryend\", this.syncHelper);\n this.viewer.removeEventListener(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere()).radius * 2;\n const size = extentsSize / 20;\n\n this.viewer.scene.traverse((object: any) => {\n let helper: DirectionalLightHelper | HemisphereLightHelper | PointLightHelper;\n\n if (object.isDirectionalLight) helper = new DirectionalLightHelper(object, size, \"#aa0000\");\n else if (object.isHemisphereLight) helper = new HemisphereLightHelper(object, size, \"#ff9800\");\n else if (object.isPointLight) helper = new PointLightHelper(object, size, \"#ff9800\");\n\n if (helper) {\n this.lightHelpers.push(helper);\n this.viewer.helpers.add(helper);\n }\n });\n };\n}\n\ncomponents.registerComponent(\"LightHelperComponent\", (viewer) => new LightHelperComponent(viewer));\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,oBAAoB,CAAA;AAIxB,IAAA,WAAA,CAAY,MAAc,EAAA;QAkB1B,IAAA,CAAA,UAAU,GAAG,MAAK;YAChB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,KAAI;gBACnC,MAAM,CAAC,gBAAgB,EAAE;gBACzB,MAAM,CAAC,OAAO,EAAE;AAClB,YAAA,CAAC,CAAC;AACF,YAA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AC,OAAO,EAAE;AAClB,QAAA,CAAC,CAAC;AACF,QAAA,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC;QAC/D,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;IAC3D;AAyBD;AAED,UAAU,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,MAAM,KAAK,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"LightHelperComponent.module.js","sources":["../../../extensions/components/LightHelperComponent.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { DirectionalLightHelper, HemisphereLightHelper, PointLightHelper, Vector3 } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass LightHelperComponent implements IComponent {\n private viewer: Viewer;\n private lightHelpers: (DirectionalLightHelper | HemisphereLightHelper | PointLightHelper)[];\n\n constructor(viewer: Viewer) {\n this.lightHelpers = [];\n this.viewer = viewer;\n this.viewer.addEventListener(\"geometryend\", this.syncHelper);\n this.viewer.addEventListener(\"clear\", this.syncHelper);\n }\n\n dispose() {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n this.viewer.removeEventListener(\"geometryend\", this.syncHelper);\n this.viewer.removeEventListener(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n const extentsSize = this.viewer.extents.getSize(new Vector3()).length() || 1;\n const helperSize = extentsSize / 20;\n\n this.viewer.scene.traverse((object: any) => {\n let helper: DirectionalLightHelper | HemisphereLightHelper | PointLightHelper;\n\n if (object.isDirectionalLight) helper = new DirectionalLightHelper(object, helperSize, \"#aa0000\");\n else if (object.isHemisphereLight) helper = new HemisphereLightHelper(object, helperSize, \"#ff9800\");\n else if (object.isPointLight) helper = new PointLightHelper(object, helperSize, \"#ff9800\");\n\n if (helper) {\n this.lightHelpers.push(helper);\n this.viewer.helpers.add(helper);\n }\n });\n };\n}\n\ncomponents.registerComponent(\"LightHelperComponent\", (viewer) => new LightHelperComponent(viewer));\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,oBAAoB,CAAA;AAIxB,IAAA,WAAA,CAAY,MAAc,EAAA;QAkB1B,IAAA,CAAA,UAAU,GAAG,MAAK;YAChB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,KAAI;gBACnC,MAAM,CAAC,gBAAgB,EAAE;gBACzB,MAAM,CAAC,OAAO,EAAE;AAClB,YAAA,CAAC,CAAC;AACF,YAAA,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;AAE5B,YAAA,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC;AAC5E,YAAA,MAAM,UAAU,GAAG,WAAW,GAAG,EAAE;YAEnC,IAAI,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AAI,CAAC,UAAU,CAAC;IAC3D;AAyBD;AAED,UAAU,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,MAAM,KAAK,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC"}
@@ -2477,8 +2477,8 @@
2477
2477
  this.viewer.models.push(modelImpl);
2478
2478
  this.viewer.syncOptions();
2479
2479
  this.viewer.syncOverlay();
2480
- this.viewer.update();
2481
2480
  this.viewer.emitEvent({ type: "databasechunk", data: gltf.scene, file: model.file, model });
2481
+ this.viewer.update(true);
2482
2482
  return this;
2483
2483
  }
2484
2484
  }