@inweb/viewer-visualize 27.4.7 → 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 (32) hide show
  1. package/dist/viewer-visualize.js +239 -136
  2. package/dist/viewer-visualize.js.map +1 -1
  3. package/dist/viewer-visualize.min.js +1 -1
  4. package/dist/viewer-visualize.module.js +72 -48
  5. package/dist/viewer-visualize.module.js.map +1 -1
  6. package/lib/Viewer/Components/CameraComponent.d.ts +1 -1
  7. package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +1 -1
  8. package/lib/Viewer/Draggers/OdaLineDragger.d.ts +0 -1
  9. package/lib/Viewer/Markup/Visualize/VisualizeMarkup.d.ts +1 -1
  10. package/lib/Viewer/Viewer.d.ts +5 -5
  11. package/package.json +6 -6
  12. package/src/Viewer/Commands/SetSelected2.ts +1 -1
  13. package/src/Viewer/Commands/index.ts +21 -10
  14. package/src/Viewer/Components/CameraComponent.ts +5 -5
  15. package/src/Viewer/Components/CanvasRemoveComponent.ts +0 -1
  16. package/src/Viewer/Components/GestureManagerComponent.ts +0 -1
  17. package/src/Viewer/Components/ZoomWheelComponent.ts +0 -1
  18. package/src/Viewer/Draggers/Common/OdBaseDragger.ts +3 -1
  19. package/src/Viewer/Draggers/MeasureLineDragger/MeasureUtils.ts +2 -2
  20. package/src/Viewer/Draggers/MeasureLineDragger/index.ts +4 -4
  21. package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +6 -3
  22. package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +1 -1
  23. package/src/Viewer/Draggers/OdaLineDragger.ts +4 -5
  24. package/src/Viewer/Loaders/FileLoader.ts +6 -4
  25. package/src/Viewer/Loaders/VSFFileLoader.ts +1 -1
  26. package/src/Viewer/Loaders/VSFXCloudPartialLoader.ts +7 -5
  27. package/src/Viewer/Loaders/VSFXCloudStreamingLoader.ts +1 -1
  28. package/src/Viewer/Loaders/VSFXFileLoader.ts +1 -1
  29. package/src/Viewer/Markup/Visualize/VisualizeMarkup.ts +1 -1
  30. package/src/Viewer/Models/ModelImpl.ts +1 -1
  31. package/src/Viewer/Viewer.ts +44 -23
  32. package/src/Viewer/utils.ts +1 -1
@@ -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 {
@@ -235,6 +234,15 @@
235
234
  enablePartialMode: false,
236
235
  memoryLimit: 3294967296,
237
236
  cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },
237
+ enableSectionFill: true,
238
+ sectionFillColor: { r: 0xff, g: 0x98, b: 0x00 },
239
+ sectionUseObjectColor: false,
240
+ enableSectionHatch: true,
241
+ sectionHatchColor: { r: 0, g: 0, b: 0 },
242
+ sectionHatchScale: 8,
243
+ enableSectionOutline: true,
244
+ sectionOutlineColor: { r: 0, g: 0, b: 0 },
245
+ sectionOutlineWidth: 2,
238
246
  edgesColor: { r: 0xff, g: 0x98, b: 0x00 },
239
247
  facesColor: { r: 0xff, g: 0x98, b: 0x00 },
240
248
  edgesVisibility: true,
@@ -293,230 +301,301 @@
293
301
  }
294
302
  }
295
303
  resetToDefaults(fields) {
304
+ const defaults = Options.defaults();
296
305
  if (fields !== undefined) {
297
- const defaults = Options.defaults();
298
- const resetData = fields.reduce((acc, field) => {
299
- acc[field] = defaults[field];
300
- return acc;
301
- }, {});
302
- 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;
303
312
  }
304
313
  else {
305
- 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();
306
321
  }
307
322
  }
308
323
  get data() {
309
324
  return this._data;
310
325
  }
311
326
  set data(value) {
312
- const enablePartialMode = value.enableStreamingMode ? value.enablePartialMode : false;
313
- const sceneGraph = enablePartialMode ? false : value.sceneGraph;
314
- this._data = { ...Options.defaults(), ...this._data, ...value, enablePartialMode, sceneGraph };
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;
334
+ if (this._data.enablePartialMode) {
335
+ this._data.enableStreamingMode = true;
336
+ this._data.sceneGraph = false;
337
+ }
338
+ if (!value.sectionFillColor && value.cuttingPlaneFillColor)
339
+ this._data.sectionFillColor = {
340
+ r: value.cuttingPlaneFillColor.red,
341
+ g: value.cuttingPlaneFillColor.green,
342
+ b: value.cuttingPlaneFillColor.blue,
343
+ };
315
344
  this.change();
316
345
  }
317
346
  get showWCS() {
318
347
  return this._data.showWCS;
319
348
  }
320
349
  set showWCS(value) {
321
- this._data.showWCS = value;
322
- this.change();
350
+ this.setProperty("showWCS", value);
323
351
  }
