@inweb/viewer-three 27.5.0 → 27.6.0

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.
Files changed (53) hide show
  1. package/dist/extensions/components/LightHelperComponent.js +1 -1
  2. package/dist/extensions/components/LightHelperComponent.js.map +1 -1
  3. package/dist/extensions/components/LightHelperComponent.min.js +1 -1
  4. package/dist/extensions/components/LightHelperComponent.module.js +1 -1
  5. package/dist/extensions/components/LightHelperComponent.module.js.map +1 -1
  6. package/dist/extensions/components/StatsPanelComponent.js +0 -1
  7. package/dist/extensions/components/StatsPanelComponent.js.map +1 -1
  8. package/dist/extensions/components/StatsPanelComponent.min.js +1 -1
  9. package/dist/extensions/components/StatsPanelComponent.module.js +0 -1
  10. package/dist/extensions/components/StatsPanelComponent.module.js.map +1 -1
  11. package/dist/extensions/loaders/GLTFCloudLoader.js +7 -2
  12. package/dist/extensions/loaders/GLTFCloudLoader.js.map +1 -1
  13. package/dist/extensions/loaders/GLTFCloudLoader.min.js +1 -1
  14. package/dist/extensions/loaders/GLTFCloudLoader.module.js +7 -2
  15. package/dist/extensions/loaders/GLTFCloudLoader.module.js.map +1 -1
  16. package/dist/extensions/loaders/GLTFFileLoader.js +2 -1
  17. package/dist/extensions/loaders/GLTFFileLoader.js.map +1 -1
  18. package/dist/extensions/loaders/GLTFFileLoader.min.js +1 -1
  19. package/dist/extensions/loaders/GLTFFileLoader.module.js +2 -1
  20. package/dist/extensions/loaders/GLTFFileLoader.module.js.map +1 -1
  21. package/dist/extensions/loaders/IFCXLoader.js +10 -5
  22. package/dist/extensions/loaders/IFCXLoader.js.map +1 -1
  23. package/dist/extensions/loaders/IFCXLoader.min.js +1 -1
  24. package/dist/extensions/loaders/IFCXLoader.module.js +10 -5
  25. package/dist/extensions/loaders/IFCXLoader.module.js.map +1 -1
  26. package/dist/viewer-three.js +161 -157
  27. package/dist/viewer-three.js.map +1 -1
  28. package/dist/viewer-three.min.js +3 -3
  29. package/dist/viewer-three.module.js +68 -53
  30. package/dist/viewer-three.module.js.map +1 -1
  31. package/extensions/components/LightHelperComponent.ts +1 -1
  32. package/extensions/components/StatsPanelComponent.ts +0 -1
  33. package/extensions/loaders/GLTFCloudLoader.ts +8 -2
  34. package/extensions/loaders/GLTFFileLoader.ts +3 -2
  35. package/extensions/loaders/IFCX/IFCXFileLoader.ts +11 -5
  36. package/lib/Viewer/Viewer.d.ts +1 -1
  37. package/lib/Viewer/measurement/Snapper.d.ts +1 -1
  38. package/package.json +5 -5
  39. package/src/Viewer/Viewer.ts +14 -16
  40. package/src/Viewer/commands/GetSelected2.ts +1 -1
  41. package/src/Viewer/commands/SetSelected.ts +1 -1
  42. package/src/Viewer/components/BackgroundComponent.ts +1 -1
  43. package/src/Viewer/components/CameraComponent.ts +1 -1
  44. package/src/Viewer/components/CanvasRemoveComponent.ts +0 -1
  45. package/src/Viewer/components/HighlighterUtils.ts +2 -2
  46. package/src/Viewer/components/SelectionComponent.ts +4 -2
  47. package/src/Viewer/helpers/SectionsHelper.js +4 -8
  48. package/src/Viewer/helpers/WCSHelper.ts +7 -5
  49. package/src/Viewer/loaders/DynamicGltfLoader/DynamicModelImpl.ts +19 -14
  50. package/src/Viewer/loaders/GLTFBinaryParser.ts +2 -2
  51. package/src/Viewer/loaders/GLTFFileDynamicLoader.ts +2 -2
  52. package/src/Viewer/measurement/Snapper.ts +2 -2
  53. package/src/Viewer/models/ModelImpl.ts +38 -25
@@ -159,8 +159,7 @@
159
159
  this.abortController = new AbortController();
