@inweb/viewer-visualize 27.1.0 → 27.1.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.
@@ -2876,13 +2876,13 @@ class InfoComponent {
2876
2876
 
2877
2877
  class RenderLoopComponent {
2878
2878
  constructor(viewer) {
2879
- this.animate = (time = 0) => {
2879
+ this.animate = (time) => {
2880
2880
  this.requestId = requestAnimationFrame(this.animate);
2881
2881
  this.viewer.render(time);
2882
2882
  this.viewer.emitEvent({ type: "animate", time });
2883
2883
  };
2884
2884
  this.viewer = viewer;
2885
- this.animate();
2885
+ this.requestId = requestAnimationFrame(this.animate);
2886
2886
  }
2887
2887
  dispose() {
2888
2888
  cancelAnimationFrame(this.requestId);
@@ -3282,8 +3282,8 @@ class VSFFileLoader extends Loader {
3282
3282
  this.viewer.models.push(modelImpl);
3283
3283
  this.viewer.syncOptions();
3284
3284
  this.viewer.syncOverlay();
3285
- this.viewer.update(true);
3286
3285
  this.viewer.emitEvent({ type: "databasechunk", data, file });
3286
+ this.viewer.update(true);
3287
3287
  return this;
3288
3288
  }
3289
3289
  }
@@ -3327,12 +3327,12 @@ class VSFCloudLoader extends Loader {
3327
3327
  this.viewer.models.push(modelImpl);
3328
3328
  this.viewer.syncOptions();
3329
3329
  this.viewer.syncOverlay();
3330
- this.viewer.update(true);
3331
3330
  this.viewer.emitEvent({ type: "databasechunk", data, file: model.file, model });
3331
+ this.viewer.update(true);
3332
3332
  }
3333
3333
  else {
3334
- this.viewer.update();
3335
3334
  this.viewer.emitEvent({ type: "geometrychunk", data, file: model.file, model });
3335
+ this.viewer.update();
3336
3336
  }
3337
3337
  }
3338
3338
  return this;
@@ -3377,8 +3377,8 @@ class VSFXFileLoader extends Loader {
3377
3377
  this.viewer.models.push(modelImpl);
3378
3378
  this.viewer.syncOptions();
3379
3379
  this.viewer.syncOverlay();
3380
- this.viewer.update(true);
3381
3380
  this.viewer.emitEvent({ type: "databasechunk", data, file });
3381
+ this.viewer.update(true);
3382
3382
  return this;
3383
3383
  }
3384
3384
  }
@@ -3418,8 +3418,8 @@ class VSFXCloudLoader extends Loader {
3418
3418
  this.viewer.models.push(modelImpl);
3419
3419
  this.viewer.syncOptions();
3420
3420
  this.viewer.syncOverlay();
3421
- this.viewer.update(true);
3422
3421
  this.viewer.emitEvent({ type: "databasechunk", data, file: model.file, model });
3422
+ this.viewer.update(true);
3423
3423
  return this;
3424
3424
  }
3425
3425
  }
@@ -3468,12 +3468,12 @@ class VSFXCloudStreamingLoader extends Loader {
3468
3468
  this.viewer.models.push(modelImpl);
3469
3469
  this.viewer.syncOptions();
3470
3470
  this.viewer.syncOverlay();
3471
- this.viewer.update(true);
3472
3471
  this.viewer.emitEvent({ type: "databasechunk", data: chunk, file: model.file, model });
3472
+ this.viewer.update(true);
3473
3473
  }
3474
3474
  else {
3475
- this.viewer.update();
3476
3475
  this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
3476
+ this.viewer.update();
3477
3477
  }
3478
3478
  };
3479
3479
  await model.downloadResource(model.database, chunkLoadHandler, this.abortController.signal);
@@ -3526,12 +3526,12 @@ class VSFXCloudPartialLoader extends Loader {
3526
3526
  this.viewer.models.push(modelImpl);
3527
3527
  this.viewer.syncOptions();
3528
3528
  this.viewer.syncOverlay();
3529
- this.viewer.update(true);
3530
3529
  this.viewer.emitEvent({ type: "databasechunk", data: chunk, file: model.file, model });
3530
+ this.viewer.update(true);
3531
3531
  }
3532
3532
  else {
3533
- this.viewer.update();
3534
3533
  this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
3534
+ this.viewer.update();
3535
3535
  }
3536
3536
  };
