@inweb/viewer-visualize 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.
- package/dist/viewer-visualize.js +29 -25
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +24 -25
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Components/RenderLoopComponent.d.ts +1 -1
- package/lib/Viewer/Loaders/index.d.ts +2 -1
- package/package.json +5 -5
- package/src/Viewer/Components/RenderLoopComponent.ts +2 -2
- package/src/Viewer/Loaders/VSFCloudLoader.ts +2 -2
- package/src/Viewer/Loaders/VSFFileLoader.ts +1 -1
- package/src/Viewer/Loaders/VSFXCloudLoader.ts +1 -1
- package/src/Viewer/Loaders/VSFXCloudPartialLoader.ts +2 -2
- package/src/Viewer/Loaders/VSFXCloudStreamingLoader.ts +2 -2
- package/src/Viewer/Loaders/VSFXFileLoader.ts +1 -1
- package/src/Viewer/Loaders/index.ts +2 -1
- package/src/Viewer/Viewer.ts +15 -15
|
@@ -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.
|
|
3
|
+
"version": "27.1.2",
|
|
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.
|
|
33
|
-
"@inweb/eventemitter2": "~27.1.
|
|
34
|
-
"@inweb/markup": "~27.1.
|
|
35
|
-
"@inweb/viewer-core": "~27.1.
|
|
32
|
+
"@inweb/client": "~27.1.2",
|
|
33
|
+
"@inweb/eventemitter2": "~27.1.2",
|
|
34
|
+
"@inweb/markup": "~27.1.2",
|
|
35
|
+
"@inweb/viewer-core": "~27.1.2"
|
|
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
|
|
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
|
* }
|
package/src/Viewer/Viewer.ts
CHANGED
|
@@ -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
|
|
|
@@ -546,31 +548,29 @@ export class Viewer
|
|
|
546
548
|
if (model && typeof model.database === "string") {
|
|
547
549
|
file = model.file;
|
|
548
550
|
}
|
|
549
|
-
if (!model) throw new Error(`Format not supported`);
|
|
550
551
|
|
|
551
552
|
let format = params.format;
|
|
552
|
-
if (!format && typeof file["type"] === "string") format = file["type"].split(".").pop();
|
|
553
|
+
if (!format && file && typeof file["type"] === "string") format = file["type"].split(".").pop();
|
|
553
554
|
if (!format && typeof file === "string") format = file.split(".").pop();
|
|
554
555
|
if (!format && file instanceof globalThis.File) format = file.name.split(".").pop();
|
|
555
556
|
|
|
556
557
|
const loader = loaders.createLoader(this, model, format);
|
|
557
|
-
if (!loader) throw new Error(`Format not supported`);
|
|
558
|
+
if (!loader) throw new Error(`Format not supported (${format})`);
|
|
558
559
|
this.loaders.push(loader);
|
|
559
560
|
|
|
560
561
|
this.emitEvent({ type: "geometrystart", file, model });
|
|
561
562
|
try {
|
|
562
563
|
await this.loadReferences(model);
|
|
563
564
|
await loader.load(model, format, params);
|
|
565
|
+
|
|
566
|
+
this.applyModelTransformMatrix(model);
|
|
567
|
+
this.applySceneGraphSettings();
|
|
564
568
|
} catch (error: any) {
|
|
565
569
|
this.emitEvent({ type: "geometryerror", data: error, file, model });
|
|
566
570
|
throw error;
|
|
567
571
|
}
|
|
568
572
|
this.emitEvent({ type: "geometryend", file, model });
|
|
569
|
-
|
|
570
|
-
if (this.visualizeJs) {
|
|
571
|
-
this.applyModelTransformMatrix(model);
|
|
572
|
-
this.applySceneGraphSettings();
|
|
573
|
-
}
|
|
573
|
+
this.update(true);
|
|
574
574
|
|
|
575
575
|
return this;
|
|
576
576
|
}
|
|
@@ -601,7 +601,6 @@ export class Viewer
|
|
|
601
601
|
|
|
602
602
|
this.syncOptions();
|
|
603
603
|
this.syncOverlay();
|
|
604
|
-
this.update(true);
|
|
605
604
|
|
|
606
605
|
this.emitEvent({ type: "geometryprogress", data: 1, file: "", buffer });
|
|
607
606
|
this.emitEvent({ type: "databasechunk", data, file: "", buffer });
|
|
@@ -610,6 +609,7 @@ export class Viewer
|
|
|
610
609
|
throw error;
|
|
611
610
|
}
|
|
612
611
|
this.emitEvent({ type: "geometryend", file: "", buffer });
|
|
612
|
+
this.update(true);
|
|
613
613
|
|
|
614
614
|
return this;
|
|
615
615
|
}
|
|
@@ -640,7 +640,6 @@ export class Viewer
|
|
|
640
640
|
|
|
641
641
|
this.syncOptions();
|
|
642
642
|
this.syncOverlay();
|
|
643
|
-
this.update(true);
|
|
644
643
|
|
|
645
644
|
this.emitEvent({ type: "geometryprogress", data: 1, file: "", buffer });
|
|
646
645
|
this.emitEvent({ type: "databasechunk", data, file: "", buffer });
|
|
@@ -649,6 +648,7 @@ export class Viewer
|
|
|
649
648
|
throw error;
|
|
650
649
|
}
|
|
651
650
|
this.emitEvent({ type: "geometryend", file: "", buffer });
|
|
651
|
+
this.update(true);
|
|
652
652
|
|
|
653
653
|
return this;
|
|
654
654
|
}
|
|
@@ -684,9 +684,9 @@ export class Viewer
|
|
|
684
684
|
|
|
685
685
|
this.syncOptions();
|
|
686
686
|
this.syncOverlay();
|
|
687
|
-
this.update(true);
|
|
688
687
|
|
|
689
688
|
this.emitEvent({ type: "clear" });
|
|
689
|
+
this.update(true);
|
|
690
690
|
|
|
691
691
|
return this;
|
|
692
692
|
}
|
|
@@ -1104,10 +1104,10 @@ export class Viewer
|
|
|
1104
1104
|
this._markup.setViewpoint(viewpoint);
|
|
1105
1105
|
|
|
1106
1106
|
this.syncOverlay();
|
|
1107
|
-
|
|
1108
1107
|
this.setActiveDragger(draggerName);
|
|
1108
|
+
|
|
1109
1109
|
this.emitEvent({ type: "drawviewpoint", data: viewpoint });
|
|
1110
|
-
this.update();
|
|
1110
|
+
this.update(true);
|
|
1111
1111
|
}
|
|
1112
1112
|
|
|
1113
1113
|
createViewpoint(): IViewpoint {
|