@inweb/viewer-visualize 25.3.21 → 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.
@@ -1,20 +1,6 @@
1
1
  import { Viewer } from "../../Viewer";
2
2
  import { Point2d } from "./Geometry";
3
3
  import { OdaGeAction } from "./OdaGeAction";
4
- /**
5
- * A [Viewer]{@link Viewer} event that fires when the viewer needs to be updated.
6
- *
7
- * @property {string} type - `update`
8
- * @event update
9
- */
10
- /**
11
- * A [Viewer]{@link Viewer} event that fires when the user selects an entity with the mouse.
12
- *
13
- * @property {string} type - `select`
14
- * @property {OdTvSelectionSet} data - The set of selected entities. For more information, see
15
- * [OdTvSelectionSet](https://cloud.opendesign.com/docs/index.html#/vis/OdTvSelectionSet?id=odtvselectionset).
16
- * @event select
17
- */
18
4
  export declare class OdBaseDragger extends OdaGeAction {
19
5
  protected subject: Viewer;
20
6
  protected needInputText: boolean;
@@ -17,7 +17,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventM
17
17
  private _renderTime;
18
18
  protected _options: Options;
19
19
  protected _visualizeJsUrl: string;
20
- protected _abortControllerForReferences: AbortController | undefined;
20
+ protected _visualizeJs: any;
21
21
  private canvaseventlistener;
22
22
  draggerFactory: Map<string, typeof OdBaseDragger>;
23
23
  canvasEvents: string[];
@@ -25,9 +25,9 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventM
25
25
  private _resizeObserver;
26
26
  canvas: HTMLCanvasElement | undefined;
27
27
  markup: IMarkup;
28
- visualizeJs: any;
29
28
  _abortController: AbortController | undefined;
30
29
  _abortControllerForRequestMap: Map<string, AbortController> | undefined;
30
+ _abortControllerForReferences: AbortController | undefined;
31
31
  client: Client | undefined;
32
32
  /**
33
33
  * @param client - The `Client` instance that provides access to a server. Do not specify
@@ -122,6 +122,11 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventM
122
122
  */
123
123
  private scheduleUpdateAsync;
124
124
  updateAsync(maxScheduleUpdateTimeInMs?: number, maxScheduleUpdateCount?: number): Promise<void>;
125
+ /**
126
+ * Returns `VisualizeJS`
127
+ * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module} instance.
128
+ */
129
+ get visualizeJs(): any;
125
130
  /**
126
131
  * Returns `VisualizeJS`
127
132
  * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module} instance.
@@ -171,7 +176,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventM
171
176
  *
172
177
  * Fires:
173
178
  *
174
- * - {@link ChangeActiveDragger | changeactivedragger}
179
+ * - {@link ChangeActiveDraggerEvent | changeactivedragger}
175
180
  *
176
181
  * @param name - Dragger name. Can be one of the {@link Viewer#draggers | draggers} list.
177
182
  * @returns Returns active dragger instance or `null` if there is no dragger with the given name.
@@ -311,22 +316,17 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventM
311
316
  * @param b - `Blue` part of color.
312
317
  */
313
318
  colorizeAllMarkup(r?: number, g?: number, b?: number): void;
314
- /**
315
- * Add an empty markup entity to the overlay.
316
- */
317
319
  addMarkupEntity(entityName: string): any;
318
320
  /**
319
321
  * Draw a viewpoint. To get a list of available model viewpoints, use the
320
- * {@link Model#getViewpoints | Model.getViewpoints()} or
321
- * {@link File#getViewpoints | File.getViewpoints()}.
322
+ * {@link Model.getViewpoints()} or {@link File.getViewpoints()}.
322
323
  *
323
- * @param viewpoint - Viewpoint.
324
+ * @param viewpoint - Viewpoint data.
324
325
  */
325
326
  drawViewpoint(viewpoint: IViewpoint): void;
326
327
  /**
327
328
  * Create a viewpoint. To add a viewpoint to the list of model viewpoints, use the
328
- * {@link Model#saveViewpoint | Model.saveViewpoint()} or
329
- * {@link File#saveViewpoint | File.saveViewpoint()}.
329
+ * {@link Model.saveViewpoint()} or {@link File.saveViewpoint()}.
330
330
  */
331
331
  createViewpoint(): IViewpoint;
332
332
  private getPoint3dFromArray;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/viewer-visualize",
3
- "version": "25.3.21",
3
+ "version": "25.3.22",
4
4
  "description": "3D CAD and BIM data Viewer powered by Visualize",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -25,7 +25,8 @@
25
25
  ],
26
26
  "scripts": {
27
27
  "build": "rollup -c rollup.config.js",
28
- "test": "karma start karma.conf.js"
28
+ "test": "karma start karma.conf.js",
29
+ "ts-docs": "typedoc"
29
30
  },