324
352
  get cameraAnimation() {
325
353
  return this._data.cameraAnimation;
326
354
  }
327
355
  set cameraAnimation(value) {
328
- this._data.cameraAnimation = value;
329
- this.change();
356
+ this.setProperty("cameraAnimation", value);
330
357
  }
331
358
  get antialiasing() {
332
359
  return this._data.antialiasing;
333
360
  }
334
361
  set antialiasing(value) {
335
- this._data.antialiasing = value;
336
- this.change();
362
+ this.setProperty("antialiasing", value);
337
363
  }
338
364
  get groundShadow() {
339
365
  return this._data.groundShadow;
340
366
  }
341
367
  set groundShadow(value) {
342
- this._data.groundShadow = value;
343
- this.change();
368
+ this.setProperty("groundShadow", value);
344
369
  }
345
370
  get shadows() {
346
371
  return this._data.shadows;
347
372
  }
348
373
  set shadows(value) {
349
- this._data.shadows = value;
350
- this.change();
374
+ this.setProperty("shadows", value);
351
375
  }
352
376
  get cameraAxisXSpeed() {
353
377
  return this._data.cameraAxisXSpeed;
354
378
  }
355
379
  set cameraAxisXSpeed(value) {
356
- this._data.cameraAxisXSpeed = value;
357
- this.change();
380
+ this.setProperty("cameraAxisXSpeed", value);
358
381
  }
359
382
  get cameraAxisYSpeed() {
360
383
  return this._data.cameraAxisYSpeed;
361
384
  }
362
385
  set cameraAxisYSpeed(value) {
363
- this.cameraAxisYSpeed = value;
364
- this.change();
386
+ this.setProperty("cameraAxisYSpeed", value);
365
387
  }
366
388
  get ambientOcclusion() {
367
389
  return this._data.ambientOcclusion;
368
390
  }
369
391
  set ambientOcclusion(value) {
370
- this._data.ambientOcclusion = value;
371
- this.change();
392
+ this.setProperty("ambientOcclusion", value);
372
393
  }
373
394
  get enableStreamingMode() {
374
395
  return this._data.enableStreamingMode;
375
396
  }
376
397
  set enableStreamingMode(value) {
377
- this._data.enableStreamingMode = value;
378
- if (!value)
379
- this._data.enablePartialMode = false;
380
- this.change();
398
+ this.setProperty("enableStreamingMode", value);
399
+ if (!value) {
400
+ this.setProperty("enablePartialMode", false);
401
+ }
381
402
  }
382
403
  get enablePartialMode() {
383
404
  return this._data.enablePartialMode;
384
405
  }
385
406
  set enablePartialMode(value) {
386
- this._data.enablePartialMode = value;
407
+ this.setProperty("enablePartialMode", value);
387
408
  if (value) {
388
- this._data.enableStreamingMode = true;
389
- this._data.sceneGraph = false;
409
+ this.setProperty("enableStreamingMode", true);
410
+ this.setProperty("sceneGraph", false);
390
411
  }
391
- this.change();
392
412
  }
393
413
  get memoryLimit() {
394
414
  return this._data.memoryLimit;
395
415
  }
396
416
  set memoryLimit(value) {
397
- this._data.memoryLimit = value;
398
- this.change();
417
+ this.setProperty("memoryLimit", value);
399
418
  }
400
419
  get cuttingPlaneFillColor() {
401
- return this._data.cuttingPlaneFillColor;
420
+ console.warn("Options.cuttingPlaneFillColor has been deprecated since 27.5 and will be removed in a future release, use sectionFillColor instead");
421
+ return {
422
+ red: this._data.sectionFillColor.r,
423
+ green: this._data.sectionFillColor.g,
424
+ blue: this._data.sectionFillColor.b,
425
+ };
402
426
  }
403
427
  set cuttingPlaneFillColor(value) {
404
- this._data.cuttingPlaneFillColor = value;
405
- this.change();
428
+ console.warn("Options.cuttingPlaneFillColor has been deprecated since 27.5 and will be removed in a future release, use sectionFillColor instead");
429
+ this.setProperty("sectionFillColor", {
430
+ r: value.red,
431
+ g: value.green,
432
+ b: value.blue,
433
+ });
434
+ }
435
+ get enableSectionFill() {
436
+ return this._data.enableSectionFill;
437
+ }
438
+ set enableSectionFill(value) {
439
+ this.setProperty("enableSectionFill", value);
440
+ }
441
+ get sectionFillColor() {
442
+ return this._data.sectionFillColor;
443
+ }
444
+ set sectionFillColor(value) {
445
+ this.setProperty("sectionFillColor", value);
446
+ }
447
+ get sectionUseObjectColor() {
448
+ return this._data.sectionUseObjectColor;
449
+ }
450
+ set sectionUseObjectColor(value) {
451
+ this.setProperty("sectionUseObjectColor", value);
452
+ }
453
+ get enableSectionHatch() {
454
+ return this._data.enableSectionHatch;
455
+ }
456
+ set enableSectionHatch(value) {
457
+ this.setProperty("enableSectionHatch", value);
458
+ }
459
+ get sectionHatchColor() {
460
+ return this._data.sectionHatchColor;
461
+ }
462
+ set sectionHatchColor(value) {
463
+ this.setProperty("sectionHatchColor", value);
464
+ }
465
+ get sectionHatchScale() {
466
+ return this._data.sectionHatchScale;
467
+ }
468
+ set sectionHatchScale(value) {
469
+ this.setProperty("sectionHatchScale", value);
470
+ }
471
+ get enableSectionOutline() {
472
+ return this._data.enableSectionOutline;
473
+ }
474
+ set enableSectionOutline(value) {
475
+ this.setProperty("enableSectionOutline", value);
476
+ }
477
+ get sectionOutlineColor() {
478
+ return this._data.sectionOutlineColor;
479
+ }
480
+ set sectionOutlineColor(value) {
481
+ this.setProperty("sectionOutlineColor", value);
482
+ }
483
+ get sectionOutlineWidth() {
484
+ return this._data.sectionOutlineWidth;
485
+ }
486
+ set sectionOutlineWidth(value) {
487
+ this.setProperty("sectionOutlineWidth", value);
406
488
  }
