@inweb/viewer-visualize 25.9.7 → 25.10.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.
@@ -82,6 +82,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
82
82
  *
83
83
  * Fires:
84
84
  *
85
+ * - {@link InitializeEvent | initialize}
85
86
  * - {@link InitializeProgressEvent | initializeprogress}
86
87
  *
87
88
  * @param canvas -
@@ -91,10 +92,6 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
91
92
  * of the `VisualizeJS` library.
92
93
  */
93
94
  initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this>;
94
- /**
95
- * Unloads an open file, clears the canvas and markups, and releases resources allocated by
96
- * this viewer instance. Call this method before release the `Viewer` instance.
97
- */
98
95
  dispose(): this;
99
96
  /**
100
97
  * Returns `true` if `VisualizeJS` module has been loaded and initialized.
@@ -181,25 +178,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
181
178
  * @param dragger - Dragger class.
182
179
  */
183
180
  registerDragger(name: string, dragger: typeof Dragger): void;
184
- /**
185
- * Returns the active dragger instance, or `null` if there is no active dragger.
186
- */
187
181
  activeDragger(): IDragger | null;
188
- /**
189
- * Changes the active dragger. Viewer must be initialized before enable dragger or exception is thrown.
190
- *
191
- * Fires:
192
- *
193
- * - {@link ChangeActiveDraggerEvent | changeactivedragger}
194
- *
195
- * @param name - Dragger name. Can be one of the {@link draggers} list.
196
- * @returns Returns the new active dragger instance or `null` if there is no dragger with the
197
- * given name.
198
- */
199
- setActiveDragger(name: string): IDragger | null;
200
- /**
201
- * Resets the state of the active dragger.
202
- */
182
+ setActiveDragger(name?: string): IDragger | null;
203
183
  resetActiveDragger(): void;
204
184
  /**
205
185
  * Removes all cutting planes.
@@ -213,9 +193,6 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
213
193
  * Creates an overlay view. Overlay view is used to draw cutting planes and `Visualize` markups.
214
194
  */
215
195
  syncOverlay(): any;
216
- /**
217
- * Returns `true` if current opened model is 3D model.
218
- */
219
196
  is3D(): boolean;
