@inweb/viewer-visualize 25.9.0 → 25.9.2

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.
@@ -77,7 +77,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
77
77
  visualizeJsUrl?: string;
78
78
  }): this;
79
79
  /**
80
- * Loads the `VisualizeJS` module and initialize it with the specified canvas. Call
80
+ * Loads the `VisualizeJS` module and initializes it with the specified canvas. Call
81
81
  * {@link dispose | dispose()} to release allocated resources.
82
82
  *
83
83
  * Fires:
@@ -92,8 +92,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
92
92
  */
93
93
  initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this>;
94
94
  /**
95
- * Releases all resources allocated by this viewer instance. Call this method before release
96
- * the `Viewer` instance.
95
+ * Unloads an open file, clears the canvas and markups, and releases resources allocated by
96
+ * this viewer instance. Call this method before release the `Viewer` instance.
97
97
  */
98
98
  dispose(): this;
99
99
  /**
@@ -151,7 +151,9 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
151
151
  syncOptions(options?: IOptions): this;
152
152
  syncHighlightingOptions(options?: IOptions): this;
153
153
  /**
154
- * List of names of registered draggers. By default, the following draggers are registered:
154
+ * List of names of registered draggers.
155
+ *
156
+ * The following draggers are registered by default:
155
157
  *
156
158
  * - `Line`
157
159
  * - `Text`
@@ -166,19 +168,21 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
166
168
  * - `CuttingPlaneZAxis`
167
169
  * - `Walk`
168
170
  *
169
- * @readonly
171
+ * To register your own command use the {@link registerDragger | registerDragger()}.
170
172
  */
171
173
  get draggers(): string[];
172
174
  /**
173
- * Registers a dragger for the viewer. Dragger is an object that received mouse/keyboard
174
- * events and does something to the viewer.
175
+ * Registers a dragger for the viewer.
176
+ *
177
+ * Dragger is an object that received mouse/keyboard events and does something to the viewer.
178
+ * For a quick tutorial on how to create your own dragger, see {@link Dragger}.
175
179
  *
176
180
  * @param name - Dragger name.
177
181
  * @param dragger - Dragger class.
178
182
  */
179
183
  registerDragger(name: string, dragger: typeof Dragger): void;
180
184
  /**
181
- * Returns active dragger instance or `null` if there is no active dragger.
185
+ * Returns the active dragger instance, or `null` if there is no active dragger.
182
186
  */
183
187
  activeDragger(): IDragger | null;
184
188
  /**
@@ -189,7 +193,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
189
193
  * - {@link ChangeActiveDraggerEvent | changeactivedragger}
190
194
  *
191
195
  * @param name - Dragger name. Can be one of the {@link draggers} list.
192
- * @returns Returns active dragger instance or `null` if there is no dragger with the given name.
196
+ * @returns Returns the new active dragger instance or `null` if there is no dragger with the
197
+ * given name.
193
198
  */
194
199
  setActiveDragger(name: string): IDragger | null;
195
200
  /**
@@ -209,7 +214,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
209
214
  */
210
215
  syncOverlay(): any;
211
216
  /**
212
- * Returns `true` if current model is 3D model.
217
+ * Returns `true` if current opened model is 3D model.
213
218
  */
214
219
  is3D(): boolean;