407
489
  get edgesColor() {
408
490
  return this._data.edgesColor;
409
491
  }
410
492
  set edgesColor(value) {
411
- this._data.edgesColor = value;
412
- this.change();
493
+ this.setProperty("edgesColor", value);
413
494
  }
414
495
  get facesColor() {
415
496
  return this._data.facesColor;
416
497
  }
417
498
  set facesColor(value) {
418
- this._data.facesColor = value;
419
- this.change();
499
+ this.setProperty("facesColor", value);
420
500
  }
421
501
  get edgesVisibility() {
422
502
  return this._data.edgesVisibility;
423
503
  }
424
504
  set edgesVisibility(value) {
425
- this._data.edgesVisibility = value;
426
- this.change();
505
+ this.setProperty("edgesVisibility", value);
427
506
  }
428
507
  get edgesOverlap() {
429
508
  return this._data.edgesOverlap;
430
509
  }
431
510
  set edgesOverlap(value) {
432
- this._data.edgesOverlap = value;
433
- this.change();
511
+ this.setProperty("edgesOverlap", value);
434
512
  }
435
513
  get facesOverlap() {
436
514
  return this._data.facesOverlap;
437
515
  }
438
516
  set facesOverlap(value) {
439
- this._data.facesOverlap = value;
440
- this.change();
517
+ this.setProperty("facesOverlap", value);
441
518
  }
442
519
  get facesTransparancy() {
443
520
  return this._data.facesTransparancy;
444
521
  }
445
522
  set facesTransparancy(value) {
446
- this._data.facesTransparancy = value;
447
- this.change();
523
+ this.setProperty("facesTransparancy", value);
448
524
  }
449
525
  get enableCustomHighlight() {
450
526
  return this._data.enableCustomHighlight;
451
527
  }
452
528
  set enableCustomHighlight(value) {
453
- this._data.enableCustomHighlight = value;
454
- this.change();
529
+ this.setProperty("enableCustomHighlight", value);
455
530
  }
456
531
  get sceneGraph() {
457
532
  return this._data.sceneGraph;
458
533
  }
459
534
  set sceneGraph(value) {
460
- this._data.sceneGraph = value;
461
- if (value)
462
- this._data.enablePartialMode = false;
463
- this.change();
535
+ this.setProperty("sceneGraph", value);
536
+ if (value) {
537
+ this.setProperty("enablePartialMode", false);
538
+ }
464
539
  }
465
540
  get edgeModel() {
466
541
  return Boolean(this._data.edgeModel);
467
542
  }
468
543
  set edgeModel(value) {
469
- this._data.edgeModel = Boolean(value);
470
- this.change();
544
+ this.setProperty("edgeModel", value);
471
545
  }
472
546
  get reverseZoomWheel() {
473
547
  return this._data.reverseZoomWheel;
474
548
  }
475
549
  set reverseZoomWheel(value) {
476
- this._data.reverseZoomWheel = !!value;
477
- this.change();
550
+ this.setProperty("reverseZoomWheel", value);
478
551
  }
479
552
  get enableZoomWheel() {
480
553
  return this._data.enableZoomWheel;
481
554
  }
482
555
  set enableZoomWheel(value) {
483
- this._data.enableZoomWheel = !!value;
484
- this.change();
556
+ this.setProperty("enableZoomWheel", value);
485
557
  }
486
558
  get enableGestures() {
487
559
  return this._data.enableGestures;
488
560
  }
489
561
  set enableGestures(value) {
490
- this._data.enableGestures = !!value;
491
- this.change();
562
+ this.setProperty("enableGestures", value);
492
563
  }
493
564
  get geometryType() {
494
565
  return this._data.geometryType;
495
566
  }
496
567
  set geometryType(value) {
497
- this._data.geometryType = value;
498
- this.change();
568
+ this.setProperty("geometryType", value);
499
569
  }
500
570
  get rulerUnit() {
501
571
  return this._data.rulerUnit;
502
572
  }
