@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.
@@ -1,12 +1,8 @@
1
1
  import { IMarkup } from "@inweb/markup";
2
2
  /**
3
- * The markup type: `Visualize` (deprecated) or `Konva`.
3
+ * Defines the type of the markup core.
4
4
  */
5
- export declare enum MarkupType {
6
- Unknown = 0,
7
- Konva = "Konva",
8
- Visualize = "Visualize"
9
- }
5
+ export type MarkupType = "Konva" | "Visualize";
10
6
  export declare class MarkupFactory {
11
7
  static createMarkup(markupType?: MarkupType): IMarkup;
12
8
  }
@@ -4,7 +4,7 @@ import { CanvasEventMap, Dragger, IDragger, IOptions, IViewer, IViewpoint, Optio
4
4
  import { IMarkup, IWorldTransform } from "@inweb/markup";
5
5
  import { MarkupType } from "./Markup/MarkupFactory";
6
6
  /**
7
- * The `Client.js` library class that provides methods to integrate with the
7
+ * 3D viewer powered by
8
8
  * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs | VisualizeJS} library.
9
9
  */
10
10
  export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMap & OptionsEventMap> implements IViewer, IWorldTransform {
@@ -31,19 +31,17 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
31
31
  _abortControllerForReferences: AbortController | undefined;
32
32
  client: Client | undefined;
33
33
  /**
34
- * @param client - The `Client` instance that provides access to a server. Do not specify
35
- * `Client` if you need a standalone viewer instance without access to server models.
34
+ * @param client - The `Client` instance that provides access to a Open Cloud Server. Do not
35
+ * specify `Client` if you need a standalone viewer instance to view `VSFX` files from the
36
+ * web or from local computer.
36
37
  * @param params - An object containing viewer configuration parameters.
37
38
  * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
38
- * library instance, or leave it undefined or blank to use the default URL defined by
39
- * `Client.js` you are using.
40
- *
41
- * _Note: Your own `VisualizeJS` library version must match the version of the `Client.js`
42
- * you are using._
39
+ * library instance, or specify `undefined` or blank to use the default URL defined by
40
+ * `Viewer.visualize` library you are using.
43
41
  * @param params.enableAutoUpdate - Enable auto-update of the viewer after any changes. If
44
- * the auto-update is disabled, you need to register the `update` event handler and update
45
- * the viewer and the active dragger manually. Default is `true`.
46
- * @param params.markupType - Specifies type of the markup core: `Visualize` (deprecated) or
42
+ * the auto-update is disabled, you need to register an `update` event handler and update
43
+ * the `VisualizeJS` viewer and active dragger manually. Default is `true`.
44
+ * @param params.markupType - The type of the markup core: `Visualize` (deprecated) or
47
45
  * `Konva`. Default is `Konva`.
48
46
  */
49
47
  constructor(client?: Client, params?: {
@@ -54,7 +52,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
54
52
  /**
55
53
  * Viewer options.
56
54
  */
57
- get options(): Options;
55
+ get options(): IOptions;
58
56
  /**
59
57
  * `VisualizeJS` library URL. Use {@link configure | configure()} to change library URL.
60
58
  *
@@ -62,23 +60,24 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
62
60
  */
63
61
  get visualizeJsUrl(): string;
64
62
  /**
65
- * 2D markup core.
63
+ * 2D markup core instance used to create markups.
66
64
  *
67
65
  * @readonly
68
66
  */
69
67
  get markup(): IMarkup;
70
68
  /**
71
- * Change the viewer configuration parameters.
69
+ * Changes the viewer parameters.
72
70
  *
73
- * @param params - An object containing new configuration parameters.
71
+ * @param params - An object containing new parameters.
74
72
  * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
75
- * library instance or leave it blank to use the default URL defined by `Client.js`.
73
+ * library instance or specify `undefined` or blank to use the default URL defined by
74
+ * `Viewer.visualize` library you are using.
76
75
  */
77
76
  configure(params: {
78
77
  visualizeJsUrl?: string;
79
78
  }): this;
80
79
  /**
81
- * Load `VisualizeJS` module and initialize it with the specified canvas. Call
80
+ * Loads the `VisualizeJS` module and initialize it with the specified canvas. Call
82
81
  * {@link dispose | dispose()} to release allocated resources.
83
82
  *
84
83
  * Fires:
@@ -93,19 +92,21 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
93
92
  */
94
93
  initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this>;
95
94
  /**
96
- * Releases all resources allocated by this `Viewer` instance. Call this method before
97
- * release the `Viewer` instance.
95
+ * Releases all resources allocated by this viewer instance. Call this method before release
96
+ * the `Viewer` instance.
98
97
  */
99
98
  dispose(): this;
100
99
  /**
101
- * Returns `true` if `VisualizeJS` module has been loaded andinitialized.
100
+ * Returns `true` if `VisualizeJS` module has been loaded and initialized.
102
101
  */
103
102
  isInitialized(): boolean;
104
103
  private render;
105
104
  resize(): this;
106
105
  /**
107
- * Updates the viewer. Do nothing if the auto-update mode is disabled in the constructor (use
108
- * the `update` event to update viewer manually).
106
+ * Updates the viewer.
107
+ *
108
+ * Do nothing if the auto-update mode is disabled in the constructor. In this case, register
109
+ * an `update` event handler and update the `Visualize` viewer and active dragger manually.
109
110
  *
110
111
  * Fires:
111
112
  *
@@ -115,15 +116,21 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
115
116
  * animation frame. Default is `false`.
116
117
  */
117
118
  update(force?: boolean): void;
119
+ private scheduleUpdateAsync;
118
120
  /**
119
- * Update with internal schedule, need after change operation when have long update for
120
- * update without lock UI
121
+ * Updates the viewer asynchronously without locking the user interface. Used to update the
122
+ * viewer after changes that require a long rendering time.
121
123
  *
122
- * @param maxScheduleUpdateTimeInMs - Maximum time for one update, by default 30 ms
123
- * @param maxScheduleUpdateCount - Maximum count of schedule update
124
- * @returns return void Promise
124
+ * Do nothing if the auto-update mode is disabled in the constructor. In this case, register
125
+ * an `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
126
+ *
127
+ * Fires:
128
+ *
129
+ * - {@link UpdateEvent | update}
130
+ *
131
+ * @param maxScheduleUpdateTimeInMs - Maximum time for one update, default 30 ms.
132
+ * @param maxScheduleUpdateCount - Maximum count of scheduled updates.
125
133
  */
126
- private scheduleUpdateAsync;
127
134
  updateAsync(maxScheduleUpdateTimeInMs?: number, maxScheduleUpdateCount?: number): Promise<void>;
128
135
  /**
129
136
  * Returns `VisualizeJS`
@@ -144,7 +151,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
144
151
  syncOptions(options?: IOptions): this;
145
152
  syncHighlightingOptions(options?: IOptions): this;
146
153
  /**
147
- * List of names of available draggers:
154
+ * List of names of registered draggers. By default, the following draggers are registered:
148
155
  *
149
156
  * - `Line`
150
157
  * - `Text`
@@ -163,7 +170,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
163
170
  */
164
171
  get draggers(): string[];
165
172
  /**
166
- * Register dragger on draggerFactory.
173
+ * Registers a dragger for the viewer. Dragger is an object that received mouse/keyboard
174
+ * events and does something to the viewer.
167
175
  *
168
176
  * @param name - Dragger name.
169
177
  * @param dragger - Dragger class.
@@ -174,7 +182,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
174
182
  */
175
183
  activeDragger(): IDragger | null;
176
184
  /**
177
- * Set active dragger. `Viewer` must be initialized before enable dragger or exception is thrown.
185
+ * Changes the active dragger. Viewer must be initialized before enable dragger or exception is thrown.
178
186
  *
179
187
  * Fires:
180
188
  *
@@ -185,23 +193,23 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
185
193
  */
186
194
  setActiveDragger(name: string): IDragger | null;
187
195
  /**
188
- * Reset the state of the active dragger.
196
+ * Resets the state of the active dragger.
189
197
  */
190
198
  resetActiveDragger(): void;
191
199
  /**
192
- * Remove all cutting planes.
200
+ * Removes all cutting planes.
193
201
  */
194
202
  clearSlices(): void;
195
203
  /**
196
- * Clear overlay view.
204
+ * Clears the overlay view.
197
205
  */
198
206
  clearOverlay(): void;
199
207
  /**
200
- * Create overlay view.
208
+ * Creates an overlay view. Overlay view is used to draw cutting planes and `Visualize` markups.
201
209
  */
202
210
  syncOverlay(): any;
203
211
  /**
204
- * Returns `true` if current drawing is 3D drawing.
212
+ * Returns `true` if current model is 3D model.
205
213
  */
206
214
  is3D(): boolean;
207
215
  screenToWorld(position: {
@@ -226,13 +234,11 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
226
234
  z: number;
227
235
  };
228
236
  /**
229
- * Returns a list of original handles for the selected entities.
237
+ * Returns a list of original handles for the selected objects.
230
238
  */
231
239
  getSelected(): string[];
232
240
  /**
233
- * Select model entities by original handles that are obtained using
234
- * {@link File.getProperties | File.getProperties()} or
235
- * {@link File.searchProperties | File.searchProperties()} methods.
241
+ * Selects the model objects by original handles that are obtained using `File.searchProperties()`.
236
242
  *
237
243
  * Fires:
238
244
  *
@@ -241,18 +247,11 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
241
247
  * @param handles - The list of original handles.
242
248
  */
243
249
  setSelected(handles?: string[]): void;
244
- /**
245
- * Load model references into the viewer. References are images, fonts, or any other files to
246
- * correct rendering of the model.
247
- *
248
- * @param model - Instance of model with references. If a `File` instance is specified
249
- * instead of a model, the file references will be loaded.
250
- */
251
250
  loadReferences(model: Model | File | Assembly): Promise<this>;
252
251
  applyModelTransformMatrix(model: Model | Assembly): void;
253
- applySceneGraphSettings(options?: Options): void;
252
+ applySceneGraphSettings(options?: IOptions): void;
254
253
  /**
255
- * Loads a model of a file or assembly into the viewer.
254
+ * Loads a model/file/assembly into the viewer.
256
255
  *
257
256
  * This method requires a {@link Client} instance to work. For standalone viewer instance use
258
257
  * {@link openVsfFile | openVsfFile()} or {@link openVsfxFile | openVsfxFile()}.
@@ -273,7 +272,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
273
272
  */
274
273
  open(file: File | Assembly | Model): Promise<this>;
275
274
  /**
276
- * Loads a VSF file into the viewer.
275
+ * Loads a `VSF` file into the viewer.
277
276
  *
278
277
  * Fires:
279
278
  *
@@ -288,7 +287,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
288
287
  */
289
288
  openVsfFile(buffer: Uint8Array | ArrayBuffer): this;
290
289
  /**
291
- * Loads a VSFX file into the viewer.
290
+ * Loads a `VSFX` file into the viewer.
292
291
  *
293
292
  * Fires:
294
293
  *
@@ -307,13 +306,11 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
307
306
  */
308
307
  cancel(): this;
309
308
  /**
310
- * Unloads the model and clears the viewer.
309
+ * Unloads the model and clears the viewer and markups.
311
310
  */
312
311
  clear(): this;
313
312
  /**
314
- * Get markup color.
315
- *
316
- * @returns Color with `RGB` values.
313
+ * Returns the color of new markup objects.
317
314
  */
318
315
  getMarkupColor(): {
319
316
  r: number;
@@ -321,7 +318,11 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
321
318
  b: number;
322
319
  };
323
320
  /**
324
- * Set markup color.
321
+ * Sets the color of new markup objects.
322
+ *
323
+ * Fires:
324
+ *
325
+ * - {@link ChangeMarkupColorEvent | changemarkupcolor}
325
326
  *
326
327
  * @param r - `Red` part of color.
327
328
  * @param g - `Green` part of color.
@@ -329,7 +330,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
329
330
  */
330
331
  setMarkupColor(r?: number, g?: number, b?: number): void;
331
332
  /**
332
- * Colorize all markup entities with the specified color.
333
+ * Colors all markup objects with the specified color.
333
334
  *
334
335
  * @param r - `Red` part of color.
335
336
  * @param g - `Green` part of color.
@@ -337,7 +338,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
337
338
  */
338
339
  colorizeAllMarkup(r?: number, g?: number, b?: number): void;
339
340
  /**
340
- * Colorize all selected markup entities with the specified color.
341
+ * Colors selected markup objects with the specified color.
341
342
  *
342
343
  * @param r - `Red` part of color.
343
344
  * @param g - `Green` part of color.
@@ -345,19 +346,21 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
345
346
  */
346
347
  colorizeSelectedMarkups(r?: number, g?: number, b?: number): void;
347
348
  /**
348
- * Add an empty markup entity to the overlay.
349
+ * Adds an empty `Visualize` markup entity to the overlay.
349
350
  */
350
351
  addMarkupEntity(entityName: string): any;
351
352
  /**
352
- * Draw a viewpoint. To get a list of available model viewpoints, use the
353
- * `Model.getViewpoints()` or `File.getViewpoints()` or `Assembly.getViewpoints()`.
353
+ * Sets the viewer state to the specified viewpoint.
354
+ *
355
+ * To get a list of available model viewpoints, use the `File.getViewpoints()`.
354
356
  *
355
357
  * @param viewpoint - Viewpoint data.
356
358
  */
357
359
  drawViewpoint(viewpoint: IViewpoint): void;
358
360
  /**
359
- * Create a viewpoint. To add a viewpoint to the list of model viewpoints, use the
360
- * `Model.saveViewpoint()` or `File.saveViewpoint()` or . `Assembly.saveViewpoint()`.
361
+ * Saves the viewer state at the viewpoint.
362
+ *
363
+ * To save a viewpoint to a model on the server, use the `File.saveViewpoint()`.
361
364
  */
362
365
  createViewpoint(): IViewpoint;
363
366
  private getPoint3dFromArray;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inweb/viewer-visualize",
3
- "version": "25.8.16",
4
- "description": "3D CAD and BIM data Viewer powered by Visualize",
3
+ "version": "25.8.20",
4
+ "description": "3D viewer powered by VisualizeJS",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "author": "Open Design Alliance",
@@ -29,10 +29,10 @@
29
29
  "docs": "typedoc"
30
30
  },
31
31
  "dependencies": {
32
- "@inweb/client": "~25.8.16",
33
- "@inweb/eventemitter2": "~25.8.16",
34
- "@inweb/markup": "~25.8.16",
35
- "@inweb/viewer-core": "~25.8.16"
32
+ "@inweb/client": "~25.8.20",
33
+ "@inweb/eventemitter2": "~25.8.20",
34
+ "@inweb/markup": "~25.8.20",
35
+ "@inweb/viewer-core": "~25.8.20"
36
36
  },
37
37
  "visualizeJS": "https://opencloud.azureedge.net/libs/visualizejs/master/Visualize.js"
38
38
  }
@@ -45,7 +45,7 @@ export class OdZoomDragger extends OdBaseDragger {
45
45
  }
46
46
 
47
47
  override drag(x: number, y: number, dltX: number, dltY: number): void {
48
- if (this.press) {
48
+ if (this.press && Math.abs(dltY) <= 10e-6) {
49
49
  const ZOOM_SPEED = 0.025;
50
50
  const zoomFactor = dltY > 0 ? 1 + ZOOM_SPEED : 1 - ZOOM_SPEED;
51
51
  this._zoomAction.action(this.pressX, this.pressY, zoomFactor);
@@ -25,24 +25,20 @@ import { IMarkup, Markup as KonvaMarkup } from "@inweb/markup";
25
25
  import { VisualizeMarkup } from "./Visualize/VisualizeMarkup";
26
26
 
27
27
  /**
28
- * The markup type: `Visualize` (deprecated) or `Konva`.
28
+ * Defines the type of the markup core.
29
29
  */
30
- export enum MarkupType {
31
- Unknown,
32
- Konva = "Konva",
33
- Visualize = "Visualize",
34
- }
30
+ export type MarkupType = "Konva" | "Visualize";
35
31
 
36
32
  export class MarkupFactory {
37
- public static createMarkup(markupType: MarkupType = MarkupType.Konva): IMarkup {
33
+ public static createMarkup(markupType: MarkupType = "Konva"): IMarkup {
38
34
  let markup: IMarkup;
39
35
 
40
36
  switch (markupType) {
41
- case MarkupType.Konva:
37
+ case "Konva":
42
38
  markup = new KonvaMarkup();
43
39
  break;
44
40
 
45
- case MarkupType.Visualize:
41
+ case "Visualize":
46
42
  markup = new VisualizeMarkup();
47
43
  break;
48
44