@inweb/viewer-visualize 25.8.16 → 25.8.20

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,8 +1,15 @@
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 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 implementating 3D viewer powered by [VisualizeJS](https://cloud.opendesign.com/docs/index.html#/visualizejs) for in-browser visualization of 3D CAD and BIM data files.
4
4
 
5
- This library enables you to integrate advanced visualization capabilities into your web applications, including user interaction with scenes and markup creation.
5
+ With `Viewer.visualize` you can:
6
+
7
+ - Visualize files stored on the [Open Cloud Server](https://cloud.opendesign.com/docs/index.html#/opencloud_server), on the web, or on your local computer.
8
+ - Add user interaction with scenes.
9
+ - Create markups.
10
+ - Save and load viewpoints.
11
+
12
+ This library is a part of [CDE SDK](https://www.opendesign.com/products/cde) by [Open Design Alliance](https://opendesign.com).
6
13
 
7
14
  > `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
15
 
@@ -18,6 +25,12 @@ For CDN, you can use [unpkg](https://unpkg.com/) or [jsDelivr](https://www.jsdel
18
25
 
19
26
  The global namespace for `Viewer.visualize` is `ODA.Visualize`.
20
27
 
28
+ ```html
29
+ <script>
30
+ const viewer = new ODA.Visualize.Viewer();
31
+ </script>
32
+ ```
33
+
21
34
  ### Install via [npm](https://npmjs.org)
22
35
 
23
36
  Open a terminal in your project folder and run:
@@ -30,6 +43,7 @@ The `Viewer.visualize` package will be downloaded and installed. Then you're rea
30
43
 
31
44
  ```javascript
32
45
  import { Viewer } from "@inweb/viewer-visualize";
46
+ const viewer = new Viewer();
33
47
  ```
34
48
 
35
49
  ## Example
@@ -37,23 +51,31 @@ import { Viewer } from "@inweb/viewer-visualize";
37
51
  Download and render file from the `Open Cloud Server`:
38
52
 
39
53
  ```html
40
- <script src="https://unpkg.com/@inweb/client@25.3/dist/client.js"></script>
41
- <script src="https://unpkg.com/@inweb/viewer-visualize@25.3/dist/viewer-visualize.js"></script>
42
-
43
- <script>
44
- const client = new ODA.Api.Client({ serverUrl: "https://cloud.opendesign.com/api" });
45
- const viewer = new ODA.Visualize.Viewer(client);
46
-
47
- init();
48
-
49
- async function init() {
50
- await client.signInWithEmail("email", "password");
51
- const files = await client.getFiles();
52
- await viewer.initialize(canvas);
53
- await viewer.open(files.result[0]);
54
- viewer.setActiveDragger("Orbit");
55
- }
56
- </script>
54
+ <html>
55
+ <body>
56
+ <div>
57
+ <canvas id="canvas" />
58
+ </div>
59
+
60
+ <script src="https://unpkg.com/@inweb/client@25.3/dist/client.js"></script>
61
+ <script src="https://unpkg.com/@inweb/viewer-visualize@25.3/dist/viewer-visualize.js"></script>
62
+
63
+ <script>
64
+ const client = new ODA.Api.Client({ serverUrl: "https://cloud.opendesign.com/api" });
65
+ const viewer = new ODA.Visualize.Viewer(client);
66
+
67
+ init();
68
+
69
+ async function init() {
70
+ await client.signInWithEmail("email", "password");
71
+ const files = await client.getFiles();
72
+ await viewer.initialize(canvas);
73
+ await viewer.open(files.result[0]);
74
+ viewer.setActiveDragger("Orbit");
75
+ }
76
+ </script>
77
+ </body>
78
+ </html>
57
79
  ```
58
80
 
59
81
  To learn more, see [First application guide](https://cloud.opendesign.com/docs/index.html#/guide).
@@ -12268,7 +12268,14 @@
12268
12268
  this._ref = ref;
12269
12269
  return;
12270
12270
  }
12271
- if (!params || !params.points) return;
12271
+ if (!params) params = {};
12272
+ if (!params.points) params.points = [ {
12273
+ x: 50,
12274
+ y: 50
12275
+ }, {
12276
+ x: 100,
12277
+ y: 100
12278
+ } ];
12272
12279
  const konvaPoints = [];
12273
12280
  params.points.forEach((point => konvaPoints.push(point.x, point.y)));
12274
12281
  this._ref = new Konva.Line({
@@ -12370,7 +12377,12 @@
12370
12377
  this._ref = ref;
12371
12378
  return;
12372
12379
  }
12373
- if (!params || !params.position || !params.text) return;
12380
+ if (!params) params = {};
12381
+ if (!params.position) params.position = {
12382
+ x: 100,
12383
+ y: 100
12384
+ };
12385
+ if (!params.text) params.text = "default";
12374
12386
  this._ref = new Konva.Text({
12375
12387
  x: params.position.x,
12376
12388
  y: params.position.y,
@@ -12472,7 +12484,11 @@
12472
12484
  this._ref = ref;
12473
12485
  return;
12474
12486
  }
12475
- if (!params || !params.position) return;
12487
+ if (!params) params = {};
12488
+ if (!params.position) params.position = {
12489
+ x: 100,
12490
+ y: 100
12491
+ };
12476
12492
  this._ref = new Konva.Rect({
12477
12493
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
12478
12494
  strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
@@ -12582,7 +12598,15 @@
12582
12598
  this._ref = ref;
12583
12599
  return;
12584
12600
  }
12585
- if (!params || !params.position || !params.radius) return;
12601
+ if (!params) params = {};
12602
+ if (!params.position) params.position = {
12603
+ x: 100,
12604
+ y: 100
12605
+ };
12606
+ if (!params.radius) params.radius = {
12607
+ x: 25,
12608
+ y: 25
12609
+ };
12586
12610
  this._ref = new Konva.Ellipse({
12587
12611
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
12588
12612
  strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
@@ -12704,7 +12728,15 @@
12704
12728
  this._ref = ref;
12705
12729
  return;
12706
12730
  }
12707
- if (!params || !params.start || !params.end) return;
12731
+ if (!params) params = {};
12732
+ if (!params.start) params.start = {
12733
+ x: 50,
12734
+ y: 50
12735
+ };
12736
+ if (!params.end) params.end = {
12737
+ x: 100,
12738
+ y: 100
12739
+ };
12708
12740
  this._ref = new Konva.Arrow({
12709
12741
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
12710
12742
  fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
@@ -12800,14 +12832,49 @@
12800
12832
  constructor(params, ref = null) {
12801
12833
  var _a, _b;
12802
12834
  this._ratio = 1;
12835
+ this.EPSILON = 1e-5;
12836
+ this.BASE64_NOT_FOUND = "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAADsAAAA7AF5KHG9AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAmhJREFUWIXtlr9rVEEQxz+H8RQUJIdeIopYm0vkCg0GBBtbG1NF7Kxt7dR/IGIw/uhTaBNLERURg2kCEUyCYCPi70b0InjGS57FzOZN3r19d+9HJIVfWO52dma/s7Mz8xa2KAaBCWAR+AkECWOmSOIdwC1gtQOpHc+NfQ8wClQ8+1d0vcdH/lQ3bSIRGAZ2pTjAqNovANXIWlXlAXA2zvi2Ln4AjqYgtagYEutENSLvjRoOImFv5iB32Ae8UrLXwFBk3h9ndF0VJnKSO9gTu3yKu5Z1LKnS8YIcABgw5Ks692JZFXcXRJ46Aq6kikCnHNi/mQ50WwVtfaIoBzL3gRk2drSscJ2wrc4VvUoe2wn/41/iBfoVLRnBGnDSY3AAKacy8AmYR+o7K1zCl6wgrgpOAc/MuhvfgMuk+1JGHQgSBcAloKXy78AjYBppJk5/noTulseBMZ23iD/piHFkEdgTQzKk+5wHjmHC3cmBg0BD5xcSTrFXyQPgIWFtDwMvab+2N8DpbhyY1v/3E8gdDgNfVX9SCVZ0/gW4B0wB71S2BpxLcuCM/jaQSHSDEeAX4VMuAG4gTzyHbcAVXXO6GxxwIX+vvxe7JHcYQ07nHqklj96UIW/YhSWzMKcep8VVtf8B1Dw6h4DfhB+sdbgn2R+gnoEc5NR3dZ+3QJ9H74HqXLPCGlJyTfI9y3YCs0owq3OLOpKkLeBI1HhSDT/mdKIPiUCARMTlQx34TMLjtww8IczmO8AJ/N/2JNSQXAiQ671JePePge0+wzJSQq4FFzlaenIvucUAkiQLhC/mLGNZ9xgn5s63BP4CCk0QDtm4BhoAAAAASUVORK5CYII=";
12837
+ this.BASE64_HEADER_START = "data:image/";
12803
12838
  if (ref) {
12839
+ if (!ref.src || !ref.src.startsWith(this.BASE64_HEADER_START)) ref.src = this.BASE64_NOT_FOUND;
12840
+ if (ref.height() <= this.EPSILON) ref.height(32);
12841
+ if (ref.width() <= this.EPSILON) ref.width(32);
12804
12842
  this._ref = ref;
12805
12843
  this._canvasImage = ref.image();
12806
- this._ratio = this._ref.height() === 0 || this._ref.width() === 0 ? 1 : this._ref.height() / this._ref.width();
12844
+ this._ratio = this._ref.height() <= this.EPSILON || this._ref.width() <= this.EPSILON ? 1 : this._ref.height() / this._ref.width();
12807
12845
  return;
12808
12846
  }
12809
- if (!params || !params.position || !params.src) return;
12847
+ if (!params) params = {};
12848
+ if (!params.position) params.position = {
12849
+ x: 50,
12850
+ y: 50
12851
+ };
12852
+ if (!params.src || !params.src.startsWith(this.BASE64_HEADER_START)) params.src = this.BASE64_NOT_FOUND;
12810
12853
  this._canvasImage = new Image;
12854
+ this._canvasImage.onload = () => {
12855
+ this._ref.image(this._canvasImage);
12856
+ if (this._ref.height() <= this.EPSILON) this._ref.height(this._canvasImage.height);
12857
+ if (this._ref.width() <= this.EPSILON) this._ref.width(this._canvasImage.width);
12858
+ this._ratio = this._ref.height() <= this.EPSILON || this._ref.width() <= this.EPSILON ? 1 : this._ref.height() / this._ref.width();
12859
+ if ((params.width <= this.EPSILON || params.height <= this.EPSILON) && (params.maxWidth >= this.EPSILON || params.maxWidth >= this.EPSILON)) {
12860
+ const heightOutOfCanvas = params.maxHeight - this._canvasImage.height;
12861
+ const widthOutOfCanvas = params.maxWidth - this._canvasImage.width;
12862
+ if (heightOutOfCanvas <= this.EPSILON || widthOutOfCanvas <= this.EPSILON) {
12863
+ if (widthOutOfCanvas <= this.EPSILON && widthOutOfCanvas < heightOutOfCanvas / this._ratio) {
12864
+ this._ref.height(params.maxWidth * this._ratio);
12865
+ this._ref.width(params.maxWidth);
12866
+ } else {
12867
+ this._ref.width(params.maxHeight / this._ratio);
12868
+ this._ref.height(params.maxHeight);
12869
+ }
12870
+ }
12871
+ }
12872
+ };
12873
+ this._canvasImage.onerror = () => {
12874
+ this._canvasImage.onerror = function() {};
12875
+ this._canvasImage.src = this.BASE64_NOT_FOUND;
12876
+ };
12877
+ this._canvasImage.src = params.src;
12811
12878
  this._ref = new Konva.Image({
12812
12879
  x: params.position.x,
12813
12880
  y: params.position.y,
@@ -12816,13 +12883,6 @@
12816
12883
  height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
12817
12884
  draggable: true
12818
12885
  });
12819
- this._canvasImage.onload = () => {
12820
- this._ref.image(this._canvasImage);
12821
- if (this._ref.height() === 0) this._ref.height(this._canvasImage.height);
12822
- if (this._ref.width() === 0) this._ref.width(this._canvasImage.width);
12823
- this._ratio = this._ref.height() === 0 || this._ref.width() === 0 ? 1 : this._ref.height() / this._ref.width();
12824
- };
12825
- this._canvasImage.src = params.src;
12826
12886
  this._ref.on("transform", (e => {
12827
12887
  const attrs = e.target.attrs;
12828
12888
  if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
@@ -12921,7 +12981,11 @@
12921
12981
  this._ref = ref;
12922
12982
  return;
12923
12983
  }
12924
- if (!params || !params.position) return;
12984
+ if (!params) params = {};
12985
+ if (!params.position) params.position = {
12986
+ x: 100,
12987
+ y: 100
12988
+ };
12925
12989
  const arcRadius = 16;
12926
12990
  this._ref = new Konva.Shape({
12927
12991
  x: params.position.x,
@@ -13917,6 +13981,8 @@
13917
13981
  src: src,
13918
13982
  width: width,
13919
13983
  height: height,
13984
+ maxWidth: this._konvaStage.width() - position.x,
13985
+ maxHeight: this._konvaStage.height() - position.y,
13920
13986
  id: id
13921
13987
  });
13922
13988
  this.addObject(konvaImage);
@@ -15375,7 +15441,7 @@
15375
15441
  this.beginInteractivity();
15376
15442
  }
15377
15443
  drag(x, y, dltX, dltY) {
15378
- if (this.press) {
15444
+ if (this.press && Math.abs(dltY) <= 10e-6) {
15379
15445
  const ZOOM_SPEED = 0.025;
15380
15446
  const zoomFactor = dltY > 0 ? 1 + ZOOM_SPEED : 1 - ZOOM_SPEED;
15381
15447
  this._zoomAction.action(this.pressX, this.pressY, zoomFactor);
@@ -16568,23 +16634,14 @@
16568
16634
  }
16569
16635
 
16570
16636
  ///////////////////////////////////////////////////////////////////////////////
16571
- /**
16572
- * The markup type: `Visualize` (deprecated) or `Konva`.
16573
- */
16574
- exports.MarkupType = void 0;
16575
- (function (MarkupType) {
16576
- MarkupType[MarkupType["Unknown"] = 0] = "Unknown";
16577
- MarkupType["Konva"] = "Konva";
16578
- MarkupType["Visualize"] = "Visualize";
16579
- })(exports.MarkupType || (exports.MarkupType = {}));
16580
16637
  class MarkupFactory {
16581
- static createMarkup(markupType = exports.MarkupType.Konva) {
16638
+ static createMarkup(markupType = "Konva") {
16582
16639
  let markup;
16583
16640
  switch (markupType) {
16584
- case exports.MarkupType.Konva:
16641
+ case "Konva":
16585
16642
  markup = new KonvaMarkup();
16586
16643
  break;
16587
- case exports.MarkupType.Visualize:
16644
+ case "Visualize":
16588
16645
  markup = new VisualizeMarkup();
16589
16646
  break;
16590
16647
  default:
@@ -16598,24 +16655,22 @@
16598
16655
  const OVERLAY_VIEW_NAME = "$OVERLAY_VIEW_NAME";
16599
16656
  const isExist = (value) => value !== undefined && value !== null;
16600
16657
  /**
16601
- * The `Client.js` library class that provides methods to integrate with the
16658
+ * 3D viewer powered by
16602
16659
  * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs | VisualizeJS} library.
16603
16660
  */
16604
16661
  class Viewer extends EventEmitter2 {
16605
16662
  /**
16606
- * @param client - The `Client` instance that provides access to a server. Do not specify
16607
- * `Client` if you need a standalone viewer instance without access to server models.
16663
+ * @param client - The `Client` instance that provides access to a Open Cloud Server. Do not
16664
+ * specify `Client` if you need a standalone viewer instance to view `VSFX` files from the
16665
+ * web or from local computer.
16608
16666
  * @param params - An object containing viewer configuration parameters.
16609
16667
  * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
16610
- * library instance, or leave it undefined or blank to use the default URL defined by
16611
- * `Client.js` you are using.
16612
- *
16613
- * _Note: Your own `VisualizeJS` library version must match the version of the `Client.js`
16614
- * you are using._
16668
+ * library instance, or specify `undefined` or blank to use the default URL defined by
16669
+ * `Viewer.visualize` library you are using.
16615
16670
  * @param params.enableAutoUpdate - Enable auto-update of the viewer after any changes. If
16616
- * the auto-update is disabled, you need to register the `update` event handler and update
16617
- * the viewer and the active dragger manually. Default is `true`.
16618
- * @param params.markupType - Specifies type of the markup core: `Visualize` (deprecated) or
16671
+ * the auto-update is disabled, you need to register an `update` event handler and update
16672
+ * the `VisualizeJS` viewer and active dragger manually. Default is `true`.
16673
+ * @param params.markupType - The type of the markup core: `Visualize` (deprecated) or
16619
16674
  * `Konva`. Default is `Konva`.
16620
16675
  */
16621
16676
  constructor(client, params = {}) {
@@ -16665,7 +16720,7 @@
16665
16720
  return this._visualizeJsUrl;
16666
16721
  }
16667
16722
  /**
16668
- * 2D markup core.
16723
+ * 2D markup core instance used to create markups.
16669
16724
  *
16670
16725
  * @readonly
16671
16726
  */
@@ -16673,18 +16728,19 @@
16673
16728
  return this._markup;
16674
16729
  }
16675
16730
  /**
16676
- * Change the viewer configuration parameters.
16731
+ * Changes the viewer parameters.
16677
16732
  *
16678
- * @param params - An object containing new configuration parameters.
16733
+ * @param params - An object containing new parameters.
16679
16734
  * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
16680
- * library instance or leave it blank to use the default URL defined by `Client.js`.
16735
+ * library instance or specify `undefined` or blank to use the default URL defined by
16736
+ * `Viewer.visualize` library you are using.
16681
16737
  */
16682
16738
  configure(params) {
16683
16739
  this._visualizeJsUrl = params.visualizeJsUrl || "https://opencloud.azureedge.net/libs/visualizejs/master/Visualize.js";
16684
16740
  return this;
16685
16741
  }
16686
16742
  /**
16687
- * Load `VisualizeJS` module and initialize it with the specified canvas. Call
16743
+ * Loads the `VisualizeJS` module and initialize it with the specified canvas. Call
16688
16744
  * {@link dispose | dispose()} to release allocated resources.
16689
16745
  *
16690
16746
  * Fires:
@@ -16739,8 +16795,8 @@
16739
16795
  return this;
16740
16796
  }
16741
16797
  /**
16742
- * Releases all resources allocated by this `Viewer` instance. Call this method before
16743
- * release the `Viewer` instance.
16798
+ * Releases all resources allocated by this viewer instance. Call this method before release
16799
+ * the `Viewer` instance.
16744
16800
  */
16745
16801
  dispose() {
16746
16802
  this.cancel();
@@ -16771,7 +16827,7 @@
16771
16827
  return this;
16772
16828
  }
16773
16829
  /**
16774
- * Returns `true` if `VisualizeJS` module has been loaded andinitialized.
16830
+ * Returns `true` if `VisualizeJS` module has been loaded and initialized.
16775
16831
  */
16776
16832
  isInitialized() {
16777
16833
  return !!this.visualizeJs;
@@ -16807,8 +16863,10 @@
16807
16863
  return this;
16808
16864
  }
16809
16865
  /**
16810
- * Updates the viewer. Do nothing if the auto-update mode is disabled in the constructor (use
16811
- * the `update` event to update viewer manually).
16866
+ * Updates the viewer.
16867
+ *
16868
+ * Do nothing if the auto-update mode is disabled in the constructor. In this case, register
16869
+ * an `update` event handler and update the `Visualize` viewer and active dragger manually.
16812
16870
  *
16813
16871
  * Fires:
16814
16872
  *
@@ -16830,21 +16888,16 @@
16830
16888
  }
16831
16889
  this.emitEvent({ type: "update", data: force });
16832
16890
  }
16833
- /**
16834
- * Update with internal schedule, need after change operation when have long update for
16835
- * update without lock UI
16836
- *
16837
- * @param maxScheduleUpdateTimeInMs - Maximum time for one update, by default 30 ms
16838
- * @param maxScheduleUpdateCount - Maximum count of schedule update
16839
- * @returns return void Promise
16840
- */
16841
16891
  scheduleUpdateAsync(maxScheduleUpdateTimeInMs = 50) {
16842
16892
  return new Promise((resolve, reject) => {
16843
16893
  setTimeout(() => {
16844
16894
  var _a, _b;
16845
16895
  try {
16846
- (_a = this.visViewer()) === null || _a === void 0 ? void 0 : _a.update(maxScheduleUpdateTimeInMs);
16847
- (_b = this.activeDragger()) === null || _b === void 0 ? void 0 : _b.updatePreview();
16896
+ if (this._enableAutoUpdate) {
16897
+ (_a = this.visViewer()) === null || _a === void 0 ? void 0 : _a.update(maxScheduleUpdateTimeInMs);
16898
+ (_b = this.activeDragger()) === null || _b === void 0 ? void 0 : _b.updatePreview();
16899
+ }
16900
+ this.emitEvent({ type: "update", data: false });
16848
16901
  resolve();
16849
16902
  }
16850
16903
  catch (e) {
@@ -16854,6 +16907,20 @@
16854
16907
  }, 0);
16855
16908
  });
16856
16909
  }
16910
+ /**
16911
+ * Updates the viewer asynchronously without locking the user interface. Used to update the
16912
+ * viewer after changes that require a long rendering time.
16913
+ *
16914
+ * Do nothing if the auto-update mode is disabled in the constructor. In this case, register
16915
+ * an `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
16916
+ *
16917
+ * Fires:
16918
+ *
16919
+ * - {@link UpdateEvent | update}
16920
+ *
16921
+ * @param maxScheduleUpdateTimeInMs - Maximum time for one update, default 30 ms.
16922
+ * @param maxScheduleUpdateCount - Maximum count of scheduled updates.
16923
+ */
16857
16924
  async updateAsync(maxScheduleUpdateTimeInMs = 50, maxScheduleUpdateCount = 50) {
16858
16925
  this._isRunAsyncUpdate = true;
16859
16926
  const device = this.visViewer().getActiveDevice();
@@ -17025,7 +17092,7 @@
17025
17092
  return this;
17026
17093
  }
17027
17094
  /**
17028
- * List of names of available draggers:
17095
+ * List of names of registered draggers. By default, the following draggers are registered:
17029
17096
  *
17030
17097
  * - `Line`
17031
17098
  * - `Text`
@@ -17046,7 +17113,8 @@
17046
17113
  return [...this.draggerFactory.keys()];
17047
17114
  }
17048
17115
  /**
17049
- * Register dragger on draggerFactory.
17116
+ * Registers a dragger for the viewer. Dragger is an object that received mouse/keyboard
17117
+ * events and does something to the viewer.
17050
17118
  *
17051
17119
  * @param name - Dragger name.
17052
17120
  * @param dragger - Dragger class.
@@ -17061,7 +17129,7 @@
17061
17129
  return this._activeDragger;
17062
17130
  }
17063
17131
  /**
17064
- * Set active dragger. `Viewer` must be initialized before enable dragger or exception is thrown.
17132
+ * Changes the active dragger. Viewer must be initialized before enable dragger or exception is thrown.
17065
17133
  *
17066
17134
  * Fires:
17067
17135
  *
@@ -17099,7 +17167,7 @@
17099
17167
  return this._activeDragger;
17100
17168
  }
17101
17169
  /**
17102
- * Reset the state of the active dragger.
17170
+ * Resets the state of the active dragger.
17103
17171
  */
17104
17172
  resetActiveDragger() {
17105
17173
  const dragger = this._activeDragger;
@@ -17109,7 +17177,7 @@
17109
17177
  }
17110
17178
  }
17111
17179
  /**
17112
- * Remove all cutting planes.
17180
+ * Removes all cutting planes.
17113
17181
  */
17114
17182
  clearSlices() {
17115
17183
  if (!this.visualizeJs)
@@ -17121,7 +17189,7 @@
17121
17189
  this.update();
17122
17190
  }
17123
17191
  /**
17124
- * Clear overlay view.
17192
+ * Clears the overlay view.
17125
17193
  */
17126
17194
  clearOverlay() {
17127
17195
  if (!this.visualizeJs)
@@ -17130,7 +17198,7 @@
17130
17198
  this.update();
17131
17199
  }
17132
17200
  /**
17133
- * Create overlay view.
17201
+ * Creates an overlay view. Overlay view is used to draw cutting planes and `Visualize` markups.
17134
17202
  */
17135
17203
  syncOverlay() {
17136
17204
  if (!this.visualizeJs)
@@ -17158,7 +17226,7 @@
17158
17226
  this.update();
17159
17227
  }
17160
17228
  /**
17161
- * Returns `true` if current drawing is 3D drawing.
17229
+ * Returns `true` if current model is 3D model.
17162
17230
  */
17163
17231
  is3D() {
17164
17232
  if (!this.visualizeJs)
@@ -17205,15 +17273,13 @@
17205
17273
  return result;
17206
17274
  }
17207
17275
  /**
17208
- * Returns a list of original handles for the selected entities.
17276
+ * Returns a list of original handles for the selected objects.
17209
17277
  */
17210
17278
  getSelected() {
17211
17279
  return this.executeCommand("getSelected");
17212
17280
  }
17213
17281
  /**
17214
- * Select model entities by original handles that are obtained using
17215
- * {@link File.getProperties | File.getProperties()} or
17216
- * {@link File.searchProperties | File.searchProperties()} methods.
17282
+ * Selects the model objects by original handles that are obtained using `File.searchProperties()`.
17217
17283
  *
17218
17284
  * Fires:
17219
17285
  *
@@ -17224,13 +17290,7 @@
17224
17290
  setSelected(handles) {
17225
17291
  this.executeCommand("setSelected", handles);
17226
17292
  }
17227
- /**
17228
- * Load model references into the viewer. References are images, fonts, or any other files to
17229
- * correct rendering of the model.
17230
- *
17231
- * @param model - Instance of model with references. If a `File` instance is specified
17232
- * instead of a model, the file references will be loaded.
17233
- */
17293
+ // Internal loading routines
17234
17294
  async loadReferences(model) {
17235
17295
  var _a;
17236
17296
  if (!this.visualizeJs)
@@ -17253,7 +17313,6 @@
17253
17313
  }
17254
17314
  return this;
17255
17315
  }
17256
- // Internal loading routines
17257
17316
  applyModelTransformMatrix(model) {
17258
17317
  this.executeCommand("applyModelTransform", model);
17259
17318
  }
@@ -17273,7 +17332,7 @@
17273
17332
  this.update();
17274
17333
  }
