@inweb/viewer-visualize 25.3.21 → 25.3.23

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.
@@ -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,6 +1056,17 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
1044
1056
  this.markup.colorizeAllMarkup(r, g, b);
1045
1057
  }
1046
1058
 
1059
+ /**
1060
+ * Colorize all selected markup entities with the specified color.
1061
+ *
1062
+ * @param r - `Red` part of color.
1063
+ * @param g - `Green` part of color.
1064
+ * @param b - `Blue` part of color.
1065
+ */
1066
+ colorizeSelectedMarkups(r = 255, g = 0, b = 0): void {
1067
+ this.markup.colorizeSelectedMarkups(r, g, b);
1068
+ }
1069
+
1047
1070
  /**
1048
1071
  * Add an empty markup entity to the overlay.
1049
1072
  */
@@ -1069,10 +1092,9 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
1069
1092
 
1070
1093
  /**
1071
1094
  * 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()}.
1095
+ * {@link Model.getViewpoints()} or {@link File.getViewpoints()}.
1074
1096
  *
1075
- * @param viewpoint - Viewpoint.
1097
+ * @param viewpoint - Viewpoint data.
1076
1098
  */
1077
1099
  drawViewpoint(viewpoint: IViewpoint): void {
1078
1100
  this.setOrthogonalCameraSettings(viewpoint.orthogonal_camera);
@@ -1082,8 +1104,7 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
1082
1104
 
1083
1105
  /**
1084
1106
  * 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()}.
1107
+ * {@link Model.saveViewpoint()} or {@link File.saveViewpoint()}.
1087
1108
  */
1088
1109
  createViewpoint(): IViewpoint {
1089
1110
  const vp = this.markup.getViewpoint();