160
160
  }
161
161
  dispose() {
162
- this.abortController.abort();
163
- this.abortController = undefined;
162
+ this.cancel();
164
163
  }
165
164
  isSupport(file, format) {
166
165
  return false;
@@ -179,10 +178,10 @@
179
178
  extractFileName(file) {
180
179
  const regex = /[^/\\?#:]+(?=\?|#|$)/;
181
180
  if (typeof file === "string")
182
- return (file.match(regex) || [])[0];
181
+ return (file.match(regex) || [])[0] || "";
183
182
  else if (file instanceof globalThis.File)
184
- return (file.name.match(regex) || [])[0];
185
- return undefined;
183
+ return (file.name.match(regex) || [])[0] || "";
184
+ return "";
186
185
  }
187
186
  };
188
187
  class Loaders {
@@ -302,23 +301,36 @@
302
301
  }
303
302
  }
304
303
  resetToDefaults(fields) {
304
+ const defaults = Options.defaults();
305
305
  if (fields !== undefined) {
306
- const defaults = Options.defaults();
307
- const resetData = fields.reduce((acc, field) => {
308
- acc[field] = defaults[field];
309
- return acc;
310
- }, {});
311
- this.data = { ...this.data, ...resetData };
306
+ const resetData = {};
307
+ for (const field of fields) {
308
+ if (field in defaults)
309
+ resetData[field] = defaults[field];
310
+ }
311
+ this.data = resetData;
312
312
  }
313
313
  else {
314
- this.data = { ...this.data, ...Options.defaults() };
314
+ this.data = defaults;
315
+ }
316
+ }
317
+ setProperty(key, value = Options.defaults()[key]) {
318
+ if (this._data[key] !== value) {
319
+ this._data[key] = value;
320
+ this.change();
315
321
  }
316
322
  }
317
323
  get data() {
318
324
  return this._data;
319
325
  }