17275
17334
  /**
17276
- * Loads a model of a file or assembly into the viewer.
17335
+ * Loads a model/file/assembly into the viewer.
17277
17336
  *
17278
17337
  * This method requires a {@link Client} instance to work. For standalone viewer instance use
17279
17338
  * {@link openVsfFile | openVsfFile()} or {@link openVsfxFile | openVsfxFile()}.
@@ -17306,7 +17365,7 @@
17306
17365
  if (!model)
17307
17366
  throw new Error("No default model found");
17308
17367
  const overrideOptions = new Options();
17309
- overrideOptions.data = this.options.data;
17368
+ overrideOptions.data = this._options.data;
17310
17369
  if (file.type === ".rcs" && !overrideOptions.enablePartialMode) {
17311
17370
  console.log("Partial load mode is forced for RCS file");
17312
17371
  overrideOptions.enablePartialMode = true;
@@ -17322,7 +17381,7 @@
17322
17381
  return this;
17323
17382
  }
17324
17383
  /**
17325
- * Loads a VSF file into the viewer.
17384
+ * Loads a `VSF` file into the viewer.
17326
17385
  *
17327
17386
  * Fires:
17328
17387
  *
@@ -17361,7 +17420,7 @@
17361
17420
  return this;
17362
17421
  }
17363
17422
  /**
17364
- * Loads a VSFX file into the viewer.
17423
+ * Loads a `VSFX` file into the viewer.
17365
17424
  *
17366
17425
  * Fires:
17367
17426
  *
@@ -17414,7 +17473,7 @@
17414
17473
  return this;
17415
17474
  }
17416
17475
  /**
17417
- * Unloads the model and clears the viewer.
17476
+ * Unloads the model and clears the viewer and markups.
17418
17477
  */
