@inweb/client 25.3.11 → 25.3.12
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/client.js +30 -13
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +17 -10
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Model.d.ts +13 -0
- package/lib/Viewer/Viewer.d.ts +4 -4
- package/lib/Viewer/ViewerEvents.d.ts +2 -1
- package/package.json +1 -1
- package/src/Api/Model.ts +19 -0
- package/src/Viewer/Viewer.ts +13 -11
- package/src/Viewer/ViewerEvents.ts +6 -1
package/lib/Api/Model.d.ts
CHANGED
|
@@ -72,7 +72,20 @@ export declare class Model {
|
|
|
72
72
|
* @readonly
|
|
73
73
|
*/
|
|
74
74
|
get name(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Model owner type, matches the file extension this is model of the file, or `assembly` for
|
|
77
|
+
* assemblies.
|
|
78
|
+
*
|
|
79
|
+
* @readonly
|
|
80
|
+
*/
|
|
81
|
+
get type(): string;
|
|
75
82
|
get version(): string;
|
|
83
|
+
/**
|
|
84
|
+
* Returns model list with one item `self`.
|
|
85
|
+
*
|
|
86
|
+
* @async
|
|
87
|
+
*/
|
|
88
|
+
getModels(): Promise<Model[]>;
|
|
76
89
|
/**
|
|
77
90
|
* Returns model viewpoint list.
|
|
78
91
|
*
|
package/lib/Viewer/Viewer.d.ts
CHANGED
|
@@ -249,11 +249,11 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventM
|
|
|
249
249
|
* - {@link GeometryErrorEvent | geometryerror}
|
|
250
250
|
*
|
|
251
251
|
* @async
|
|
252
|
-
* @param
|
|
253
|
-
* specified, the default model will be loaded. If there is no default
|
|
254
|
-
* availiable model will be loaded.
|
|
252
|
+
* @param file - File or Assembly or Model instance to load. If a `File` instance with
|
|
253
|
+
* multiple models is specified, the default model will be loaded. If there is no default
|
|
254
|
+
* model, first availiable model will be loaded.
|
|
255
255
|
*/
|
|
256
|
-
open(
|
|
256
|
+
open(file: File | Assembly | Model): Promise<this>;
|
|
257
257
|
/**
|
|
258
258
|
* Loads a VSF file into the viewer.
|
|
259
259
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/client",
|
|
3
|
-
"version": "25.3.
|
|
3
|
+
"version": "25.3.12",
|
|
4
4
|
"description": "Client.js is a library for implementing BIM Project management applications.",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
package/src/Api/Model.ts
CHANGED
|
@@ -133,11 +133,30 @@ export class Model {
|
|
|
133
133
|
return this.data.name;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Model owner type, matches the file extension this is model of the file, or `assembly` for
|
|
138
|
+
* assemblies.
|
|
139
|
+
*
|
|
140
|
+
* @readonly
|
|
141
|
+
*/
|
|
142
|
+
get type(): string {
|
|
143
|
+
return this.file.type;
|
|
144
|
+
}
|
|
145
|
+
|
|
136
146
|
// Reserved for future use.
|
|
137
147
|
get version(): string {
|
|
138
148
|
return this.data.version;
|
|
139
149
|
}
|
|
140
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Returns model list with one item `self`.
|
|
153
|
+
*
|
|
154
|
+
* @async
|
|
155
|
+
*/
|
|
156
|
+
getModels(): Promise<Model[]> {
|
|
157
|
+
return Promise.resolve([this]);
|
|
158
|
+
}
|
|
159
|
+
|
|
141
160
|
/**
|
|
142
161
|
* Returns model viewpoint list.
|
|
143
162
|
*
|
package/src/Viewer/Viewer.ts
CHANGED
|
@@ -836,35 +836,37 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
|
|
|
836
836
|
* - {@link GeometryErrorEvent | geometryerror}
|
|
837
837
|
*
|
|
838
838
|
* @async
|
|
839
|
-
* @param
|
|
840
|
-
* specified, the default model will be loaded. If there is no default
|
|
841
|
-
* availiable model will be loaded.
|
|
839
|
+
* @param file - File or Assembly or Model instance to load. If a `File` instance with
|
|
840
|
+
* multiple models is specified, the default model will be loaded. If there is no default
|
|
841
|
+
* model, first availiable model will be loaded.
|
|
842
842
|
*/
|
|
843
|
-
async open(
|
|
843
|
+
async open(file: File | Assembly | Model): Promise<this> {
|
|
844
844
|
if (!this.visualizeJs) return this;
|
|
845
845
|
|
|
846
846
|
this.cancel();
|
|
847
847
|
this.clear();
|
|
848
848
|
|
|
849
|
-
this.emitEvent({ type: "open", model });
|
|
849
|
+
this.emitEvent({ type: "open", file, model: file });
|
|
850
850
|
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
851
|
+
let model: Model;
|
|
852
|
+
|
|
853
|
+
if (file) {
|
|
854
|
+
const models = (await file.getModels()) || [];
|
|
855
|
+
model = models.find((model: Model) => model.default) || models[0];
|
|
854
856
|
}
|
|
855
857
|
if (!model) throw new Error("No default model found");
|
|
856
858
|
|
|
857
|
-
await this.loadReferences(model);
|
|
858
|
-
|
|
859
859
|
const overrideOptions = new Options();
|
|
860
860
|
overrideOptions.data = this.options.data;
|
|
861
|
-
if (
|
|
861
|
+
if (file.type === ".rcs") {
|
|
862
862
|
console.log("Partial load mode is forced for RCS file");
|
|
863
863
|
overrideOptions.enablePartialMode = true;
|
|
864
864
|
}
|
|
865
865
|
|
|
866
866
|
const loaderFactory = new LoaderFactory();
|
|
867
867
|
const loader = loaderFactory.create(this, model, overrideOptions.data);
|
|
868
|
+
|
|
869
|
+
await this.loadReferences(model);
|
|
868
870
|
await loader.load();
|
|
869
871
|
|
|
870
872
|
if (this.visualizeJs) {
|
|
@@ -265,7 +265,12 @@ export interface OpenEvent {
|
|
|
265
265
|
type: "open";
|
|
266
266
|
|
|
267
267
|
/**
|
|
268
|
-
*
|
|
268
|
+
* File instance to open.
|
|
269
|
+
*/
|
|
270
|
+
file?: File | Assembly | Model;
|
|
271
|
+
|
|
272
|
+
/*
|
|
273
|
+
* Deprecated since `25.3`. Use `file` instead.
|
|
269
274
|
*/
|
|
270
275
|
model?: File | Assembly | Model;
|
|
271
276
|
|