320
326
  set data(value) {
321
- this._data = { ...Options.defaults(), ...this._data, ...value };
327
+ const defaults = Options.defaults();
328
+ const merged = { ...defaults, ...this._data, ...value };
329
+ for (const key of Object.keys(defaults)) {
330
+ if (merged[key] === undefined)
331
+ merged[key] = defaults[key];
332
+ }
333
+ this._data = merged;
322
334
  if (this._data.enablePartialMode) {
323
335
  this._data.enableStreamingMode = true;
324
336
  this._data.sceneGraph = false;
@@ -335,84 +347,74 @@
335
347
  return this._data.showWCS;
336
348
  }
337
349
  set showWCS(value) {
338
- this._data.showWCS = value;
339
- this.change();
350
+ this.setProperty("showWCS", value);
340
351
  }
341
352
  get cameraAnimation() {
342
353
  return this._data.cameraAnimation;
343
354
  }
344
355
  set cameraAnimation(value) {
345
- this._data.cameraAnimation = value;
346
- this.change();
356
+ this.setProperty("cameraAnimation", value);
347
357
  }
348
358
  get antialiasing() {
349
359
  return this._data.antialiasing;
350
360
  }
351
361
  set antialiasing(value) {
352
- this._data.antialiasing = value;
353
- this.change();
362
+ this.setProperty("antialiasing", value);
354
363
  }
355
364
  get groundShadow() {
356
365
  return this._data.groundShadow;
357
366
  }
358
367
  set groundShadow(value) {
359
- this._data.groundShadow = value;
360
- this.change();
368
+ this.setProperty("groundShadow", value);
361
369
  }
362
370
  get shadows() {
363
371
  return this._data.shadows;
364
372
  }
365
373
  set shadows(value) {
366
- this._data.shadows = value;
367
- this.change();
374
+ this.setProperty("shadows", value);
368
375
  }
369
376
  get cameraAxisXSpeed() {
370
377
  return this._data.cameraAxisXSpeed;
371
378
  }
372
379
  set cameraAxisXSpeed(value) {
373
- this._data.cameraAxisXSpeed = value;
374
- this.change();
380
+ this.setProperty("cameraAxisXSpeed", value);
375
381
  }
376
382
  get cameraAxisYSpeed() {
377
383
  return this._data.cameraAxisYSpeed;
378
384
  }
379
385
  set cameraAxisYSpeed(value) {
380
- this.cameraAxisYSpeed = value;
381
- this.change();
386
+ this.setProperty("cameraAxisYSpeed", value);
382
387
  }
383
388
  get ambientOcclusion() {
384
389
  return this._data.ambientOcclusion;
385
390
  }
386
391
  set ambientOcclusion(value) {
387
- this._data.ambientOcclusion = value;
388
- this.change();
392
+ this.setProperty("ambientOcclusion", value);
389
393
  }
390
394
  get enableStreamingMode() {
391
395
  return this._data.enableStreamingMode;
392
396
  }
393
397
  set enableStreamingMode(value) {
394
- this._data.enableStreamingMode = value;
395
- if (!value)
396
- this._data.enablePartialMode = false;
397
- this.change();
398
+ this.setProperty("enableStreamingMode", value);
399
+ if (!value) {
400
+ this.setProperty("enablePartialMode", false);
401
+ }
398
402
  }
399
403
  get enablePartialMode() {
400
404
  return this._data.enablePartialMode;
401
405
  }
402
406
  set enablePartialMode(value) {
403
- this._data.enablePartialMode = value;
407
+ this.setProperty("enablePartialMode", value);
404
408
  if (value) {
405
- this._data.enableStreamingMode = true;
406
- this._data.sceneGraph = false;
409
+ this.setProperty("enableStreamingMode", true);
410
+ this.setProperty("sceneGraph", false);
407
411
  }
408
- this.change();
409
412
  }
410
413
  get memoryLimit() {
411
414
  return this._data.memoryLimit;
412
415
  }
413
416
  set memoryLimit(value) {
414
- this._data.memoryLimit = value;
415
- this.change();
417
+ this.setProperty("memoryLimit", value);
416
418
  }
417
419
  get cuttingPlaneFillColor() {
418
420
  console.warn("Options.cuttingPlaneFillColor has been deprecated since 27.5 and will be removed in a future release, use sectionFillColor instead");
@@ -424,189 +426,176 @@
424
426
  }
425
427
  set cuttingPlaneFillColor(value) {
426
428
  console.warn("Options.cuttingPlaneFillColor has been deprecated since 27.5 and will be removed in a future release, use sectionFillColor instead");
427
- this._data.sectionFillColor = {
429
+ this.setProperty("sectionFillColor", {
428
430
  r: value.red,
429
431
  g: value.green,
430
432
  b: value.blue,
431
- };
432
- this.change();
433
+ });
433
434
  }
434
435
  get enableSectionFill() {
435
436
  return this._data.enableSectionFill;
436
437
  }
437
438
  set enableSectionFill(value) {
438
- this._data.enableSectionFill = value;
439
- this.change();
439
+ this.setProperty("enableSectionFill", value);
440
440
  }
441
441
  get sectionFillColor() {
442
442
  return this._data.sectionFillColor;
443
443
  }
444
444
  set sectionFillColor(value) {
445
- this._data.sectionFillColor = value;
446
- this.change();
445
+ this.setProperty("sectionFillColor", value);
447
446
  }
448
447
  get sectionUseObjectColor() {
449
448
  return this._data.sectionUseObjectColor;
450
449
  }
451
450
  set sectionUseObjectColor(value) {
452
- this._data.sectionUseObjectColor = value;
453
- this.change();
451
+ this.setProperty("sectionUseObjectColor", value);
454
452
  }
455
453
  get enableSectionHatch() {
456
454
  return this._data.enableSectionHatch;
457
455
  }
458
456
  set enableSectionHatch(value) {
459
- this._data.enableSectionHatch = value;
460
- this.change();
457
+ this.setProperty("enableSectionHatch", value);
461
458
  }
462
459
  get sectionHatchColor() {
463
460
  return this._data.sectionHatchColor;
464
461
  }
465
462
  set sectionHatchColor(value) {
466
- this._data.sectionHatchColor = value;
467
- this.change();
463
+ this.setProperty("sectionHatchColor", value);
468
464
  }
469
465
  get sectionHatchScale() {
470
466
  return this._data.sectionHatchScale;
471
467
  }
472
468
  set sectionHatchScale(value) {
473
- this._data.sectionHatchScale = value;
474
- this.change();
469
+ this.setProperty("sectionHatchScale", value);
475
470
  }
476
471
  get enableSectionOutline() {
477
472
  return this._data.enableSectionOutline;
478
473
  }
479
474
  set enableSectionOutline(value) {
480
- this._data.enableSectionOutline = value;
481
- this.change();
475
+ this.setProperty("enableSectionOutline", value);
482
476
  }
483
477
  get sectionOutlineColor() {
484
478
  return this._data.sectionOutlineColor;
485
479
  }
486
480
  set sectionOutlineColor(value) {
487
- this._data.sectionOutlineColor = value;
488
- this.change();
481
+ this.setProperty("sectionOutlineColor", value);
489
482
  }
490
483
  get sectionOutlineWidth() {
491
484
  return this._data.sectionOutlineWidth;
492
485
  }
493
486
  set sectionOutlineWidth(value) {
494
- this._data.sectionOutlineWidth = value;
495
- this.change();
487
+ this.setProperty("sectionOutlineWidth", value);
496
488
  }
497
489
  get edgesColor() {
498
490
  return this._data.edgesColor;
499
491
  }
500
492
  set edgesColor(value) {
501
- this._data.edgesColor = value;
502
- this.change();
493
+ this.setProperty("edgesColor", value);
503
494
  }
504
495
  get facesColor() {
505
496
  return this._data.facesColor;
506
497
  }
507
498
  set facesColor(value) {
508
- this._data.facesColor = value;
509
- this.change();
499
+ this.setProperty("facesColor", value);
510
500
  }
511
501
  get edgesVisibility() {
512
502
  return this._data.edgesVisibility;
513
503
  }
514
504
  set edgesVisibility(value) {
515
- this._data.edgesVisibility = value;
516
- this.change();
505
+ this.setProperty("edgesVisibility", value);
517
506
  }
518
507
  get edgesOverlap() {
519
508
  return this._data.edgesOverlap;
520
509
  }
521
510
  set edgesOverlap(value) {
522
- this._data.edgesOverlap = value;
523
- this.change();
511
+ this.setProperty("edgesOverlap", value);
524
512
  }
525
513
  get facesOverlap() {
526
514
  return this._data.facesOverlap;
527
515
  }
528
516
  set facesOverlap(value) {
529
- this._data.facesOverlap = value;
530
- this.change();
517
+ this.setProperty("facesOverlap", value);
531
518
  }
532
519
  get facesTransparancy() {
533
520
  return this._data.facesTransparancy;
534
521
  }
535
522
  set facesTransparancy(value) {
536
- this._data.facesTransparancy = value;
537
- this.change();
523
+ this.setProperty("facesTransparancy", value);
538
524
  }
539
525
  get enableCustomHighlight() {
540
526
  return this._data.enableCustomHighlight;
541
527
  }
542
528
  set enableCustomHighlight(value) {
543
- this._data.enableCustomHighlight = value;
544
- this.change();
529
+ this.setProperty("enableCustomHighlight", value);
545
530
  }
546
531
  get sceneGraph() {
547
532
  return this._data.sceneGraph;
548
533
  }
549
534
  set sceneGraph(value) {
550
- this._data.sceneGraph = value;
551
- if (value)
552
- this._data.enablePartialMode = false;
553
- this.change();
535
+ this.setProperty("sceneGraph", value);
536
+ if (value) {
537
+ this.setProperty("enablePartialMode", false);
538
+ }
554
539
  }
555
540
  get edgeModel() {
556
541
  return Boolean(this._data.edgeModel);
557
542
  }
558
543
  set edgeModel(value) {
559
- this._data.edgeModel = Boolean(value);
560
- this.change();
544
+ this.setProperty("edgeModel", value);
561
545
  }
562
546
  get reverseZoomWheel() {
563
547
  return this._data.reverseZoomWheel;
564
548
  }
565
549
  set reverseZoomWheel(value) {
566
- this._data.reverseZoomWheel = !!value;
567
- this.change();
550
+ this.setProperty("reverseZoomWheel", value);
568
551
  }
569
552
  get enableZoomWheel() {
570
553
  return this._data.enableZoomWheel;
571
554
  }
572
555
  set enableZoomWheel(value) {
573
- this._data.enableZoomWheel = !!value;
574
- this.change();
556
+ this.setProperty("enableZoomWheel", value);
575
557
  }
576
558
  get enableGestures() {
577
559
  return this._data.enableGestures;
578
560
  }
579
561
  set enableGestures(value) {
580
- this._data.enableGestures = !!value;
581
- this.change();
562
+ this.setProperty("enableGestures", value);
582
563
  }
583
564
  get geometryType() {
584
565
  return this._data.geometryType;
585
566
  }
586
567
  set geometryType(value) {
587
- this._data.geometryType = value;
588
- this.change();
568
+ this.setProperty("geometryType", value);
589
569
  }
590
570
  get rulerUnit() {
591
571
  return this._data.rulerUnit;
592
572
  }
593
573
  set rulerUnit(value) {
594
- this._data.rulerUnit = value;
595
- this.change();
574
+ this.setProperty("rulerUnit", value);
596
575
  }
597
576
  get rulerPrecision() {
598
577
  return this._data.rulerPrecision;
599
578
  }
600
579
  set rulerPrecision(value) {
601
- this._data.rulerPrecision = value;
602
- this.change();
580
+ this.setProperty("rulerPrecision", value);
603
581
  }
604
582
  get cameraMode() {
605
583
  return this._data.cameraMode || "perspective";
606
584
  }
607
585
  set cameraMode(value) {
608
- this._data.cameraMode = value;
609
- this.change();
586
+ this.setProperty("cameraMode", value);
587
+ }
588
+ get snapshotMimeType() {
589
+ return this._data.snapshotMimeType;
590
+ }
591
+ set snapshotMimeType(value) {
592
+ this.setProperty("snapshotMimeType", value);
593
+ }
594
+ get snapshotQuality() {
595
+ return this._data.snapshotQuality;
596
+ }
597
+ set snapshotQuality(value) {
598
+ this.setProperty("snapshotQuality", value);
610
599
  }
611
600
  }
