@inweb/viewer-visualize 27.1.0 → 27.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,5 +5,5 @@ export declare class RenderLoopComponent implements IComponent {
5
5
  protected requestId: number;
6
6
  constructor(viewer: Viewer);
7
7
  dispose(): void;
8
- animate: (time?: number) => void;
8
+ animate: (time: number) => void;
9
9
  }
@@ -55,11 +55,12 @@ import { ILoadersRegistry } from "@inweb/viewer-core";
55
55
  *
56
56
  * this.viewer.syncOptions();
57
57
  * this.viewer.syncOverlay();
58
- * this.viewer.update();
59
58
  *
60
59
  * this.viewer.emitEvent({ type: "geometryprogress", data: 1, file });
61
60
  * this.viewer.emitEvent({ type: "databasechunk", data, file });
62
61
  *
62
+ * this.viewer.update(true);
63
+ *
63
64
  * return Promise.resove(this);
64
65
  * };
65
66
  * }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/viewer-visualize",
3
- "version": "27.1.0",
3
+ "version": "27.1.1",
4
4
  "description": "JavaScript library for rendering CAD and BIM files in a browser using VisualizeJS",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -29,10 +29,10 @@
29
29
  "docs": "typedoc"
30
30
  },
31
31
  "dependencies": {
32
- "@inweb/client": "~27.1.0",
33
- "@inweb/eventemitter2": "~27.1.0",
34
- "@inweb/markup": "~27.1.0",
35
- "@inweb/viewer-core": "~27.1.0"
32
+ "@inweb/client": "~27.1.1",
33
+ "@inweb/eventemitter2": "~27.1.1",
34
+ "@inweb/markup": "~27.1.1",
35
+ "@inweb/viewer-core": "~27.1.1"
36
36
  },
37
37
  "visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js"
38
38
  }
@@ -30,14 +30,14 @@ export class RenderLoopComponent implements IComponent {
30
30
 
31
31
  constructor(viewer: Viewer) {
32
32
  this.viewer = viewer;
33
- this.animate();
33
+ this.requestId = requestAnimationFrame(this.animate);
34
34
  }
35
35
 
36
36
  dispose() {
37
37
  cancelAnimationFrame(this.requestId);
38
38
  }
39
39
 
40
- animate = (time = 0) => {
40
+ animate = (time: number) => {
41
41
  this.requestId = requestAnimationFrame(this.animate);
42
42
 
43
43
  this.viewer.render(time);
@@ -76,12 +76,12 @@ export class VSFCloudLoader extends Loader {
76
76
 
77
77
  this.viewer.syncOptions();
78
78
  this.viewer.syncOverlay();
79
- this.viewer.update(true);
80
79
 
81
80
  this.viewer.emitEvent({ type: "databasechunk", data, file: model.file, model });
81
+ this.viewer.update(true);
82
82
  } else {
83
- this.viewer.update();
84
83
  this.viewer.emitEvent({ type: "geometrychunk", data, file: model.file, model });
84
+ this.viewer.update();
85
85
  }
86
86
  }
87
87
 
@@ -76,9 +76,9 @@ export class VSFFileLoader extends Loader {
76
76
 
77
77
  this.viewer.syncOptions();
78
78
  this.viewer.syncOverlay();
79
- this.viewer.update(true);
80
79
 
81
80
  this.viewer.emitEvent({ type: "databasechunk", data, file });
81
+ this.viewer.update(true);
82
82
 
83
83
  return this;
84
84
  }
@@ -71,9 +71,9 @@ export class VSFXCloudLoader extends Loader {
71
71
 
72
72
  this.viewer.syncOptions();
73
73
  this.viewer.syncOverlay();
74
- this.viewer.update(true);
75
74
 
76
75
  this.viewer.emitEvent({ type: "databasechunk", data, file: model.file, model });
76
+ this.viewer.update(true);
77
77
 
78
78
  return this;
79
79
  }
@@ -85,12 +85,12 @@ export class VSFXCloudPartialLoader extends Loader {
85
85
 
86
86
  this.viewer.syncOptions();
87
87
  this.viewer.syncOverlay();
88
- this.viewer.update(true);
89
88
 
90
89
  this.viewer.emitEvent({ type: "databasechunk", data: chunk, file: model.file, model });
90
+ this.viewer.update(true);
91
91
  } else {
92
- this.viewer.update();
93
92
  this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
93
+ this.viewer.update();
94
94
  }
95
95
  };
96
96
 
@@ -83,12 +83,12 @@ export class VSFXCloudStreamingLoader extends Loader {
83
83
 
84
84
  this.viewer.syncOptions();
85
85
  this.viewer.syncOverlay();
86
- this.viewer.update(true);
87
86
 
88
87
  this.viewer.emitEvent({ type: "databasechunk", data: chunk, file: model.file, model });
88
+ this.viewer.update(true);
89
89
  } else {
90
- this.viewer.update();
91
90
  this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
91
+ this.viewer.update();
92
92
  }
93
93
  };
