@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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Viewer.visualize
2
2
 
3
- `Viewer.visualize` is JavaScript library implementating 3D viewer powered by [VisualizeJS](https://cloud.opendesign.com/docs/index.html#/visualizejs) for in-browser visualization of CAD and BIM data files.
3
+ `Viewer.visualize` is JavaScript library for rendering CAD and BIM files in a browser using [VisualizeJS](https://cloud.opendesign.com/docs/index.html#/visualizejs).
4
4
 
5
5
  Core capabilities:
6
6
 
@@ -17549,7 +17549,7 @@
17549
17549
  * `Viewer.visualize` library you are using.
17550
17550
  */
17551
17551
  configure(params) {
17552
- this._visualizeJsUrl = params.visualizeJsUrl || "https://opencloud.azureedge.net/libs/visualizejs/master/Visualize.js";
17552
+ this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js";
17553
17553
  return this;
17554
17554
  }
17555
17555
  /**
@@ -17558,6 +17558,7 @@
17558
17558
  *
17559
17559
  * Fires:
17560
17560
  *
17561
+ * - {@link InitializeEvent | initialize}
17561
17562
  * - {@link InitializeProgressEvent | initializeprogress}
17562
17563
  *
17563
17564
  * @param canvas -
@@ -17607,17 +17608,13 @@
17607
17608
  this.emitEvent({ type: "initialize" });
17608
17609
  return this;
17609
17610
  }
17610
- /**
17611
- * Unloads an open file, clears the canvas and markups, and releases resources allocated by
17612
- * this viewer instance. Call this method before release the `Viewer` instance.
17613
- */
17614
17611
  dispose() {
17615
17612
  this.cancel();
17616
17613
  this.emitEvent({ type: "dispose" });
17617
17614
  if (this.frameId)
17618
17615
  cancelAnimationFrame(this.frameId);
17619
17616
  this.frameId = 0;
17620
- this.setActiveDragger("");
17617
+ this.setActiveDragger();
17621
17618
  this.removeAllListeners();
17622
17619
  if (this._gestureManager)
17623
17620
  this._gestureManager.dispose();
@@ -17941,24 +17938,10 @@
17941
17938
  registerDragger(name, dragger) {
17942
17939
  this.draggerFactory.set(name, dragger);
17943
17940
  }
17944
- /**
17945
- * Returns the active dragger instance, or `null` if there is no active dragger.
17946
- */
17947
17941
  activeDragger() {
17948
17942
  return this._activeDragger;
17949
17943
  }
17950
- /**
17951
- * Changes the active dragger. Viewer must be initialized before enable dragger or exception is thrown.
17952
- *
17953
- * Fires:
17954
- *
17955
- * - {@link ChangeActiveDraggerEvent | changeactivedragger}
17956
- *
17957
- * @param name - Dragger name. Can be one of the {@link draggers} list.
17958
- * @returns Returns the new active dragger instance or `null` if there is no dragger with the
17959
- * given name.
17960
- */
17961
- setActiveDragger(name) {
17944
+ setActiveDragger(name = "") {
17962
17945
  var _a;
17963
17946
  if (((_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.name) !== name) {
17964
17947
  if (this._activeDragger) {
@@ -17986,13 +17969,10 @@
17986
17969
  }
17987
17970
  return this._activeDragger;
17988
17971
  }
17989
- /**
17990
- * Resets the state of the active dragger.
17991
- */
17992
17972
  resetActiveDragger() {
17993
17973
  const dragger = this._activeDragger;
17994
17974
  if (dragger) {
17995
- this.setActiveDragger("");
17975
+ this.setActiveDragger();
17996
17976
  this.setActiveDragger(dragger.name);
17997
17977
  }
17998
17978
  }
@@ -18045,9 +18025,6 @@
18045
18025
  this._markup.syncOverlay();
18046
18026
  this.update();
18047
18027
  }
18048
- /**
18049
- * Returns `true` if current opened model is 3D model.
18050
- */
18051
18028
  is3D() {
18052
18029
  if (!this.visualizeJs)
18053
18030
  return false;
@@ -18156,6 +18133,9 @@
18156
18133
  *
18157
18134
  * The file geometry data on the server must be converted to `VSFX` format.
18158
18135
  *
18136
+ * To open a large file, enable {@link IOptions.enablePartialMode | partial load} mode before
18137
+ * opening (see example below).
18138
+ *
18159
18139
  * This method requires a `Client` instance to be specified when creating the viewer to load
18160
18140
  * model reference files from the Open Cloud Server. For a standalone viewer instance use
18161
18141
  * {@link openVsfFile | openVsfFile()} or {@link openVsfxFile | openVsfxFile()}.
@@ -18170,6 +18150,11 @@
18170
18150
  * - {@link GeometryEndEvent | geometryend}
18171
18151
  * - {@link GeometryErrorEvent | geometryerror}
18172
18152
  *
18153
+ * @example <caption>Using partial load mode to open a large file from a server.</caption>
18154
+ * viewer.options.enableStreamingMode = true;
18155
+ * viewer.options.enablePartialMode = true;
18156
+ * await viewer.open(file);
18157
+ *
18173
18158
  * @param file - File, assembly or specific model to load. If a `File` instance with multiple
18174
18159
  * models is specified, the default model will be loaded. If there is no default model,
18175
18160
  * first availiable model will be loaded.
@@ -18287,9 +18272,6 @@
18287
18272
  }
18288
18273
  return this;
18289
18274
  }
18290
- /**
18291
- * Cancels asynchronous file loading started by {@link open | open()}.
18292
- */
18293
18275
  cancel() {
18294
18276
  var _a, _b, _c;
18295
18277
  (_a = this._abortControllerForReferences) === null || _a === void 0 ? void 0 : _a.abort();
@@ -18301,14 +18283,12 @@
18301
18283
  this.emitEvent({ type: "cancel" });
18302
18284
  return this;
18303
18285
  }
18304
- /**
18305
- * Unloads an open file and clears the canvas and markups.
18306
- */
18307
18286
  clear() {
18308
18287
  if (!this.visualizeJs)
18309
18288
  return this;
18310
18289
  const visLib = this.visLib();
18311
18290
  const visViewer = visLib.getViewer();
18291
+ this.setActiveDragger();
18312
18292
  this.clearOverlay();
18313
18293
  visViewer.clear();
18314
18294
  visViewer.createLocalDatabase();
@@ -18397,10 +18377,10 @@
18397
18377
  * To save a viewpoint to the server for a specific file, use the `File.saveViewpoint()`.
18398
18378
  */
18399
18379
  createViewpoint() {
18400
- const vp = this._markup.getViewpoint();
18401
- vp.orthogonal_camera = this.getOrthogonalCameraSettings();
18402
- vp.clipping_planes = this.getClippingPlanes();
18403
- return vp;
18380
+ const viewpoint = this._markup.getViewpoint();
18381
+ viewpoint.orthogonal_camera = this.getOrthogonalCameraSettings();
18382
+ viewpoint.clipping_planes = this.getClippingPlanes();
18383
+ return viewpoint;
18404
18384
  }
18405
18385
  getPoint3dFromArray(array) {
18406
18386
  return { x: array[0], y: array[1], z: array[2] };