220
197
  screenToWorld(position: {
221
198
  x: number;
@@ -260,6 +237,9 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
260
237
  *
261
238
  * The file geometry data on the server must be converted to `VSFX` format.
262
239
  *
240
+ * To open a large file, enable {@link IOptions.enablePartialMode | partial load} mode before
241
+ * opening (see example below).
242
+ *
263
243
  * This method requires a `Client` instance to be specified when creating the viewer to load
264
244
  * model reference files from the Open Cloud Server. For a standalone viewer instance use
265
245
  * {@link openVsfFile | openVsfFile()} or {@link openVsfxFile | openVsfxFile()}.
@@ -274,6 +254,11 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
274
254
  * - {@link GeometryEndEvent | geometryend}
275
255
  * - {@link GeometryErrorEvent | geometryerror}
276
256
  *
257
+ * @example <caption>Using partial load mode to open a large file from a server.</caption>
258
+ * viewer.options.enableStreamingMode = true;
259
+ * viewer.options.enablePartialMode = true;
260
+ * await viewer.open(file);
261
+ *
277
262
  * @param file - File, assembly or specific model to load. If a `File` instance with multiple
278
263
  * models is specified, the default model will be loaded. If there is no default model,
279
264
  * first availiable model will be loaded.
@@ -315,13 +300,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
315
300
  * @param buffer - Binary data buffer to load.
316
301
  */
317
302
  openVsfxFile(buffer: Uint8Array | ArrayBuffer): this;
318
- /**
319
- * Cancels asynchronous file loading started by {@link open | open()}.
320
- */
321
303
  cancel(): this;
322
- /**
323
- * Unloads an open file and clears the canvas and markups.
324
- */
325
304
  clear(): this;
326
305
  /**
327
306
  * Returns the color of new markup objects.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inweb/viewer-visualize",
3
- "version": "25.9.7",
4
- "description": "3D viewer powered by VisualizeJS",
3
+ "version": "25.10.0",
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",
7
7
  "author": "Open Design Alliance",
@@ -29,10 +29,10 @@
29
29
  "docs": "typedoc"
30
30
  },
31
31
  "dependencies": {
32
- "@inweb/client": "~25.9.7",
33
- "@inweb/eventemitter2": "~25.9.7",
34
- "@inweb/markup": "~25.9.7",
35
- "@inweb/viewer-core": "~25.9.7"
32
+ "@inweb/client": "~25.10.0",
33
+ "@inweb/eventemitter2": "~25.10.0",
34
+ "@inweb/markup": "~25.10.0",
35
+ "@inweb/viewer-core": "~25.10.0"
36
36
  },
37
- "visualizeJS": "https://opencloud.azureedge.net/libs/visualizejs/master/Visualize.js"
37
+ "visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js"
38
38
  }
@@ -65,7 +65,6 @@ const isExist = (value) => value !== undefined && value !== null;
65
65
  * 3D viewer powered by
66
66
  * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs | VisualizeJS} library.
67
67
  */
68
-
69
68
  export class Viewer
70
69
  extends EventEmitter2<ViewerEventMap & CanvasEventMap & OptionsEventMap>
71
70
  implements IViewer, IWorldTransform
@@ -196,6 +195,7 @@ export class Viewer
196
195
  *
197
196
  * Fires:
198
197
  *
198
+ * - {@link InitializeEvent | initialize}
199
199
  * - {@link InitializeProgressEvent | initializeprogress}
200
200
  *
201
201
  * @param canvas -
@@ -262,10 +262,6 @@ export class Viewer
262
262
  return this;
263
263
  }
264
264
 
265
- /**
266
- * Unloads an open file, clears the canvas and markups, and releases resources allocated by
267
- * this viewer instance. Call this method before release the `Viewer` instance.
268
- */
269
265
  dispose(): this {
270
266
  this.cancel();
271
267
  this.emitEvent({ type: "dispose" });
@@ -273,7 +269,7 @@ export class Viewer
273
269
  if (this.frameId) cancelAnimationFrame(this.frameId);
274
270
  this.frameId = 0;
275
271
 
276
- this.setActiveDragger("");
272
+ this.setActiveDragger();
277
273
  this.removeAllListeners();
278
274
 
279
275
  if (this._gestureManager) this._gestureManager.dispose();
@@ -659,25 +655,11 @@ export class Viewer
659
655
  this.draggerFactory.set(name, dragger);
660
656
  }
661
657
 
662
- /**
663
- * Returns the active dragger instance, or `null` if there is no active dragger.
664
- */
665
658
  activeDragger(): IDragger | null {
666
659
  return this._activeDragger;
667
660
  }
668
661
 
669
- /**
670
- * Changes the active dragger. Viewer must be initialized before enable dragger or exception is thrown.
671
- *
672
- * Fires:
673
- *
674
- * - {@link ChangeActiveDraggerEvent | changeactivedragger}
675
- *
676
- * @param name - Dragger name. Can be one of the {@link draggers} list.
677
- * @returns Returns the new active dragger instance or `null` if there is no dragger with the
678
- * given name.
679
- */
680
- setActiveDragger(name: string): IDragger | null {
662
+ setActiveDragger(name = ""): IDragger | null {
681
663
  if (this._activeDragger?.name !== name) {
682
664
  if (this._activeDragger) {
683
665
  this._activeDragger.dispose();
@@ -705,13 +687,10 @@ export class Viewer
705
687
  return this._activeDragger;
706
688
  }
707
689
 
708
- /**
709
- * Resets the state of the active dragger.
710
- */
711
690
  resetActiveDragger(): void {
712
691
  const dragger = this._activeDragger;
713
692
  if (dragger) {
714
- this.setActiveDragger("");
693
+ this.setActiveDragger();
715
694
  this.setActiveDragger(dragger.name);
716
695
  }
717
696
  }
@@ -775,9 +754,6 @@ export class Viewer
775
754
  this.update();
776
755
  }
777
756
 
778
- /**
779
- * Returns `true` if current opened model is 3D model.
780
- */
781
757
  is3D(): boolean {
782
758
  if (!this.visualizeJs) return false;
783
759
 
@@ -911,6 +887,9 @@ export class Viewer
911
887
  *
912
888
  * The file geometry data on the server must be converted to `VSFX` format.
913
889
  *
890
+ * To open a large file, enable {@link IOptions.enablePartialMode | partial load} mode before
891
+ * opening (see example below).
892
+ *
914
893
  * This method requires a `Client` instance to be specified when creating the viewer to load
915
894
  * model reference files from the Open Cloud Server. For a standalone viewer instance use
916
895
  * {@link openVsfFile | openVsfFile()} or {@link openVsfxFile | openVsfxFile()}.
@@ -925,6 +904,11 @@ export class Viewer
925
904
  * - {@link GeometryEndEvent | geometryend}
926
905
  * - {@link GeometryErrorEvent | geometryerror}
927
906
  *
907
+ * @example <caption>Using partial load mode to open a large file from a server.</caption>
908
+ * viewer.options.enableStreamingMode = true;
909
+ * viewer.options.enablePartialMode = true;
910
+ * await viewer.open(file);
911
+ *
928
912
  * @param file - File, assembly or specific model to load. If a `File` instance with multiple
929
913
  * models is specified, the default model will be loaded. If there is no default model,
930
914
  * first availiable model will be loaded.
@@ -1063,9 +1047,6 @@ export class Viewer
1063
1047
  return this;
1064
1048
  }
1065
1049
 
1066
- /**
1067
- * Cancels asynchronous file loading started by {@link open | open()}.
1068
- */
1069
1050
  cancel(): this {
1070
1051
  this._abortControllerForReferences?.abort();
1071
1052
  this._abortControllerForReferences = undefined;
@@ -1081,15 +1062,13 @@ export class Viewer
1081
1062
  return this;
1082
1063
  }
1083
1064
 
1084
- /**
1085
- * Unloads an open file and clears the canvas and markups.
1086
- */
1087
1065
  clear(): this {
1088
1066
  if (!this.visualizeJs) return this;
1089
1067
 
1090
1068
  const visLib = this.visLib();
1091
1069
  const visViewer = visLib.getViewer();
1092
1070
 
1071
+ this.setActiveDragger();
1093
1072
  this.clearOverlay();
1094
1073
 
1095
1074
  visViewer.clear();
@@ -1193,11 +1172,11 @@ export class Viewer
1193
1172
  * To save a viewpoint to the server for a specific file, use the `File.saveViewpoint()`.
1194
1173
  */
1195
1174
  createViewpoint(): IViewpoint {
1196
- const vp = this._markup.getViewpoint();
1197
- vp.orthogonal_camera = this.getOrthogonalCameraSettings();
1198
- vp.clipping_planes = this.getClippingPlanes();
1175
+ const viewpoint = this._markup.getViewpoint();
1176
+ viewpoint.orthogonal_camera = this.getOrthogonalCameraSettings();
1177
+ viewpoint.clipping_planes = this.getClippingPlanes();
1199
1178
 
1200
- return vp;
1179
+ return viewpoint;
1201
1180
  }
1202
1181
 
1203
1182
  private getPoint3dFromArray(array) {
File without changes
File without changes