94
94
 
@@ -76,9 +76,9 @@ export class VSFXFileLoader extends Loader {
76
76
 
77
77
  this.viewer.syncOptions();
78
78
  this.viewer.syncOverlay();
79
- this.viewer.update(true);
80
79
 
81
80
  this.viewer.emitEvent({ type: "databasechunk", data, file });
81
+ this.viewer.update(true);
82
82
 
83
83
  return this;
84
84
  }
@@ -87,11 +87,12 @@ import { VSFXCloudPartialLoader } from "./VSFXCloudPartialLoader";
87
87
  *
88
88
  * this.viewer.syncOptions();
89
89
  * this.viewer.syncOverlay();
90
- * this.viewer.update();
91
90
  *
92
91
  * this.viewer.emitEvent({ type: "geometryprogress", data: 1, file });
93
92
  * this.viewer.emitEvent({ type: "databasechunk", data, file });
94
93
  *
94
+ * this.viewer.update(true);
95
+ *
95
96
  * return Promise.resove(this);
96
97
  * };
97
98
  * }
@@ -284,9 +284,9 @@ export class Viewer
284
284
  this.syncOverlay();
285
285
 
286
286
  this._renderTime = performance.now();
287
- this.render(this._renderTime);
288
287
 
289
288
  this.emitEvent({ type: "initialize" });
289
+ this.update(true);
290
290
 
291
291
  return this;
292
292
  }
@@ -339,8 +339,8 @@ export class Viewer
339
339
 
340
340
  this._viewer.resize(0, this.canvas.width, this.canvas.height, 0);
341
341
 
342
- this.update(true);
343
342
  this.emitEvent({ type: "resize", width, height });
343
+ this.update(true);
344
344
  }
345
345
 
346
346
  resize(): this {
@@ -435,6 +435,8 @@ export class Viewer
435
435
  }
436
436
 
437
437
  applyModelTransformMatrix(model: Model | Assembly) {
438
+ if (!this.visualizeJs) return;
439
+
438
440
  this.executeCommand("applyModelTransform", model);
439
441
  }
440
442
 
@@ -561,16 +563,15 @@ export class Viewer
561
563
  try {
562
564
  await this.loadReferences(model);
563
565
  await loader.load(model, format, params);
566
+
567
+ this.applyModelTransformMatrix(model);
568
+ this.applySceneGraphSettings();
564
569
  } catch (error: any) {
565
570
  this.emitEvent({ type: "geometryerror", data: error, file, model });
566
571
  throw error;
567
572
  }
568
573
  this.emitEvent({ type: "geometryend", file, model });
569
-
570
- if (this.visualizeJs) {
571
- this.applyModelTransformMatrix(model);
572
- this.applySceneGraphSettings();
573
- }
574
+ this.update(true);
574
575
 
575
576
  return this;
576
577
  }
@@ -601,7 +602,6 @@ export class Viewer
601
602
 
602
603
  this.syncOptions();
603
604
  this.syncOverlay();
604
- this.update(true);
605
605
 
606
606
  this.emitEvent({ type: "geometryprogress", data: 1, file: "", buffer });
607
607
  this.emitEvent({ type: "databasechunk", data, file: "", buffer });
@@ -610,6 +610,7 @@ export class Viewer
610
610
  throw error;
611
611
  }
612
612
  this.emitEvent({ type: "geometryend", file: "", buffer });
613
+ this.update(true);
613
614
 
614
615
  return this;
615
616
  }
@@ -640,7 +641,6 @@ export class Viewer
640
641
 
641
642
  this.syncOptions();
642
643
  this.syncOverlay();
643
- this.update(true);
644
644
 
645
645
  this.emitEvent({ type: "geometryprogress", data: 1, file: "", buffer });
646
646
  this.emitEvent({ type: "databasechunk", data, file: "", buffer });
@@ -649,6 +649,7 @@ export class Viewer
649
649
  throw error;
650
650
  }
651
651
  this.emitEvent({ type: "geometryend", file: "", buffer });
652
+ this.update(true);
652
653
 
653
654
  return this;
654
655
  }
@@ -684,9 +685,9 @@ export class Viewer
684
685
 
685
686
  this.syncOptions();
686
687
  this.syncOverlay();
687
- this.update(true);
688
688
 
689
689
  this.emitEvent({ type: "clear" });
690
+ this.update(true);
690
691
 
691
692
  return this;
692
693
  }
@@ -1104,10 +1105,10 @@ export class Viewer
1104
1105
  this._markup.setViewpoint(viewpoint);
1105
1106
 
1106
1107
  this.syncOverlay();
1107
-
1108
1108
  this.setActiveDragger(draggerName);
1109
+
1109
1110
  this.emitEvent({ type: "drawviewpoint", data: viewpoint });
1110
- this.update();
1111
+ this.update(true);
1111
1112
  }
1112
1113
 
1113
1114
  createViewpoint(): IViewpoint {