@inweb/client 25.3.9 → 25.3.10

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,7 +1,5 @@
1
1
  import { EventEmitter2 } from "../Viewer/EventEmitter2";
2
2
  import { ClientEventMap } from "./ClientEvents";
3
- import { Options } from "../Viewer/Options";
4
- import { OptionsEventMap } from "../Viewer/OptionsEvents";
5
3
  import { Assembly } from "./Assembly";
6
4
  import { File } from "./File";
7
5
  import { Job } from "./Job";
@@ -12,8 +10,7 @@ import { User } from "./User";
12
10
  * Server](https://cloud.opendesign.com/docs/index.html#/opencloud_server) resources like
13
11
  * Projects, Files, Issues etc.
14
12
  */
15
- export declare class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
16
- private _options;
13
+ export declare class Client extends EventEmitter2<ClientEventMap> {
17
14
  private _serverUrl;
18
15
  private _httpClient;
19
16
  private _user;
@@ -33,10 +30,10 @@ export declare class Client extends EventEmitter2<ClientEventMap & OptionsEventM
33
30
  */
34
31
  get serverUrl(): string;
35
32
  /**
36
- * `VisualizeJS` parameters. Changes to these parameters are automatically applied to
37
- * `Viewer` instances associated with that client.
33
+ * Deprecated since `25.3`. Use [Viewer.options]{@link Viewer#options} instead to change
34
+ * Viewer parameters.
38
35
  */
39
- get options(): Options;
36
+ get options(): any;
40
37
  /**
41
38
  * Change the client configuration parameters.
42
39
  *
@@ -223,7 +220,7 @@ export declare class Client extends EventEmitter2<ClientEventMap & OptionsEventM
223
220
  * @param params - An object containing upload parameters.
224
221
  * @param params.geometry=true - Create job to extract file geometry data. Can be:
225
222
  *
226
- * - `true` - Extract file geometry data into type, defined by [options]{@link Client#options}.
223
+ * - `true` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
227
224
  * - `vsfx` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
228
225
  * - `gltf` - Extract file geometry data into `glTF` to open the file in `Three.js` viewer.
229
226
  *
@@ -25,7 +25,6 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventM
25
25
  protected _options: Options;
26
26
  protected _visualizeJsUrl: string;
27
27
  protected _abortControllerForReferences: AbortController | undefined;
28
- private clientoptionschange;
29
28
  private canvaseventlistener;
30
29
  draggerFactory: Map<string, typeof OdBaseDragger>;
31
30
  canvasEvents: string[];
@@ -58,11 +57,6 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventM
58
57
  });
59
58
  /**
60
59
  * `VisualizeJS` parameters.
61
- *
62
- * Use this only for standalone viewer instances. Use {@link Client#options | Client.options}
63
- * instead if the viewer was created with a `Client` reference using
64
- * {@link Viewer | Viewer.create(client)}. Changes in client options will be automatically
65
- * applied to the viewer options.
66
60
  */
67
61
  get options(): Options;
68
62
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/client",
3
- "version": "25.3.9",
3
+ "version": "25.3.10",
4
4
  "description": "Client.js is a library for implementing BIM Project management applications.",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
package/src/Api/Client.ts CHANGED
@@ -25,8 +25,6 @@ import { EventEmitter2 } from "../Viewer/EventEmitter2";
25
25
  import { IHttpClient } from "./IHttpClient";
26
26
  import { HttpClient } from "./HttpClient";
27
27
  import { ClientEventMap } from "./ClientEvents";
28
- import { Options } from "../Viewer/Options";
29
- import { OptionsEventMap } from "../Viewer/OptionsEvents";
30
28
  import { Assembly } from "./Assembly";
31
29
  import { File } from "./File";
32
30
  import { Job } from "./Job";
@@ -39,8 +37,7 @@ import { downloadProgress, json, text, parseArgs } from "./impl/Utils";
39
37
  * Server](https://cloud.opendesign.com/docs/index.html#/opencloud_server) resources like
40
38
  * Projects, Files, Issues etc.
41
39
  */
42
- export class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
43
- private _options: Options;
40
+ export class Client extends EventEmitter2<ClientEventMap> {
44
41
  private _serverUrl: string;
45
42
 
46
43
  private _httpClient: IHttpClient;
@@ -56,7 +53,6 @@ export class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
56
53
  super();
57
54
  this.configure(params);
58
55
  this.eventEmitter = this;
59
- this._options = new Options(this);
60
56
  this._user = null;
61
57
  }
62
58
 
@@ -70,11 +66,47 @@ export class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
70
66
  }
71
67
 
72
68
  /**
73
- * `VisualizeJS` parameters. Changes to these parameters are automatically applied to
74
- * `Viewer` instances associated with that client.
75
- */
76
- get options(): Options {
77
- return this._options;
69
+ * Deprecated since `25.3`. Use [Viewer.options]{@link Viewer#options} instead to change
70
+ * Viewer parameters.
71
+ */
72
+ get options(): any {
73
+ console.warn(
74
+ "Client.options has been deprecated since 25.3 and will be removed in a future release, use Viewer.options instead."
75
+ );
76
+ const data = {
77
+ showWCS: true,
78
+ cameraAnimation: true,
79
+ antialiasing: true,
80
+ groundShadow: false,
81
+ shadows: false,
82
+ cameraAxisXSpeed: 4,
83
+ cameraAxisYSpeed: 1,
84
+ ambientOcclusion: false,
85
+ enableStreamingMode: true,
86
+ enablePartialMode: false,
87
+ memoryLimit: 3294967296,
88
+ cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },
89
+ edgesColor: { r: 0xff, g: 0x98, b: 0x00 },
90
+ facesColor: { r: 0xff, g: 0x98, b: 0x00 },
91
+ edgesVisibility: true,
92
+ edgesOverlap: true,
93
+ facesOverlap: false,
94
+ facesTransparancy: 200,
95
+ enableCustomHighlight: true,
96
+ sceneGraph: false,
97
+ edgeModel: true,
98
+ reverseZoomWheel: false,
99
+ enableZoomWheel: true,
100
+ enableGestures: true,
101
+ };
102
+ return {
103
+ ...data,
104
+ data,
105
+ defaults: () => data,
106
+ resetToDefaults: () => {},
107
+ saveToStorage: () => {},
108
+ loadFromStorage: () => {},
109
+ };
78
110
  }
79
111
 
80
112
  /**
@@ -402,7 +434,7 @@ export class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
402
434
  * @param params - An object containing upload parameters.
403
435
  * @param params.geometry=true - Create job to extract file geometry data. Can be:
404
436
  *
405
- * - `true` - Extract file geometry data into type, defined by [options]{@link Client#options}.
437
+ * - `true` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
406
438
  * - `vsfx` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
407
439
  * - `gltf` - Extract file geometry data into `glTF` to open the file in `Three.js` viewer.
408
440
  *
@@ -441,7 +473,7 @@ export class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
441
473
  .then((xhr: XMLHttpRequest) => JSON.parse(xhr.responseText))
442
474
  .then((data) => new File(data, this._httpClient));
443
475
 
444
- const geometryType = typeof params.geometry === "string" ? params.geometry : this.options.geometryType;
476
+ const geometryType = typeof params.geometry === "string" ? params.geometry : "vsfx";
445
477
 
446
478
  const jobs: string[] = [];
447
479
  if (params.geometry) jobs.push((await result.extractGeometry(geometryType)).outputFormat);
@@ -25,7 +25,7 @@ import { IViewer } from "./IViewer";
25
25
  import { commands } from "./Commands";
26
26
  import { EventEmitter2 } from "./EventEmitter2";
27
27
  import { ViewerEventMap } from "./ViewerEvents";
28
- import { OptionsEventMap, OptionsChangeEvent } from "./OptionsEvents";
28
+ import { OptionsEventMap } from "./OptionsEvents";
29
29
  import { CANVAS_EVENTS } from "./CanvasEvents";
30
30
 
31
31
  import { OdBaseDragger } from "./Draggers/Common/OdBaseDragger";
@@ -76,7 +76,6 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
76
76
  protected _visualizeJsUrl: string;
77
77
  protected _abortControllerForReferences: AbortController | undefined;
78
78
 
79
- private clientoptionschange: (event: OptionsChangeEvent) => void;
80
79
  private canvaseventlistener: (event: Event) => void;
81
80
 
82
81
  public draggerFactory: Map<string, typeof OdBaseDragger>;
@@ -117,7 +116,6 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
117
116
  this._options = new Options(this);
118
117
 
119
118
  this.client = client;
120
- this.clientoptionschange = (event: OptionsChangeEvent) => (this._options.data = event.data.data);
121
119
 
122
120
  this._activeDragger = null;
123
121
  this._renderTime = 0;
@@ -154,11 +152,6 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
154
152
 
155
153
  /**
156
154
  * `VisualizeJS` parameters.
157
- *
158
- * Use this only for standalone viewer instances. Use {@link Client#options | Client.options}
159
- * instead if the viewer was created with a `Client` reference using
160
- * {@link Viewer | Viewer.create(client)}. Changes in client options will be automatically
161
- * applied to the viewer options.
162
155
  */
163
156
  get options(): Options {
164
157
  return this._options;
@@ -207,10 +200,6 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
207
200
  * of the `VisualizeJS` library. Retrieves {@link event:visualizeprogress | visualizeprogress} event.
208
201
  */
209
202
  async initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this> {
210
- if (this.client) {
211
- this.client.addEventListener("optionschange", this.clientoptionschange);
212
- this.options.data = this.client.options.data;
213
- }
214
203
  this.addEventListener("optionschange", (event) => this.syncOptions(event.data));
215
204
 
216
205
  if (canvas.style.width === "" && canvas.style.height === "") {
@@ -287,8 +276,6 @@ export class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventMap> impl
287
276
  this.visualizeJs?.getViewer().clear();
288
277
  this.visualizeJs = undefined;
289
278
 
290
- this.client?.removeEventListener("optionschange", this.clientoptionschange);
291
-
292
279
  return this;
293
280
  }
294
281