@inweb/viewer-three 27.1.1 → 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 (44) 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/LightHelperComponent.js +5 -5
  12. package/dist/extensions/components/LightHelperComponent.js.map +1 -1
  13. package/dist/extensions/components/LightHelperComponent.min.js +1 -1
  14. package/dist/extensions/components/LightHelperComponent.module.js +6 -6
  15. package/dist/extensions/components/LightHelperComponent.module.js.map +1 -1
  16. package/dist/viewer-three.js +1344 -78
  17. package/dist/viewer-three.js.map +1 -1
  18. package/dist/viewer-three.min.js +4 -4
  19. package/dist/viewer-three.module.js +98 -79
  20. package/dist/viewer-three.module.js.map +1 -1
  21. package/extensions/components/AxesHelperComponent.ts +13 -12
  22. package/extensions/components/GridHelperComponent.ts +4 -6
  23. package/extensions/components/LightHelperComponent.ts +6 -6
  24. package/lib/Viewer/commands/SetDefaultViewPosition.d.ts +1 -1
  25. package/lib/Viewer/loaders/GLTFBinaryParser.d.ts +11 -0
  26. package/lib/Viewer/loaders/GLTFFileDynamicLoader.d.ts +0 -1
  27. package/lib/Viewer/loaders/JSONStreamParser.d.ts +5 -0
  28. package/package.json +7 -5
  29. package/src/Viewer/Viewer.ts +4 -7
  30. package/src/Viewer/commands/SetDefaultViewPosition.ts +3 -3
  31. package/src/Viewer/commands/ZoomTo.ts +6 -6
  32. package/src/Viewer/components/CameraComponent.ts +3 -3
  33. package/src/Viewer/components/LightComponent.ts +5 -8
  34. package/src/Viewer/components/SelectionComponent.ts +3 -1
  35. package/src/Viewer/draggers/CuttingPlaneDragger.ts +6 -6
  36. package/src/Viewer/draggers/FlyDragger.ts +1 -1
  37. package/src/Viewer/draggers/MeasureLineDragger.ts +10 -7
  38. package/src/Viewer/draggers/WalkDragger.ts +1 -1
  39. package/src/Viewer/loaders/DynamicGltfLoader/GltfStructure.js +7 -1
  40. package/src/Viewer/loaders/{GLTFBinaryExtension.ts → GLTFBinaryParser.ts} +34 -29
  41. package/src/Viewer/loaders/GLTFCloudDynamicLoader.ts +10 -9
  42. package/src/Viewer/loaders/GLTFFileDynamicLoader.ts +9 -8
  43. package/src/Viewer/loaders/JSONStreamParser.ts +38 -0
  44. package/lib/Viewer/loaders/GLTFBinaryExtension.d.ts +0 -5
@@ -29,14 +29,14 @@ import { DynamicModelImpl } from "./DynamicGltfLoader/DynamicModelImpl";
29
29
  import { DynamicGltfLoader } from "./DynamicGltfLoader/DynamicGltfLoader.js";
30
30
  import { GltfStructure } from "./DynamicGltfLoader/GltfStructure.js";
31
31
  import { GLTFLoadingManager, GLTFLoadParams } from "./GLTFLoadingManager";
32
- import { GLTFBinaryExtension } from "./GLTFBinaryExtension";
32
+ import { GLTFBinaryParser } from "./GLTFBinaryParser";
33
+ import { JSONStreamParser } from "./JSONStreamParser";
33
34
  import { RangesLoader } from "./RangesLoader";
34
35
 
35
36
  export class GLTFFileDynamicLoader extends Loader {
36
37
  public viewer: Viewer;
37
38
  private gltfLoader: DynamicGltfLoader;
38
39
  private manager: GLTFLoadingManager;
39
- private gltf: any;
40
40
  private glb: ArrayBuffer;
41
41
 
42
42
  constructor(viewer: Viewer) {
@@ -104,15 +104,16 @@ export class GLTFFileDynamicLoader extends Loader {
104
104
 
105
105
  const data = await loader.loadAsync(this.manager.fileURL, progress);
106
106
 
107
- const extension = new GLTFBinaryExtension(data as ArrayBuffer);
108
- this.gltf = JSON.parse(extension.content);
109
- this.glb = extension.body;
107
+ const binaryParser = new GLTFBinaryParser(data as ArrayBuffer);
108
+ const jsonParser = new JSONStreamParser(binaryParser.content);
110
109
 
111
- if (/\.glb$/i.test(this.manager.fileURL) && !this.glb) {
112
- throw new Error("GLTFFileDynamicLoader: Binary buffer chunk not found or type not supported.");
110
+ if (!jsonParser.json) {
111
+ throw new Error("GLTFFileDynamicLoader: JSON content not found or invalid.");
113
112
  }
114
113
 
115
- return this.gltf;
114
+ this.glb = binaryParser.body;
115
+
116
+ return jsonParser.json;
116
117
  },
117
118
 
118
119
  loadBinaryData: (ranges, uri = "") => {
@@ -0,0 +1,38 @@
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 { JSONParser } from "@streamparser/json";
25
+
26
+ export class JSONStreamParser extends JSONParser {
27
+ public json: any;
28
+
29
+ constructor(data?: Uint8Array) {
30
+ super();
31
+
32
+ this.onValue = ({ value, stack }) => {
33
+ if (stack.length === 0) this.json = value;
34
+ };
35
+
36
+ if (data) this.write(data);
37
+ }
38
+ }
@@ -1,5 +0,0 @@
1
- export declare class GLTFBinaryExtension {
2
- content: string;
3
- body: ArrayBuffer;
4
- constructor(data: ArrayBuffer);
5
- }