@inweb/viewer-three 26.10.2 → 26.10.3

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.
@@ -31,22 +31,18 @@
31
31
  constructor(viewer) {
32
32
  this.syncHelper = () => {
33
33
  this.axesHelper1.removeFromParent();
34
- this.axesHelper1.dispose();
35
34
  this.axesHelper2.removeFromParent();
36
- this.axesHelper2.dispose();
37
35
  const size = this.viewer.extents.getSize(new three.Vector3()).length();
38
36
  const center = this.viewer.extents.getCenter(new three.Vector3());
39
- this.axesHelper1 = new three.AxesHelper(size || 1);
40
- this.axesHelper2 = new three.AxesHelper(size);
41
37
  this.axesHelper1.position.set(0, 0, 0);
42
- this.viewer.helpers.add(this.axesHelper1);
43
- if (this.viewer.extents.isEmpty())
44
- return;
38
+ this.axesHelper1.scale.setScalar(size);
45
39
  this.axesHelper2.position.copy(center);
40
+ this.axesHelper2.scale.setScalar(size);
41
+ this.viewer.helpers.add(this.axesHelper1);
46
42
  this.viewer.helpers.add(this.axesHelper2);
47
43
  };
48
- this.axesHelper1 = new three.AxesHelper();
49
- this.axesHelper2 = new three.AxesHelper();
44
+ this.axesHelper1 = new three.AxesHelper(1);
45
+ this.axesHelper2 = new three.AxesHelper(1);
50
46
  this.viewer = viewer;
51
47
  this.viewer.addEventListener("initialize", this.syncHelper);
52
48
  this.viewer.addEventListener("geometryend", this.syncHelper);
@@ -1 +1 @@
1
- {"version":3,"file":"AxesHelperComponent.js","sources":["../../../plugins/components/AxesHelperComponent.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 { AxesHelper, Vector3 } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass AxesHelperComponent implements IComponent {\n private viewer: Viewer;\n private axesHelper1: AxesHelper;\n private axesHelper2: AxesHelper;\n\n constructor(viewer: Viewer) {\n this.axesHelper1 = new AxesHelper();\n this.axesHelper2 = new AxesHelper();\n\n this.viewer = viewer;\n this.viewer.addEventListener(\"initialize\", this.syncHelper);\n this.viewer.addEventListener(\"geometryend\", this.syncHelper);\n this.viewer.addEventListener(\"clear\", this.syncHelper);\n }\n\n dispose() {\n this.axesHelper1.removeFromParent();\n this.axesHelper1.dispose();\n\n this.axesHelper2.removeFromParent();\n this.axesHelper2.dispose();\n\n this.viewer.removeEventListener(\"initialize\", this.syncHelper);\n this.viewer.removeEventListener(\"geometryend\", this.syncHelper);\n this.viewer.removeEventListener(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\n this.axesHelper1.removeFromParent();\n this.axesHelper1.dispose();\n\n this.axesHelper2.removeFromParent();\n this.axesHelper2.dispose();\n\n const size = this.viewer.extents.getSize(new Vector3()).length();\n const center = this.viewer.extents.getCenter(new Vector3());\n\n this.axesHelper1 = new AxesHelper(size || 1);\n this.axesHelper2 = new AxesHelper(size);\n\n this.axesHelper1.position.set(0, 0, 0);\n this.viewer.helpers.add(this.axesHelper1);\n\n if (this.viewer.extents.isEmpty()) return;\n\n this.axesHelper2.position.copy(center);\n this.viewer.helpers.add(this.axesHelper2);\n };\n}\n\ncomponents.registerComponent(\"AxesHelperComponent\", (viewer) => new AxesHelperComponent(viewer));\n"],"names":["Vector3","AxesHelper","components"],"mappings":";;;;;;;;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AEnC,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;YACpB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC;YAC3D,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;IACL,QAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;IACnC,QAAA,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;IAE1B,QAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;IACnC,QAAA,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;YAE1B,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC;YAC9D,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;IAuBD;AAEDC,0BAAU,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,CAAC,MAAM,KAAK,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;;;;;;"}
1
+ {"version":3,"file":"AxesHelperComponent.js","sources":["../../../plugins/components/AxesHelperComponent.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 { AxesHelper, Vector3 } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass AxesHelperComponent implements IComponent {\n private viewer: Viewer;\n private axesHelper1: AxesHelper;\n private axesHelper2: AxesHelper;\n\n constructor(viewer: Viewer) {\n this.axesHelper1 = new AxesHelper(1);\n this.axesHelper2 = new AxesHelper(1);\n\n this.viewer = viewer;\n this.viewer.addEventListener(\"initialize\", this.syncHelper);\n this.viewer.addEventListener(\"geometryend\", this.syncHelper);\n this.viewer.addEventListener(\"clear\", this.syncHelper);\n }\n\n dispose() {\n this.axesHelper1.removeFromParent();\n this.axesHelper1.dispose();\n\n this.axesHelper2.removeFromParent();\n this.axesHelper2.dispose();\n\n this.viewer.removeEventListener(\"initialize\", this.syncHelper);\n this.viewer.removeEventListener(\"geometryend\", this.syncHelper);\n this.viewer.removeEventListener(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\n this.axesHelper1.removeFromParent();\n this.axesHelper2.removeFromParent();\n\n const size = this.viewer.extents.getSize(new Vector3()).length();\n const center = this.viewer.extents.getCenter(new Vector3());\n\n this.axesHelper1.position.set(0, 0, 0);\n this.axesHelper1.scale.setScalar(size);\n\n this.axesHelper2.position.copy(center);\n this.axesHelper2.scale.setScalar(size);\n\n this.viewer.helpers.add(this.axesHelper1);\n this.viewer.helpers.add(this.axesHelper2);\n };\n}\n\ncomponents.registerComponent(\"AxesHelperComponent\", (viewer) => new AxesHelperComponent(viewer));\n"],"names":["Vector3","AxesHelper","components"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BA,MAAM,mBAAmB,CAAA;IAKvB,IAAA,WAAA,C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gB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;QACxD;QAEA,OAAO,GAAA;IACL,QAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;IACnC,QAAA,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;IAE1B,QAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;IACnC,QAAA,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;YAE1B,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC;YAC9D,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;IAkBD;AAEDC,0BAAU,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,CAAC,MAAM,KAAK,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;;;;;;"}
@@ -21,4 +21,4 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- !function(e,s){"object"==typeof exports&&"undefined"!=typeof module?s(require("three"),require("@inweb/viewer-three")):"function"==typeof define&&define.amd?define(["three","@inweb/viewer-three"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).THREE,e.ODA.Three)}(this,function(e,s){"use strict";class t{constructor(s){this.syncHelper=()=>{this.axesHelper1.removeFromParent(),this.axesHelper1.dispose(),this.axesHelper2.removeFromParent(),this.axesHelper2.dispose();const s=this.viewer.extents.getSize(new e.Vector3).length(),t=this.viewer.extents.getCenter(new e.Vector3);this.axesHelper1=new e.AxesHelper(s||1),this.axesHelper2=new e.AxesHelper(s),this.axesHelper1.position.set(0,0,0),this.viewer.helpers.add(this.axesHelper1),this.viewer.extents.isEmpty()||(this.axesHelper2.position.copy(t),this.viewer.helpers.add(this.axesHelper2))},this.axesHelper1=new e.AxesHelper,this.axesHelper2=new e.AxesHelper,this.viewer=s,this.viewer.addEventListener("initialize",this.syncHelper),this.viewer.addEventListener("geometryend",this.syncHelper),this.viewer.addEventListener("clear",this.syncHelper)}dispose(){this.axesHelper1.removeFromParent(),this.axesHelper1.dispose(),this.axesHelper2.removeFromParent(),this.axesHelper2.dispose(),this.viewer.removeEventListener("initialize",this.syncHelper),this.viewer.removeEventListener("geometryend",this.syncHelper),this.viewer.removeEventListener("clear",this.syncHelper)}}s.components.registerComponent("AxesHelperComponent",e=>new t(e))});
24
+ !function(e,s){"object"==typeof exports&&"undefined"!=typeof module?s(require("three"),require("@inweb/viewer-three")):"function"==typeof define&&define.amd?define(["three","@inweb/viewer-three"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).THREE,e.ODA.Three)}(this,function(e,s){"use strict";class t{constructor(s){this.syncHelper=()=>{this.axesHelper1.removeFromParent(),this.axesHelper2.removeFromParent();const s=this.viewer.extents.getSize(new e.Vector3).length(),t=this.viewer.extents.getCenter(new e.Vector3);this.axesHelper1.position.set(0,0,0),this.axesHelper1.scale.setScalar(s),this.axesHelper2.position.copy(t),this.axesHelper2.scale.setScalar(s),this.viewer.helpers.add(this.axesHelper1),this.viewer.helpers.add(this.axesHelper2)},this.axesHelper1=new e.AxesHelper(1),this.axesHelper2=new e.AxesHelper(1),this.viewer=s,this.viewer.addEventListener("initialize",this.syncHelper),this.viewer.addEventListener("geometryend",this.syncHelper),this.viewer.addEventListener("clear",this.syncHelper)}dispose(){this.axesHelper1.removeFromParent(),this.axesHelper1.dispose(),this.axesHelper2.removeFromParent(),this.axesHelper2.dispose(),this.viewer.removeEventListener("initialize",this.syncHelper),this.viewer.removeEventListener("geometryend",this.syncHelper),this.viewer.removeEventListener("clear",this.syncHelper)}}s.components.registerComponent("AxesHelperComponent",e=>new t(e))});
@@ -28,22 +28,18 @@ class AxesHelperComponent {
28
28
  constructor(viewer) {
29
29
  this.syncHelper = () => {
30
30
  this.axesHelper1.removeFromParent();
31
- this.axesHelper1.dispose();
32
31
  this.axesHelper2.removeFromParent();
33
- this.axesHelper2.dispose();
34
32
  const size = this.viewer.extents.getSize(new Vector3()).length();
35
33
  const center = this.viewer.extents.getCenter(new Vector3());
36
- this.axesHelper1 = new AxesHelper(size || 1);
37
- this.axesHelper2 = new AxesHelper(size);
38
34
  this.axesHelper1.position.set(0, 0, 0);
39
- this.viewer.helpers.add(this.axesHelper1);
40
- if (this.viewer.extents.isEmpty())
41
- return;
35
+ this.axesHelper1.scale.setScalar(size);
42
36
  this.axesHelper2.position.copy(center);
37
+ this.axesHelper2.scale.setScalar(size);
38
+ this.viewer.helpers.add(this.axesHelper1);
43
39
  this.viewer.helpers.add(this.axesHelper2);
44
40
  };
45
- this.axesHelper1 = new AxesHelper();
46
- this.axesHelper2 = new AxesHelper();
41
+ this.axesHelper1 = new AxesHelper(1);
42
+ this.axesHelper2 = new AxesHelper(1);
47
43
  this.viewer = viewer;
48
44
  this.viewer.addEventListener("initialize", this.syncHelper);
49
45
  this.viewer.addEventListener("geometryend", this.syncHelper);
@@ -1 +1 @@
1
- {"version":3,"file":"AxesHelperComponent.module.js","sources":["../../../plugins/components/AxesHelperComponent.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 { AxesHelper, Vector3 } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass AxesHelperComponent implements IComponent {\n private viewer: Viewer;\n private axesHelper1: AxesHelper;\n private axesHelper2: AxesHelper;\n\n constructor(viewer: Viewer) {\n this.axesHelper1 = new AxesHelper();\n this.axesHelper2 = new AxesHelper();\n\n this.viewer = viewer;\n this.viewer.addEventListener(\"initialize\", this.syncHelper);\n this.viewer.addEventListener(\"geometryend\", this.syncHelper);\n this.viewer.addEventListener(\"clear\", this.syncHelper);\n }\n\n dispose() {\n this.axesHelper1.removeFromParent();\n this.axesHelper1.dispose();\n\n this.axesHelper2.removeFromParent();\n this.axesHelper2.dispose();\n\n this.viewer.removeEventListener(\"initialize\", this.syncHelper);\n this.viewer.removeEventListener(\"geometryend\", this.syncHelper);\n this.viewer.removeEventListener(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\n this.axesHelper1.removeFromParent();\n this.axesHelper1.dispose();\n\n this.axesHelper2.removeFromParent();\n this.axesHelper2.dispose();\n\n const size = this.viewer.extents.getSize(new Vector3()).length();\n const center = this.viewer.extents.getCenter(new Vector3());\n\n this.axesHelper1 = new AxesHelper(size || 1);\n this.axesHelper2 = new AxesHelper(size);\n\n this.axesHelper1.position.set(0, 0, 0);\n this.viewer.helpers.add(this.axesHelper1);\n\n if (this.viewer.extents.isEmpty()) return;\n\n this.axesHelper2.position.copy(center);\n this.viewer.helpers.add(this.axesHelper2);\n };\n}\n\ncomponents.registerComponent(\"AxesHelperComponent\", (viewer) => new AxesHelperComponent(viewer));\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,mBAAmB,CAAA;AAKvB,IAAA,WAAA,CAAY,MAAc,EAAA;QAsB1B,IAAA,CAAA,UAAU,GAAG,MAAK;AAChB,YAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;AACnC,YAAA,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE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CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;IACxD;IAEA,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;AACnC,QAAA,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;AAE1B,QAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;AACnC,QAAA,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;QAE1B,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC;QAC9D,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;AAuBD;AAED,UAAU,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,CAAC,MAAM,KAAK,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"AxesHelperComponent.module.js","sources":["../../../plugins/components/AxesHelperComponent.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 { AxesHelper, Vector3 } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass AxesHelperComponent implements IComponent {\n private viewer: Viewer;\n private axesHelper1: AxesHelper;\n private axesHelper2: AxesHelper;\n\n constructor(viewer: Viewer) {\n this.axesHelper1 = new AxesHelper(1);\n this.axesHelper2 = new AxesHelper(1);\n\n this.viewer = viewer;\n this.viewer.addEventListener(\"initialize\", this.syncHelper);\n this.viewer.addEventListener(\"geometryend\", this.syncHelper);\n this.viewer.addEventListener(\"clear\", this.syncHelper);\n }\n\n dispose() {\n this.axesHelper1.removeFromParent();\n this.axesHelper1.dispose();\n\n this.axesHelper2.removeFromParent();\n this.axesHelper2.dispose();\n\n this.viewer.removeEventListener(\"initialize\", this.syncHelper);\n this.viewer.removeEventListener(\"geometryend\", this.syncHelper);\n this.viewer.removeEventListener(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\n this.axesHelper1.removeFromParent();\n this.axesHelper2.removeFromParent();\n\n const size = this.viewer.extents.getSize(new Vector3()).length();\n const center = this.viewer.extents.getCenter(new Vector3());\n\n this.axesHelper1.position.set(0, 0, 0);\n this.axesHelper1.scale.setScalar(size);\n\n this.axesHelper2.position.copy(center);\n this.axesHelper2.scale.setScalar(size);\n\n this.viewer.helpers.add(this.axesHelper1);\n this.viewer.helpers.add(this.axesHelper2);\n };\n}\n\ncomponents.registerComponent(\"AxesHelperComponent\", (viewer) => new AxesHelperComponent(viewer));\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,mBAAmB,CAAA;AAKvB,IAAA,WAAA,CAAY,MAAc,EAAA;QAsB1B,IAAA,CAAA,UAAU,GAAG,MAAK;AAChB,YAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;AACnC,YAAA,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;AAEnC,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC,MAAM,E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MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC;QAC9D,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;AAkBD;AAED,UAAU,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,CAAC,MAAM,KAAK,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,62 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
3
+ // All rights reserved.
4
+ //
5
+ // This software and its documentation and related materials are owned by
6
+ // the Alliance. The software may only be incorporated into application
7
+ // programs owned by members of the Alliance, subject to a signed
8
+ // Membership Agreement and Supplemental Software License Agreement with the
9
+ // Alliance. The structure and organization of this software are the valuable
10
+ // trade secrets of the Alliance and its suppliers. The software is also
11
+ // protected by copyright law and international treaty provisions. Application
12
+ // programs incorporating this software must include the following statement
13
+ // with their copyright notices:
14
+ //
15
+ // This application incorporates Open Design Alliance software pursuant to a
16
+ // license agreement with Open Design Alliance.
17
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
18
+ // All rights reserved.
19
+ //
20
+ // By use of this software, its documentation or related materials, you
21
+ // acknowledge and accept the above terms.
22
+ ///////////////////////////////////////////////////////////////////////////////
23
+
24
+ (function (global, factory) {
25
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('three'), require('@inweb/viewer-three')) :
26
+ typeof define === 'function' && define.amd ? define(['three', '@inweb/viewer-three'], factory) :
27
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE, global.ODA.Three));
28
+ })(this, (function (three, viewerThree) { 'use strict';
29
+
30
+ class GridHelperComponent {
31
+ constructor(viewer) {
32
+ this.syncHelper = () => {
33
+ this.gridHelper.removeFromParent();
34
+ if (this.viewer.extents.isEmpty())
35
+ return;
36
+ const size = this.viewer.extents.getSize(new three.Vector3()).multiply(this.viewer.camera.up).length();
37
+ const center = this.viewer.extents.getCenter(new three.Vector3());
38
+ const upY = new three.Vector3(0, 1, 0);
39
+ const up = new three.Vector3().copy(this.viewer.camera.up);
40
+ this.gridHelper.scale.setScalar(size);
41
+ this.gridHelper.position.copy(center);
42
+ this.gridHelper.quaternion.setFromUnitVectors(upY, up);
43
+ this.viewer.helpers.add(this.gridHelper);
44
+ };
45
+ this.gridHelper = new three.GridHelper(10, 20, 0x444444, 0xaaaaaa);
46
+ this.viewer = viewer;
47
+ this.viewer.on("initialize", this.syncHelper);
48
+ this.viewer.on("geometryend", this.syncHelper);
49
+ this.viewer.on("clear", this.syncHelper);
50
+ }
51
+ dispose() {
52
+ this.gridHelper.removeFromParent();
53
+ this.gridHelper.dispose();
54
+ this.viewer.off("initialize", this.syncHelper);
55
+ this.viewer.off("geometryend", this.syncHelper);
56
+ this.viewer.off("clear", this.syncHelper);
57
+ }
58
+ }
59
+ viewerThree.components.registerComponent("GridHelperComponent", (viewer) => new GridHelperComponent(viewer));
60
+
61
+ }));
62
+ //# sourceMappingURL=GridHelperComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GridHelperComponent.js","sources":["../../../plugins/components/GridHelperComponent.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 { GridHelper, Vector3 } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass GridHelperComponent implements IComponent {\n private viewer: Viewer;\n private gridHelper: GridHelper;\n\n constructor(viewer: Viewer) {\n this.gridHelper = new GridHelper(10, 20, 0x444444, 0xaaaaaa);\n this.viewer = viewer;\n this.viewer.on(\"initialize\", this.syncHelper);\n this.viewer.on(\"geometryend\", this.syncHelper);\n this.viewer.on(\"clear\", this.syncHelper);\n }\n\n dispose() {\n this.gridHelper.removeFromParent();\n this.gridHelper.dispose();\n\n this.viewer.off(\"initialize\", this.syncHelper);\n this.viewer.off(\"geometryend\", this.syncHelper);\n this.viewer.off(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\n this.gridHelper.removeFromParent();\n\n if (this.viewer.extents.isEmpty()) return;\n\n const size = this.viewer.extents.getSize(new Vector3()).multiply(this.viewer.camera.up).length();\n const center = this.viewer.extents.getCenter(new Vector3());\n\n const upY = new Vector3(0, 1, 0);\n const up = new Vector3().copy(this.viewer.camera.up);\n\n this.gridHelper.scale.setScalar(size);\n this.gridHelper.position.copy(center);\n this.gridHelper.quaternion.setFromUnitVectors(upY, up);\n\n this.viewer.helpers.add(this.gridHelper);\n };\n}\n\ncomponents.registerComponent(\"GridHelperComponent\", (viewer) => new GridHelperComponent(viewer));\n"],"names":["Vector3","GridHelper","components"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BA,MAAM,mBAAmB,CAAA;IAIvB,IAAA,WAAA,CAAY,MAAc,EAAA;YAiB1B,IAAA,CAAA,UAAU,GAAG,MAAK;IAChB,YAAA,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE;IAElC,YAAA,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE;oBAAE;IAEnC,YAA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AC,UAAU,CAAC,gBAAgB,EAAE;IAClC,QAAA,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;YAEzB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC;YAC9C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;QAC3C;IAmBD;AAEDC,0BAAU,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,CAAC,MAAM,KAAK,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;;;;;;"}
@@ -0,0 +1,24 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
3
+ // All rights reserved.
4
+ //
5
+ // This software and its documentation and related materials are owned by
6
+ // the Alliance. The software may only be incorporated into application
7
+ // programs owned by members of the Alliance, subject to a signed
8
+ // Membership Agreement and Supplemental Software License Agreement with the
9
+ // Alliance. The structure and organization of this software are the valuable
10
+ // trade secrets of the Alliance and its suppliers. The software is also
11
+ // protected by copyright law and international treaty provisions. Application
12
+ // programs incorporating this software must include the following statement
13
+ // with their copyright notices:
14
+ //
15
+ // This application incorporates Open Design Alliance software pursuant to a
16
+ // license agreement with Open Design Alliance.
17
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
18
+ // All rights reserved.
19
+ //
20
+ // By use of this software, its documentation or related materials, you
21
+ // acknowledge and accept the above terms.
22
+ ///////////////////////////////////////////////////////////////////////////////
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 r{constructor(i){this.syncHelper=()=>{if(this.gridHelper.removeFromParent(),this.viewer.extents.isEmpty())return;const i=this.viewer.extents.getSize(new e.Vector3).multiply(this.viewer.camera.up).length(),r=this.viewer.extents.getCenter(new e.Vector3),t=new e.Vector3(0,1,0),s=(new e.Vector3).copy(this.viewer.camera.up);this.gridHelper.scale.setScalar(i),this.gridHelper.position.copy(r),this.gridHelper.quaternion.setFromUnitVectors(t,s),this.viewer.helpers.add(this.gridHelper)},this.gridHelper=new e.GridHelper(10,20,4473924,11184810),this.viewer=i,this.viewer.on("initialize",this.syncHelper),this.viewer.on("geometryend",this.syncHelper),this.viewer.on("clear",this.syncHelper)}dispose(){this.gridHelper.removeFromParent(),this.gridHelper.dispose(),this.viewer.off("initialize",this.syncHelper),this.viewer.off("geometryend",this.syncHelper),this.viewer.off("clear",this.syncHelper)}}i.components.registerComponent("GridHelperComponent",e=>new r(e))});
@@ -0,0 +1,57 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
3
+ // All rights reserved.
4
+ //
5
+ // This software and its documentation and related materials are owned by
6
+ // the Alliance. The software may only be incorporated into application
7
+ // programs owned by members of the Alliance, subject to a signed
8
+ // Membership Agreement and Supplemental Software License Agreement with the
9
+ // Alliance. The structure and organization of this software are the valuable
10
+ // trade secrets of the Alliance and its suppliers. The software is also
11
+ // protected by copyright law and international treaty provisions. Application
12
+ // programs incorporating this software must include the following statement
13
+ // with their copyright notices:
14
+ //
15
+ // This application incorporates Open Design Alliance software pursuant to a
16
+ // license agreement with Open Design Alliance.
17
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
18
+ // All rights reserved.
19
+ //
20
+ // By use of this software, its documentation or related materials, you
21
+ // acknowledge and accept the above terms.
22
+ ///////////////////////////////////////////////////////////////////////////////
23
+
24
+ import { Vector3, GridHelper } from 'three';
25
+ import { components } from '@inweb/viewer-three';
26
+
27
+ class GridHelperComponent {
28
+ constructor(viewer) {
29
+ this.syncHelper = () => {
30
+ this.gridHelper.removeFromParent();
31
+ if (this.viewer.extents.isEmpty())
32
+ return;
33
+ const size = this.viewer.extents.getSize(new Vector3()).multiply(this.viewer.camera.up).length();
34
+ const center = this.viewer.extents.getCenter(new Vector3());
35
+ const upY = new Vector3(0, 1, 0);
36
+ const up = new Vector3().copy(this.viewer.camera.up);
37
+ this.gridHelper.scale.setScalar(size);
38
+ this.gridHelper.position.copy(center);
39
+ this.gridHelper.quaternion.setFromUnitVectors(upY, up);
40
+ this.viewer.helpers.add(this.gridHelper);
41
+ };
42
+ this.gridHelper = new GridHelper(10, 20, 0x444444, 0xaaaaaa);
43
+ this.viewer = viewer;
44
+ this.viewer.on("initialize", this.syncHelper);
45
+ this.viewer.on("geometryend", this.syncHelper);
46
+ this.viewer.on("clear", this.syncHelper);
47
+ }
48
+ dispose() {
49
+ this.gridHelper.removeFromParent();
50
+ this.gridHelper.dispose();
51
+ this.viewer.off("initialize", this.syncHelper);
52
+ this.viewer.off("geometryend", this.syncHelper);
53
+ this.viewer.off("clear", this.syncHelper);
54
+ }
55
+ }
56
+ components.registerComponent("GridHelperComponent", (viewer) => new GridHelperComponent(viewer));
57
+ //# sourceMappingURL=GridHelperComponent.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GridHelperComponent.module.js","sources":["../../../plugins/components/GridHelperComponent.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 { GridHelper, Vector3 } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass GridHelperComponent implements IComponent {\n private viewer: Viewer;\n private gridHelper: GridHelper;\n\n constructor(viewer: Viewer) {\n this.gridHelper = new GridHelper(10, 20, 0x444444, 0xaaaaaa);\n this.viewer = viewer;\n this.viewer.on(\"initialize\", this.syncHelper);\n this.viewer.on(\"geometryend\", this.syncHelper);\n this.viewer.on(\"clear\", this.syncHelper);\n }\n\n dispose() {\n this.gridHelper.removeFromParent();\n this.gridHelper.dispose();\n\n this.viewer.off(\"initialize\", this.syncHelper);\n this.viewer.off(\"geometryend\", this.syncHelper);\n this.viewer.off(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\n this.gridHelper.removeFromParent();\n\n if (this.viewer.extents.isEmpty()) return;\n\n const size = this.viewer.extents.getSize(new Vector3()).multiply(this.viewer.camera.up).length();\n const center = this.viewer.extents.getCenter(new Vector3());\n\n const upY = new Vector3(0, 1, 0);\n const up = new Vector3().copy(this.viewer.camera.up);\n\n this.gridHelper.scale.setScalar(size);\n this.gridHelper.position.copy(center);\n this.gridHelper.quaternion.setFromUnitVectors(upY, up);\n\n this.viewer.helpers.add(this.gridHelper);\n };\n}\n\ncomponents.registerComponent(\"GridHelperComponent\", (viewer) => new GridHelperComponent(viewer));\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,mBAAmB,CAAA;AAIvB,IAAA,WAAA,CAAY,MAAc,EAAA;QAiB1B,IAAA,CAAA,UAAU,GAAG,MAAK;AAChB,YAAA,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE;AAElC,YAAA,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE;gBAAE;AAEnC,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC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AI,CAAC,UAAU,CAAC,OAAO,EAAE;QAEzB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC;QAC9C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;IAC3C;AAmBD;AAED,UAAU,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,CAAC,MAAM,KAAK,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC"}
@@ -33897,7 +33897,7 @@ void main() {
33897
33897
  this.overlay.render();
33898
33898
  };
33899
33899
  this.updateSnapper = () => {
33900
- this.snapper.update(this.viewer);
33900
+ this.snapper.setFromViewer(this.viewer);
33901
33901
  };
33902
33902
  this.updateSnapperCamera = () => {
33903
33903
  this.snapper.camera = this.viewer.camera;
@@ -33934,7 +33934,6 @@ void main() {
33934
33934
  this.viewer.removeEventListener("showall", this.updateSnapper);
33935
33935
  this.viewer.removeEventListener("changecameramode", this.updateSnapperCamera);
33936
33936
  this.snapper.dispose();
33937
- this.snapper.dispose();
33938
33937
  this.overlay.detach();
33939
33938
  this.overlay.dispose();
33940
33939
  super.dispose();
@@ -33951,6 +33950,7 @@ void main() {
33951
33950
  this.camera = camera;
33952
33951
  this.canvas = canvas;
33953
33952
  this.objects = [];
33953
+ this.clippingPlanes = [];
33954
33954
  this.raycaster = new Raycaster();
33955
33955
  this.detectRadiusInPixels = this.isMobile() ? MOBILE_SNAP_DISTANCE : DESKTOP_SNAP_DISTANCE;
33956
33956
  this.edgesCache = new WeakMap();
@@ -33966,7 +33966,7 @@ void main() {
33966
33966
  getMousePosition(event, target) {
33967
33967
  return target.set(event.clientX, event.clientY);
33968
33968
  }
33969
- getPointerIntersects(mouse, objects) {
33969
+ getPointerIntersects(mouse) {
33970
33970
  const rect = this.canvas.getBoundingClientRect();
33971
33971
  const x = ((mouse.x - rect.left) / rect.width) * 2 - 1;
33972
33972
  const y = (-(mouse.y - rect.top) / rect.height) * 2 + 1;
@@ -33980,7 +33980,11 @@ void main() {
33980
33980
  Points: { threshold: 0.01 },
33981
33981
  Sprite: {},
33982
33982
  };
33983
- return this.raycaster.intersectObjects(objects, false);
33983
+ let intersects = this.raycaster.intersectObjects(this.objects, false);
33984
+ this.clippingPlanes.forEach((plane) => {
33985
+ intersects = intersects.filter((intersect) => plane.distanceToPoint(intersect.point) >= 0);
33986
+ });
33987
+ return intersects;
33984
33988
  }
33985
33989
  getDetectRadius(point) {
33986
33990
  const camera = this.camera;
@@ -34001,7 +34005,7 @@ void main() {
34001
34005
  }
34002
34006
  getSnapPoint(event) {
34003
34007
  const mouse = this.getMousePosition(event, new Vector2());
34004
- const intersections = this.getPointerIntersects(mouse, this.objects);
34008
+ const intersections = this.getPointerIntersects(mouse);
34005
34009
  if (intersections.length === 0)
34006
34010
  return undefined;
34007
34011
  const object = intersections[0].object;
@@ -34049,40 +34053,47 @@ void main() {
34049
34053
  return object.localToWorld(snapPoint);
34050
34054
  return intersectionPoint.clone();
34051
34055
  }
34052
- update(viewer) {
34056
+ setFromViewer(viewer) {
34053
34057
  this.objects.length = 0;
34054
34058
  viewer.models.forEach((model) => {
34055
34059
  model.getVisibleObjects().forEach((object) => this.objects.push(object));
34056
34060
  });
34061
+ this.camera = viewer.camera;
34062
+ this.clippingPlanes = viewer.renderer.clippingPlanes || [];
34057
34063
  }
34058
34064
  }
34059
34065
  class MeasureOverlay {
34060
34066
  constructor(camera, canvas) {
34061
34067
  this.lines = [];
34068
+ this.resizeContainer = (entries) => {
34069
+ const { width, height } = entries[0].contentRect;
34070
+ if (!width || !height)
34071
+ return;
34072
+ this.container.style.width = `${width}px`;
34073
+ this.container.style.height = `${height}px`;
34074
+ };
34062
34075
  this.camera = camera;
34063
34076
  this.canvas = canvas;
34064
34077
  this.projector = new MeasureProjector(camera, canvas);
34078
+ this.resizeObserver = new ResizeObserver(this.resizeContainer);
34065
34079
  }
34066
34080
  attach() {
34067
34081
  this.container = document.createElement("div");
34068
34082
  this.container.id = "measure-container";
34069
- this.container.style.background = "rgba(0,0,0,0)";
34070
34083
  this.container.style.position = "absolute";
34071
- this.container.style.top = "0px";
34072
- this.container.style.left = "0px";
34073
- this.container.style.width = "100%";
34074
- this.container.style.height = "100%";
34075
34084
  this.container.style.outline = "none";
34076
34085
  this.container.style.pointerEvents = "none";
34077
34086
  this.container.style.overflow = "hidden";
34078
34087
  if (!this.canvas.parentElement)
34079
34088
  return;
34080
34089
  this.canvas.parentElement.appendChild(this.container);
34090
+ this.resizeObserver.observe(this.canvas.parentElement);
34081
34091
  }
34082
34092
  dispose() {
34083
34093
  this.clear();
34084
34094
  }
34085
34095
  detach() {
34096
+ this.resizeObserver.disconnect();
34086
34097
  this.container.remove();
34087
34098
  this.container = undefined;
34088
34099
  }
@@ -36161,7 +36172,11 @@ void main() {
36161
36172
  Points: { threshold: 0.01 },
36162
36173
  Sprite: {},
36163
36174
  };
36164
- return this.raycaster.intersectObjects(objects, false);
36175
+ let intersects = this.raycaster.intersectObjects(objects, false);
36176
+ (this.viewer.renderer.clippingPlanes || []).forEach((plane) => {
36177
+ intersects = intersects.filter((intersect) => plane.distanceToPoint(intersect.point) >= 0);
36178
+ });
36179
+ return intersects;
36165
36180
  }
36166
36181
  select(objects, model) {
36167
36182
  if (!model) {
@@ -56139,16 +56154,17 @@ void main() {
56139
56154
  this._markupContainer = document.createElement("div");
56140
56155
  this._markupContainer.id = "markup-container";
56141
56156
  this._markupContainer.style.position = "absolute";
56142
- this._markupContainer.style.top = "0px";
56143
- this._markupContainer.style.left = "0px";
56144
56157
  this._markupContainer.style.outline = "0px";
56145
56158
  this._markupContainer.style.pointerEvents = "none";
56146
56159
  const parentDiv = this._container.parentElement;
56147
56160
  parentDiv.appendChild(this._markupContainer);
56148
- if (viewer)
56161
+ if (viewer) {
56149
56162
  this._viewer.addEventListener("resize", this.resizeViewer);
56150
- else
56163
+ }
56164
+ else {
56151
56165
  this._resizeObserver = new ResizeObserver(debounce(this.resizeContainer, 100));
56166
+ this._resizeObserver.observe(parentDiv);
56167
+ }
56152
56168
  this._markupColor.setColor(255, 0, 0);
56153
56169
  this.initializeKonva();
56154
56170
  if (this._viewer) {