17419
17478
  clear() {
17420
17479
  if (!this.visualizeJs)
@@ -17431,15 +17490,17 @@
17431
17490
  return this;
17432
17491
  }
17433
17492
  /**
17434
- * Get markup color.
17435
- *
17436
- * @returns Color with `RGB` values.
17493
+ * Returns the color of new markup objects.
17437
17494
  */
17438
17495
  getMarkupColor() {
17439
17496
  return this._markup.getMarkupColor();
17440
17497
  }
17441
17498
  /**
17442
- * Set markup color.
17499
+ * Sets the color of new markup objects.
17500
+ *
17501
+ * Fires:
17502
+ *
17503
+ * - {@link ChangeMarkupColorEvent | changemarkupcolor}
17443
17504
  *
17444
17505
  * @param r - `Red` part of color.
17445
17506
  * @param g - `Green` part of color.
@@ -17451,7 +17512,7 @@
17451
17512
  this.emitEvent({ type: "changemarkupcolor", data: color });
17452
17513
  }
17453
17514
  /**
17454
- * Colorize all markup entities with the specified color.
17515
+ * Colors all markup objects with the specified color.
17455
17516
  *
17456
17517
  * @param r - `Red` part of color.
17457
17518
  * @param g - `Green` part of color.
@@ -17461,7 +17522,7 @@
17461
17522
  this._markup.colorizeAllMarkup(r, g, b);
17462
17523
  }
17463
17524
  /**
17464
- * Colorize all selected markup entities with the specified color.
17525
+ * Colors selected markup objects with the specified color.
17465
17526
  *
17466
17527
  * @param r - `Red` part of color.
17467
17528
  * @param g - `Green` part of color.
@@ -17471,7 +17532,7 @@
17471
17532
  this._markup.colorizeSelectedMarkups(r, g, b);
17472
17533
  }
17473
17534
  /**
17474
- * Add an empty markup entity to the overlay.
17535
+ * Adds an empty `Visualize` markup entity to the overlay.
17475
17536
  */
