@inweb/viewer-core 26.10.6 → 26.12.0
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-core.js +63 -0
- package/dist/viewer-core.js.map +1 -1
- package/dist/viewer-core.module.js +63 -1
- package/dist/viewer-core.module.js.map +1 -1
- package/lib/commands/ICommands.d.ts +5 -4
- package/lib/index.d.ts +3 -0
- package/lib/loaders/ILoader.d.ts +1 -1
- package/lib/loaders/Loader.d.ts +1 -0
- package/lib/models/IModel.d.ts +20 -0
- package/lib/options/IOptions.d.ts +35 -5
- package/lib/options/Options.d.ts +2 -0
- package/lib/viewer/IInfo.d.ts +144 -0
- package/lib/viewer/IViewer.d.ts +56 -12
- package/lib/viewer/Info.d.ts +10 -0
- package/lib/viewer/ViewerEvents.d.ts +40 -16
- package/package.json +3 -3
- package/src/commands/ICommands.ts +5 -4
- package/src/index.ts +3 -0
- package/src/loaders/ILoader.ts +1 -1
- package/src/loaders/Loader.ts +9 -0
- package/src/models/IModel.ts +44 -0
- package/src/options/IOptions.ts +36 -4
- package/src/options/Options.ts +9 -0
- package/src/viewer/IInfo.ts +196 -0
- package/src/viewer/IViewer.ts +61 -12
- package/src/viewer/Info.ts +82 -0
- package/src/viewer/ViewerEvents.ts +44 -16
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
/**
|
|
25
|
+
* Perfomance metrics.
|
|
26
|
+
*/
|
|
27
|
+
export interface IPerformanceInfo {
|
|
28
|
+
/**
|
|
29
|
+
* Frames Per Second: the measure of rendering performance and smoothness.
|
|
30
|
+
*/
|
|
31
|
+
fps: number;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The time it takes to render a single frame.
|
|
35
|
+
*/
|
|
36
|
+
frameTime: number;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The time from loading the file to the first frame being rendered on screen.
|
|
40
|
+
*/
|
|
41
|
+
timeToFirstRender: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The total file loading time.
|
|
45
|
+
*/
|
|
46
|
+
loadTime: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Render related metrics.
|
|
51
|
+
*/
|
|
52
|
+
export interface IRenderInfo {
|
|
53
|
+
/**
|
|
54
|
+
* The current width and height of the rendering canvas.
|
|
55
|
+
*/
|
|
56
|
+
viewport: { width: number; height: number };
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The current anti-aliasing technique being used.
|
|
60
|
+
*/
|
|
61
|
+
antialiasing: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The number of draw calls of the current frame.
|
|
65
|
+
*/
|
|
66
|
+
drawCalls: number;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The number of rendered triangle primitives of the current frame.
|
|
70
|
+
*/
|
|
71
|
+
triangles: number;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The number of rendered point primitives of the current frame.
|
|
75
|
+
*/
|
|
76
|
+
points: number;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The number of rendered line primitives of the current frame.
|
|
80
|
+
*/
|
|
81
|
+
lines: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Scene related metrics.
|
|
86
|
+
*/
|
|
87
|
+
export interface ISceneInfo {
|
|
88
|
+
/**
|
|
89
|
+
* The total number of objects in the scene graph.
|
|
90
|
+
*/
|
|
91
|
+
objects: number;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The total number of triangles in the entire scene.
|
|
95
|
+
*/
|
|
96
|
+
triangles: number;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The total number of point primitives in the scene.
|
|
100
|
+
*/
|
|
101
|
+
points: number;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The total number of lines in the scene.
|
|
105
|
+
*/
|
|
106
|
+
lines: number;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The total number of edges in the scene.
|
|
110
|
+
*/
|
|
111
|
+
edges: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Memory related metrics.
|
|
116
|
+
*/
|
|
117
|
+
export interface IMemoryInfo {
|
|
118
|
+
/**
|
|
119
|
+
* The number of unique geometries and the memory they consume.
|
|
120
|
+
*/
|
|
121
|
+
geometries: number;
|
|
122
|
+
geometryBytes: number;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The number of textures and the memory they consume.
|
|
126
|
+
*/
|
|
127
|
+
textures: number;
|
|
128
|
+
textureBytes: number;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The number of unique materials in use.
|
|
132
|
+
*/
|
|
133
|
+
materials: number;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* An estimation of the total VRAM being used by the WebGL context.
|
|
137
|
+
*/
|
|
138
|
+
totalEstimatedGpuBytes: number;
|
|
139
|
+
|
|
140
|
+
// The currently active segment of JS heap, in bytes. This feature
|
|
141
|
+
// is not standardized. We do not recommend using non-standard features
|
|
142
|
+
// in production, as they have limited browser support, and may change
|
|
143
|
+
// or be removed.
|
|
144
|
+
|
|
145
|
+
usedJSHeapSize: number;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* System information.
|
|
150
|
+
*/
|
|
151
|
+
export interface ISystemInfo {
|
|
152
|
+
/**
|
|
153
|
+
* Renderer string of the graphics driver.
|
|
154
|
+
*/
|
|
155
|
+
webglRenderer: string;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Vendor string of the graphics driver.
|
|
159
|
+
*/
|
|
160
|
+
webglVendor: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* The statistical information about the scene, GPU memory and the rendering process.
|
|
165
|
+
*/
|
|
166
|
+
export interface IInfo {
|
|
167
|
+
/**
|
|
168
|
+
* Perfomance metrics.
|
|
169
|
+
*/
|
|
170
|
+
performance: IPerformanceInfo;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Render related metrics.
|
|
174
|
+
*/
|
|
175
|
+
render: IRenderInfo;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Scene related metrics.
|
|
179
|
+
*/
|
|
180
|
+
scene: ISceneInfo;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Scene related metrics after optimization.
|
|
184
|
+
*/
|
|
185
|
+
optimizedScene: ISceneInfo;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Memory related metrics.
|
|
189
|
+
*/
|
|
190
|
+
memory: IMemoryInfo;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* System information.
|
|
194
|
+
*/
|
|
195
|
+
system: ISystemInfo;
|
|
196
|
+
}
|
package/src/viewer/IViewer.ts
CHANGED
|
@@ -27,8 +27,10 @@ import { ICommandService } from "../commands/ICommands";
|
|
|
27
27
|
import { IOptions } from "../options/IOptions";
|
|
28
28
|
import { IDragger } from "../draggers/IDraggers";
|
|
29
29
|
import { IComponent } from "../components/IComponents";
|
|
30
|
-
import { FileSource } from "../loaders/ILoader";
|
|
30
|
+
import { FileSource, ILoader } from "../loaders/ILoader";
|
|
31
|
+
import { IModel } from "../models/IModel";
|
|
31
32
|
import { IViewpoint } from "./IViewpoint";
|
|
33
|
+
import { IInfo } from "./IInfo";
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
* Viewer core interface.
|
|
@@ -78,6 +80,16 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
78
80
|
*/
|
|
79
81
|
canvasEvents: string[];
|
|
80
82
|
|
|
83
|
+
/**
|
|
84
|
+
* List of active loaders used to load models into the viewer.
|
|
85
|
+
*/
|
|
86
|
+
loaders: ILoader[];
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* List of models loaded into the viewer.
|
|
90
|
+
*/
|
|
91
|
+
models: IModel[];
|
|
92
|
+
|
|
81
93
|
/**
|
|
82
94
|
* List of names of available draggers.
|
|
83
95
|
*
|
|
@@ -101,6 +113,11 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
101
113
|
*/
|
|
102
114
|
components: string[];
|
|
103
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Statistical information about the GPU memory and the rendering process.
|
|
118
|
+
*/
|
|
119
|
+
info: IInfo;
|
|
120
|
+
|
|
104
121
|
/**
|
|
105
122
|
* Initializes the viewer it with the specified canvas. Call {@link dispose | dispose()} to release
|
|
106
123
|
* allocated resources.
|
|
@@ -169,14 +186,16 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
169
186
|
* thrown.
|
|
170
187
|
*
|
|
171
188
|
* For URLs, the file extension is used to determine the file format. For a `ArrayBuffer` and `Data
|
|
172
|
-
* URL`, a file format must be specified using `params.format` parameter
|
|
173
|
-
*
|
|
189
|
+
* URL`, a file format must be specified using `params.format` parameter. If no appropriate loader is
|
|
190
|
+
* found for the specified format, an exception will be thrown.
|
|
174
191
|
*
|
|
175
192
|
* If there was an active dragger before opening the file, it will be deactivated. After opening the
|
|
176
193
|
* file, you must manually activate the required dragger.
|
|
177
194
|
*
|
|
178
195
|
* Fires:
|
|
179
196
|
*
|
|
197
|
+
* - {@link CancelEvent | cancel}
|
|
198
|
+
* - {@link ClearEvent | clear}
|
|
180
199
|
* - {@link OpenEvent | open}
|
|
181
200
|
* - {@link GeometryStartEvent | geometrystart}
|
|
182
201
|
* - {@link GeometryProgressEvent | geometryprogress}
|
|
@@ -185,23 +204,26 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
185
204
|
* - {@link GeometryEndEvent | geometryend}
|
|
186
205
|
* - {@link GeometryErrorEvent | geometryerror}
|
|
187
206
|
*
|
|
188
|
-
* @param file - File to load. Can be
|
|
207
|
+
* @param file - File to load. Can be:
|
|
189
208
|
*
|
|
190
209
|
* - `File`, `Assembly` or `Model` instance from the Open Cloud Server
|
|
191
|
-
* -
|
|
210
|
+
* - `URL` string
|
|
192
211
|
* - {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL} string
|
|
193
212
|
* - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object
|
|
194
213
|
* - {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}
|
|
195
214
|
* object
|
|
196
215
|
*
|
|
197
216
|
* @param params - Loading parameters.
|
|
198
|
-
* @param params.format - File format
|
|
199
|
-
*
|
|
200
|
-
* @param params.mode - File opening mode. Viewer specific. Can be one of:
|
|
217
|
+
* @param params.format - File format. Required when loading a file as `ArrayBuffer` or `Data URL`.
|
|
218
|
+
* @param params.mode - File opening mode. Can be one of:
|
|
201
219
|
*
|
|
202
|
-
* - `
|
|
203
|
-
* - `
|
|
220
|
+
* - `file` - Single file mode. Unloads an open file and opens a new one. This is default mode.
|
|
221
|
+
* - `assembly` - Assembly mode. Appends a file to an already open file (). This mode is not supported
|
|
222
|
+
* for all viewers.
|
|
204
223
|
*
|
|
224
|
+
* @param params.modelId - Unique model ID in the assembly (multi-model scene). Used as a model prefix
|
|
225
|
+
* when selecting objects (see {@link getSelected2}). Must not contain the ":" (colon). Required when
|
|
226
|
+
* loading a file as `ArrayBuffer` or `Data URL`.
|
|
205
227
|
* @param params.requestHeader - The
|
|
206
228
|
* {@link https://developer.mozilla.org/docs/Glossary/Request_header | request header} used in HTTP
|
|
207
229
|
* request.
|
|
@@ -215,6 +237,7 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
215
237
|
params: {
|
|
216
238
|
format?: string;
|
|
217
239
|
mode?: string;
|
|
240
|
+
modelId?: string;
|
|
218
241
|
requestHeader?: HeadersInit;
|
|
219
242
|
withCredentials?: boolean;
|
|
220
243
|
}
|
|
@@ -259,21 +282,45 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
259
282
|
clearSlices(): void;
|
|
260
283
|
|
|
261
284
|
/**
|
|
262
|
-
* Returns a list of original handles for the selected objects.
|
|
285
|
+
* Returns a list of original handles for the selected objects. To avoid handle collisions in
|
|
286
|
+
* assemblies (multi-model scenes), use {@link getSelected2} instead.
|
|
287
|
+
*
|
|
288
|
+
* @returns The list of original object handles.
|
|
263
289
|
*/
|
|
264
290
|
getSelected(): string[];
|
|
265
291
|
|
|
266
292
|
/**
|
|
267
|
-
*
|
|
293
|
+
* Returns a list of original handles for the selected objects in assemblies (multi-model scenes).
|
|
294
|
+
*
|
|
295
|
+
* @returns The list of original object handles with model prefix in format "model:handle".
|
|
296
|
+
*/
|
|
297
|
+
getSelected2(): string[];
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Selects the objects by original handles. To avoid handle collisions in assemblies (multi-model
|
|
301
|
+
* scenes), use {@link setSelected2} instead.
|
|
268
302
|
*
|
|
269
303
|
* Fires:
|
|
270
304
|
*
|
|
271
305
|
* - {@link SelectEvent | select}
|
|
306
|
+
* - {@link Select2Event | select2}
|
|
272
307
|
*
|
|
273
308
|
* @param handles - The list of original handles.
|
|
274
309
|
*/
|
|
275
310
|
setSelected(handles?: string[]): void;
|
|
276
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Selects the objects by original handles in assemblies (multi-model scenes).
|
|
314
|
+
*
|
|
315
|
+
* Fires:
|
|
316
|
+
*
|
|
317
|
+
* - {@link SelectEvent | select}
|
|
318
|
+
* - {@link Select2Event | select2}
|
|
319
|
+
*
|
|
320
|
+
* @param handles - The list of original handles with model prefix in format "model:handle".
|
|
321
|
+
*/
|
|
322
|
+
setSelected2(handles?: string[]): void;
|
|
323
|
+
|
|
277
324
|
/**
|
|
278
325
|
* Unselects all objects.
|
|
279
326
|
*
|
|
@@ -358,6 +405,8 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
358
405
|
|
|
359
406
|
/**
|
|
360
407
|
* Returns the component reference, or `null` if there is no component with the specified name.
|
|
408
|
+
*
|
|
409
|
+
* @param name - Component name. Can be one of the {@link components} list.
|
|
361
410
|
*/
|
|
362
411
|
getComponent(name: string): IComponent | null;
|
|
363
412
|
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { IInfo, IMemoryInfo, IPerformanceInfo, IRenderInfo, ISceneInfo, ISystemInfo } from "./IInfo";
|
|
25
|
+
|
|
26
|
+
export class Info implements IInfo {
|
|
27
|
+
public performance: IPerformanceInfo; // animate
|
|
28
|
+
public render: IRenderInfo; // render
|
|
29
|
+
public scene: ISceneInfo; // databasechunk
|
|
30
|
+
public optimizedScene: ISceneInfo; // databasechunk
|
|
31
|
+
public memory: IMemoryInfo; // databasechunk
|
|
32
|
+
public system: ISystemInfo; // initialize, options, resize
|
|
33
|
+
|
|
34
|
+
constructor() {
|
|
35
|
+
this.performance = {
|
|
36
|
+
fps: 0,
|
|
37
|
+
frameTime: 0,
|
|
38
|
+
timeToFirstRender: 0,
|
|
39
|
+
loadTime: 0,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
this.render = {
|
|
43
|
+
viewport: { width: 0, height: 0 },
|
|
44
|
+
antialiasing: "",
|
|
45
|
+
drawCalls: 0,
|
|
46
|
+
triangles: 0,
|
|
47
|
+
points: 0,
|
|
48
|
+
lines: 0,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
this.scene = {
|
|
52
|
+
objects: 0,
|
|
53
|
+
triangles: 0,
|
|
54
|
+
points: 0,
|
|
55
|
+
lines: 0,
|
|
56
|
+
edges: 0,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
this.optimizedScene = {
|
|
60
|
+
objects: 0,
|
|
61
|
+
triangles: 0,
|
|
62
|
+
points: 0,
|
|
63
|
+
lines: 0,
|
|
64
|
+
edges: 0,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
this.memory = {
|
|
68
|
+
geometries: 0,
|
|
69
|
+
geometryBytes: 0,
|
|
70
|
+
textures: 0,
|
|
71
|
+
textureBytes: 0,
|
|
72
|
+
materials: 0,
|
|
73
|
+
totalEstimatedGpuBytes: 0,
|
|
74
|
+
usedJSHeapSize: 0,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
this.system = {
|
|
78
|
+
webglRenderer: "",
|
|
79
|
+
webglVendor: "",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -45,7 +45,7 @@ export interface AnimateEvent {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
* Event that fires when
|
|
48
|
+
* Event that fires when file loading has been canceled.
|
|
49
49
|
*
|
|
50
50
|
* @event
|
|
51
51
|
*/
|
|
@@ -254,7 +254,7 @@ export interface GeometryChunkEvent {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
|
-
* Event that fires after
|
|
257
|
+
* Event that fires after file has been successfully loaded.
|
|
258
258
|
*
|
|
259
259
|
* @event
|
|
260
260
|
*/
|
|
@@ -317,7 +317,7 @@ export interface GeometryErrorEvent {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
/**
|
|
320
|
-
* Event that measures the progress of the
|
|
320
|
+
* Event that measures the progress of the file loading.
|
|
321
321
|
*
|
|
322
322
|
* @event
|
|
323
323
|
*/
|
|
@@ -351,7 +351,7 @@ export interface GeometryProgressEvent {
|
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
/**
|
|
354
|
-
* Event that fires before the
|
|
354
|
+
* Event that fires before the file loads.
|
|
355
355
|
*
|
|
356
356
|
* @event
|
|
357
357
|
*/
|
|
@@ -445,7 +445,7 @@ export interface IsolateEvent {
|
|
|
445
445
|
}
|
|
446
446
|
|
|
447
447
|
/**
|
|
448
|
-
* Event that fires before
|
|
448
|
+
* Event that fires before file open.
|
|
449
449
|
*
|
|
450
450
|
* @event
|
|
451
451
|
*/
|
|
@@ -456,14 +456,14 @@ export interface OpenEvent {
|
|
|
456
456
|
type: "open";
|
|
457
457
|
|
|
458
458
|
/**
|
|
459
|
-
* File
|
|
459
|
+
* File opening mode.
|
|
460
460
|
*/
|
|
461
|
-
|
|
461
|
+
mode: string;
|
|
462
462
|
|
|
463
463
|
/**
|
|
464
|
-
*
|
|
464
|
+
* File to load.
|
|
465
465
|
*/
|
|
466
|
-
|
|
466
|
+
file: File | Assembly | Model | string | globalThis.File | ArrayBuffer;
|
|
467
467
|
|
|
468
468
|
/**
|
|
469
469
|
* Deprecated since `26.4`. Use {@link file} instead.
|
|
@@ -576,10 +576,33 @@ export interface SelectEvent {
|
|
|
576
576
|
/**
|
|
577
577
|
* Selection set (viewer dependent).
|
|
578
578
|
*/
|
|
579
|
-
data
|
|
579
|
+
data?: any;
|
|
580
580
|
|
|
581
581
|
/**
|
|
582
|
-
* Handles of selected
|
|
582
|
+
* Handles of selected objects.
|
|
583
|
+
*/
|
|
584
|
+
handles: string[];
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Event that fires after viewer selection changes. Uses model prefix to avoid handle collisions in
|
|
589
|
+
* assemblies (multi-model scenes).
|
|
590
|
+
*
|
|
591
|
+
* @event
|
|
592
|
+
*/
|
|
593
|
+
export interface Select2Event {
|
|
594
|
+
/**
|
|
595
|
+
* Event type.
|
|
596
|
+
*/
|
|
597
|
+
type: "select2";
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Selection set (viewer dependent).
|
|
601
|
+
*/
|
|
602
|
+
data?: any;
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Handles of selected objects with model prefix in format "model:handle".
|
|
583
606
|
*/
|
|
584
607
|
handles: string[];
|
|
585
608
|
}
|
|
@@ -798,7 +821,7 @@ export interface ViewerEventMap {
|
|
|
798
821
|
animate: AnimateEvent;
|
|
799
822
|
|
|
800
823
|
/**
|
|
801
|
-
* Event that fires when
|
|
824
|
+
* Event that fires when file loading has been canceled.
|
|
802
825
|
*/
|
|
803
826
|
cancel: CancelEvent;
|
|
804
827
|
|
|
@@ -863,7 +886,7 @@ export interface ViewerEventMap {
|
|
|
863
886
|
geometrychunk: GeometryChunkEvent;
|
|
864
887
|
|
|
865
888
|
/**
|
|
866
|
-
* Event that fires after
|
|
889
|
+
* Event that fires after file has been successfully loaded.
|
|
867
890
|
*/
|
|
868
891
|
geometryend: GeometryEndEvent;
|
|
869
892
|
|
|
@@ -873,12 +896,12 @@ export interface ViewerEventMap {
|
|
|
873
896
|
geometryerror: GeometryErrorEvent;
|
|
874
897
|
|
|
875
898
|
/**
|
|
876
|
-
* Event that measures the progress of the
|
|
899
|
+
* Event that measures the progress of the file loading.
|
|
877
900
|
*/
|
|
878
901
|
geometryprogress: GeometryProgressEvent;
|
|
879
902
|
|
|
880
903
|
/**
|
|
881
|
-
* Event that fires before the
|
|
904
|
+
* Event that fires before the file opens.
|
|
882
905
|
*/
|
|
883
906
|
geometrystart: GeometryStartEvent;
|
|
884
907
|
|
|
@@ -903,7 +926,7 @@ export interface ViewerEventMap {
|
|
|
903
926
|
isolate: IsolateEvent;
|
|
904
927
|
|
|
905
928
|
/**
|
|
906
|
-
* Event that fires before
|
|
929
|
+
* Event that fires before file opens.
|
|
907
930
|
*/
|
|
908
931
|
open: OpenEvent;
|
|
909
932
|
|
|
@@ -932,6 +955,11 @@ export interface ViewerEventMap {
|
|
|
932
955
|
*/
|
|
933
956
|
select: SelectEvent;
|
|
934
957
|
|
|
958
|
+
/**
|
|
959
|
+
* Event that fires when the selection changes.
|
|
960
|
+
*/
|
|
961
|
+
select2: Select2Event;
|
|
962
|
+
|
|
935
963
|
/**
|
|
936
964
|
* Event that fires after selected objects becomes visible.
|
|
937
965
|
*/
|