@inweb/viewer-visualize 25.8.2 → 25.8.4

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.
@@ -18,6 +18,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
18
18
  protected _options: Options;
19
19
  protected _visualizeJsUrl: string;
20
20
  protected _visualizeJs: any;
21
+ protected _visualizeTimestamp: number;
21
22
  private canvaseventlistener;
22
23
  draggerFactory: Map<string, typeof Dragger>;
23
24
  canvasEvents: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/viewer-visualize",
3
- "version": "25.8.2",
3
+ "version": "25.8.4",
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",
@@ -29,10 +29,10 @@
29
29
  "docs": "typedoc"
30
30
  },
31
31
  "dependencies": {
32
- "@inweb/client": "~25.8.2",
33
- "@inweb/eventemitter2": "~25.8.2",
34
- "@inweb/markup": "~25.8.2",
35
- "@inweb/viewer-core": "~25.8.2"
32
+ "@inweb/client": "~25.8.4",
33
+ "@inweb/eventemitter2": "~25.8.4",
34
+ "@inweb/markup": "~25.8.4",
35
+ "@inweb/viewer-core": "~25.8.4"
36
36
  },
37
37
  "visualizeJS": "https://opencloud.azureedge.net/libs/visualizejs/master/Visualize.js"
38
38
  }
@@ -79,6 +79,7 @@ export class Viewer
79
79
  protected _options: Options;
80
80
  protected _visualizeJsUrl = "";
81
81
  protected _visualizeJs: any;
82
+ protected _visualizeTimestamp: number;
82
83
 
83
84
  private canvaseventlistener: (event: Event) => void;
84
85
 
@@ -215,12 +216,22 @@ export class Viewer
215
216
  canvas.width = canvas.clientWidth * window.devicePixelRatio;
216
217
  canvas.height = canvas.clientHeight * window.devicePixelRatio;
217
218
 
219
+ this._visualizeTimestamp = Date.now();
220
+ const visualizeTimestamp = this._visualizeTimestamp;
221
+
218
222
  const visualizeJs: any = await loadVisualizeJs(this.visualizeJsUrl, (event) => {
219
223
  const { loaded, total } = event;
220
224
  if (onProgress) onProgress(new ProgressEvent("progress", { lengthComputable: true, loaded, total }));
221
225
  this.emitEvent({ type: "initializeprogress", data: loaded / total, loaded, total });
222
226
  });
223
227
 
228
+ if (visualizeTimestamp !== this._visualizeTimestamp) {
229
+ console.error(
230
+ "Viewer error: dispose() was called before initialize() completed. Are you using React strict mode?"
231
+ );
232
+ return this;
233
+ }
234
+
224
235
  this._visualizeJs = visualizeJs;
225
236
  this.visualizeJs.canvas = canvas;
226
237
  this.visualizeJs.Viewer.create();
@@ -284,6 +295,7 @@ export class Viewer
284
295
 
285
296
  if (this._visualizeJs) this._visualizeJs.getViewer().clear();
286
297
  this._visualizeJs = undefined;
298
+ this._visualizeTimestamp = undefined;
287
299
 
288
300
  return this;
289
301
  }