17476
17537
  addMarkupEntity(entityName) {
17477
17538
  if (!this.visualizeJs)
@@ -17489,8 +17550,9 @@
17489
17550
  return entityId;
17490
17551
  }
17491
17552
  /**
17492
- * Draw a viewpoint. To get a list of available model viewpoints, use the
17493
- * `Model.getViewpoints()` or `File.getViewpoints()` or `Assembly.getViewpoints()`.
17553
+ * Sets the viewer state to the specified viewpoint.
17554
+ *
17555
+ * To get a list of available model viewpoints, use the `File.getViewpoints()`.
17494
17556
  *
17495
17557
  * @param viewpoint - Viewpoint data.
17496
17558
  */
@@ -17500,8 +17562,9 @@
17500
17562
  this._markup.setViewpoint(viewpoint);
17501
17563
  }
17502
17564
  /**
17503
- * Create a viewpoint. To add a viewpoint to the list of model viewpoints, use the
17504
- * `Model.saveViewpoint()` or `File.saveViewpoint()` or . `Assembly.saveViewpoint()`.
17565
+ * Saves the viewer state at the viewpoint.
17566
+ *
17567
+ * To save a viewpoint to a model on the server, use the `File.saveViewpoint()`.
17505
17568
  */
17506
17569
  createViewpoint() {
17507
17570
  const vp = this._markup.getViewpoint();