3537
3537
  const downloadResourceRange = async (dataId, requestId, ranges) => {
@@ -4085,8 +4085,8 @@ class Viewer extends EventEmitter2 {
4085
4085
  this.syncOptions();
4086
4086
  this.syncOverlay();
4087
4087
  this._renderTime = performance.now();
4088
- this.render(this._renderTime);
4089
4088
  this.emitEvent({ type: "initialize" });
4089
+ this.update(true);
4090
4090
  return this;
4091
4091
  }
4092
4092
  dispose() {
@@ -4122,8 +4122,8 @@ class Viewer extends EventEmitter2 {
4122
4122
  this.canvas.style.height = height + "px";
4123
4123
  }
4124
4124
  this._viewer.resize(0, this.canvas.width, this.canvas.height, 0);
4125
- this.update(true);
4126
4125
  this.emitEvent({ type: "resize", width, height });
4126
+ this.update(true);
4127
4127
  }
4128
4128
  resize() {
4129
4129
  console.warn("Viewer.resize() has been deprecated since 26.9 and will be removed in a future release, use Viewer.setSize() instead.");
@@ -4190,6 +4190,8 @@ class Viewer extends EventEmitter2 {
4190
4190
  return this;
4191
4191
  }
4192
4192
  applyModelTransformMatrix(model) {
4193
+ if (!this.visualizeJs)
4194
+ return;
4193
4195
  this.executeCommand("applyModelTransform", model);
4194
4196
  }
4195
4197
  applySceneGraphSettings(options = this.options) {
@@ -4218,10 +4220,8 @@ class Viewer extends EventEmitter2 {
4218
4220
  if (model && typeof model.database === "string") {
4219
4221
  file = model.file;
4220
4222
  }
4221
- if (!model)
4222
- throw new Error(`Format not supported`);
4223
4223
  let format = params.format;
4224
- if (!format && typeof file["type"] === "string")
4224
+ if (!format && file && typeof file["type"] === "string")
4225
4225
  format = file["type"].split(".").pop();
4226
4226
  if (!format && typeof file === "string")
4227
4227
  format = file.split(".").pop();
@@ -4229,22 +4229,21 @@ class Viewer extends EventEmitter2 {
4229
4229
  format = file.name.split(".").pop();
4230
4230
  const loader = loaders.createLoader(this, model, format);
4231
4231
  if (!loader)
4232
- throw new Error(`Format not supported`);
4232
+ throw new Error(`Format not supported (${format})`);
4233
4233
  this.loaders.push(loader);
4234
4234
  this.emitEvent({ type: "geometrystart", file, model });
4235
4235
  try {
4236
4236
  await this.loadReferences(model);
4237
4237
  await loader.load(model, format, params);
4238
+ this.applyModelTransformMatrix(model);
4239
+ this.applySceneGraphSettings();
4238
4240
  }
4239
4241
  catch (error) {
4240
4242
  this.emitEvent({ type: "geometryerror", data: error, file, model });
4241
4243
  throw error;
4242
4244
  }
4243
4245
  this.emitEvent({ type: "geometryend", file, model });
4244
- if (this.visualizeJs) {
4245
- this.applyModelTransformMatrix(model);
4246
- this.applySceneGraphSettings();
4247
- }
4246
+ this.update(true);
4248
4247
  return this;
4249
4248
  }
4250
4249
  openVsfFile(buffer) {
@@ -4261,7 +4260,6 @@ class Viewer extends EventEmitter2 {
4261
4260
  visViewer.parseFile(data);
4262
4261
  this.syncOptions();
4263
4262
  this.syncOverlay();
4264
- this.update(true);
4265
4263
  this.emitEvent({ type: "geometryprogress", data: 1, file: "", buffer });
4266
4264
  this.emitEvent({ type: "databasechunk", data, file: "", buffer });
4267
4265
  }
@@ -4270,6 +4268,7 @@ class Viewer extends EventEmitter2 {
4270
4268
  throw error;
4271
4269
  }
4272
4270
  this.emitEvent({ type: "geometryend", file: "", buffer });
4271
+ this.update(true);
4273
4272
  return this;
4274
4273
  }
4275
4274
  openVsfxFile(buffer) {
@@ -4286,7 +4285,6 @@ class Viewer extends EventEmitter2 {
4286
4285
  visViewer.parseVsfx(data);
4287
4286
  this.syncOptions();
4288
4287
  this.syncOverlay();
4289
- this.update(true);
4290
4288
  this.emitEvent({ type: "geometryprogress", data: 1, file: "", buffer });
4291
4289
  this.emitEvent({ type: "databasechunk", data, file: "", buffer });
4292
4290
  }
@@ -4295,6 +4293,7 @@ class Viewer extends EventEmitter2 {
4295
4293
  throw error;
4296
4294
  }
4297
4295
  this.emitEvent({ type: "geometryend", file: "", buffer });
4296
+ this.update(true);
4298
4297
  return this;
4299
4298
  }
4300
4299
  cancel() {
@@ -4321,8 +4320,8 @@ class Viewer extends EventEmitter2 {
4321
4320
  visViewer.createLocalDatabase();
4322
4321
  this.syncOptions();
4323
4322
  this.syncOverlay();
4324
- this.update(true);
4325
4323
  this.emitEvent({ type: "clear" });
4324
+ this.update(true);
4326
4325
  return this;
4327
4326
  }
4328
4327
  is3D() {
@@ -4615,7 +4614,7 @@ class Viewer extends EventEmitter2 {
4615
4614
  this.syncOverlay();
4616
4615
  this.setActiveDragger(draggerName);
4617
4616
  this.emitEvent({ type: "drawviewpoint", data: viewpoint });
4618
- this.update();
4617
+ this.update(true);
4619
4618
  }
4620
4619
  createViewpoint() {
4621
4620
  if (!this.visualizeJs)