@inweb/viewer-core 26.1.0 → 26.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-core.js +1 -1
- package/dist/viewer-core.js.map +1 -1
- package/dist/viewer-core.module.js +1 -1
- package/dist/viewer-core.module.js.map +1 -1
- package/lib/commands/ICommands.d.ts +8 -8
- package/lib/components/IComponents.d.ts +4 -4
- package/lib/draggers/IDraggers.d.ts +6 -6
- package/lib/options/IOptions.d.ts +11 -12
- package/lib/viewer/IViewer.d.ts +24 -25
- package/lib/viewer/IViewpoint.d.ts +36 -32
- package/lib/viewer/ViewerEvents.d.ts +10 -12
- package/package.json +3 -3
- package/src/commands/ICommands.ts +8 -8
- package/src/components/IComponents.ts +4 -4
- package/src/draggers/IDraggers.ts +6 -6
- package/src/options/IOptions.ts +11 -12
- package/src/viewer/IViewer.ts +24 -25
- package/src/viewer/IViewpoint.ts +38 -33
- package/src/viewer/ViewerEvents.ts +10 -12
|
@@ -58,8 +58,8 @@ export interface IOptions {
|
|
|
58
58
|
/**
|
|
59
59
|
* Enable streaming of drawings from the server.
|
|
60
60
|
*
|
|
61
|
-
* If streaming is disabled, the file/assembly will be loaded in one go. The viewer will only
|
|
62
|
-
*
|
|
61
|
+
* If streaming is disabled, the file/assembly will be loaded in one go. The viewer will only update
|
|
62
|
+
* once the loading is complete, which may take a while.
|
|
63
63
|
*
|
|
64
64
|
* If streaming is enabled, {@link enablePartialMode | partial streaming} mode may be enabled as well.
|
|
65
65
|
*
|
|
@@ -69,11 +69,11 @@ export interface IOptions {
|
|
|
69
69
|
/**
|
|
70
70
|
* Enable partial streaming mode to be able open large drawing.
|
|
71
71
|
*
|
|
72
|
-
* In partial streaming mode, the viewer keeps only visible objects in memory and loads other
|
|
73
|
-
*
|
|
72
|
+
* In partial streaming mode, the viewer keeps only visible objects in memory and loads other objects
|
|
73
|
+
* when the camera changes.
|
|
74
74
|
*
|
|
75
|
-
* Only used if {@link enableStreamingMode | streaming} is enabled. If partial streaming is
|
|
76
|
-
*
|
|
75
|
+
* Only used if {@link enableStreamingMode | streaming} is enabled. If partial streaming is enabled,
|
|
76
|
+
* then {@link sceneGraph | scene graph} will be disabled.
|
|
77
77
|
*
|
|
78
78
|
* @defaultValue false
|
|
79
79
|
*/
|
|
@@ -129,8 +129,7 @@ export interface IOptions {
|
|
|
129
129
|
/**
|
|
130
130
|
* Enable scene graph.
|
|
131
131
|
*
|
|
132
|
-
* Scene graph increases perfomance improvement, but consumes memory.
|
|
133
|
-
* up a lot of memory. If scene graph is enabled, then
|
|
132
|
+
* Scene graph increases perfomance improvement, but consumes memory. If scene graph is enabled, then
|
|
134
133
|
* {@link enablePartialMode | partial streaming} mode will be disabled.
|
|
135
134
|
*/
|
|
136
135
|
sceneGraph: boolean;
|
|
@@ -155,8 +154,8 @@ export interface IOptions {
|
|
|
155
154
|
/**
|
|
156
155
|
* Enable touch gestures.
|
|
157
156
|
*
|
|
158
|
-
* This option will be ignored when {@link enableZoomWheel | mouse wheel zooming} is disabled,
|
|
159
|
-
*
|
|
157
|
+
* This option will be ignored when {@link enableZoomWheel | mouse wheel zooming} is disabled, since
|
|
158
|
+
* gestures contains touch zoom.
|
|
160
159
|
*/
|
|
161
160
|
enableGestures: boolean;
|
|
162
161
|
/**
|
|
@@ -166,8 +165,8 @@ export interface IOptions {
|
|
|
166
165
|
/**
|
|
167
166
|
* Ruler unit.
|
|
168
167
|
*
|
|
169
|
-
* Available values: Default, Millimeters, Centimeters, Meters, Feet, Inches, Yards,
|
|
170
|
-
*
|
|
168
|
+
* Available values: Default, Millimeters, Centimeters, Meters, Feet, Inches, Yards, Kilometers, Miles,
|
|
169
|
+
* Micrometers, MicroInches
|
|
171
170
|
*
|
|
172
171
|
* @defaultValue Default
|
|
173
172
|
*/
|
package/lib/viewer/IViewer.d.ts
CHANGED
|
@@ -18,15 +18,14 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
18
18
|
*/
|
|
19
19
|
options: IOptions;
|
|
20
20
|
/**
|
|
21
|
-
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement}
|
|
22
|
-
*
|
|
21
|
+
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement} for the
|
|
22
|
+
* viewer used to operate on. Defined only while the viewer is initialized.
|
|
23
23
|
*/
|
|
24
24
|
canvas: HTMLCanvasElement | undefined;
|
|
25
25
|
/**
|
|
26
26
|
* List of canvas events, such as mouse events or
|
|
27
27
|
* {@link https://developer.mozilla.org/docs/Web/API/Pointer_events#event_types_and_global_event_handlers | pointer events}
|
|
28
|
-
* or
|
|
29
|
-
* {@link https://developer.mozilla.org/docs/Web/API/TouchEvent#touch_event_types | touch events}
|
|
28
|
+
* or {@link https://developer.mozilla.org/docs/Web/API/TouchEvent#touch_event_types | touch events}
|
|
30
29
|
* that the viewer should listen and redirect to the draggers and components.
|
|
31
30
|
*
|
|
32
31
|
* By default, the following events are redirected:
|
|
@@ -72,8 +71,8 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
72
71
|
*/
|
|
73
72
|
components: string[];
|
|
74
73
|
/**
|
|
75
|
-
* Initializes the viewer it with the specified canvas. Call {@link dispose | dispose()} to
|
|
76
|
-
*
|
|
74
|
+
* Initializes the viewer it with the specified canvas. Call {@link dispose | dispose()} to release
|
|
75
|
+
* allocated resources.
|
|
77
76
|
*
|
|
78
77
|
* Fires:
|
|
79
78
|
*
|
|
@@ -81,15 +80,15 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
81
80
|
* - {@link InitializeProgressEvent | initializeprogress}
|
|
82
81
|
*
|
|
83
82
|
* @param canvas -
|
|
84
|
-
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement}
|
|
85
|
-
*
|
|
83
|
+
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement} for the
|
|
84
|
+
* viewer used to operate on.
|
|
86
85
|
* @param onProgress - A callback function that handles events measuring progress of viewer
|
|
87
86
|
* initialization.
|
|
88
87
|
*/
|
|
89
88
|
initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this>;
|
|
90
89
|
/**
|
|
91
|
-
* Unloads an open file, clears the canvas and markups, and releases resources allocated by
|
|
92
|
-
*
|
|
90
|
+
* Unloads an open file, clears the canvas and markups, and releases resources allocated by this viewer
|
|
91
|
+
* instance. Call this method before release the `Viewer` instance.
|
|
93
92
|
*/
|
|
94
93
|
dispose(): this;
|
|
95
94
|
/**
|
|
@@ -103,8 +102,8 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
103
102
|
*
|
|
104
103
|
* - {@link UpdateEvent | update}
|
|
105
104
|
*
|
|
106
|
-
* @param force - If `true` updates the viewer immidietly. Otherwise updates on next
|
|
107
|
-
*
|
|
105
|
+
* @param force - If `true` updates the viewer immidietly. Otherwise updates on next animation frame.
|
|
106
|
+
* Default is `false`.
|
|
108
107
|
*/
|
|
109
108
|
update(force?: boolean): void;
|
|
110
109
|
/**
|
|
@@ -112,11 +111,11 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
112
111
|
*
|
|
113
112
|
* The file geometry data on the server must be converted into a format siutable for the viewer.
|
|
114
113
|
*
|
|
115
|
-
* This method requires a `Client` instance to be specified to load model reference files
|
|
116
|
-
*
|
|
114
|
+
* This method requires a `Client` instance to be specified to load model reference files from the Open
|
|
115
|
+
* Cloud Server.
|
|
117
116
|
*
|
|
118
|
-
* If there was an active dragger before opening the file, it will be deactivated. After
|
|
119
|
-
*
|
|
117
|
+
* If there was an active dragger before opening the file, it will be deactivated. After opening the
|
|
118
|
+
* file, you must manually activate the required dragger.
|
|
120
119
|
*
|
|
121
120
|
* Fires:
|
|
122
121
|
*
|
|
@@ -128,9 +127,9 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
128
127
|
* - {@link GeometryEndEvent | geometryend}
|
|
129
128
|
* - {@link GeometryErrorEvent | geometryerror}
|
|
130
129
|
*
|
|
131
|
-
* @param file - File, assembly or specific model to load. If a `File` instance with multiple
|
|
132
|
-
*
|
|
133
|
-
*
|
|
130
|
+
* @param file - File, assembly or specific model to load. If a `File` instance with multiple models is
|
|
131
|
+
* specified, the default model will be loaded. If there is no default model, first availiable model
|
|
132
|
+
* will be loaded.
|
|
134
133
|
*/
|
|
135
134
|
open(file: Model | File | Assembly): Promise<this>;
|
|
136
135
|
/**
|
|
@@ -235,17 +234,17 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
235
234
|
*/
|
|
236
235
|
activeDragger(): IDragger | null;
|
|
237
236
|
/**
|
|
238
|
-
* Changes the active dragger. The viewer must be initialized before activating the dragger,
|
|
239
|
-
*
|
|
237
|
+
* Changes the active dragger. The viewer must be initialized before activating the dragger, otherwise
|
|
238
|
+
* an exception will be thrown.
|
|
240
239
|
*
|
|
241
240
|
* Fires:
|
|
242
241
|
*
|
|
243
242
|
* - {@link ChangeActiveDraggerEvent | changeactivedragger}
|
|
244
243
|
*
|
|
245
|
-
* @param name - Dragger name. Can be one of the {@link draggers} list or an ampty string to
|
|
246
|
-
*
|
|
247
|
-
* @returns Returns the new active dragger reference or `null` if there is no dragger with
|
|
248
|
-
*
|
|
244
|
+
* @param name - Dragger name. Can be one of the {@link draggers} list or an ampty string to deactivate
|
|
245
|
+
* the current dragger.
|
|
246
|
+
* @returns Returns the new active dragger reference or `null` if there is no dragger with the given
|
|
247
|
+
* name.
|
|
249
248
|
*/
|
|
250
249
|
setActiveDragger(name: string): IDragger | null;
|
|
251
250
|
/**
|
|
@@ -81,20 +81,10 @@ export interface IOrthogonalCamera {
|
|
|
81
81
|
* View field height to calculate aspect ratio.
|
|
82
82
|
*/
|
|
83
83
|
field_height: number;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Defines the subsection of a model (clipping plane).
|
|
87
|
-
*/
|
|
88
|
-
export interface IClippingPlane {
|
|
89
84
|
/**
|
|
90
|
-
*
|
|
85
|
+
* The entire vertical scaling from view to world.
|
|
91
86
|
*/
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Direction of the clipping plane. The Direction vector points in the _invisible_ direction
|
|
95
|
-
* meaning the half-space that is clipped.
|
|
96
|
-
*/
|
|
97
|
-
direction: IDirection;
|
|
87
|
+
view_to_world_scale: number;
|
|
98
88
|
}
|
|
99
89
|
/**
|
|
100
90
|
* Describes a viewpoint using an perspective camera.
|
|
@@ -113,11 +103,25 @@ export interface IPerspectiveCamera {
|
|
|
113
103
|
*/
|
|
114
104
|
up_vector: IDirection;
|
|
115
105
|
/**
|
|
116
|
-
* The entire vertical field of view angle of the camera, expressed in degrees. Valid range 0
|
|
117
|
-
*
|
|
106
|
+
* The entire vertical field of view angle of the camera, expressed in degrees. Valid range 0 to 180
|
|
107
|
+
* exclusive.
|
|
118
108
|
*/
|
|
119
109
|
field_of_view: number;
|
|
120
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Defines the subsection of a model (clipping plane).
|
|
113
|
+
*/
|
|
114
|
+
export interface IClippingPlane {
|
|
115
|
+
/**
|
|
116
|
+
* Origin of the clipping plane.
|
|
117
|
+
*/
|
|
118
|
+
location: IPoint;
|
|
119
|
+
/**
|
|
120
|
+
* Direction of the clipping plane. The Direction vector points in the _invisible_ direction meaning
|
|
121
|
+
* the half-space that is clipped.
|
|
122
|
+
*/
|
|
123
|
+
direction: IDirection;
|
|
124
|
+
}
|
|
121
125
|
/**
|
|
122
126
|
* Defines the markup line object of the viewpoint.
|
|
123
127
|
*/
|
|
@@ -137,8 +141,8 @@ export interface ILine {
|
|
|
137
141
|
*/
|
|
138
142
|
width?: number;
|
|
139
143
|
/**
|
|
140
|
-
* Line color in hexadecimal color syntax `#RGB` using its primary color components (red,
|
|
141
|
-
*
|
|
144
|
+
* Line color in hexadecimal color syntax `#RGB` using its primary color components (red, green, blue)
|
|
145
|
+
* written as hexadecimal numbers.
|
|
142
146
|
*/
|
|
143
147
|
color?: string;
|
|
144
148
|
/**
|
|
@@ -171,8 +175,8 @@ export interface IText {
|
|
|
171
175
|
*/
|
|
172
176
|
text_size?: number;
|
|
173
177
|
/**
|
|
174
|
-
* Text color in hexadecimal color syntax `#RGB` using its primary color components (red,
|
|
175
|
-
*
|
|
178
|
+
* Text color in hexadecimal color syntax `#RGB` using its primary color components (red, green, blue)
|
|
179
|
+
* written as hexadecimal numbers.
|
|
176
180
|
*/
|
|
177
181
|
color?: string;
|
|
178
182
|
/**
|
|
@@ -193,8 +197,8 @@ export interface IArrow {
|
|
|
193
197
|
*/
|
|
194
198
|
end: IPoint;
|
|
195
199
|
/**
|
|
196
|
-
* Line color in hexadecimal color syntax `#RGB` using its primary color components (red,
|
|
197
|
-
*
|
|
200
|
+
* Line color in hexadecimal color syntax `#RGB` using its primary color components (red, green, blue)
|
|
201
|
+
* written as hexadecimal numbers.
|
|
198
202
|
*/
|
|
199
203
|
color?: string;
|
|
200
204
|
/**
|
|
@@ -223,8 +227,8 @@ export interface ICloud {
|
|
|
223
227
|
*/
|
|
224
228
|
line_width?: number;
|
|
225
229
|
/**
|
|
226
|
-
* Line color in hexadecimal color syntax `#RGB` using its primary color components (red,
|
|
227
|
-
*
|
|
230
|
+
* Line color in hexadecimal color syntax `#RGB` using its primary color components (red, green, blue)
|
|
231
|
+
* written as hexadecimal numbers.
|
|
228
232
|
*/
|
|
229
233
|
color?: string;
|
|
230
234
|
/**
|
|
@@ -252,8 +256,8 @@ export interface IEllipse {
|
|
|
252
256
|
*/
|
|
253
257
|
line_width?: number;
|
|
254
258
|
/**
|
|
255
|
-
* Line color in hexadecimal color syntax `#RGB` using its primary color components (red,
|
|
256
|
-
*
|
|
259
|
+
* Line color in hexadecimal color syntax `#RGB` using its primary color components (red, green, blue)
|
|
260
|
+
* written as hexadecimal numbers.
|
|
257
261
|
*/
|
|
258
262
|
color?: string;
|
|
259
263
|
/**
|
|
@@ -308,8 +312,8 @@ export interface IRectangle {
|
|
|
308
312
|
*/
|
|
309
313
|
line_width?: number;
|
|
310
314
|
/**
|
|
311
|
-
* Line color in hexadecimal color syntax `#RGB` using its primary color components (red,
|
|
312
|
-
*
|
|
315
|
+
* Line color in hexadecimal color syntax `#RGB` using its primary color components (red, green, blue)
|
|
316
|
+
* written as hexadecimal numbers.
|
|
313
317
|
*/
|
|
314
318
|
color?: string;
|
|
315
319
|
/**
|
|
@@ -326,8 +330,8 @@ export interface IColoring {
|
|
|
326
330
|
*/
|
|
327
331
|
handle: string;
|
|
328
332
|
/**
|
|
329
|
-
* Color in hexadecimal color syntax `#ARGB` using its primary color components (alpha, red,
|
|
330
|
-
*
|
|
333
|
+
* Color in hexadecimal color syntax `#ARGB` using its primary color components (alpha, red, green,
|
|
334
|
+
* blue) written as hexadecimal numbers.
|
|
331
335
|
*/
|
|
332
336
|
color: string;
|
|
333
337
|
}
|
|
@@ -362,8 +366,8 @@ export interface ISnapshot {
|
|
|
362
366
|
*/
|
|
363
367
|
export interface IViewpoint {
|
|
364
368
|
/**
|
|
365
|
-
* Embedded pictures in the viewpoint. A list of bitmaps can be used to add more information,
|
|
366
|
-
*
|
|
369
|
+
* Embedded pictures in the viewpoint. A list of bitmaps can be used to add more information, for
|
|
370
|
+
* example, text in the visualization.
|
|
367
371
|
*/
|
|
368
372
|
bitmaps?: IBitmap[];
|
|
369
373
|
/**
|
|
@@ -443,8 +447,8 @@ export interface IViewpoint {
|
|
|
443
447
|
*/
|
|
444
448
|
custom_fields?: any;
|
|
445
449
|
/**
|
|
446
|
-
* Snapshot image of the viewpoint. The longest dimension of should not exceed 1500 px,
|
|
447
|
-
*
|
|
450
|
+
* Snapshot image of the viewpoint. The longest dimension of should not exceed 1500 px, length or
|
|
451
|
+
* width.
|
|
448
452
|
*/
|
|
449
453
|
snapshot?: ISnapshot;
|
|
450
454
|
}
|
|
@@ -127,8 +127,8 @@ export interface ExplodeEvent {
|
|
|
127
127
|
/**
|
|
128
128
|
* Event that fires when the model geometry data chunk has been loaded.
|
|
129
129
|
*
|
|
130
|
-
* Note that small files are loaded in one chunk, and `geometrychunk` event does not fire, only
|
|
131
|
-
*
|
|
130
|
+
* Note that small files are loaded in one chunk, and `geometrychunk` event does not fire, only the
|
|
131
|
+
* `databasechink` event fires.
|
|
132
132
|
*
|
|
133
133
|
* @event
|
|
134
134
|
*/
|
|
@@ -275,14 +275,13 @@ export interface InitializeProgressEvent {
|
|
|
275
275
|
*/
|
|
276
276
|
data: number;
|
|
277
277
|
/**
|
|
278
|
-
* A 64-bit unsigned integer value indicating the amount of work already performed by the
|
|
279
|
-
*
|
|
280
|
-
* value of this property.
|
|
278
|
+
* A 64-bit unsigned integer value indicating the amount of work already performed by the underlying
|
|
279
|
+
* process. The ratio of work done can be calculated by dividing total by the value of this property.
|
|
281
280
|
*/
|
|
282
281
|
loaded: number;
|
|
283
282
|
/**
|
|
284
|
-
* A 64-bit unsigned integer representing the total amount of work that the underlying
|
|
285
|
-
*
|
|
283
|
+
* A 64-bit unsigned integer representing the total amount of work that the underlying process is in
|
|
284
|
+
* the progress of performing.
|
|
286
285
|
*/
|
|
287
286
|
total: number;
|
|
288
287
|
}
|
|
@@ -417,14 +416,13 @@ export interface VisualizeProgressEvent {
|
|
|
417
416
|
*/
|
|
418
417
|
type: "visualizeprogress";
|
|
419
418
|
/**
|
|
420
|
-
* A 64-bit unsigned integer value indicating the amount of work already performed by the
|
|
421
|
-
*
|
|
422
|
-
* value of this property.
|
|
419
|
+
* A 64-bit unsigned integer value indicating the amount of work already performed by the underlying
|
|
420
|
+
* process. The ratio of work done can be calculated by dividing total by the value of this property.
|
|
423
421
|
*/
|
|
424
422
|
loaded: number;
|
|
425
423
|
/**
|
|
426
|
-
* A 64-bit unsigned integer representing the total amount of work that the underlying
|
|
427
|
-
*
|
|
424
|
+
* A 64-bit unsigned integer representing the total amount of work that the underlying process is in
|
|
425
|
+
* the progress of performing.
|
|
428
426
|
*/
|
|
429
427
|
total: number;
|
|
430
428
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-core",
|
|
3
|
-
"version": "26.1.
|
|
3
|
+
"version": "26.1.2",
|
|
4
4
|
"description": "3D CAD and BIM data Viewer core",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"test": "karma start karma.conf.js"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@inweb/eventemitter2": "~26.1.
|
|
29
|
+
"@inweb/eventemitter2": "~26.1.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@inweb/eventemitter2": "~26.1.
|
|
32
|
+
"@inweb/eventemitter2": "~26.1.2"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -32,8 +32,8 @@ export interface ICommandService {
|
|
|
32
32
|
*
|
|
33
33
|
* @param id - ID of the command to execute.
|
|
34
34
|
* @param args - Parameters passed to the command handler function.
|
|
35
|
-
* @returns Returns the result of the command handler function. Returns `undefined` when the
|
|
36
|
-
*
|
|
35
|
+
* @returns Returns the result of the command handler function. Returns `undefined` when the command
|
|
36
|
+
* doesn't exists.
|
|
37
37
|
*/
|
|
38
38
|
executeCommand(id: string, ...args: any[]): any;
|
|
39
39
|
}
|
|
@@ -94,8 +94,8 @@ export interface ICommandDescription {
|
|
|
94
94
|
*/
|
|
95
95
|
export interface ICommandsRegistry {
|
|
96
96
|
/**
|
|
97
|
-
* Binds a command ID to a handler function. Registering a command with an existing ID twice
|
|
98
|
-
*
|
|
97
|
+
* Binds a command ID to a handler function. Registering a command with an existing ID twice overrides
|
|
98
|
+
* the existing handler.
|
|
99
99
|
*
|
|
100
100
|
* @param id - Unique ID for the command.
|
|
101
101
|
* @param handler - Command handler function.
|
|
@@ -125,14 +125,14 @@ export interface ICommandsRegistry {
|
|
|
125
125
|
getCommand(id: string): ICommand | undefined;
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* Executes the command denoted by the given command. If the command is not found, tries to
|
|
129
|
-
*
|
|
128
|
+
* Executes the command denoted by the given command. If the command is not found, tries to set active
|
|
129
|
+
* dragger with the specified name.
|
|
130
130
|
*
|
|
131
131
|
* @param id - Command ID or dragger name.
|
|
132
132
|
* @param viewer - Viewer instance that wants to execute the command.
|
|
133
133
|
* @param args - Parameters passed to the command handler function.
|
|
134
|
-
* @returns Returns the result of the command handler function or new active dragger
|
|
135
|
-
*
|
|
134
|
+
* @returns Returns the result of the command handler function or new active dragger instance. Returns
|
|
135
|
+
* `undefined` if neither the command nor the dragger exists.
|
|
136
136
|
*/
|
|
137
137
|
executeCommand(id: string, viewer: IViewer, ...args: any[]): any;
|
|
138
138
|
}
|
|
@@ -55,8 +55,8 @@ export type IComponentsMap = Map<string, IComponentProvider>;
|
|
|
55
55
|
*/
|
|
56
56
|
export interface IComponentsRegistry {
|
|
57
57
|
/**
|
|
58
|
-
* Binds a component name to a component. Registering a component with an existing name twice
|
|
59
|
-
*
|
|
58
|
+
* Binds a component name to a component. Registering a component with an existing name twice overrides
|
|
59
|
+
* the existing component.
|
|
60
60
|
*
|
|
61
61
|
* @param name - Unique name for the component.
|
|
62
62
|
* @param provider - Component provider.
|
|
@@ -84,8 +84,8 @@ export interface IComponentsRegistry {
|
|
|
84
84
|
getComponent(name: string): IComponentProvider | undefined;
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* Creates the component denoted by the given name. Returns `null` if a component with given
|
|
88
|
-
*
|
|
87
|
+
* Creates the component denoted by the given name. Returns `null` if a component with given name not
|
|
88
|
+
* registered.
|
|
89
89
|
*
|
|
90
90
|
* @param name - Component name.
|
|
91
91
|
* @param viewer - Viewer instance that wants to create the component.
|
|
@@ -46,8 +46,8 @@ export interface IDragger {
|
|
|
46
46
|
dispose(): void;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* Deprecated since `25.12`. Instead, register an `update` event listener for the viewer and
|
|
50
|
-
*
|
|
49
|
+
* Deprecated since `25.12`. Instead, register an `update` event listener for the viewer and update the
|
|
50
|
+
* dragger preview in the event handler.
|
|
51
51
|
*
|
|
52
52
|
* @deprecated
|
|
53
53
|
*/
|
|
@@ -71,8 +71,8 @@ export type IDraggersMap = Map<string, IDraggerProvider>;
|
|
|
71
71
|
*/
|
|
72
72
|
export interface IDraggersRegistry {
|
|
73
73
|
/**
|
|
74
|
-
* Binds a dragger name to a dragger provider. Registering a dragger with an existing name
|
|
75
|
-
*
|
|
74
|
+
* Binds a dragger name to a dragger provider. Registering a dragger with an existing name twice
|
|
75
|
+
* overrides the existing dragger.
|
|
76
76
|
*
|
|
77
77
|
* @param name - Unique name for the dragger.
|
|
78
78
|
* @param provider - Dragger provider.
|
|
@@ -100,8 +100,8 @@ export interface IDraggersRegistry {
|
|
|
100
100
|
getDragger(name: string): IDraggerProvider | undefined;
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* Creates the dragger denoted by the given name. Returns `null` if a dragger with given name
|
|
104
|
-
*
|
|
103
|
+
* Creates the dragger denoted by the given name. Returns `null` if a dragger with given name not
|
|
104
|
+
* registered.
|
|
105
105
|
*
|
|
106
106
|
* @param name - Dragger name.
|
|
107
107
|
* @param viewer - Viewer instance that wants to create the dragger.
|
package/src/options/IOptions.ts
CHANGED
|
@@ -90,8 +90,8 @@ export interface IOptions {
|
|
|
90
90
|
/**
|
|
91
91
|
* Enable streaming of drawings from the server.
|
|
92
92
|
*
|
|
93
|
-
* If streaming is disabled, the file/assembly will be loaded in one go. The viewer will only
|
|
94
|
-
*
|
|
93
|
+
* If streaming is disabled, the file/assembly will be loaded in one go. The viewer will only update
|
|
94
|
+
* once the loading is complete, which may take a while.
|
|
95
95
|
*
|
|
96
96
|
* If streaming is enabled, {@link enablePartialMode | partial streaming} mode may be enabled as well.
|
|
97
97
|
*
|
|
@@ -102,11 +102,11 @@ export interface IOptions {
|
|
|
102
102
|
/**
|
|
103
103
|
* Enable partial streaming mode to be able open large drawing.
|
|
104
104
|
*
|
|
105
|
-
* In partial streaming mode, the viewer keeps only visible objects in memory and loads other
|
|
106
|
-
*
|
|
105
|
+
* In partial streaming mode, the viewer keeps only visible objects in memory and loads other objects
|
|
106
|
+
* when the camera changes.
|
|
107
107
|
*
|
|
108
|
-
* Only used if {@link enableStreamingMode | streaming} is enabled. If partial streaming is
|
|
109
|
-
*
|
|
108
|
+
* Only used if {@link enableStreamingMode | streaming} is enabled. If partial streaming is enabled,
|
|
109
|
+
* then {@link sceneGraph | scene graph} will be disabled.
|
|
110
110
|
*
|
|
111
111
|
* @defaultValue false
|
|
112
112
|
*/
|
|
@@ -164,8 +164,7 @@ export interface IOptions {
|
|
|
164
164
|
/**
|
|
165
165
|
* Enable scene graph.
|
|
166
166
|
*
|
|
167
|
-
* Scene graph increases perfomance improvement, but consumes memory.
|
|
168
|
-
* up a lot of memory. If scene graph is enabled, then
|
|
167
|
+
* Scene graph increases perfomance improvement, but consumes memory. If scene graph is enabled, then
|
|
169
168
|
* {@link enablePartialMode | partial streaming} mode will be disabled.
|
|
170
169
|
*/
|
|
171
170
|
sceneGraph: boolean;
|
|
@@ -194,8 +193,8 @@ export interface IOptions {
|
|
|
194
193
|
/**
|
|
195
194
|
* Enable touch gestures.
|
|
196
195
|
*
|
|
197
|
-
* This option will be ignored when {@link enableZoomWheel | mouse wheel zooming} is disabled,
|
|
198
|
-
*
|
|
196
|
+
* This option will be ignored when {@link enableZoomWheel | mouse wheel zooming} is disabled, since
|
|
197
|
+
* gestures contains touch zoom.
|
|
199
198
|
*/
|
|
200
199
|
enableGestures: boolean;
|
|
201
200
|
|
|
@@ -207,8 +206,8 @@ export interface IOptions {
|
|
|
207
206
|
/**
|
|
208
207
|
* Ruler unit.
|
|
209
208
|
*
|
|
210
|
-
* Available values: Default, Millimeters, Centimeters, Meters, Feet, Inches, Yards,
|
|
211
|
-
*
|
|
209
|
+
* Available values: Default, Millimeters, Centimeters, Meters, Feet, Inches, Yards, Kilometers, Miles,
|
|
210
|
+
* Micrometers, MicroInches
|
|
212
211
|
*
|
|
213
212
|
* @defaultValue Default
|
|
214
213
|
*/
|
package/src/viewer/IViewer.ts
CHANGED
|
@@ -44,16 +44,15 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
44
44
|
options: IOptions;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement}
|
|
48
|
-
*
|
|
47
|
+
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement} for the
|
|
48
|
+
* viewer used to operate on. Defined only while the viewer is initialized.
|
|
49
49
|
*/
|
|
50
50
|
canvas: HTMLCanvasElement | undefined;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* List of canvas events, such as mouse events or
|
|
54
54
|
* {@link https://developer.mozilla.org/docs/Web/API/Pointer_events#event_types_and_global_event_handlers | pointer events}
|
|
55
|
-
* or
|
|
56
|
-
* {@link https://developer.mozilla.org/docs/Web/API/TouchEvent#touch_event_types | touch events}
|
|
55
|
+
* or {@link https://developer.mozilla.org/docs/Web/API/TouchEvent#touch_event_types | touch events}
|
|
57
56
|
* that the viewer should listen and redirect to the draggers and components.
|
|
58
57
|
*
|
|
59
58
|
* By default, the following events are redirected:
|
|
@@ -102,8 +101,8 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
102
101
|
components: string[];
|
|
103
102
|
|
|
104
103
|
/**
|
|
105
|
-
* Initializes the viewer it with the specified canvas. Call {@link dispose | dispose()} to
|
|
106
|
-
*
|
|
104
|
+
* Initializes the viewer it with the specified canvas. Call {@link dispose | dispose()} to release
|
|
105
|
+
* allocated resources.
|
|
107
106
|
*
|
|
108
107
|
* Fires:
|
|
109
108
|
*
|
|
@@ -111,16 +110,16 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
111
110
|
* - {@link InitializeProgressEvent | initializeprogress}
|
|
112
111
|
*
|
|
113
112
|
* @param canvas -
|
|
114
|
-
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement}
|
|
115
|
-
*
|
|
113
|
+
* {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement} for the
|
|
114
|
+
* viewer used to operate on.
|
|
116
115
|
* @param onProgress - A callback function that handles events measuring progress of viewer
|
|
117
116
|
* initialization.
|
|
118
117
|
*/
|
|
119
118
|
initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this>;
|
|
120
119
|
|
|
121
120
|
/**
|
|
122
|
-
* Unloads an open file, clears the canvas and markups, and releases resources allocated by
|
|
123
|
-
*
|
|
121
|
+
* Unloads an open file, clears the canvas and markups, and releases resources allocated by this viewer
|
|
122
|
+
* instance. Call this method before release the `Viewer` instance.
|
|
124
123
|
*/
|
|
125
124
|
dispose(): this;
|
|
126
125
|
|
|
@@ -136,8 +135,8 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
136
135
|
*
|
|
137
136
|
* - {@link UpdateEvent | update}
|
|
138
137
|
*
|
|
139
|
-
* @param force - If `true` updates the viewer immidietly. Otherwise updates on next
|
|
140
|
-
*
|
|
138
|
+
* @param force - If `true` updates the viewer immidietly. Otherwise updates on next animation frame.
|
|
139
|
+
* Default is `false`.
|
|
141
140
|
*/
|
|
142
141
|
update(force?: boolean): void;
|
|
143
142
|
|
|
@@ -146,11 +145,11 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
146
145
|
*
|
|
147
146
|
* The file geometry data on the server must be converted into a format siutable for the viewer.
|
|
148
147
|
*
|
|
149
|
-
* This method requires a `Client` instance to be specified to load model reference files
|
|
150
|
-
*
|
|
148
|
+
* This method requires a `Client` instance to be specified to load model reference files from the Open
|
|
149
|
+
* Cloud Server.
|
|
151
150
|
*
|
|
152
|
-
* If there was an active dragger before opening the file, it will be deactivated. After
|
|
153
|
-
*
|
|
151
|
+
* If there was an active dragger before opening the file, it will be deactivated. After opening the
|
|
152
|
+
* file, you must manually activate the required dragger.
|
|
154
153
|
*
|
|
155
154
|
* Fires:
|
|
156
155
|
*
|
|
@@ -162,9 +161,9 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
162
161
|
* - {@link GeometryEndEvent | geometryend}
|
|
163
162
|
* - {@link GeometryErrorEvent | geometryerror}
|
|
164
163
|
*
|
|
165
|
-
* @param file - File, assembly or specific model to load. If a `File` instance with multiple
|
|
166
|
-
*
|
|
167
|
-
*
|
|
164
|
+
* @param file - File, assembly or specific model to load. If a `File` instance with multiple models is
|
|
165
|
+
* specified, the default model will be loaded. If there is no default model, first availiable model
|
|
166
|
+
* will be loaded.
|
|
168
167
|
*/
|
|
169
168
|
open(file: Model | File | Assembly): Promise<this>;
|
|
170
169
|
|
|
@@ -285,17 +284,17 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
285
284
|
activeDragger(): IDragger | null;
|
|
286
285
|
|
|
287
286
|
/**
|
|
288
|
-
* Changes the active dragger. The viewer must be initialized before activating the dragger,
|
|
289
|
-
*
|
|
287
|
+
* Changes the active dragger. The viewer must be initialized before activating the dragger, otherwise
|
|
288
|
+
* an exception will be thrown.
|
|
290
289
|
*
|
|
291
290
|
* Fires:
|
|
292
291
|
*
|
|
293
292
|
* - {@link ChangeActiveDraggerEvent | changeactivedragger}
|
|
294
293
|
*
|
|
295
|
-
* @param name - Dragger name. Can be one of the {@link draggers} list or an ampty string to
|
|
296
|
-
*
|
|
297
|
-
* @returns Returns the new active dragger reference or `null` if there is no dragger with
|
|
298
|
-
*
|
|
294
|
+
* @param name - Dragger name. Can be one of the {@link draggers} list or an ampty string to deactivate
|
|
295
|
+
* the current dragger.
|
|
296
|
+
* @returns Returns the new active dragger reference or `null` if there is no dragger with the given
|
|
297
|
+
* name.
|
|
299
298
|
*/
|
|
300
299
|
setActiveDragger(name: string): IDragger | null;
|
|
301
300
|
|