503
573
  set rulerUnit(value) {
504
- this._data.rulerUnit = value;
505
- this.change();
574
+ this.setProperty("rulerUnit", value);
506
575
  }
507
576
  get rulerPrecision() {
508
577
  return this._data.rulerPrecision;
509
578
  }
510
579
  set rulerPrecision(value) {
511
- this._data.rulerPrecision = value;
512
- this.change();
580
+ this.setProperty("rulerPrecision", value);
513
581
  }
514
582
  get cameraMode() {
515
583
  return this._data.cameraMode || "perspective";
516
584
  }
517
585
  set cameraMode(value) {
518
- this._data.cameraMode = value;
519
- 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);
520
599
  }
521
600
  }
522
601
  const CanvasEvents = [
@@ -680,6 +759,7 @@
680
759
  class OdBaseDragger extends OdaGeAction {
681
760
  constructor(subject) {
682
761
  super(subject.visualizeJs);
762
+ this.name = "";
683
763
  this.beginInteractivity = () => {
684
764
  const viewer = this.getViewer();
685
765
  const view = viewer.activeView;
@@ -706,6 +786,8 @@
706
786
  this.needInputText = false;
707
787
  this.mouseDownPosition = { x: 0, y: 0 };
708
788
  this.autoSelect = false;
789
+ this.isDragging = false;
790
+ this.press = false;
709
791
  this.pointerdown = this.pointerdown.bind(this);
710
792
  this.pointerup = this.pointerup.bind(this);
711
793
  this.pointercancel = this.pointercancel.bind(this);
@@ -1209,16 +1291,16 @@
1209
1291
  this.m_overlayElement.style.zIndex = "1";
1210
1292
  this.m_overlayElement.style.pointerEvents = "none";
1211
1293
  document.body.appendChild(this.m_overlayElement);
1212
- this.optionsChange = this.optionsChange.bind(this);
1294
+ this.updateUnits = this.updateUnits.bind(this);
1213
1295
  this.updatePreview = this.updatePreview.bind(this);
1214
- this.subject.addEventListener("optionschange", this.optionsChange);
1296
+ this.subject.addEventListener("optionschange", this.updateUnits);
1215
1297
  this.subject.addEventListener("render", this.updatePreview);
1216
1298
  this.resize();
1217
1299
  }
1218
1300
  dispose() {
1219
1301
  super.dispose();
1220
1302
  this.m_overlayElement.remove();
1221
- this.subject.removeEventListener("optionschange", this.optionsChange);
1303
+ this.subject.removeEventListener("optionschange", this.updateUnits);
1222
1304
  this.subject.removeEventListener("render", this.updatePreview);
1223
1305
  }
1224
1306
  updatePreview() {
@@ -1320,7 +1402,7 @@
1320
1402
  this.items.push(item);
1321
1403
  return item;
1322
1404
  }
1323
- optionsChange(event) {
1405
+ updateUnits(event) {
1324
1406
  var _a, _b;
1325
1407
  const options = event.data;
1326
1408
  const toUnitName = (_a = options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
@@ -2103,9 +2185,8 @@
2103
2185
  plane.set(this.toGePoint(this.m_center), this.m_normal);
2104
2186
  avp.addCuttingPlane(plane);
2105
2187
  this.index = avp.numCuttingPlanes() - 1;
2106
- const { red, green, blue } = this.subject.options.cuttingPlaneFillColor;
2107
- avp.setEnableCuttingPlaneFill(true, red, green, blue);
2108
- avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kSlantRight, 0x0, 0x0, 0x0);
2188
+ this.subject.syncOptions();
2189
+ this.subject.emitEvent({ type: "changecuttingplanes" });
2109
2190
  this.m_model = this.getModel();
2110
2191
  this.createPreview();
2111
2192
  this.deleteAll([ext, avp, plane]);
@@ -2145,6 +2226,7 @@
2145
2226
  const plane = this.createPlane();
2146
2227
  plane.set(this.toGePoint(this.m_center), this.m_normal);
2147
2228
  avp.updateCuttingPlane(this.index, plane);
2229
+ this.subject.emitEvent({ type: "changecuttingplanes" });
2148
2230
  this.drawPreview();
2149
2231
  this.deleteAll([avp, plane, oldCenter, delta, oldLast]);
2150
2232
  const device = this.getViewer().getActiveDevice();
@@ -2160,6 +2242,7 @@
2160
2242
  const plane = this.createPlane();
2161
2243
  plane.set(this.toGePoint(this.m_center), this.m_normal);
2162
2244
  avp.updateCuttingPlane(this.index, plane);
2245
+ this.subject.emitEvent({ type: "changecuttingplanes" });
2163
2246
  this.deleteAll([avp, plane, this.m_last]);
2164
2247
  const device = this.getViewer().getActiveDevice();
2165
2248
  device.invalidate(device.getSize());
@@ -2245,7 +2328,7 @@
2245
2328
 
2246
2329
  class OdCuttingPlaneZAxisDragger extends OdBaseCuttingPlaneDragger {
2247
2330
  createNormal() {
2248
- return [0, 0, 1];
2331
+ return [0, 0, -1];
2249
2332
  }
2250
2333
  handleDelta(delta) {
2251
2334
  delta.x = 0.0;
@@ -2890,16 +2973,16 @@
2890
2973
  constructor(subject) {
2891
2974
  super(subject);
2892
2975
  this.press = false;
2976
+ this.drawPoints = [];
2893
2977
  }
2894
2978
  dispose() {
2895
2979
  super.dispose();
2896
2980
  this.end();
2897
- this.points = null;
2898
- this.drawPoints = null;
2981
+ this.drawPoints.length = 0;
2899
2982
  }
2900
2983
  start(x, y) {
2901
2984
  const point = this.getViewer().screenToWorld(x, y);
2902
- this.drawPoints = [point[0], point[1], point[2]];
2985
+ this.drawPoints.push(point[0], point[1], point[2]);
2903
2986
  }
2904
2987
  drag(x, y) {
2905
2988
  if (this.isDragging) {
@@ -2911,7 +2994,7 @@
2911
2994
  end() {
2912
2995
  if (this.entity) {
2913
2996
  this.entity.delete();
2914
- this.drawPoints = null;
2997
+ this.drawPoints.length = 0;
2915
2998
  this.entity = null;
2916
2999
  }
2917
3000
  }
@@ -3410,24 +3493,34 @@
3410
3493
  commands.registerCommand("zoomToObjects", zoomToObjects);
3411
3494
  commands.registerCommand("zoomToSelected", zoomToSelected);
3412
3495
  commands.registerCommand("autoTransformAllModelsToCentralPoint", autoTransformAllModelsToCentralPoint);
3413
- commands.registerCommand("k3DViewTop", (viewer) => setDefaultViewPosition(viewer, "k3DViewTop"));
3414
- commands.registerCommand("k3DViewBottom", (viewer) => setDefaultViewPosition(viewer, "k3DViewBottom"));
3415
- commands.registerCommand("k3DViewLeft", (viewer) => setDefaultViewPosition(viewer, "k3DViewLeft"));
3416
- commands.registerCommand("k3DViewRight", (viewer) => setDefaultViewPosition(viewer, "k3DViewRight"));
3417
- commands.registerCommand("k3DViewFront", (viewer) => setDefaultViewPosition(viewer, "k3DViewFront"));
3418
- commands.registerCommand("k3DViewBack", (viewer) => setDefaultViewPosition(viewer, "k3DViewBack"));
3419
- commands.registerCommand("k3DViewSE", (viewer) => setDefaultViewPosition(viewer, "k3DViewSE"));
3420
- commands.registerCommand("k3DViewSW", (viewer) => setDefaultViewPosition(viewer, "k3DViewSW"));
3421
- commands.registerCommand("k3DViewNE", (viewer) => setDefaultViewPosition(viewer, "k3DViewNE"));
3422
- commands.registerCommand("k3DViewNW", (viewer) => setDefaultViewPosition(viewer, "k3DViewNW"));
3496
+ commands.registerCommand("top", (viewer) => setDefaultViewPosition(viewer, "k3DViewTop"));
3497
+ commands.registerCommand("bottom", (viewer) => setDefaultViewPosition(viewer, "k3DViewBottom"));
3498
+ commands.registerCommand("left", (viewer) => setDefaultViewPosition(viewer, "k3DViewLeft"));
3499
+ commands.registerCommand("right", (viewer) => setDefaultViewPosition(viewer, "k3DViewRight"));
3500
+ commands.registerCommand("front", (viewer) => setDefaultViewPosition(viewer, "k3DViewFront"));
3501
+ commands.registerCommand("back", (viewer) => setDefaultViewPosition(viewer, "k3DViewBack"));
3502
+ commands.registerCommand("se", (viewer) => setDefaultViewPosition(viewer, "k3DViewSE"));
3503
+ commands.registerCommand("sw", (viewer) => setDefaultViewPosition(viewer, "k3DViewSW"));
3504
+ commands.registerCommand("ne", (viewer) => setDefaultViewPosition(viewer, "k3DViewNE"));
3505
+ commands.registerCommand("nw", (viewer) => setDefaultViewPosition(viewer, "k3DViewNW"));
3423
3506
  commands.registerCommandAlias("clearMarkup", "clearOverlay");
3424
3507
  commands.registerCommandAlias("clearSelected", "unselect");
3425
3508
  commands.registerCommandAlias("getSnapshot", "createPreview");
3426
3509
  commands.registerCommandAlias("zoomToExtents", "zoomExtents");
3510
+ commands.registerCommandAlias("top", "k3DViewTop");
3511
+ commands.registerCommandAlias("bottom", "k3DViewBottom");
3512
+ commands.registerCommandAlias("left", "k3DViewLeft");
3513
+ commands.registerCommandAlias("right", "k3DViewRight");
3514
+ commands.registerCommandAlias("front", "k3DViewFront");
3515
+ commands.registerCommandAlias("back", "k3DViewBack");
3516
+ commands.registerCommandAlias("se", "k3DViewSE");
3517
+ commands.registerCommandAlias("sw", "k3DViewSW");
3518
+ commands.registerCommandAlias("ne", "k3DViewNE");
3519
+ commands.registerCommandAlias("nw", "k3DViewNW");
3427
3520
 
3428
3521
  class CameraComponent {
3429
3522
  constructor(viewer) {
3430
- this.optionsChange = () => {
3523
+ this.syncOptions = () => {
3431
3524
  this.switchCameraMode(this.viewer.options.cameraMode);
3432
3525
  };
3433
3526
  this.geometryEnd = () => {
@@ -3440,14 +3533,14 @@
3440
3533
  this.viewer = viewer;
3441
3534
  this.viewer.addEventListener("databasechunk", this.geometryEnd);
3442
3535
  this.viewer.addEventListener("clear", this.geometryEnd);
3443
- this.viewer.addEventListener("optionschange", this.optionsChange);
3444
- this.viewer.addEventListener("initialize", this.optionsChange);
3536
+ this.viewer.addEventListener("optionschange", this.syncOptions);
3537
+ this.viewer.addEventListener("initialize", this.syncOptions);
3445
3538
  }
3446
3539
  dispose() {
3447
3540
  this.viewer.removeEventListener("databasechunk", this.geometryEnd);
3448
3541
  this.viewer.removeEventListener("clear", this.geometryEnd);
3449
- this.viewer.removeEventListener("optionschange", this.optionsChange);
3450
- this.viewer.removeEventListener("initialize", this.optionsChange);
3542
+ this.viewer.removeEventListener("optionschange", this.syncOptions);
3543
+ this.viewer.removeEventListener("initialize", this.syncOptions);
3451
3544
  }
3452
3545
  getCameraMode(view) {
3453
3546
  return view.perspective ? "perspective" : "orthographic";
@@ -3597,7 +3690,6 @@
3597
3690
  }
3598
3691
  dispose() {
3599
3692
  this.mutationObserver.disconnect();
3600
- this.mutationObserver = undefined;
3601
3693
  }
3602
3694
  }
3603
3695
 
@@ -3623,7 +3715,6 @@
3623
3715
  }
3624
3716
  dispose() {
3625
3717
  this.zoomWheelDragger.dispose();
3626
- this.zoomWheelDragger = undefined;
3627
3718
  }
3628
3719
  }
3629
3720
 
@@ -3817,7 +3908,6 @@
3817
3908
  }
3818
3909
  dispose() {
3819
3910
  this.gestureManager.dispose();
3820
- this.gestureManager = undefined;
3821
3911
  }
3822
3912
  }
3823
3913
 
@@ -3880,6 +3970,9 @@
3880
3970
  components.registerComponent("ResetComponent", (viewer) => new ResetComponent(viewer));
3881
3971
 
3882
3972
  class ModelImpl {
3973
+ constructor() {
3974
+ this.id = "";
3975
+ }
3883
3976
  dispose() { }
3884
3977
  }
3885
3978
 
@@ -3887,7 +3980,6 @@
3887
3980
  constructor() {
3888
3981
  this.requestHeader = {};
3889
3982
  this.withCredentials = false;
3890
- this.abortSignal = undefined;
3891
3983
  }
3892
3984
  setRequestHeader(requestHeader) {
3893
3985
  this.requestHeader = requestHeader;
@@ -3909,12 +4001,15 @@
3909
4001
  .then((response) => {
3910
4002
  if (!response.ok)
3911
4003
  throw new Error(`Failed to fetch "${response.url}", status ${response.status}`);
4004
+ const body = response.body;
4005
+ if (!body)
4006
+ return response;
3912
4007
  const contentLength = response.headers.get("X-File-Size") || response.headers.get("Content-Length");
3913
4008
  const total = parseInt(contentLength || "", 10) || 0;
3914
4009
  const lengthComputable = total > 0;
3915
4010
  const stream = new ReadableStream({
3916
4011
  async start(controller) {
3917
- const reader = response.body.getReader();
4012
+ const reader = body.getReader();
3918
4013
  let loaded = 0;
3919
4014
  try {
3920
4015
  while (true) {
@@ -3943,7 +4038,7 @@
3943
4038
  const reader = new FileReader();
3944
4039
  reader.onload = () => resolve(reader.result);
3945
4040
  reader.onerror = () => reject(reader.error);
3946
- reader.onprogress = onProgress;
4041
+ reader.onprogress = onProgress || null;
3947
4042
  reader.readAsArrayBuffer(new Blob([file]));
3948
4043
  });
3949
4044
  }
@@ -3962,7 +4057,7 @@
3962
4057
  super();
3963
4058
  this.viewer = viewer;
3964
4059
  }
3965
- isSupport(file, format) {
4060
+ isSupport(file, format = "") {
3966
4061
  return ((typeof file === "string" || file instanceof globalThis.File || file instanceof ArrayBuffer) &&
3967
4062
  /vsf$/i.test(format));
3968
4063
  }
@@ -4057,7 +4152,7 @@
4057
4152
  super();
4058
4153
  this.viewer = viewer;
4059
4154
  }
4060
- isSupport(file, format) {
4155
+ isSupport(file, format = "") {
4061
4156
  return ((typeof file === "string" || file instanceof globalThis.File || file instanceof ArrayBuffer) &&
4062
4157
  /vsfx$/i.test(format));
4063
4158
  }
@@ -4186,7 +4281,7 @@
4186
4281
  }
4187
4282
  else {
4188
4283
  this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
4189
- this.viewer.update();
4284
+ this.viewer.update(500);
4190
4285
  }
4191
4286
  };
4192
4287
  await model.downloadResource(model.database, chunkLoadHandler, this.abortController.signal);
@@ -4244,7 +4339,7 @@
4244
4339
  }
4245
4340
  else {
4246
4341
  this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
4247
- this.viewer.update();
4342
+ this.viewer.update(500);
4248
4343
  }
4249
4344
  };
4250
4345
  const downloadResourceRange = async (dataId, requestId, ranges) => {
@@ -4417,7 +4512,7 @@
4417
4512
  const script = document.createElement("script");
4418
4513
  script.src = url;
4419
4514
  script.async = true;
4420
- script.crossOrigin = params.crossOrigin;
4515
+ script.crossOrigin = params.crossOrigin || null;
4421
4516
  script.onload = () => resolve(script);
4422
4517
  script.onerror = () => {
4423
4518
  script.remove();
@@ -17215,8 +17310,8 @@ js: import "konva/skia-backend";
17215
17310
  this.lineWidth = 4;
17216
17311
  this.lineType = "solid";
17217
17312
  this.fontSize = 34;
17218
- this.changeActiveDragger = (event) => {
17219
- const draggerName = event.data;
17313
+ this.changeActiveDragger = ({ data }) => {
17314
+ const draggerName = data || "";
17220
17315
  this._markupContainer.className = this._container.className
17221
17316
  .split(" ")
17222
17317
  .filter((x) => !x.startsWith("oda-cursor-"))
@@ -17277,19 +17372,19 @@ js: import "konva/skia-backend";
17277
17372
  this._resizeObserver = new ResizeObserver(this.resizeContainer);
17278
17373
  this._resizeObserver.observe(container);
17279
17374
  if (this._viewer) {
17280
- this._viewer.addEventListener("changeactivedragger", this.changeActiveDragger);
17281
- this._viewer.addEventListener("pan", this.pan);
17282
- this._viewer.addEventListener("zoomat", this.zoomAt);
17283
- this._viewer.addEventListener("changecameramode", this.changeCameraMode);
17375
+ this._viewer.on("changeactivedragger", this.changeActiveDragger);
17376
+ this._viewer.on("pan", this.pan);
17377
+ this._viewer.on("zoomat", this.zoomAt);
17378
+ this._viewer.on("changecameramode", this.changeCameraMode);
17284
17379
  }
17285
17380
  }
17286
17381
  dispose() {
17287
17382
  var _a, _b;
17288
17383
  if (this._viewer) {
17289
- this._viewer.removeEventListener("changecameramode", this.changeCameraMode);
17290
- this._viewer.removeEventListener("zoomat", this.zoomAt);
17291
- this._viewer.removeEventListener("pan", this.pan);
17292
- this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
17384
+ this._viewer.off("changecameramode", this.changeCameraMode);
17385
+ this._viewer.off("zoomat", this.zoomAt);
17386
+ this._viewer.off("pan", this.pan);
17387
+ this._viewer.off("changeactivedragger", this.changeActiveDragger);
17293
17388
  }
17294
17389
  (_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
17295
17390
  this._resizeObserver = undefined;
@@ -18052,6 +18147,7 @@ js: import "konva/skia-backend";
18052
18147
  constructor() {
18053
18148
  this._markupColor = { r: 255, g: 0, b: 0 };
18054
18149
  this.lineWidth = 4;
18150
+ this.lineType = "solid";
18055
18151
  this.fontSize = 34;
18056
18152
  }
18057
18153
  initialize(container, containerEvents, viewer, worldTransformer) {
@@ -18260,9 +18356,9 @@ js: import "konva/skia-backend";
18260
18356
  this.info = new Info();
18261
18357
  this.canvasEvents = CANVAS_EVENTS.slice();
18262
18358
  this.canvaseventlistener = (event) => this.emit(event);
18359
+ this._visualizeTimestamp = 0;
18263
18360
  this._activeDragger = null;
18264
18361
  this._components = [];
18265
- this._updateDelay = 1000;
18266
18362
  this._renderNeeded = false;
18267
18363
  this._renderTime = 0;
18268
18364
  this._enableAutoUpdate = (_a = params.enableAutoUpdate) !== null && _a !== void 0 ? _a : true;
@@ -18287,7 +18383,7 @@ js: import "konva/skia-backend";
18287
18383
  return this._markup;
18288
18384
  }
18289
18385
  configure(params) {
18290
- this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/27.4/Visualize.js";
18386
+ this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js";
18291
18387
  this._crossOrigin = params.crossOrigin;
18292
18388
  return this;
18293
18389
  }
@@ -18327,7 +18423,9 @@ js: import "konva/skia-backend";
18327
18423
  this.canvasEvents.forEach((x) => canvas.addEventListener(x, this.canvaseventlistener));
18328
18424
  this._markup.initialize(this.canvas, this.canvasEvents, this, this);
18329
18425
  for (const name of components.getComponents().keys()) {
18330
- this._components.push(components.createComponent(name, this));
18426
+ const component = components.createComponent(name, this);
18427
+ if (component)
18428
+ this._components.push(component);
18331
18429
  }
18332
18430
  this.syncOptions();
18333
18431
  this.syncOverlay();
@@ -18343,7 +18441,7 @@ js: import "konva/skia-backend";
18343
18441
  this.removeAllListeners();
18344
18442
  this.setActiveDragger();
18345
18443
  this._components.forEach((component) => component.dispose());
18346
- this._components = [];
18444
+ this._components.length = 0;
18347
18445
  this._markup.dispose();
18348
18446
  if (this.canvas) {
18349
18447
  this.canvasEvents.forEach((x) => this.canvas.removeEventListener(x, this.canvaseventlistener));
@@ -18352,7 +18450,7 @@ js: import "konva/skia-backend";
18352
18450
  if (this._viewer)
18353
18451
  this._viewer.clear();
18354
18452
  this._visualizeJs = undefined;
18355
- this._visualizeTimestamp = undefined;
18453
+ this._visualizeTimestamp = 0;
18356
18454
  this._viewer = undefined;
18357
18455
  return this;
18358
18456
  }
@@ -18374,13 +18472,14 @@ js: import "konva/skia-backend";
18374
18472
  }
18375
18473
  update(force = false) {
18376
18474
  const time = performance.now();
18377
- force = force || time - this._renderTime >= this._updateDelay;
18475
+ if (typeof force === "number" && time - this._renderTime >= force)
18476
+ force = true;
18378
18477
  if (this._enableAutoUpdate) {
18379
18478
  this._renderNeeded = true;
18380
18479
  if (force)
18381
18480
  this.render(time);
18382
18481
  }
18383
- this.emitEvent({ type: "update", force });
18482
+ this.emitEvent({ type: "update", force: !!force });
18384
18483
  }
18385
18484
  render(time) {
18386
18485
  if (!this.visualizeJs)
@@ -18494,9 +18593,9 @@ js: import "konva/skia-backend";
18494
18593
  this.clearOverlay();
18495
18594
  this.clearSelected();
18496
18595
  this.loaders.forEach((loader) => loader.dispose());
18497
- this.loaders = [];
18596
+ this.loaders.length = 0;
18498
18597
  this.models.forEach((model) => model.dispose());
18499
- this.models = [];
18598
+ this.models.length = 0;
18500
18599
  visViewer.clear();
18501
18600
  visViewer.createLocalDatabase();
18502
18601
  this.syncOptions();
@@ -18586,6 +18685,8 @@ js: import "konva/skia-backend";
18586
18685
  visualStyleId.delete();
18587
18686
  activeView.delete();
18588
18687
  }
18688
+ view.setEnableCuttingPlaneFill(options.enableSectionFill, options.sectionFillColor.r, options.sectionFillColor.g, options.sectionFillColor.b);
18689
+ view.setCuttingPlaneFillPatternEnabled(options.enableSectionHatch, visLib.CuttingPlaneFillStyle.kSlantRight, options.sectionHatchColor.r, options.sectionHatchColor.g, options.sectionHatchColor.b);
18589
18690
  const params = options.enableCustomHighlight ? options : Options.defaults();
18590
18691
  const { Entry, OdTvRGBColorDef } = visLib;
18591
18692
  const highlightStyleId = visViewer.findHighlightStyle("Web_Default");
@@ -18657,6 +18758,7 @@ js: import "konva/skia-backend";
18657
18758
  const activeView = visViewer.activeView;
18658
18759
  activeView.removeCuttingPlanes();
18659
18760
  activeView.delete();
18761
+ this.emitEvent({ type: "changecuttingplanes" });
18660
18762
  this.emitEvent({ type: "clearslices" });
18661
18763
  this.update();
18662
18764
  }
@@ -18725,7 +18827,7 @@ js: import "konva/skia-backend";
18725
18827
  }
18726
18828
  }
18727
18829
  getComponent(name) {
18728
- return this._components.find((component) => component.name === name);
18830
+ return this._components.find((component) => component.name === name) || null;
18729
18831
  }
18730
18832
  drawViewpoint(viewpoint) {
18731
18833
  var _a, _b;
@@ -18768,6 +18870,7 @@ js: import "konva/skia-backend";
18768
18870
  activeView.addCuttingPlane(cuttingPlane);
18769
18871
  activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
18770
18872
  }
18873
+ this.emitEvent({ type: "changecuttingplanes" });
18771
18874
  }
18772
18875
  };
18773
18876
  const setSelection = (selection) => {