215
220
  screenToWorld(position: {
@@ -305,11 +310,11 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
305
310
  */
306
311
  openVsfxFile(buffer: Uint8Array | ArrayBuffer): this;
307
312
  /**
308
- * Cancels asynchronous model loading started by {@link open | open()}.
313
+ * Cancels asynchronous file loading started by {@link open | open()}.
309
314
  */
310
315
  cancel(): this;
311
316
  /**
312
- * Unloads the model and clears the viewer and markups.
317
+ * Unloads an open file and clears the canvas and markups.
313
318
  */
314
319
  clear(): this;
315
320
  /**
@@ -374,11 +379,42 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
374
379
  private getClippingPlanes;
375
380
  private setClippingPlanes;
376
381
  /**
377
- * Executes the command denoted by the given command identifier.
378
- *
379
- * @param id - Identifier of the command to execute.
380
- * @param args - Parameters passed to the command function.
381
- * @returns A returned value of the given command. Returns `undefined` when the command doesn't exists.
382
+ * Executes the command denoted by the given command. If the command is not found, tries to
383
+ * set active dragger with the specified name.
384
+ *
385
+ * The following commands are registered by default:
386
+ *
387
+ * - `applyModelTransform`
388
+ * - `autoTransformAllModelsToCentralPoint`
389
+ * - `clearMarkup`
390
+ * - `clearSlices`
391
+ * - `createPreview`
392
+ * - `explode`
393
+ * - `getDefaultViewPositions`
394
+ * - `getModels`
395
+ * - `getSelected`
396
+ * - `hideSelected`
397
+ * - `isolateSelected`
398
+ * - `regenerateAll`
399
+ * - `resetView`
400
+ * - `selectModel`
401
+ * - `setActiveDragger`
402
+ * - `setDefaultViewPosition`
403
+ * - `setMarkupColor`
404
+ * - `setSelected`
405
+ * - `showAll`
406
+ * - `unselect`
407
+ * - `zoomToExtents`
408
+ * - `zoomToObjects`
409
+ * - `zoomToSelected`
410
+ *
411
+ * To register your own command use the {@link ICommands.registerCommand | registerCommand()}
412
+ * method of the {@link commands} manager.
413
+ *
414
+ * @param id - Command ID or dragger name.
415
+ * @param args - Parameters passed to the command handler function.
416
+ * @returns Returns the result of the command handler function or new active dragger
417
+ * instance. Returns `undefined` if neither the command nor the dragger exists.
382
418
  */
383
419
  executeCommand(id: string, ...args: any[]): any;
384
420
  deviceAutoRegeneration(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/viewer-visualize",
3
- "version": "25.9.0",
3
+ "version": "25.9.2",
4
4
  "description": "3D viewer powered by VisualizeJS",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -29,10 +29,10 @@
29
29
  "docs": "typedoc"
30
30
  },
31
31
  "dependencies": {
32
- "@inweb/client": "~25.9.0",
33
- "@inweb/eventemitter2": "~25.9.0",
34
- "@inweb/markup": "~25.9.0",
35
- "@inweb/viewer-core": "~25.9.0"
32
+ "@inweb/client": "~25.9.2",
33
+ "@inweb/eventemitter2": "~25.9.2",
34
+ "@inweb/markup": "~25.9.2",
35
+ "@inweb/viewer-core": "~25.9.2"
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 && Math.abs(dltY) <= 10e-6) {
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);
@@ -191,7 +191,7 @@ export class Viewer
191
191
  }
192
192
 
193
193
  /**
194
- * Loads the `VisualizeJS` module and initialize it with the specified canvas. Call
194
+ * Loads the `VisualizeJS` module and initializes it with the specified canvas. Call
195
195
  * {@link dispose | dispose()} to release allocated resources.
196
196
  *
197
197
  * Fires:
@@ -263,8 +263,8 @@ export class Viewer
263
263
  }
264
264
 
265
265
  /**
266
- * Releases all resources allocated by this viewer instance. Call this method before release
267
- * the `Viewer` instance.
266
+ * Unloads an open file, clears the canvas and markups, and releases resources allocated by
267
+ * this viewer instance. Call this method before release the `Viewer` instance.
268
268
  */
269
269
  dispose(): this {
270
270
  this.cancel();
@@ -623,7 +623,9 @@ export class Viewer
623
623
  }
624
624
 
625
625
  /**
626
- * List of names of registered draggers. By default, the following draggers are registered:
626
+ * List of names of registered draggers.
627
+ *
628
+ * The following draggers are registered by default:
627
629
  *
628
630
  * - `Line`
629
631
  * - `Text`
@@ -638,15 +640,17 @@ export class Viewer
638
640
  * - `CuttingPlaneZAxis`
639
641
  * - `Walk`
640
642
  *
641
- * @readonly
643
+ * To register your own command use the {@link registerDragger | registerDragger()}.
642
644
  */
643
645
  get draggers(): string[] {
644
646
  return [...this.draggerFactory.keys()];
645
647
  }
646
648
 
647
649
  /**
648
- * Registers a dragger for the viewer. Dragger is an object that received mouse/keyboard
649
- * events and does something to the viewer.
650
+ * Registers a dragger for the viewer.
651
+ *
652
+ * Dragger is an object that received mouse/keyboard events and does something to the viewer.
653
+ * For a quick tutorial on how to create your own dragger, see {@link Dragger}.
650
654
  *
651
655
  * @param name - Dragger name.
652
656
  * @param dragger - Dragger class.
@@ -656,7 +660,7 @@ export class Viewer
656
660
  }
657
661
 
658
662
  /**
659
- * Returns active dragger instance or `null` if there is no active dragger.
663
+ * Returns the active dragger instance, or `null` if there is no active dragger.
660
664
  */
661
665
  activeDragger(): IDragger | null {
662
666
  return this._activeDragger;
@@ -670,7 +674,8 @@ export class Viewer
670
674
  * - {@link ChangeActiveDraggerEvent | changeactivedragger}
671
675
  *
672
676
  * @param name - Dragger name. Can be one of the {@link draggers} list.
673
- * @returns Returns active dragger instance or `null` if there is no dragger with the given name.
677
+ * @returns Returns the new active dragger instance or `null` if there is no dragger with the
678
+ * given name.
674
679
  */
675
680
  setActiveDragger(name: string): IDragger | null {
676
681
  if (this._activeDragger?.name !== name) {
@@ -771,7 +776,7 @@ export class Viewer
771
776
  }
772
777
 
773
778
  /**
774
- * Returns `true` if current model is 3D model.
779
+ * Returns `true` if current opened model is 3D model.
775
780
  */
776
781
  is3D(): boolean {
777
782
  if (!this.visualizeJs) return false;
@@ -1053,7 +1058,7 @@ export class Viewer
1053
1058
  }
1054
1059
 
1055
1060
  /**
1056
- * Cancels asynchronous model loading started by {@link open | open()}.
1061
+ * Cancels asynchronous file loading started by {@link open | open()}.
1057
1062
  */
1058
1063
  cancel(): this {
1059
1064
  this._abortControllerForReferences?.abort();
@@ -1071,7 +1076,7 @@ export class Viewer
1071
1076
  }
1072
1077
 
1073
1078
  /**
1074
- * Unloads the model and clears the viewer and markups.
1079
+ * Unloads an open file and clears the canvas and markups.
1075
1080
  */
1076
1081
  clear(): this {
1077
1082
  if (!this.visualizeJs) return this;
@@ -1267,11 +1272,42 @@ export class Viewer
1267
1272
  }
1268
1273
 
1269
1274
  /**
1270
- * Executes the command denoted by the given command identifier.
1275
+ * Executes the command denoted by the given command. If the command is not found, tries to
1276
+ * set active dragger with the specified name.
1277
+ *
1278
+ * The following commands are registered by default:
1279
+ *
1280
+ * - `applyModelTransform`
1281
+ * - `autoTransformAllModelsToCentralPoint`
1282
+ * - `clearMarkup`
1283
+ * - `clearSlices`
1284
+ * - `createPreview`
1285
+ * - `explode`
1286
+ * - `getDefaultViewPositions`
1287
+ * - `getModels`
1288
+ * - `getSelected`
1289
+ * - `hideSelected`
1290
+ * - `isolateSelected`
1291
+ * - `regenerateAll`
1292
+ * - `resetView`
1293
+ * - `selectModel`
1294
+ * - `setActiveDragger`
1295
+ * - `setDefaultViewPosition`
1296
+ * - `setMarkupColor`
1297
+ * - `setSelected`
1298
+ * - `showAll`
1299
+ * - `unselect`
1300
+ * - `zoomToExtents`
1301
+ * - `zoomToObjects`
1302
+ * - `zoomToSelected`
1303
+ *
1304
+ * To register your own command use the {@link ICommands.registerCommand | registerCommand()}
1305
+ * method of the {@link commands} manager.
1271
1306
  *
1272
- * @param id - Identifier of the command to execute.
1273
- * @param args - Parameters passed to the command function.
1274
- * @returns A returned value of the given command. Returns `undefined` when the command doesn't exists.
1307
+ * @param id - Command ID or dragger name.
1308
+ * @param args - Parameters passed to the command handler function.
1309
+ * @returns Returns the result of the command handler function or new active dragger
1310
+ * instance. Returns `undefined` if neither the command nor the dragger exists.
1275
1311
  */
1276
1312
  executeCommand(id: string, ...args: any[]): any {
1277
1313
  return commands("VisualizeJS").executeCommand(id, this, ...args);