612
601
  const CanvasEvents = [
@@ -34508,7 +34497,7 @@ void main() {
34508
34497
  const object = intersections[0].object;
34509
34498
  const intersectionPoint = intersections[0].point;
34510
34499
  const localPoint = object.worldToLocal(intersectionPoint.clone());
34511
- let snapPoint;
34500
+ let snapPoint = undefined;
34512
34501
  let snapDistance = this.getDetectRadius(intersectionPoint);
34513
34502
  const geometry = object.geometry;
34514
34503
  const positions = geometry.attributes.position.array;
@@ -36393,7 +36382,7 @@ void main() {
36393
36382
  }
36394
36383
  dispose() {
36395
36384
  this.viewer.removeEventListener("optionschange", this.syncOptions);
36396
- this.viewer.scene.background = undefined;
36385
+ this.viewer.scene.background = null;
36397
36386
  }
36398
36387
  }
36399
36388
 
@@ -36469,7 +36458,7 @@ void main() {
36469
36458
  if (mode === this.getCameraMode(currentCamera))
36470
36459
  return;
36471
36460
  const target = this.viewer.target.clone();
36472
- let camera;
36461
+ let camera = null;
36473
36462
  if (currentCamera.isOrthographicCamera) {
36474
36463
  const fov = currentCamera.userData.fov || 45;
36475
36464
  const fieldHeight = (currentCamera.top - currentCamera.bottom) / currentCamera.zoom;
@@ -36760,7 +36749,6 @@ void main() {
36760
36749
  }
36761
36750
  dispose() {
36762
36751
  this.mutationObserver.disconnect();
36763
- this.mutationObserver = undefined;
36764
36752
  }
36765
36753
  }
36766
36754
 
@@ -38816,11 +38804,13 @@ void main() {
38816
38804
  canvas.width = 64;
38817
38805
  canvas.height = 64;
38818
38806
  const context = canvas.getContext("2d");
38819
- context.clearRect(0, 0, 64, 64);
38820
- context.font = "24px Arial";
38821
- context.textAlign = "center";
38822
- context.fillStyle = color.getStyle();
38823
- context.fillText(text, 32, 41);
38807
+ if (context) {
38808
+ context.clearRect(0, 0, 64, 64);
38809
+ context.font = "24px Arial";
38810
+ context.textAlign = "center";
38811
+ context.fillStyle = color.getStyle();
38812
+ context.fillText(text, 32, 41);
38813
+ }
38824
38814
  const texture = new CanvasTexture(canvas);
38825
38815
  texture.colorSpace = SRGBColorSpace;
38826
38816
  return new SpriteMaterial({ map: texture, toneMapped: false });
@@ -38949,8 +38939,8 @@ void main() {
38949
38939
  if (object.material)
38950
38940
  disposeMaterials(object.material);
38951
38941
  }
38952
- this.handleToObjects = undefined;
38953
- this.originalObjects = undefined;
38942
+ this.handleToObjects.clear();
38943
+ this.originalObjects.clear();
38954
38944
  this.scene.traverse(disposeObject);
38955
38945
  this.scene.clear();
38956
38946
  }
@@ -39216,44 +39206,54 @@ void main() {
39216
39206
  centersCache.set(handle, target.clone());
39217
39207
  return target;
39218
39208
  };
39219
- function calcExplodeDepth(object, depth) {
39220
- let result = depth;
39221
- object.children.forEach((x) => {
39222
- const objectDepth = calcExplodeDepth(x, depth + 1);
39223
- if (result < objectDepth)
39224
- result = objectDepth;
39225
- });
39209
+ const calcObjectOffset = (object, target) => {
39210
+ const parent = object.parent;
39211
+ if (!parent || parent.userData.originalCenter === undefined)
39212
+ return target;
39213
+ return target.subVectors(object.userData.originalCenter, parent.userData.originalCenter);
39214
+ };
39215
+ const calcObjectDepth = (object) => {
39216
+ if (object.userData.depth !== undefined)
39217
+ return object.userData.depth;
39218
+ const parent = object.parent;
39219
+ const depth = parent && object !== explodeRoot ? calcObjectDepth(parent) + 1 : 0;
39220
+ object.userData.depth = depth;
39226
39221
  object.userData.originalPosition = object.position.clone();
39227
39222
  object.userData.originalCenter = calcObjectCenter(object, new Vector3());
39228
- return result;
39229
- }
39223
+ object.userData.originalOffset = calcObjectOffset(object, new Vector3());
39224
+ return depth;
39225
+ };
39230
39226
  const explodeScale = scale / 100;
39231
39227
  const explodeRoot = this.scene;
39232
- if (!explodeRoot.userData.explodeDepth) {
39233
- explodeRoot.userData.explodeDepth = calcExplodeDepth(explodeRoot, 1);
39228
+ const explodeObjects = this.getObjects();
39229
+ if (explodeRoot.userData.explodeDepth === undefined) {
39230
+ let maxDepth = 0;
39231
+ explodeObjects.forEach((object) => {
39232
+ const depth = calcObjectDepth(object);
39233
+ if (depth > maxDepth)
39234
+ maxDepth = depth;
39235
+ });
39236
+ explodeRoot.userData.explodeDepth = maxDepth;
39234
39237
  }
39235
39238
  const maxDepth = explodeRoot.userData.explodeDepth;
39236
39239
  const scaledExplodeDepth = explodeScale * maxDepth + 1;
39237
39240
  const explodeDepth = 0 | scaledExplodeDepth;
39238
39241
  const currentSegmentFraction = scaledExplodeDepth - explodeDepth;
39239
- function explodeObject(object, depth) {
39242
+ const explodeObject = (object) => {
39240
39243
  if (object.isCamera)
39241
39244
  return;
39242
- if (object.userData.isHighlightWireframe)
39243
- return;
39244
39245
  object.position.copy(object.userData.originalPosition);
39246
+ const depth = object.userData.depth;
39245
39247
  if (depth > 0 && depth <= explodeDepth) {
39246
39248
  let objectScale = explodeScale * coeff;
39247
39249
  if (depth === explodeDepth)
39248
39250
  objectScale *= currentSegmentFraction;
39249
- const parentCenter = object.parent.userData.originalCenter;
39250
- const objectCenter = object.userData.originalCenter;
39251
- const localOffset = objectCenter.clone().sub(parentCenter).multiplyScalar(objectScale);
39252
- object.position.add(localOffset);
39251
+ object.position.addScaledVector(object.userData.originalOffset, objectScale);
39253
39252
  }
39254
- object.children.forEach((x) => explodeObject(x, depth + 1));
39255
- }
39256
- explodeObject(explodeRoot, 0);
39253
+ };
39254
+ explodeObjects.forEach((object) => {
39255
+ explodeObject(object);
39256
+ });
39257
39257
  this.scene.updateMatrixWorld();
39258
39258
  return this;
39259
39259
  }
@@ -39356,6 +39356,12 @@ void main() {
39356
39356
  centersCache.set(handle, target.clone());
39357
39357
  return target;
39358
39358
  };
39359
+ const calcObjectOffset = (object, target) => {
39360
+ const parent = object.parent;
39361
+ if (!parent || parent.userData.originalCenter === undefined)
39362
+ return target;
39363
+ return target.subVectors(object.userData.originalCenter, parent.userData.originalCenter);
39364
+ };
39359
39365
  const calcObjectDepth = (object) => {
39360
39366
  if (object.userData.depth !== undefined)
39361
39367
  return object.userData.depth;
@@ -39364,13 +39370,15 @@ void main() {
39364
39370
  object.userData.depth = depth;
39365
39371
  object.userData.originalPosition = object.position.clone();
39366
39372
  object.userData.originalCenter = calcObjectCenter(object, new Vector3());
39373
+ object.userData.originalOffset = calcObjectOffset(object, new Vector3());
39367
39374
  return depth;
39368
39375
  };
39369
39376
  const explodeScale = scale / 100;
39370
39377
  const explodeRoot = this.scene.children[0];
39371
- if (!explodeRoot.userData.explodeDepth) {
39378
+ const explodeObjects = this.getObjects();
39379
+ if (explodeRoot.userData.explodeDepth === undefined) {
39372
39380
  let maxDepth = 0;
39373
- this.gltfLoader.originalObjects.forEach((object) => {
39381
+ explodeObjects.forEach((object) => {
39374
39382
  const depth = calcObjectDepth(object);
39375
39383
  if (depth > maxDepth)
39376
39384
  maxDepth = depth;
@@ -39382,29 +39390,26 @@ void main() {
39382
39390
  const explodeDepth = 0 | scaledExplodeDepth;
39383
39391
  const currentSegmentFraction = scaledExplodeDepth - explodeDepth;
39384
39392
  const offsetCache = new Map();
39385
- const calcObjectOffset = (object, target) => {
39393
+ const calcExplodeOffset = (object, target) => {
39386
39394
  if (offsetCache.has(object))
39387
39395
  return target.copy(offsetCache.get(object));
39388
39396
  const parent = object.parent;
39389
39397
  if (parent && object !== explodeRoot)
39390
- calcObjectOffset(parent, target);
39398
+ calcExplodeOffset(parent, target);
39391
39399
  const depth = object.userData.depth;
39392
39400
  if (depth > 0 && depth <= explodeDepth) {
39393
39401
  let objectScale = explodeScale * coeff;
39394
39402
  if (depth === explodeDepth)
39395
39403
  objectScale *= currentSegmentFraction;
39396
- const parentCenter = parent.userData.originalCenter;
39397
- const objectCenter = object.userData.originalCenter;
39398
- const localOffset = objectCenter.clone().sub(parentCenter).multiplyScalar(objectScale);
39399
- target.add(localOffset);
39404
+ target.addScaledVector(object.userData.originalOffset, objectScale);
39400
39405
  }
39401
39406
  offsetCache.set(object, target.clone());
39402
39407
  return target;
39403
39408
  };
39404
39409
  const transformMap = new Map();
39405
- this.gltfLoader.originalObjects.forEach((object) => {
39406
- const globalOffset = calcObjectOffset(object, new Vector3());
39407
- transformMap.set(object, new Matrix4().makeTranslation(globalOffset));
39410
+ explodeObjects.forEach((object) => {
39411
+ const offset = calcExplodeOffset(object, new Vector3());
39412
+ transformMap.set(object, new Matrix4().makeTranslation(offset));
39408
39413
  });
39409
39414
  this.gltfLoader.applyObjectTransforms(transformMap);
39410
39415
  this.scene.updateMatrixWorld();
@@ -42763,10 +42768,10 @@ void main() {
42763
42768
  }
42764
42769
  offset += chunkLength;
42765
42770
  }
42766
- if (typeof this.content === "undefined") {
42771
+ if (this.content === undefined) {
42767
42772
  throw new Error("GLTFBinaryParser: JSON content not found.");
42768
42773
  }
42769
- if (typeof this.body === "undefined") {
42774
+ if (this.body === undefined) {
42770
42775
  throw new Error("GLTFBinaryParser: Binary buffer chunk not found or type not supported.");
42771
42776
  }
42772
42777
  }
@@ -44092,11 +44097,11 @@ void main() {
44092
44097
  if (this.manager)
44093
44098
  this.manager.dispose();
44094
44099
  }
44095
- isSupport(file, format) {
44100
+ isSupport(file, format = "") {
44096
44101
  return ((typeof file === "string" || file instanceof globalThis.File || file instanceof ArrayBuffer) &&
44097
44102
  /(gltf|glb)$/i.test(format));
44098
44103
  }
44099
- async load(file, format, params) {
44104
+ async load(file, format, params = {}) {
44100
44105
  this.manager = new GLTFLoadingManager(file, params);
44101
44106
  const scene = new Group$1();
44102
44107
  this.gltfLoader = new DynamicGltfLoader(this.viewer.camera, scene, this.viewer.renderer);
@@ -58476,8 +58481,8 @@ js: import "konva/skia-backend";
58476
58481
  this.lineWidth = 4;
58477
58482
  this.lineType = "solid";
58478
58483
  this.fontSize = 34;
58479
- this.changeActiveDragger = (event) => {
58480
- const draggerName = event.data;
58484
+ this.changeActiveDragger = ({ data }) => {
58485
+ const draggerName = data || "";
58481
58486
  this._markupContainer.className = this._container.className
58482
58487
  .split(" ")
58483
58488
  .filter((x) => !x.startsWith("oda-cursor-"))
@@ -58538,19 +58543,19 @@ js: import "konva/skia-backend";
58538
58543
  this._resizeObserver = new ResizeObserver(this.resizeContainer);
58539
58544
  this._resizeObserver.observe(container);
58540
58545
  if (this._viewer) {
58541
- this._viewer.addEventListener("changeactivedragger", this.changeActiveDragger);
58542
- this._viewer.addEventListener("pan", this.pan);
58543
- this._viewer.addEventListener("zoomat", this.zoomAt);
58544
- this._viewer.addEventListener("changecameramode", this.changeCameraMode);
58546
+ this._viewer.on("changeactivedragger", this.changeActiveDragger);
58547
+ this._viewer.on("pan", this.pan);
58548
+ this._viewer.on("zoomat", this.zoomAt);
58549
+ this._viewer.on("changecameramode", this.changeCameraMode);
58545
58550
  }
58546
58551
  }
58547
58552
  dispose() {
58548
58553
  var _a, _b;
58549
58554
  if (this._viewer) {
58550
- this._viewer.removeEventListener("changecameramode", this.changeCameraMode);
58551
- this._viewer.removeEventListener("zoomat", this.zoomAt);
58552
- this._viewer.removeEventListener("pan", this.pan);
58553
- this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
58555
+ this._viewer.off("changecameramode", this.changeCameraMode);
58556
+ this._viewer.off("zoomat", this.zoomAt);
58557
+ this._viewer.off("pan", this.pan);
58558
+ this._viewer.off("changeactivedragger", this.changeActiveDragger);
58554
58559
  }
58555
58560
  (_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
58556
58561
  this._resizeObserver = undefined;
@@ -59387,7 +59392,9 @@ js: import "konva/skia-backend";
59387
59392
  this.canvasEvents.forEach((x) => canvas.addEventListener(x, this.canvaseventlistener));
59388
59393
  this._markup.initialize(this.canvas, this.canvasEvents, this, this);
59389
59394
  for (const name of components.getComponents().keys()) {
59390
- this._components.push(components.createComponent(name, this));
59395
+ const component = components.createComponent(name, this);
59396
+ if (component)
59397
+ this._components.push(component);
59391
59398
  }
59392
59399
  this.syncOptions();
59393
59400
  this.syncOverlay();
@@ -59409,10 +59416,7 @@ js: import "konva/skia-backend";
59409
59416
  this.setActiveDragger();
59410
59417
  this._components.forEach((component) => component.dispose());
59411
59418
  this._components.length = 0;
59412
- if (this._markup) {
59413
- this._markup.dispose();
59414
- this._markup = undefined;
59415
- }
59419
+ this._markup.dispose();
59416
59420
  if (this.canvas) {
59417
59421
  this.canvasEvents.forEach((x) => this.canvas.removeEventListener(x, this.canvaseventlistener));
59418
59422
  this.canvas = undefined;
@@ -59665,7 +59669,7 @@ js: import "konva/skia-backend";
59665
59669
  }
59666
59670
  }
59667
59671
  getComponent(name) {
59668
- return this._components.find((component) => component.name === name);
59672
+ return this._components.find((component) => component.name === name) || null;
59669
59673
  }
59670
59674
  drawViewpoint(viewpoint) {
59671
59675
  var _a, _b, _c, _d;