30
31
  "dependencies": {
31
32
  "@inweb/client": "^25.3.19",
@@ -31,22 +31,6 @@ const CLICK_DELTA = 5;
31
31
 
32
32
  const INTERACTIVITY_FPS = 24;
33
33
 
34
- /**
35
- * A [Viewer]{@link Viewer} event that fires when the viewer needs to be updated.
36
- *
37
- * @property {string} type - `update`
38
- * @event update
39
- */
40
-
41
- /**
42
- * A [Viewer]{@link Viewer} event that fires when the user selects an entity with the mouse.
43
- *
44
- * @property {string} type - `select`
45
- * @property {OdTvSelectionSet} data - The set of selected entities. For more information, see
46
- * [OdTvSelectionSet](https://cloud.opendesign.com/docs/index.html#/vis/OdTvSelectionSet?id=odtvselectionset).
47
- * @event select
48
- */
49
-
50
34
  export class OdBaseDragger extends OdaGeAction {
51
35
  protected subject: Viewer;
52
36
  protected needInputText: boolean;
@@ -75,7 +75,7 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
75
75
 
76
76
  protected _options: Options;
77
77
  protected _visualizeJsUrl = "";
78
- protected _abortControllerForReferences: AbortController | undefined;
78
+ protected _visualizeJs: any;
79
79
 
80
80
  private canvaseventlistener: (event: Event) => void;
81
81
 
@@ -86,9 +86,9 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
86
86
  public canvas: HTMLCanvasElement | undefined;
87
87
  public markup: IMarkup;
88
88
 
89
- public visualizeJs: any;
90
89
  public _abortController: AbortController | undefined;
91
90
  public _abortControllerForRequestMap: Map<string, AbortController> | undefined;
91
+ public _abortControllerForReferences: AbortController | undefined;
92
92
  public client: Client | undefined;
93
93
 
94
94
  /**
@@ -219,7 +219,7 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
219
219
  onProgress?.(event);
220
220
  });
221
221
 
222
- this.visualizeJs = visualizeJs;
222
+ this._visualizeJs = visualizeJs;
223
223
  this.visualizeJs.canvas = canvas;
224
224
  this.visualizeJs.Viewer.create();
225
225
 
@@ -260,22 +260,26 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
260
260
  this.frameId = 0;
261
261
 
262
262
  this.setActiveDragger("");
263
+ this.removeAllListeners();
263
264
 
264
- this._zoomWheelDragger?.dispose();
265
- this._gestureManager?.dispose();
265
+ if (this._gestureManager) this._gestureManager.dispose();
266
+ this._gestureManager = undefined;
266
267
 
267
- this.removeAllListeners();
268
+ if (this._zoomWheelDragger) this._zoomWheelDragger.dispose();
269
+ this._zoomWheelDragger = undefined;
268
270
 
269
- this._resizeObserver?.disconnect();
271
+ if (this._resizeObserver) this._resizeObserver.disconnect();
270
272
  this._resizeObserver = undefined;
271
273
 
272
274
  this.markup.dispose();
273
275
 
274
- this.canvasEvents.forEach((x) => this.canvas?.removeEventListener(x, this.canvaseventlistener));
275
- this.canvas = undefined;
276
+ if (this.canvas) {
277
+ this.canvasEvents.forEach((x) => this.canvas.removeEventListener(x, this.canvaseventlistener));
278
+ this.canvas = undefined;
279
+ }
276
280
 
277
- this.visualizeJs?.getViewer().clear();
278
- this.visualizeJs = undefined;
281
+ if (this._visualizeJs) this._visualizeJs.getViewer().clear();
282
+ this._visualizeJs = undefined;
279
283
 
280
284
  return this;
281
285
  }
@@ -386,6 +390,14 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
386
390
  }
387
391
  }
388
392
 
393
+ /**
394
+ * Returns `VisualizeJS`
395
+ * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module} instance.
396
+ */
397
+ get visualizeJs(): any {
398
+ return this._visualizeJs;
399
+ }
400
+
389
401
  /**
390
402
  * Returns `VisualizeJS`
391
403
  * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module} instance.
@@ -627,7 +639,7 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
627
639
  *
628
640
  * Fires:
629
641
  *
630
- * - {@link ChangeActiveDragger | changeactivedragger}
642
+ * - {@link ChangeActiveDraggerEvent | changeactivedragger}
631
643
  *
632
644
  * @param name - Dragger name. Can be one of the {@link Viewer#draggers | draggers} list.
633
645
  * @returns Returns active dragger instance or `null` if there is no dragger with the given name.
@@ -1044,7 +1056,7 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
1044
1056
  this.markup.colorizeAllMarkup(r, g, b);
1045
1057
  }
1046
1058
 
1047
- /**
1059
+ /*
1048
1060
  * Add an empty markup entity to the overlay.
1049
1061
  */
1050
1062
  addMarkupEntity(entityName: string) {
@@ -1069,10 +1081,9 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
1069
1081
 
1070
1082
  /**
1071
1083
  * Draw a viewpoint. To get a list of available model viewpoints, use the
1072
- * {@link Model#getViewpoints | Model.getViewpoints()} or
1073
- * {@link File#getViewpoints | File.getViewpoints()}.
1084
+ * {@link Model.getViewpoints()} or {@link File.getViewpoints()}.
1074
1085
  *
1075
- * @param viewpoint - Viewpoint.
1086
+ * @param viewpoint - Viewpoint data.
1076
1087
  */
1077
1088
  drawViewpoint(viewpoint: IViewpoint): void {
1078
1089
  this.setOrthogonalCameraSettings(viewpoint.orthogonal_camera);
@@ -1082,8 +1093,7 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
1082
1093
 
1083
1094
  /**
1084
1095
  * Create a viewpoint. To add a viewpoint to the list of model viewpoints, use the
1085
- * {@link Model#saveViewpoint | Model.saveViewpoint()} or
1086
- * {@link File#saveViewpoint | File.saveViewpoint()}.
1096
+ * {@link Model.saveViewpoint()} or {@link File.saveViewpoint()}.
1087
1097
  */
1088
1098
  createViewpoint(): IViewpoint {
1089
1099
  const vp = this.markup.getViewpoint();