@inweb/viewer-visualize 25.3.20 → 25.3.22

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,10 +1,10 @@
1
1
  # Viewer.visualize
2
2
 
3
- `Viewer.visualize` is JavaScript library powered by [Visualize](https://www.opendesign.com/products/visualize) for in-browser visualization of 3D CAD and BIM data in browser from `VSFX` files stored on the [Open Cloud Server](https://cloud.opendesign.com/docs/index.html#/opencloud_server), on the web, or on your local computer.
3
+ `Viewer.visualize` is JavaScript library powered by [Visualize](https://www.opendesign.com/products/visualize) for in-browser visualization of 3D CAD and BIM data files stored on the [Open Cloud Server](https://cloud.opendesign.com/docs/index.html#/opencloud_server), on the web, or on your local computer.
4
4
 
5
- This library enables you to integrate advanced visualization capabilities into your web applications, including user interaction with scenes and objects, markups, and collaboration using the [inWEB Open Cloud](https://www.opendesign.com/products/open-cloud) platform.
5
+ This library enables you to integrate advanced visualization capabilities into your web applications, including user interaction with scenes and markup creation.
6
6
 
7
- > `VSFX` is an internal [Visualize SDK](https://cloud.opendesign.com/docs/index.html#/visualizejs) file format with support for streaming and partial viewing.
7
+ > `Viewer.visualize` uses `VSFX` file format as internal geometry data format. `VSFX` is a [Visualize SDK](https://cloud.opendesign.com/docs/index.html#/visualizejs) file format with support for streaming and partial viewing.
8
8
 
9
9
  ## Installation
10
10
 
@@ -365,7 +365,9 @@
365
365
  }
366
366
  }
367
367
 
368
- const CANVAS_EVENTS = [ "click", "dblclick", "mousedown", "mousemove", "mouseup", "mouseleave", "pointerdown", "pointermove", "pointerup", "pointerleave", "pointercancel", "wheel", "touchstart", "touchmove", "touchend", "touchcancel" ];
368
+ const CanvasEvents = [ "click", "contextmenu", "dblclick", "mousedown", "mouseleave", "mousemove", "mouseup", "pointercancel", "pointerdown", "pointerleave", "pointermove", "pointerup", "touchcancel", "touchend", "touchmove", "touchstart", "wheel" ];
369
+
370
+ const CANVAS_EVENTS = CanvasEvents;
369
371
 
370
372
  ///////////////////////////////////////////////////////////////////////////////
371
373
  const composeMatrixFromTransform = (translate, rotate, scale, modelCenter, matrix) => {
@@ -809,20 +811,6 @@
809
811
  ///////////////////////////////////////////////////////////////////////////////
810
812
  const CLICK_DELTA = 5;
811
813
  const INTERACTIVITY_FPS = 24;
812
- /**
813
- * A [Viewer]{@link Viewer} event that fires when the viewer needs to be updated.
814
- *
815
- * @property {string} type - `update`
816
- * @event update
817
- */
818
- /**
819
- * A [Viewer]{@link Viewer} event that fires when the user selects an entity with the mouse.
820
- *
821
- * @property {string} type - `select`
822
- * @property {OdTvSelectionSet} data - The set of selected entities. For more information, see
823
- * [OdTvSelectionSet](https://cloud.opendesign.com/docs/index.html#/vis/OdTvSelectionSet?id=odtvselectionset).
824
- * @event select
825
- */
826
814
  class OdBaseDragger extends OdaGeAction {
827
815
  constructor(subject) {
828
816
  super(subject.visualizeJs);
@@ -16426,7 +16414,7 @@
16426
16414
  markupDraggers === null || markupDraggers === void 0 ? void 0 : markupDraggers.forEach((value, key) => {
16427
16415
  this.registerDragger(key, value);
16428
16416
  });
16429
- this.canvasEvents = CANVAS_EVENTS;
16417
+ this.canvasEvents = CANVAS_EVENTS.slice();
16430
16418
  this.canvaseventlistener = (event) => this.emit(event);
16431
16419
  this._enableAutoUpdate = (_b = params.enableAutoUpdate) !== null && _b !== void 0 ? _b : true;
16432
16420
  this._isNeedRender = false;
@@ -16494,7 +16482,7 @@
16494
16482
  const event = { loaded, timeStamp, total, lengthComputable, type: "visualizeprogress" };
16495
16483
  onProgress === null || onProgress === void 0 ? void 0 : onProgress(event);
16496
16484
  });
16497
- this.visualizeJs = visualizeJs;
16485
+ this._visualizeJs = visualizeJs;
16498
16486
  this.visualizeJs.canvas = canvas;
16499
16487
  this.visualizeJs.Viewer.create();
16500
16488
  this.canvas = canvas;
@@ -16519,23 +16507,30 @@
16519
16507
  * release the `Viewer` instance.
16520
16508
  */
16521
16509
  dispose() {
16522
- var _a, _b, _c, _d;
16523
16510
  this.cancel();
16524
16511
  this.emitEvent({ type: "dispose" });
16525
16512
  if (this.frameId)
16526
16513
  cancelAnimationFrame(this.frameId);
16527
16514
  this.frameId = 0;
16528
16515
  this.setActiveDragger("");
16529
- (_a = this._zoomWheelDragger) === null || _a === void 0 ? void 0 : _a.dispose();
16530
- (_b = this._gestureManager) === null || _b === void 0 ? void 0 : _b.dispose();
16531
16516
  this.removeAllListeners();
16532
- (_c = this._resizeObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
16517
+ if (this._gestureManager)
16518
+ this._gestureManager.dispose();
16519
+ this._gestureManager = undefined;
16520
+ if (this._zoomWheelDragger)
16521
+ this._zoomWheelDragger.dispose();
16522
+ this._zoomWheelDragger = undefined;
16523
+ if (this._resizeObserver)
16524
+ this._resizeObserver.disconnect();
16533
16525
  this._resizeObserver = undefined;
16534
16526
  this.markup.dispose();
16535
- this.canvasEvents.forEach((x) => { var _a; return (_a = this.canvas) === null || _a === void 0 ? void 0 : _a.removeEventListener(x, this.canvaseventlistener); });
16536
- this.canvas = undefined;
16537
- (_d = this.visualizeJs) === null || _d === void 0 ? void 0 : _d.getViewer().clear();
16538
- this.visualizeJs = undefined;
16527
+ if (this.canvas) {
16528
+ this.canvasEvents.forEach((x) => this.canvas.removeEventListener(x, this.canvaseventlistener));
16529
+ this.canvas = undefined;
16530
+ }
16531
+ if (this._visualizeJs)
16532
+ this._visualizeJs.getViewer().clear();
16533
+ this._visualizeJs = undefined;
16539
16534
  return this;
16540
16535
  }
16541
16536
  /**
@@ -16638,6 +16633,13 @@
16638
16633
  this._isRunAsyncUpdate = false;
16639
16634
  }
16640
16635
  }
16636
+ /**
16637
+ * Returns `VisualizeJS`
16638
+ * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module} instance.
16639
+ */
16640
+ get visualizeJs() {
16641
+ return this._visualizeJs;
16642
+ }
16641
16643
  /**
16642
16644
  * Returns `VisualizeJS`
16643
16645
  * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module} instance.
@@ -16827,7 +16829,7 @@
16827
16829
  *
16828
16830
  * Fires:
16829
16831
  *
16830
- * - {@link ChangeActiveDragger | changeactivedragger}
16832
+ * - {@link ChangeActiveDraggerEvent | changeactivedragger}
16831
16833
  *
16832
16834
  * @param name - Dragger name. Can be one of the {@link Viewer#draggers | draggers} list.
16833
16835
  * @returns Returns active dragger instance or `null` if there is no dragger with the given name.
@@ -17187,7 +17189,7 @@
17187
17189
  colorizeAllMarkup(r = 255, g = 0, b = 0) {
17188
17190
  this.markup.colorizeAllMarkup(r, g, b);
17189
17191
  }
17190
- /**
17192
+ /*
17191
17193
  * Add an empty markup entity to the overlay.
17192
17194
  */
17193
17195
  addMarkupEntity(entityName) {
@@ -17207,10 +17209,9 @@
17207
17209
  }
17208
17210
  /**
17209
17211
  * Draw a viewpoint. To get a list of available model viewpoints, use the
17210
- * {@link Model#getViewpoints | Model.getViewpoints()} or
17211
- * {@link File#getViewpoints | File.getViewpoints()}.
17212
+ * {@link Model.getViewpoints()} or {@link File.getViewpoints()}.
17212
17213
  *
17213
- * @param viewpoint - Viewpoint.
17214
+ * @param viewpoint - Viewpoint data.
17214
17215
  */
17215
17216
  drawViewpoint(viewpoint) {
17216
17217
  this.setOrthogonalCameraSettings(viewpoint.orthogonal_camera);
@@ -17219,8 +17220,7 @@
17219
17220
  }
17220
17221
  /**
17221
17222
  * Create a viewpoint. To add a viewpoint to the list of model viewpoints, use the
17222
- * {@link Model#saveViewpoint | Model.saveViewpoint()} or
17223
- * {@link File#saveViewpoint | File.saveViewpoint()}.
17223
+ * {@link Model.saveViewpoint()} or {@link File.saveViewpoint()}.
17224
17224
  */
17225
17225
  createViewpoint() {
17226
17226
  const vp = this.markup.getViewpoint();
@@ -17295,6 +17295,7 @@
17295
17295
  }
17296
17296
 
17297
17297
  exports.CANVAS_EVENTS = CANVAS_EVENTS;
17298
+ exports.CanvasEvents = CanvasEvents;
17298
17299
  exports.OdBaseDragger = OdBaseDragger;
17299
17300
  exports.Options = Options;
17300
17301
  exports.Viewer = Viewer;