vim-web 0.3.44-dev.3 → 0.3.44-dev.30

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 (43) hide show
  1. package/README.md +2 -2
  2. package/dist/style.css +9 -5
  3. package/dist/types/core-viewers/ultra/index.d.ts +1 -1
  4. package/dist/types/core-viewers/ultra/viewer/camera.d.ts +2 -1
  5. package/dist/types/core-viewers/ultra/viewer/inputs/{inputKeyboard.d.ts → keyboardHandler.d.ts} +1 -1
  6. package/dist/types/core-viewers/ultra/viewer/inputs/{inputMouse.d.ts → mouseHandler.d.ts} +7 -6
  7. package/dist/types/core-viewers/ultra/viewer/inputs/{InputTouch.d.ts → touchHandler.d.ts} +1 -1
  8. package/dist/types/core-viewers/ultra/viewer/marshal.d.ts +1 -1
  9. package/dist/types/core-viewers/ultra/viewer/sectionBox.d.ts +1 -0
  10. package/dist/types/core-viewers/ultra/viewer/selection.d.ts +3 -0
  11. package/dist/types/core-viewers/ultra/viewer/vim.d.ts +1 -1
  12. package/dist/types/core-viewers/webgl/loader/materials/viewerMaterials.d.ts +1 -1
  13. package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxHandle.d.ts +2 -0
  14. package/dist/types/core-viewers/webgl/viewer/inputs/inputHandler.d.ts +1 -0
  15. package/dist/types/react-viewers/bim/bimPanel.d.ts +3 -3
  16. package/dist/types/react-viewers/bim/bimTree.d.ts +2 -2
  17. package/dist/types/react-viewers/controlbar/controlBar.d.ts +1 -0
  18. package/dist/types/react-viewers/controlbar/controlBarIds.d.ts +29 -0
  19. package/dist/types/react-viewers/helpers/{inputs.d.ts → componentInputs.d.ts} +2 -2
  20. package/dist/types/react-viewers/helpers/isolation.d.ts +2 -2
  21. package/dist/types/react-viewers/helpers/reactUtils.d.ts +39 -0
  22. package/dist/types/react-viewers/index.d.ts +4 -0
  23. package/dist/types/react-viewers/panels/axesPanel.d.ts +2 -2
  24. package/dist/types/react-viewers/panels/contextMenu.d.ts +2 -2
  25. package/dist/types/react-viewers/panels/icons.d.ts +1 -0
  26. package/dist/types/react-viewers/state/cameraState.d.ts +22 -0
  27. package/dist/types/react-viewers/state/controlBarState.d.ts +31 -33
  28. package/dist/types/react-viewers/state/sectionBoxState.d.ts +12 -14
  29. package/dist/types/react-viewers/ultra/errors/ultraErrors.d.ts +1 -1
  30. package/dist/types/react-viewers/ultra/index.d.ts +1 -0
  31. package/dist/types/react-viewers/ultra/ultraCameraState.d.ts +2 -0
  32. package/dist/types/react-viewers/ultra/ultraComponent.d.ts +1 -7
  33. package/dist/types/react-viewers/ultra/ultraComponentRef.d.ts +36 -0
  34. package/dist/types/react-viewers/ultra/ultraControlBarState.d.ts +14 -1
  35. package/dist/types/react-viewers/urls.d.ts +1 -0
  36. package/dist/types/react-viewers/webgl/webglCameraState.d.ts +2 -0
  37. package/dist/types/react-viewers/webgl/webglComponentRef.d.ts +7 -2
  38. package/dist/vim-web.iife.js +529 -396
  39. package/dist/vim-web.iife.js.map +1 -1
  40. package/dist/vim-web.js +529 -396
  41. package/dist/vim-web.js.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/types/react-viewers/helpers/camera.d.ts +0 -37
@@ -45835,7 +45835,7 @@ void main() {
45835
45835
  }
45836
45836
  }
45837
45837
  class ElementMapping {
45838
- constructor(instances, instanceToElement, elementIds2, instanceMeshes) {
45838
+ constructor(instances, instanceToElement, elementIds, instanceMeshes) {
45839
45839
  __publicField(this, "_instanceToElement");
45840
45840
  __publicField(this, "_instanceMeshes");
45841
45841
  __publicField(this, "_elementToInstances");
@@ -45848,17 +45848,17 @@ void main() {
45848
45848
  this._elementToInstances = ElementMapping.invertMap(
45849
45849
  this._instanceToElement
45850
45850
  );
45851
- this._elementIds = elementIds2;
45852
- this._elementIdToElements = ElementMapping.invertArray(elementIds2);
45851
+ this._elementIds = elementIds;
45852
+ this._elementIdToElements = ElementMapping.invertArray(elementIds);
45853
45853
  this._instanceMeshes = instanceMeshes;
45854
45854
  }
45855
45855
  static async fromG3d(g3d2, bim) {
45856
45856
  const instanceToElement = await bim.node.getAllElementIndex();
45857
- const elementIds2 = await bim.element.getAllId();
45857
+ const elementIds = await bim.element.getAllId();
45858
45858
  return new ElementMapping(
45859
45859
  Array.from(g3d2.instanceNodes),
45860
45860
  instanceToElement,
45861
- elementIds2,
45861
+ elementIds,
45862
45862
  g3d2.instanceMeshes
45863
45863
  );
45864
45864
  }
@@ -48874,14 +48874,14 @@ void main() {
48874
48874
  this._onUpdate.dispatch();
48875
48875
  }
48876
48876
  /**
48877
- * Size of the blur convolution on the selection outline effect.
48877
+ * Size of the blur convolution on the selection outline effect. Minimum 2.
48878
48878
  */
48879
48879
  get outlineBlur() {
48880
48880
  return this.outline.strokeBlur;
48881
48881
  }
48882
48882
  set outlineBlur(value) {
48883
48883
  if (this.outline.strokeBlur === value) return;
48884
- this.outline.strokeBlur = value;
48884
+ this.outline.strokeBlur = Math.max(value, 2);
48885
48885
  this._onUpdate.dispatch();
48886
48886
  }
48887
48887
  /**
@@ -50633,8 +50633,12 @@ void main() {
50633
50633
  }
50634
50634
  frameSphere(sphere, forward) {
50635
50635
  const direction = this.getNormalizedDirection(forward);
50636
- const fov2 = this._camera.camPerspective.camera.fov * Math.PI / 180;
50637
- const dist2 = sphere.radius * 1.2 / Math.tan(fov2 / 2);
50636
+ this._camera.frustrumSizeAt(sphere.center);
50637
+ const vFov = this._camera.camPerspective.camera.fov * Math.PI / 180;
50638
+ const vDist = sphere.radius * 1.2 / Math.tan(vFov / 2);
50639
+ const hFov = vFov * this._camera.camPerspective.camera.aspect;
50640
+ const hDist = sphere.radius * 1.2 / Math.tan(hFov / 2);
50641
+ const dist2 = Math.max(vDist, hDist);
50638
50642
  const safeDist = Math.max(dist2, this._camera.camPerspective.camera.near * 2);
50639
50643
  const pos = direction.multiplyScalar(-safeDist).add(sphere.center);
50640
50644
  this.set(pos, sphere.center);
@@ -50664,7 +50668,7 @@ void main() {
50664
50668
  }
50665
50669
  init(duration) {
50666
50670
  this.cancel();
50667
- this._duration = duration;
50671
+ this._duration = Math.max(duration, 0.01);
50668
50672
  this._clock.start();
50669
50673
  }
50670
50674
  cancel() {
@@ -50985,6 +50989,7 @@ void main() {
50985
50989
  * @returns {CameraMovement} The camera movement api.
50986
50990
  */
50987
50991
  lerp(duration = 1, force = false) {
50992
+ if (duration <= 0) return this.snap(force);
50988
50993
  this.stop();
50989
50994
  this._force = force;
50990
50995
  this._lerp.init(duration);
@@ -51297,7 +51302,7 @@ void main() {
51297
51302
  KEY_Z: 90
51298
51303
  };
51299
51304
  const KeySet = new Set(Object.values(KEYS));
51300
- class KeyboardHandler extends InputHandler$1 {
51305
+ let KeyboardHandler$1 = class KeyboardHandler extends InputHandler$1 {
51301
51306
  constructor() {
51302
51307
  super(...arguments);
51303
51308
  // Settings
@@ -51403,7 +51408,7 @@ void main() {
51403
51408
  this.camera.localVelocity = move;
51404
51409
  }
51405
51410
  }
51406
- }
51411
+ };
51407
51412
  class SimpleInstanceSubmesh {
51408
51413
  constructor(mesh, index2) {
51409
51414
  __publicField(this, "mesh");
@@ -51652,7 +51657,7 @@ void main() {
51652
51657
  return this.raycast.object;
51653
51658
  }
51654
51659
  }
51655
- class TouchHandler extends InputHandler$1 {
51660
+ let TouchHandler$1 = class TouchHandler extends InputHandler$1 {
51656
51661
  constructor(viewer) {
51657
51662
  super(viewer);
51658
51663
  __publicField(this, "TAP_DURATION_MS", 500);
@@ -51805,8 +51810,8 @@ void main() {
51805
51810
  average(p1, p2) {
51806
51811
  return p1.clone().lerp(p2, 0.5);
51807
51812
  }
51808
- }
51809
- class MouseHandler extends InputHandler$1 {
51813
+ };
51814
+ let MouseHandler$1 = class MouseHandler extends InputHandler$1 {
51810
51815
  constructor(viewer) {
51811
51816
  super(viewer);
51812
51817
  __publicField(this, "_idleDelayMs", 150);
@@ -51886,10 +51891,10 @@ void main() {
51886
51891
  });
51887
51892
  __publicField(this, "onMouseUp", (event) => {
51888
51893
  event.stopImmediatePropagation();
51894
+ event.preventDefault();
51889
51895
  const btn = this.getButton(event);
51890
51896
  if (btn === this._buttonDown) return;
51891
51897
  this._viewer.gizmos.rectangle.visible = false;
51892
- event.preventDefault();
51893
51898
  if (!this._buttonDown) return;
51894
51899
  if (this.inputs.pointerActive === "rect" && this._hasMouseMoved && !this._hasCameraMoved) {
51895
51900
  this.onRectEnd();
@@ -52058,7 +52063,7 @@ void main() {
52058
52063
  this.gizmoRect.setCorners(this._downPosition, this._lastPosition);
52059
52064
  }
52060
52065
  }
52061
- }
52066
+ };
52062
52067
  var dist = {};
52063
52068
  var SimpleEventDispatcher = {};
52064
52069
  var hasRequiredSimpleEventDispatcher;
@@ -52328,9 +52333,9 @@ void main() {
52328
52333
  this.touch.unregister();
52329
52334
  });
52330
52335
  this._viewer = viewer;
52331
- this.keyboard = new KeyboardHandler(viewer);
52332
- this.mouse = new MouseHandler(viewer);
52333
- this.touch = new TouchHandler(viewer);
52336
+ this.keyboard = new KeyboardHandler$1(viewer);
52337
+ this.mouse = new MouseHandler$1(viewer);
52338
+ this.touch = new TouchHandler$1(viewer);
52334
52339
  this._scheme = new DefaultInputScheme(viewer);
52335
52340
  this.pointerActive = viewer.settings.camera.controls.orbit ? "orbit" : "look";
52336
52341
  this._pointerFallback = viewer.settings.camera.controls.orbit ? "look" : "orbit";
@@ -54896,7 +54901,6 @@ void main() {
54896
54901
  * Disposes all resources.
54897
54902
  */
54898
54903
  dispose() {
54899
- console.log("dispose");
54900
54904
  if (this._animId !== void 0) cancelAnimationFrame(this._animId);
54901
54905
  this._html.div.remove();
54902
54906
  this._viewer.renderer.remove(this._group);
@@ -55469,6 +55473,7 @@ void main() {
55469
55473
  __publicField(this, "_color");
55470
55474
  __publicField(this, "_highlightColor");
55471
55475
  __publicField(this, "_materials");
55476
+ __publicField(this, "_camera");
55472
55477
  __publicField(this, "_camSub");
55473
55478
  this._materials = [matAlways, matBehind];
55474
55479
  this._forward = new Vector3();
@@ -55481,15 +55486,18 @@ void main() {
55481
55486
  this.quaternion.setFromUnitVectors(new Vector3(0, -1, 0), this._forward);
55482
55487
  }
55483
55488
  trackCamera(camera2) {
55484
- const rescale = () => {
55485
- const size = camera2.frustrumSizeAt(this.position);
55486
- this.scale.set(size.x * 3e-3, size.x * 3e-3, size.x * 3e-3);
55487
- };
55488
- this._camSub = camera2.onMoved.subscribe(() => rescale());
55489
- rescale();
55489
+ this._camera = camera2;
55490
+ this.update();
55491
+ this._camSub = camera2.onMoved.subscribe(() => this.update());
55492
+ }
55493
+ update() {
55494
+ if (!this._camera) return;
55495
+ const size = this._camera.frustrumSizeAt(this.position);
55496
+ this.scale.set(size.x * 3e-3, size.x * 3e-3, size.x * 3e-3);
55490
55497
  }
55491
55498
  setPosition(position) {
55492
55499
  this.position.copy(position);
55500
+ this.update();
55493
55501
  }
55494
55502
  get forward() {
55495
55503
  return this._forward;
@@ -57627,7 +57635,37 @@ void main() {
57627
57635
  }
57628
57636
  return Math.min(Math.max(value, min2), max2);
57629
57637
  }
57630
- class InputMouse extends InputHandler {
57638
+ class CaptureStateMachine {
57639
+ constructor(canvas) {
57640
+ __publicField(this, "_canvas");
57641
+ __publicField(this, "state");
57642
+ __publicField(this, "id");
57643
+ this._canvas = canvas;
57644
+ this.state = "none";
57645
+ this.id = -1;
57646
+ }
57647
+ onPointerDown(event) {
57648
+ if (this.state === "captured") {
57649
+ this._canvas.releasePointerCapture(this.id);
57650
+ }
57651
+ this.id = event.pointerId;
57652
+ this.state = "captured";
57653
+ }
57654
+ onPointerMove(event) {
57655
+ if (this.state === "capture") {
57656
+ this._canvas.setPointerCapture(this.id);
57657
+ this.state = "captured";
57658
+ }
57659
+ }
57660
+ onPointerUp(event) {
57661
+ if (this.state === "captured") {
57662
+ this._canvas.releasePointerCapture(this.id);
57663
+ this.state = "none";
57664
+ this.id = -1;
57665
+ }
57666
+ }
57667
+ }
57668
+ class MouseHandler extends InputHandler {
57631
57669
  constructor(canvas, rpc, selection, camera2) {
57632
57670
  super();
57633
57671
  __publicField(this, "_rpc");
@@ -57635,45 +57673,47 @@ void main() {
57635
57673
  __publicField(this, "_lastMouseDownPosition", new Vector2(0, 0));
57636
57674
  __publicField(this, "_selection");
57637
57675
  __publicField(this, "_camera");
57676
+ __publicField(this, "_capture");
57638
57677
  this._canvas = canvas;
57639
57678
  this._rpc = rpc;
57640
57679
  this._selection = selection;
57641
57680
  this._camera = camera2;
57681
+ this._capture = new CaptureStateMachine(canvas);
57642
57682
  }
57643
57683
  register() {
57644
57684
  this.reg(this._canvas, "pointerdown", (e) => {
57645
- this.handlePointerDown(e);
57685
+ this.onPointerDown(e);
57646
57686
  });
57647
57687
  this.reg(this._canvas, "pointerup", (e) => {
57648
- this.handlePointerUp(e);
57688
+ this.onPointerUp(e);
57649
57689
  });
57650
57690
  this.reg(this._canvas, "pointermove", (e) => {
57651
- this.handlePointerMove(e);
57691
+ this.onPointerMove(e);
57652
57692
  });
57653
57693
  this.reg(this._canvas, "wheel", (e) => {
57654
- this.handleMouseScroll(e);
57694
+ this.onMouseScroll(e);
57655
57695
  });
57656
57696
  this.reg(this._canvas, "dblclick", (e) => {
57657
- this.handleDoubleClick(e);
57697
+ this.onDoubleClick(e);
57658
57698
  });
57659
57699
  }
57660
57700
  dispose() {
57661
57701
  this.unregister();
57662
57702
  }
57663
- handlePointerDown(event) {
57703
+ onPointerDown(event) {
57664
57704
  if (event.pointerType !== "mouse") return;
57665
57705
  const pos = this.relativePosition(event);
57666
57706
  this._rpc.RPCMouseButtonEvent(pos, event.button, true);
57667
57707
  this._lastMouseDownPosition = pos;
57668
- this._canvas.setPointerCapture(event.pointerId);
57708
+ this._capture.onPointerDown(event);
57669
57709
  event.preventDefault();
57670
57710
  }
57671
- handlePointerUp(event) {
57711
+ onPointerUp(event) {
57672
57712
  if (event.pointerType !== "mouse") return;
57673
57713
  const pos = this.relativePosition(event);
57674
57714
  this._rpc.RPCMouseButtonEvent(pos, event.button, false);
57675
57715
  this.handleMouseClick(event);
57676
- this._canvas.releasePointerCapture(event.pointerId);
57716
+ this._capture.onPointerUp(event);
57677
57717
  event.preventDefault();
57678
57718
  }
57679
57719
  async handleMouseClick(event) {
@@ -57693,21 +57733,24 @@ void main() {
57693
57733
  this._selection.select(hit.vim, hit.nodeIndex);
57694
57734
  }
57695
57735
  }
57696
- handlePointerMove(event) {
57736
+ onPointerMove(event) {
57697
57737
  if (event.pointerType !== "mouse") return;
57698
57738
  this._canvas.focus();
57739
+ this._capture.onPointerMove(event);
57699
57740
  const pos = this.relativePosition(event);
57700
57741
  this._rpc.RPCMouseMoveEvent(pos);
57701
57742
  }
57702
- async handleDoubleClick(event) {
57743
+ async onDoubleClick(event) {
57703
57744
  const pos = this.relativePosition(event);
57704
57745
  const hit = await this._selection.hitTest(pos);
57705
57746
  if (hit) {
57706
57747
  this._camera.frameVim(hit.vim, [hit.nodeIndex], 1);
57748
+ } else {
57749
+ this._camera.frameAll(1);
57707
57750
  }
57708
57751
  event.preventDefault();
57709
57752
  }
57710
- handleMouseScroll(event) {
57753
+ onMouseScroll(event) {
57711
57754
  this._rpc.RPCMouseScrollEvent(Math.sign(event.deltaY));
57712
57755
  event.preventDefault();
57713
57756
  }
@@ -57719,7 +57762,7 @@ void main() {
57719
57762
  );
57720
57763
  }
57721
57764
  }
57722
- class InputTouch extends InputHandler {
57765
+ class TouchHandler extends InputHandler {
57723
57766
  constructor(canvas, rpc) {
57724
57767
  super();
57725
57768
  __publicField(this, "_rpc");
@@ -58016,7 +58059,7 @@ void main() {
58016
58059
  // -------------------- SectionBox -------------------
58017
58060
  writeSectionBoxState(data2) {
58018
58061
  this.writeBoolean(data2.visible);
58019
- this.writeBoolean(data2.interactible);
58062
+ this.writeBoolean(data2.interactive);
58020
58063
  this.writeBoolean(data2.clip);
58021
58064
  this.writeBox3(data2.box);
58022
58065
  }
@@ -58171,12 +58214,12 @@ void main() {
58171
58214
  }
58172
58215
  readSectionBoxState() {
58173
58216
  const visible2 = this.readBoolean();
58174
- const interactible = this.readBoolean();
58217
+ const interactive = this.readBoolean();
58175
58218
  const clip = this.readBoolean();
58176
58219
  const box = this.readBox3();
58177
58220
  return {
58178
58221
  visible: visible2,
58179
- interactible,
58222
+ interactive,
58180
58223
  clip,
58181
58224
  box
58182
58225
  };
@@ -59648,7 +59691,7 @@ void main() {
59648
59691
  "Control",
59649
59692
  "Shift"
59650
59693
  ]);
59651
- class InputKeyboard extends InputHandler {
59694
+ class KeyboardHandler extends InputHandler {
59652
59695
  constructor(rpc, selection, camera2, inputs) {
59653
59696
  super();
59654
59697
  __publicField(this, "_rpc");
@@ -59687,15 +59730,19 @@ void main() {
59687
59730
  switch (event.key) {
59688
59731
  case "Escape":
59689
59732
  this._selection.clear();
59733
+ event.preventDefault();
59690
59734
  break;
59691
59735
  case "f":
59692
59736
  this.frameContext();
59737
+ event.preventDefault();
59693
59738
  break;
59694
59739
  case "Home":
59695
59740
  this._camera.restoreSavedPosition();
59741
+ event.preventDefault();
59696
59742
  break;
59697
59743
  case " ":
59698
59744
  this._inputs.mode = this._inputs.mode === InputMode.Orbit ? InputMode.Free : InputMode.Orbit;
59745
+ event.preventDefault();
59699
59746
  break;
59700
59747
  }
59701
59748
  }
@@ -59726,9 +59773,9 @@ void main() {
59726
59773
  this._canvas = canvas;
59727
59774
  this._rpc = rpc;
59728
59775
  this._renderer = renderer;
59729
- this._inputsMouse = new InputMouse(this._canvas, this._rpc, selection, camera2);
59730
- this._inputsTouch = new InputTouch(this._canvas, this._rpc);
59731
- this._keyboard = new InputKeyboard(this._rpc, selection, camera2, this);
59776
+ this._inputsMouse = new MouseHandler(this._canvas, this._rpc, selection, camera2);
59777
+ this._inputsTouch = new TouchHandler(this._canvas, this._rpc);
59778
+ this._keyboard = new KeyboardHandler(this._rpc, selection, camera2, this);
59732
59779
  }
59733
59780
  onConnect() {
59734
59781
  this.register();
@@ -60737,11 +60784,20 @@ Averrage Date/Second ${avgDataRatePS} kb
60737
60784
  */
60738
60785
  removeHighlight(nodes, fallback) {
60739
60786
  const toUpdate = [];
60740
- for (const node of nodes) {
60741
- const state = this._nodeStates.get(node);
60742
- if (state === "highlighted") {
60743
- this._nodeStates.set(node, fallback);
60744
- toUpdate.push(node);
60787
+ if (nodes === "all") {
60788
+ for (const [node, state] of this._nodeStates.entries()) {
60789
+ if (state === "highlighted") {
60790
+ this._nodeStates.set(node, fallback);
60791
+ toUpdate.push(node);
60792
+ }
60793
+ }
60794
+ } else {
60795
+ for (const node of nodes) {
60796
+ const state = this._nodeStates.get(node);
60797
+ if (state === "highlighted") {
60798
+ this._nodeStates.set(node, fallback);
60799
+ toUpdate.push(node);
60800
+ }
60745
60801
  }
60746
60802
  }
60747
60803
  if (toUpdate.length > 0) {
@@ -60812,8 +60868,8 @@ Averrage Date/Second ${avgDataRatePS} kb
60812
60868
  if (nodes === "all") {
60813
60869
  this._rpc.RPCClearMaterialOverrides(this._handle);
60814
60870
  } else {
60815
- const ids = new Array(nodes.length).fill(MaterialHandles.Invalid);
60816
- this._rpc.RPCSetMaterialOverrides(this._handle, nodes, ids);
60871
+ const ids2 = new Array(nodes.length).fill(MaterialHandles.Invalid);
60872
+ this._rpc.RPCSetMaterialOverrides(this._handle, nodes, ids2);
60817
60873
  }
60818
60874
  }
60819
60875
  updateMap(nodes, state) {
@@ -60974,7 +61030,6 @@ Averrage Date/Second ${avgDataRatePS} kb
60974
61030
  * Cleans up resources by removing resize observer and clearing timeouts
60975
61031
  */
60976
61032
  dispose() {
60977
- console.log("Disposing Viewport");
60978
61033
  this._clearTimeout();
60979
61034
  this._observer.disconnect();
60980
61035
  }
@@ -61235,11 +61290,15 @@ Averrage Date/Second ${avgDataRatePS} kb
61235
61290
  * Handles camera initialization when connection is established
61236
61291
  */
61237
61292
  onConnect() {
61293
+ this.set(new Vector3(-1e3, 1e3, 1e3), new Vector3(0, 0, 0), 0);
61238
61294
  this.restoreLastPosition();
61239
61295
  }
61240
61296
  onCameraPose(pose) {
61241
61297
  this._lastPosition = pose;
61242
61298
  }
61299
+ set(position, target, blendTime = this._defaultBlendTime) {
61300
+ this._rpc.RPCSetCameraPosition(new Segment(position, target), blendTime);
61301
+ }
61243
61302
  /**
61244
61303
  * Pauses or resumes rendering
61245
61304
  * @param value - True to pause rendering, false to resume
@@ -61303,6 +61362,9 @@ Averrage Date/Second ${avgDataRatePS} kb
61303
61362
  get onValueChanged() {
61304
61363
  return this._onValueChanged.asEvent();
61305
61364
  }
61365
+ get() {
61366
+ return this._selectedNodes;
61367
+ }
61306
61368
  /**
61307
61369
  * Gets the total number of selected nodes across all VIMs.
61308
61370
  * @returns The total count of selected nodes.
@@ -61338,7 +61400,7 @@ Averrage Date/Second ${avgDataRatePS} kb
61338
61400
  * @param node - A single node index or array of node indices to select.
61339
61401
  */
61340
61402
  select(vim, node) {
61341
- this.clear();
61403
+ this._clear();
61342
61404
  this.add(vim, node);
61343
61405
  }
61344
61406
  /**
@@ -61413,6 +61475,12 @@ Averrage Date/Second ${avgDataRatePS} kb
61413
61475
  * @param vim - Optional. If provided, only clears selections for the specified VIM.
61414
61476
  */
61415
61477
  clear(vim) {
61478
+ const changed = this._clear(vim);
61479
+ if (changed) {
61480
+ this._onValueChanged.dispatch();
61481
+ }
61482
+ }
61483
+ _clear(vim) {
61416
61484
  let changed = false;
61417
61485
  this._selectedNodes.forEach((nodes, v) => {
61418
61486
  if (vim === void 0 || v === vim) {
@@ -61421,9 +61489,7 @@ Averrage Date/Second ${avgDataRatePS} kb
61421
61489
  }
61422
61490
  });
61423
61491
  this._selectedNodes.clear();
61424
- if (changed) {
61425
- this._onValueChanged.dispatch();
61426
- }
61492
+ return changed;
61427
61493
  }
61428
61494
  /**
61429
61495
  * Calculates the bounding box encompassing all selected nodes.
@@ -61445,8 +61511,7 @@ Averrage Date/Second ${avgDataRatePS} kb
61445
61511
  * Should be called when the selection manager is no longer needed.
61446
61512
  */
61447
61513
  dispose() {
61448
- this.clear();
61449
- this._selectedNodes = /* @__PURE__ */ new Map();
61514
+ this._clear();
61450
61515
  }
61451
61516
  }
61452
61517
  class VimCollection {
@@ -61743,13 +61808,14 @@ Averrage Date/Second ${avgDataRatePS} kb
61743
61808
  }
61744
61809
  class SectionBox {
61745
61810
  constructor(rpc) {
61746
- __publicField(this, "_visible", true);
61747
- __publicField(this, "_interactible", true);
61748
- __publicField(this, "_clip", true);
61811
+ __publicField(this, "_visible", false);
61812
+ __publicField(this, "_interactible", false);
61813
+ __publicField(this, "_clip", false);
61749
61814
  __publicField(this, "_box", new Box3());
61750
61815
  __publicField(this, "_rpc");
61751
61816
  __publicField(this, "_interval");
61752
61817
  __publicField(this, "_animationFrame");
61818
+ __publicField(this, "_pullId", 0);
61753
61819
  // Signals
61754
61820
  __publicField(this, "_onUpdate", new distExports$1.SignalDispatcher());
61755
61821
  this._rpc = rpc;
@@ -61766,6 +61832,7 @@ Averrage Date/Second ${avgDataRatePS} kb
61766
61832
  this._interval = setInterval(() => this.pull(), 1e3);
61767
61833
  }
61768
61834
  scheduleUpdate() {
61835
+ this._pullId++;
61769
61836
  if (this._animationFrame) return;
61770
61837
  this._animationFrame = requestAnimationFrame(() => {
61771
61838
  this._animationFrame = void 0;
@@ -61774,13 +61841,15 @@ Averrage Date/Second ${avgDataRatePS} kb
61774
61841
  }
61775
61842
  async pull() {
61776
61843
  if (this.needUpdate) return;
61844
+ const id2 = this._pullId;
61777
61845
  const state = await this._rpc.RPCGetSectionBox();
61846
+ if (id2 !== this._pullId) return;
61778
61847
  let changed = false;
61779
- if (state.visible !== this._visible || state.interactible !== this._interactible || state.clip !== this._clip || state.box !== this._box) {
61848
+ if (state.visible !== this._visible || state.interactive !== this._interactible || state.clip !== this._clip || state.box !== this._box) {
61780
61849
  changed = true;
61781
61850
  }
61782
61851
  this._visible = state.visible;
61783
- this._interactible = state.interactible;
61852
+ this._interactible = state.interactive;
61784
61853
  this._clip = state.clip;
61785
61854
  this._box = state.box;
61786
61855
  if (changed) {
@@ -61790,7 +61859,7 @@ Averrage Date/Second ${avgDataRatePS} kb
61790
61859
  async push() {
61791
61860
  await this._rpc.RPCSetSectionBox({
61792
61861
  visible: this._visible,
61793
- interactible: this._interactible,
61862
+ interactive: this._interactible,
61794
61863
  clip: this._clip,
61795
61864
  box: this._box
61796
61865
  });
@@ -66817,6 +66886,25 @@ Averrage Date/Second ${avgDataRatePS} kb
66817
66886
  }
66818
66887
  );
66819
66888
  }
66889
+ function autoCamera({ height, width, fill: fill2 = "", className }) {
66890
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className, height, width, viewBox: "0 0 256 256", children: [
66891
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
66892
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66893
+ "path",
66894
+ {
66895
+ fill: fill2,
66896
+ d: "M 242.35934,69.720521 V 192.19034 c 0,9.46501 -7.97359,15.37204 -14.35248,10.67406 l -39.68884,-29.41993 v 8.38267 c 0,25.1595 -15.90243,45.64407 -35.51391,45.64407 H 48.520099 C 28.90861,227.51727 13.006195,206.98664 13.006195,181.80411 V 80.187338 c 0,-25.159506 15.902415,-45.644066 35.513904,-45.644066 H 152.55325 c 19.57566,0 35.51392,20.4385 35.51392,45.644066 v 8.382665 L 227.756,59.150074 c 6.33409,-4.801607 14.60334,1.162981 14.60334,10.570447 z"
66897
+ }
66898
+ ),
66899
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66900
+ "path",
66901
+ {
66902
+ fill: "white",
66903
+ d: "m 134.24221,179.28573 -6.38,-16.771 H 73.539201 l -6.38,17.135 c -2.492,6.684 -4.618,11.211 -6.38,13.581 -1.763,2.309 -4.649,3.464 -8.659,3.464 -3.403,0 -6.411,-1.246 -9.024,-3.737 -2.613,-2.492 -3.919,-5.317 -3.919,-8.477 0,-1.823 0.304,-3.706 0.911,-5.651 0.608,-1.944 1.611,-4.648 3.008,-8.112 l 34.18,-86.771005 c 0.972,-2.491 2.127,-5.469 3.463,-8.932 1.398,-3.525 2.856,-6.441 4.375,-8.75 1.58,-2.309 3.616,-4.163 6.107,-5.56 2.552005,-1.458 5.682005,-2.188 9.388009,-2.188 3.768,0 6.897,0.73 9.388,2.188 2.552,1.397 4.588,3.22 6.107,5.469 1.58,2.248 2.886,4.678 3.919,7.291 1.094,2.552 2.461,5.986 4.102,10.3 l 34.909,86.224005 c 2.734,6.562 4.101,11.332 4.101,14.31 0,3.099 -1.306,5.955 -3.919,8.568 -2.552,2.552 -5.651,3.828 -9.297,3.828 -2.126,0 -3.949,-0.395 -5.468,-1.185 -1.52,-0.729 -2.796,-1.732 -3.829,-3.008 -1.033,-1.337 -2.157,-3.342 -3.372,-6.016 -1.155,-2.734 -2.157,-5.134 -3.008,-7.2 z m -53.594009,-37.097 h 39.922009 l -20.143,-55.143005 z"
66904
+ }
66905
+ )
66906
+ ] });
66907
+ }
66820
66908
  function orbit({ height, width, fill: fill2 = "", className }) {
66821
66909
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className, height, width, viewBox: "0 0 256 256", children: [
66822
66910
  /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
@@ -67340,6 +67428,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67340
67428
  const icons = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
67341
67429
  __proto__: null,
67342
67430
  arrowLeft,
67431
+ autoCamera,
67343
67432
  camera,
67344
67433
  checkmark,
67345
67434
  close,
@@ -67486,7 +67575,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67486
67575
  );
67487
67576
  };
67488
67577
  const onHomeBtn = () => {
67489
- props.camera.reset();
67578
+ props.camera.reset.call();
67490
67579
  };
67491
67580
  const btnStyle2 = "vim-axes-button vc-flex vc-items-center vc-justify-center vc-text-gray-medium vc-transition-all hover:vc-text-primary-royal";
67492
67581
  const btnIsolation = /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -67577,6 +67666,41 @@ Averrage Date/Second ${avgDataRatePS} kb
67577
67666
  if (section.enable !== void 0 && !section.enable()) return null;
67578
67667
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `vim-control-bar-section ${section.style ?? sectionDefaultStyle}`, children: section.buttons.map((b) => createButton(b)) }, section.id);
67579
67668
  }
67669
+ const ids = {
67670
+ // Sections
67671
+ sectionCamera: "controlBar.sectionCamera",
67672
+ sectionInputs: "controlBar.sectionInputs",
67673
+ sectionActions: "controlBar.sectionActions",
67674
+ sectionTools: "controlBar.sectionTools",
67675
+ sectionSettings: "controlBar.sectionSettings",
67676
+ sectionMeasure: "controlBar.sectionMeasure",
67677
+ sectionSectionBox: "controlBar.sectionSectionBox",
67678
+ // Camera buttons
67679
+ buttonCameraAuto: "controlBar.camera.auto",
67680
+ buttonCameraOrbit: "controlBar.camera.orbit",
67681
+ buttonCameraLook: "controlBarcamera.look",
67682
+ buttonCameraPan: "controlBar.camera.pan",
67683
+ buttonCameraZoom: "controlBar.camera.zoom",
67684
+ buttonCameraZoomWindow: "controlBar.camera.zoomWindow",
67685
+ // Settings buttons
67686
+ buttonProjectInspector: "controlBar.projectInspector",
67687
+ buttonSettings: "controlBar.settings",
67688
+ buttonHelp: "controlBar.help",
67689
+ buttonMaximize: "controlBar.maximize",
67690
+ // Action Buttons
67691
+ buttonToggleIsolation: "controlBar.action.toggleIsolation",
67692
+ buttonZoomToFit: "controlBar.action.zoomToFit",
67693
+ // Tools buttons
67694
+ buttonSectionBox: "controlBar.sectionBox",
67695
+ buttonMeasure: "controlBar.measure",
67696
+ // Section box buttons
67697
+ buttonSectionBoxEnable: "controlBar.sectionBox.enable",
67698
+ buttonSectionBoxVisible: "controlBar.sectionBox.visible",
67699
+ buttonSectionBoxShrinkToSelection: "controlBar.sectionBox.shrinkToSelection",
67700
+ buttonSectionBoxAuto: "controlBar.sectionBox.auto",
67701
+ buttonSectionBoxReset: "controlBar.sectionBox.reset",
67702
+ buttonSectionBoxSettings: "controlBar.sectionBox.settings"
67703
+ };
67580
67704
  function ControlBar(props) {
67581
67705
  React2.useEffect(() => {
67582
67706
  ReactTooltip.rebuild();
@@ -67606,6 +67730,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67606
67730
  buttonExpandStyle,
67607
67731
  createButton,
67608
67732
  createSection: createSection$1,
67733
+ ids,
67609
67734
  sectionBlueStyle,
67610
67735
  sectionDefaultStyle,
67611
67736
  sectionNoPadStyle
@@ -67791,95 +67916,62 @@ Averrage Date/Second ${avgDataRatePS} kb
67791
67916
  clear
67792
67917
  };
67793
67918
  }
67794
- const elementIds = {
67795
- // Sections
67796
- sectionCamera: "controlBar.sectionCamera",
67797
- sectionActions: "controlBar.sectionActions",
67798
- sectionTools: "controlBar.sectionTools",
67799
- sectionSettings: "controlBar.sectionSettings",
67800
- sectionMeasure: "controlBar.sectionMeasure",
67801
- sectionSectionBox: "controlBar.sectionSectionBox",
67802
- // Camera buttons
67803
- buttonCameraOrbit: "controlBar.camera.orbit",
67804
- buttonCameraLook: "controlBarcamera.look",
67805
- buttonCameraPan: "controlBar.camera.pan",
67806
- buttonCameraZoom: "controlBar.camera.zoom",
67807
- buttonCameraZoomWindow: "controlBar.camera.zoomWindow",
67808
- // Settings buttons
67809
- buttonProjectInspector: "controlBar.projectInspector",
67810
- buttonSettings: "controlBar.settings",
67811
- buttonHelp: "controlBar.help",
67812
- buttonMaximize: "controlBar.maximize",
67813
- // Action Buttons
67814
- buttonToggleIsolation: "controlBar.action.toggleIsolation",
67815
- buttonZoomToFit: "controlBar.action.zoomToFit",
67816
- // Tools buttons
67817
- buttonSectionBox: "controlBar.sectionBox",
67818
- buttonMeasure: "controlBar.measure",
67819
- // Section box buttons
67820
- buttonSectionBoxEnable: "controlBar.sectionBox.enable",
67821
- buttonSectionBoxVisible: "controlBar.sectionBox.visible",
67822
- buttonSectionBoxShrinkToSelection: "controlBar.sectionBox.shrinkToSelection",
67823
- buttonSectionBoxAuto: "controlBar.sectionBox.auto",
67824
- buttonSectionBoxClip: "controlBar.sectionBox.clip",
67825
- buttonSectionBoxSettings: "controlBar.sectionBox.settings"
67826
- };
67827
67919
  function controlBarSectionBox(section, hasSelection) {
67828
67920
  return {
67829
- id: elementIds.sectionSectionBox,
67830
- style: section.getEnable() ? sectionNoPadStyle : sectionDefaultStyle,
67921
+ id: ids.sectionSectionBox,
67922
+ style: section.enable.get() ? sectionNoPadStyle : sectionDefaultStyle,
67831
67923
  //enable: () => section.getEnable(),
67832
67924
  buttons: [
67833
67925
  {
67834
- id: elementIds.buttonSectionBoxEnable,
67926
+ id: ids.buttonSectionBoxEnable,
67835
67927
  tip: "Enable Section Box",
67836
- isOn: () => section.getEnable(),
67928
+ isOn: () => section.enable.get(),
67837
67929
  style: (on) => buttonExpandStyle(on),
67838
- action: () => section.setEnable(!section.getEnable()),
67930
+ action: () => section.enable.set(!section.enable.get()),
67839
67931
  icon: sectionBox
67840
67932
  },
67841
67933
  {
67842
- id: elementIds.buttonSectionBoxShrinkToSelection,
67934
+ id: ids.buttonSectionBoxShrinkToSelection,
67843
67935
  tip: "Fit Section",
67844
- enabled: () => section.getEnable(),
67936
+ enabled: () => section.enable.get(),
67845
67937
  isOn: () => hasSelection,
67846
67938
  style: (on) => buttonDisableStyle(on),
67847
- action: () => section.sectionSelection(),
67939
+ action: () => section.sectionSelection.call(),
67848
67940
  icon: sectionBoxShrink
67849
67941
  },
67850
67942
  {
67851
- id: elementIds.buttonSectionBoxClip,
67943
+ id: ids.buttonSectionBoxReset,
67852
67944
  tip: "Reset Section",
67853
- enabled: () => section.getEnable(),
67945
+ enabled: () => section.enable.get(),
67854
67946
  style: (on) => buttonDefaultStyle(on),
67855
- action: () => section.sectionReset(),
67947
+ action: () => section.sectionReset.call(),
67856
67948
  icon: sectionBoxReset
67857
67949
  },
67858
67950
  {
67859
- id: elementIds.buttonSectionBoxVisible,
67951
+ id: ids.buttonSectionBoxVisible,
67860
67952
  tip: "Show Section Box",
67861
- enabled: () => section.getEnable(),
67862
- isOn: () => section.getVisible(),
67953
+ enabled: () => section.enable.get(),
67954
+ isOn: () => section.visible.get(),
67863
67955
  style: (on) => buttonDefaultStyle(on),
67864
- action: () => section.setVisible(!section.getVisible()),
67956
+ action: () => section.visible.set(!section.visible.get()),
67865
67957
  icon: visible
67866
67958
  },
67867
67959
  {
67868
- id: elementIds.buttonSectionBoxAuto,
67960
+ id: ids.buttonSectionBoxAuto,
67869
67961
  tip: "Auto Section",
67870
- enabled: () => section.getEnable(),
67871
- isOn: () => section.getAuto(),
67962
+ enabled: () => section.enable.get(),
67963
+ isOn: () => section.auto.get(),
67872
67964
  style: (on) => buttonDefaultStyle(on),
67873
- action: () => section.setAuto(!section.getAuto()),
67965
+ action: () => section.auto.set(!section.auto.get()),
67874
67966
  icon: sectionBoxAuto
67875
67967
  },
67876
67968
  {
67877
- id: elementIds.buttonSectionBoxSettings,
67969
+ id: ids.buttonSectionBoxSettings,
67878
67970
  tip: "Section Settings",
67879
- enabled: () => section.getEnable(),
67880
- isOn: () => section.getOffsetVisible(),
67971
+ enabled: () => section.enable.get(),
67972
+ isOn: () => section.showOffsetPanel.get(),
67881
67973
  style: (on) => buttonDefaultStyle(on),
67882
- action: () => section.setOffsetsVisible(!section.getOffsetVisible()),
67974
+ action: () => section.showOffsetPanel.set(!section.showOffsetPanel.get()),
67883
67975
  icon: slidersHoriz
67884
67976
  }
67885
67977
  ]
@@ -67888,12 +67980,12 @@ Averrage Date/Second ${avgDataRatePS} kb
67888
67980
  function controlBarPointer(viewer, camera2, settings2, section) {
67889
67981
  const pointer = getPointerState(viewer);
67890
67982
  return {
67891
- id: elementIds.sectionCamera,
67983
+ id: ids.sectionInputs,
67892
67984
  enable: () => anyUiCursorButton(settings2),
67893
67985
  style: sectionDefaultStyle,
67894
67986
  buttons: [
67895
67987
  {
67896
- id: elementIds.buttonCameraOrbit,
67988
+ id: ids.buttonCameraOrbit,
67897
67989
  enabled: () => isTrue(settings2.ui.orbit),
67898
67990
  tip: "Orbit",
67899
67991
  action: () => pointer.onButton("orbit"),
@@ -67902,7 +67994,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67902
67994
  style: buttonDefaultStyle
67903
67995
  },
67904
67996
  {
67905
- id: elementIds.buttonCameraLook,
67997
+ id: ids.buttonCameraLook,
67906
67998
  enabled: () => isTrue(settings2.ui.lookAround),
67907
67999
  tip: "Look Around",
67908
68000
  action: () => pointer.onButton("look"),
@@ -67911,7 +68003,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67911
68003
  style: buttonDefaultStyle
67912
68004
  },
67913
68005
  {
67914
- id: elementIds.buttonCameraPan,
68006
+ id: ids.buttonCameraPan,
67915
68007
  enabled: () => isTrue(settings2.ui.pan),
67916
68008
  tip: "Pan",
67917
68009
  action: () => pointer.onButton("pan"),
@@ -67920,7 +68012,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67920
68012
  style: buttonDefaultStyle
67921
68013
  },
67922
68014
  {
67923
- id: elementIds.buttonCameraZoom,
68015
+ id: ids.buttonCameraZoom,
67924
68016
  enabled: () => isTrue(settings2.ui.zoom),
67925
68017
  tip: "Zoom",
67926
68018
  action: () => pointer.onButton("zoom"),
@@ -67929,7 +68021,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67929
68021
  style: buttonDefaultStyle
67930
68022
  },
67931
68023
  {
67932
- id: elementIds.buttonCameraZoomWindow,
68024
+ id: ids.buttonCameraZoomWindow,
67933
68025
  enabled: () => isTrue(settings2.ui.zoomWindow),
67934
68026
  tip: "Zoom Window",
67935
68027
  action: () => {
@@ -67944,21 +68036,21 @@ Averrage Date/Second ${avgDataRatePS} kb
67944
68036
  }
67945
68037
  function controlBarActions(camera2, settings2, isolation, measure$1) {
67946
68038
  return {
67947
- id: elementIds.sectionActions,
68039
+ id: ids.sectionActions,
67948
68040
  enable: () => true,
67949
68041
  style: sectionDefaultStyle,
67950
68042
  buttons: [
67951
68043
  {
67952
- id: elementIds.buttonZoomToFit,
68044
+ id: ids.buttonZoomToFit,
67953
68045
  enabled: () => isTrue(settings2.ui.zoomToFit),
67954
68046
  tip: "Zoom to Fit",
67955
- action: () => camera2.frameContext(),
68047
+ action: () => camera2.frameSelection.call(),
67956
68048
  icon: frameSelection,
67957
68049
  isOn: () => false,
67958
68050
  style: buttonDefaultStyle
67959
68051
  },
67960
68052
  {
67961
- id: elementIds.buttonToggleIsolation,
68053
+ id: ids.buttonToggleIsolation,
67962
68054
  enabled: () => isTrue(settings2.ui.toggleIsolation),
67963
68055
  tip: "Toggle Isolation",
67964
68056
  action: () => isolation.toggle("controlBar"),
@@ -67966,7 +68058,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67966
68058
  style: buttonDefaultStyle
67967
68059
  },
67968
68060
  {
67969
- id: elementIds.buttonMeasure,
68061
+ id: ids.buttonMeasure,
67970
68062
  enabled: () => isTrue(settings2.ui.measuringMode),
67971
68063
  isOn: () => measure$1.active,
67972
68064
  tip: "Measuring Mode",
@@ -67980,12 +68072,12 @@ Averrage Date/Second ${avgDataRatePS} kb
67980
68072
  function controlBarSettings(modal, side, settings$1) {
67981
68073
  const fullScreen = getFullScreenState();
67982
68074
  return {
67983
- id: elementIds.sectionSettings,
68075
+ id: ids.sectionSettings,
67984
68076
  enable: () => anyUiSettingButton(settings$1),
67985
68077
  style: sectionDefaultStyle,
67986
68078
  buttons: [
67987
68079
  {
67988
- id: elementIds.buttonProjectInspector,
68080
+ id: ids.buttonProjectInspector,
67989
68081
  enabled: () => isTrue(settings$1.ui.projectInspector) && (isTrue(settings$1.ui.bimTreePanel) || isTrue(settings$1.ui.bimInfoPanel)),
67990
68082
  tip: "Project Inspector",
67991
68083
  action: () => side.toggleContent("bim"),
@@ -67993,7 +68085,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67993
68085
  style: buttonDefaultStyle
67994
68086
  },
67995
68087
  {
67996
- id: elementIds.buttonSettings,
68088
+ id: ids.buttonSettings,
67997
68089
  enabled: () => isTrue(settings$1.ui.settings),
67998
68090
  tip: "Settings",
67999
68091
  action: () => side.toggleContent("settings"),
@@ -68001,7 +68093,7 @@ Averrage Date/Second ${avgDataRatePS} kb
68001
68093
  style: buttonDefaultStyle
68002
68094
  },
68003
68095
  {
68004
- id: elementIds.buttonHelp,
68096
+ id: ids.buttonHelp,
68005
68097
  enabled: () => isTrue(settings$1.ui.help),
68006
68098
  tip: "Help",
68007
68099
  action: () => modal.help(true),
@@ -68009,7 +68101,7 @@ Averrage Date/Second ${avgDataRatePS} kb
68009
68101
  style: buttonDefaultStyle
68010
68102
  },
68011
68103
  {
68012
- id: elementIds.buttonMaximize,
68104
+ id: ids.buttonMaximize,
68013
68105
  enabled: () => isTrue(settings$1.ui.maximise) && settings$1.capacity.canGoFullScreen,
68014
68106
  tip: fullScreen.get() ? "Minimize" : "Fullscreen",
68015
68107
  action: () => fullScreen.toggle(),
@@ -68019,15 +68111,34 @@ Averrage Date/Second ${avgDataRatePS} kb
68019
68111
  ]
68020
68112
  };
68021
68113
  }
68114
+ function controlBarCamera(camera2) {
68115
+ return {
68116
+ id: ids.sectionCamera,
68117
+ enable: () => true,
68118
+ style: sectionDefaultStyle,
68119
+ buttons: [
68120
+ {
68121
+ id: ids.buttonCameraAuto,
68122
+ tip: "Auto Camera",
68123
+ isOn: () => camera2.autoCamera.get(),
68124
+ action: () => camera2.autoCamera.set(!camera2.autoCamera.get()),
68125
+ icon: autoCamera,
68126
+ style: buttonDefaultStyle
68127
+ }
68128
+ ]
68129
+ };
68130
+ }
68022
68131
  function useControlBar(viewer, camera2, modal, side, isolation, cursor, settings2, section, customization) {
68023
68132
  const measure2 = getMeasureState(viewer, cursor);
68024
68133
  const pointerSection = controlBarPointer(viewer, camera2, settings2);
68025
68134
  const actionSection = controlBarActions(camera2, settings2, isolation, measure2);
68026
68135
  const sectionBoxSection = controlBarSectionBox(section, viewer.selection.count > 0);
68027
68136
  const settingsSection = controlBarSettings(modal, side, settings2);
68137
+ const cameraSection = controlBarCamera(camera2);
68028
68138
  let controlBarSections = [
68029
68139
  pointerSection,
68030
68140
  actionSection,
68141
+ cameraSection,
68031
68142
  sectionBoxSection,
68032
68143
  // Optional section
68033
68144
  settingsSection
@@ -72022,42 +72133,21 @@ Averrage Date/Second ${avgDataRatePS} kb
72022
72133
  };
72023
72134
  const viewer = props.viewer;
72024
72135
  const camera2 = props.camera;
72025
- const [section, setSection] = React2.useState({
72026
- visible: viewer.gizmos.sectionBox.visible,
72027
- clip: viewer.gizmos.sectionBox.clip
72028
- });
72029
- const isClipping = () => {
72030
- return !viewer.gizmos.sectionBox.box.containsBox(viewer.renderer.getBoundingBox());
72031
- };
72032
- const [clipping, setClipping] = React2.useState(isClipping());
72033
72136
  const [, setVersion] = React2.useState(0);
72034
72137
  const hidden2 = props.isolation.isActive();
72035
72138
  React2.useEffect(() => {
72036
- const subState = viewer.gizmos.sectionBox.onStateChanged.subscribe(() => {
72037
- setSection({
72038
- visible: viewer.gizmos.sectionBox.visible,
72039
- clip: viewer.gizmos.sectionBox.clip
72040
- });
72041
- });
72042
- const subConfirm = viewer.gizmos.sectionBox.onBoxConfirm.subscribe(
72043
- () => setClipping(isClipping())
72044
- );
72045
72139
  props.isolation.onChanged.subscribe(() => setVersion((v) => v + 1));
72046
- return () => {
72047
- subState();
72048
- subConfirm();
72049
- };
72050
72140
  }, []);
72051
72141
  const onShowControlsBtn = (e) => {
72052
72142
  props.modal.help(true);
72053
72143
  e.stopPropagation();
72054
72144
  };
72055
72145
  const onCameraResetBtn = (e) => {
72056
- camera2.reset();
72146
+ camera2.reset.call();
72057
72147
  e.stopPropagation();
72058
72148
  };
72059
72149
  const onCameraFrameBtn = (e) => {
72060
- camera2.frameContext();
72150
+ camera2.frameSelection.call();
72061
72151
  e.stopPropagation();
72062
72152
  };
72063
72153
  const onSelectionIsolateBtn = (e) => {
@@ -72082,30 +72172,13 @@ Averrage Date/Second ${avgDataRatePS} kb
72082
72172
  props.isolation.show(getSelection(), "contextMenu");
72083
72173
  e.stopPropagation();
72084
72174
  };
72085
- const onSelectionClearBtn = (e) => {
72086
- viewer.selection.clear();
72087
- e.stopPropagation();
72088
- };
72089
72175
  const onShowAllBtn = (e) => {
72090
72176
  props.isolation.clear("contextMenu");
72091
72177
  e.stopPropagation();
72092
72178
  };
72093
- const onSectionToggleBtn = (e) => {
72094
- viewer.gizmos.sectionBox.clip = !viewer.gizmos.sectionBox.clip;
72095
- };
72096
- const onSectionResetBtn = (e) => {
72097
- viewer.gizmos.sectionBox.fitBox(viewer.renderer.getBoundingBox());
72098
- e.stopPropagation();
72099
- };
72100
72179
  const onMeasureDeleteBtn = (e) => {
72101
72180
  viewer.gizmos.measure.abort();
72102
72181
  };
72103
- const onFitSectionToSelectionBtn = (e) => {
72104
- const box = viewer.selection.getBoundingBox();
72105
- if (box) {
72106
- viewer.gizmos.sectionBox.fitBox(box);
72107
- }
72108
- };
72109
72182
  const createButton2 = (button) => {
72110
72183
  if (!button.enabled) return null;
72111
72184
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -72152,10 +72225,10 @@ Averrage Date/Second ${avgDataRatePS} kb
72152
72225
  },
72153
72226
  {
72154
72227
  id: contextMenuElementIds.zoomToFit,
72155
- label: "Zoom to Fit",
72228
+ label: "Focus Camera",
72156
72229
  keyboard: "F",
72157
72230
  action: onCameraFrameBtn,
72158
- enabled: true
72231
+ enabled: hasSelection
72159
72232
  },
72160
72233
  {
72161
72234
  id: contextMenuElementIds.dividerSelection,
@@ -72189,13 +72262,6 @@ Averrage Date/Second ${avgDataRatePS} kb
72189
72262
  action: onSelectionShowBtn,
72190
72263
  enabled: hasSelection && !hasVisibleSelection
72191
72264
  },
72192
- {
72193
- id: contextMenuElementIds.clearSelection,
72194
- label: "Clear Selection",
72195
- keyboard: "Esc",
72196
- action: onSelectionClearBtn,
72197
- enabled: hasSelection
72198
- },
72199
72265
  {
72200
72266
  id: contextMenuElementIds.showAll,
72201
72267
  label: "Show All",
@@ -72210,31 +72276,6 @@ Averrage Date/Second ${avgDataRatePS} kb
72210
72276
  keyboard: "",
72211
72277
  action: onMeasureDeleteBtn,
72212
72278
  enabled: measuring
72213
- },
72214
- {
72215
- id: contextMenuElementIds.dividerSection,
72216
- enabled: clipping || section.visible
72217
- },
72218
- {
72219
- id: contextMenuElementIds.ignoreSection,
72220
- label: section.clip ? "Ignore Section Box" : "Apply Section Box",
72221
- keyboard: "",
72222
- action: onSectionToggleBtn,
72223
- enabled: clipping
72224
- },
72225
- {
72226
- id: contextMenuElementIds.resetSection,
72227
- label: "Reset Section Box",
72228
- keyboard: "",
72229
- action: onSectionResetBtn,
72230
- enabled: clipping
72231
- },
72232
- {
72233
- id: contextMenuElementIds.fitSectionToSelection,
72234
- label: "Fit Section Box to Selection",
72235
- keyboard: "",
72236
- action: onFitSectionToSelectionBtn,
72237
- enabled: section.visible && hasSelection
72238
72279
  }
72239
72280
  ];
72240
72281
  elements = ((_c = props.customization) == null ? void 0 : _c.call(props, elements)) ?? elements;
@@ -72389,7 +72430,7 @@ Averrage Date/Second ${avgDataRatePS} kb
72389
72430
  createInteractiveElementProps: (item, treeId, actions, renderFlags) => ({
72390
72431
  onKeyUp: (e) => {
72391
72432
  if (e.key === "f") {
72392
- props.camera.frameContext();
72433
+ props.camera.frameSelection.call();
72393
72434
  }
72394
72435
  if (e.key === "Escape") {
72395
72436
  props.viewer.selection.clear();
@@ -72432,7 +72473,7 @@ Averrage Date/Second ${avgDataRatePS} kb
72432
72473
  },
72433
72474
  onPrimaryAction: (item, _) => {
72434
72475
  if (doubleClick.isDoubleClick(item.index)) {
72435
- props.camera.frameSelection();
72476
+ props.camera.frameSelection.call();
72436
72477
  }
72437
72478
  },
72438
72479
  onFocusItem: (item) => {
@@ -74723,7 +74764,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74723
74764
  return true;
74724
74765
  }
74725
74766
  case KEYS.KEY_F: {
74726
- this._camera.frameContext();
74767
+ this._camera.frameSelection.call();
74727
74768
  return true;
74728
74769
  }
74729
74770
  case KEYS.KEY_I: {
@@ -74917,7 +74958,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74917
74958
  if (!this._settings.isolation.enable) return;
74918
74959
  this._isolation = objects ?? [];
74919
74960
  this._apply(source);
74920
- this._camera.frameVisibleObjects();
74961
+ this._camera.frameScene.call();
74921
74962
  }
74922
74963
  /**
74923
74964
  * Toggles isolation by using the current selection.
@@ -74932,7 +74973,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74932
74973
  if (!this._settings.isolation.enable) return;
74933
74974
  this._isolation = [...this._viewer.selection.objects].filter((o) => o.type === "Object3D");
74934
74975
  this._apply(source);
74935
- this._camera.frameVisibleObjects();
74976
+ this._camera.frameScene.call();
74936
74977
  this._viewer.selection.clear();
74937
74978
  }
74938
74979
  /**
@@ -75032,75 +75073,6 @@ Averrage Date/Second ${avgDataRatePS} kb
75032
75073
  return objects;
75033
75074
  }
75034
75075
  }
75035
- class ComponentCamera {
75036
- constructor(viewer) {
75037
- __publicField(this, "_viewer");
75038
- this._viewer = viewer;
75039
- }
75040
- /**
75041
- * Resets the camera to its initial position.
75042
- */
75043
- reset() {
75044
- this._viewer.camera.lerp(1).reset();
75045
- }
75046
- /**
75047
- * Frames selected elements if there is an active selection; otherwise, frames all visible objects.
75048
- * @param duration Optional duration of the camera movement animation (default: 1).
75049
- */
75050
- frameContext(duration = 1) {
75051
- if (this._viewer.selection.count > 0) {
75052
- this.frameSelection(duration);
75053
- } else {
75054
- this.frameVisibleObjects(void 0, duration);
75055
- }
75056
- }
75057
- /**
75058
- * Frames selected elements if there is an active selection; otherwise, does nothing.
75059
- * @param duration Optional duration of the camera movement animation (default: 1).
75060
- */
75061
- frameSelection(duration = 1) {
75062
- if (this._viewer.selection.count === 0) return;
75063
- const box = this._viewer.selection.getBoundingBox();
75064
- if (box && this._viewer.gizmos.sectionBox.box.intersectsBox(box)) {
75065
- const movement = duration === 0 ? this._viewer.camera.snap() : this._viewer.camera.lerp(duration);
75066
- movement.frame(box);
75067
- }
75068
- }
75069
- /**
75070
- * Frames all visible objects in the scene.
75071
- * @param source Optional VIM to specify the source of objects to frame.
75072
- * @param duration Duration of the camera movement animation (default: 1).
75073
- */
75074
- frameVisibleObjects(source, duration = 1) {
75075
- const movement = duration === 0 ? this._viewer.camera.snap() : this._viewer.camera.lerp(duration);
75076
- const box = this.getVisibleBoundingBox(source);
75077
- movement.frame(box);
75078
- }
75079
- /**
75080
- * Returns the bounding box of all visible objects.
75081
- * @param source Optional VIM to specify the source of visible objects.
75082
- * @returns The bounding box of all visible objects.
75083
- */
75084
- getVisibleBoundingBox(source) {
75085
- let box;
75086
- const vimBoxUnion = (vim) => {
75087
- for (const obj of vim.getObjects()) {
75088
- if (!obj.visible) continue;
75089
- const b = obj.getBoundingBox();
75090
- if (!b) continue;
75091
- box = box ? box.union(b) : b == null ? void 0 : b.clone();
75092
- }
75093
- };
75094
- if (source) {
75095
- vimBoxUnion(source);
75096
- } else {
75097
- for (const vim of this._viewer.vims) {
75098
- vimBoxUnion(vim);
75099
- }
75100
- }
75101
- return box;
75102
- }
75103
- }
75104
75076
  function createContainer(element) {
75105
75077
  let root = element;
75106
75078
  if (root === void 0) {
@@ -75659,7 +75631,7 @@ Averrage Date/Second ${avgDataRatePS} kb
75659
75631
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
75660
75632
  "div",
75661
75633
  {
75662
- className: "vim-modal vc-absolute vc-inset-0 vc-z-40 vc-flex vc-items-center vc-justify-center vc-bg-overflow vc-backdrop-blur",
75634
+ className: "vim-modal vc-absolute vc-inset-0 vc-z-40 vc-flex vc-items-center vc-justify-center vc-bg-overflow vc-bg-gray",
75663
75635
  onClick: ((_a2 = props.state.current) == null ? void 0 : _a2.canClose) ? () => {
75664
75636
  var _a3, _b3;
75665
75637
  return (_b3 = (_a3 = state.current) == null ? void 0 : _a3.onClose) == null ? void 0 : _b3.call(_a3);
@@ -75732,8 +75704,8 @@ Averrage Date/Second ${avgDataRatePS} kb
75732
75704
  resizeObserver.disconnect();
75733
75705
  }
75734
75706
  };
75735
- }, [props.state.getOffsetVisible()]);
75736
- if (!props.state.getOffsetVisible()) return null;
75707
+ }, [props.state.showOffsetPanel.get()]);
75708
+ if (!props.state.showOffsetPanel.get()) return null;
75737
75709
  const renderField = (id2, label, field) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vim-sectionbox-offsets-entry vc-text-xs vc-flex vc-items-center vc-justify-center vc-justify-between vc-my-2", children: [
75738
75710
  /* @__PURE__ */ jsxRuntimeExports.jsx("dt", { className: "vc-w-1/2 vc-inline", children: label }),
75739
75711
  /* @__PURE__ */ jsxRuntimeExports.jsx("dd", { className: "vc-w-1/3 vc-inline", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -75741,10 +75713,10 @@ Averrage Date/Second ${avgDataRatePS} kb
75741
75713
  {
75742
75714
  id: id2,
75743
75715
  type: "text",
75744
- value: props.state.getText(field),
75745
- onChange: (e) => props.state.setText(field, e.target.value),
75716
+ value: field.get(),
75717
+ onChange: (e) => field.set(e.target.value),
75746
75718
  className: "vc-border vc-inline vc-border-gray-300 vc-py-1 vc-w-full vc-px-1",
75747
- onBlur: () => props.state.validate(field)
75719
+ onBlur: () => field.confirm()
75748
75720
  }
75749
75721
  ) })
75750
75722
  ] });
@@ -75766,15 +75738,15 @@ Averrage Date/Second ${avgDataRatePS} kb
75766
75738
  "button",
75767
75739
  {
75768
75740
  className: "vc-flex vc-border-none vc-bg-transparent vc-text-sm vc-cursor-pointer",
75769
- onClick: () => props.state.setOffsetsVisible(false),
75741
+ onClick: () => props.state.showOffsetPanel.set(false),
75770
75742
  children: close({ height: 12, width: 12, fill: "currentColor" })
75771
75743
  }
75772
75744
  )
75773
75745
  ] }),
75774
75746
  /* @__PURE__ */ jsxRuntimeExports.jsxs("dl", { className: "vc-text-xl vc-text-gray-darker vc-mb-2 vc-mx-2 ", children: [
75775
- renderField("topOffset", "Top Offset", "topOffset"),
75776
- renderField("sideOffseet", "Side Offset", "sideOffset"),
75777
- renderField("bottomOffset", "Bottom Offset", "bottomOffset")
75747
+ renderField("topOffset", "Top Offset", props.state.topOffset),
75748
+ renderField("sideOffseet", "Side Offset", props.state.sideOffset),
75749
+ renderField("bottomOffset", "Bottom Offset", props.state.bottomOffset)
75778
75750
  ] })
75779
75751
  ]
75780
75752
  }
@@ -75812,83 +75784,158 @@ Averrage Date/Second ${avgDataRatePS} kb
75812
75784
  r.max.z += b2.max.z;
75813
75785
  return r;
75814
75786
  }
75787
+ function useStateRef(initialValue) {
75788
+ const [value, setValue] = React2.useState(initialValue);
75789
+ const ref = React2.useRef(initialValue);
75790
+ const event = React2.useRef(new distExports.SimpleEventDispatcher());
75791
+ const validate = React2.useRef((value2) => value2);
75792
+ const confirm = React2.useRef((value2) => value2);
75793
+ const set2 = (value2) => {
75794
+ const finalValue = validate.current(value2) ?? value2;
75795
+ if (finalValue === void 0) return;
75796
+ if (finalValue === ref.current) return;
75797
+ ref.current = finalValue;
75798
+ setValue(finalValue);
75799
+ event.current.dispatch(finalValue);
75800
+ };
75801
+ return {
75802
+ get() {
75803
+ return ref.current;
75804
+ },
75805
+ set: set2,
75806
+ confirm() {
75807
+ set2(confirm.current(ref.current));
75808
+ },
75809
+ useOnChange(on) {
75810
+ React2.useEffect(() => {
75811
+ return event.current.subscribe(on);
75812
+ }, []);
75813
+ },
75814
+ useMemo(on, deps) {
75815
+ return React2.useMemo(() => on(value), [...deps || [], value]);
75816
+ },
75817
+ useValidate(on) {
75818
+ React2.useEffect(() => {
75819
+ validate.current = on;
75820
+ }, []);
75821
+ },
75822
+ useConfirm(on) {
75823
+ React2.useEffect(() => {
75824
+ confirm.current = on;
75825
+ }, []);
75826
+ }
75827
+ };
75828
+ }
75829
+ function useActionRef(action) {
75830
+ const ref = React2.useRef(action);
75831
+ return {
75832
+ call() {
75833
+ ref == null ? void 0 : ref.current();
75834
+ },
75835
+ set(func) {
75836
+ ref.current = func;
75837
+ }
75838
+ };
75839
+ }
75840
+ function useArgActionRef(action) {
75841
+ const ref = React2.useRef(action);
75842
+ return {
75843
+ call(arg) {
75844
+ ref == null ? void 0 : ref.current(arg);
75845
+ },
75846
+ set(func) {
75847
+ ref.current = func;
75848
+ }
75849
+ };
75850
+ }
75851
+ function useFuncRef(func) {
75852
+ const ref = React2.useRef(func);
75853
+ return {
75854
+ call() {
75855
+ return ref == null ? void 0 : ref.current();
75856
+ },
75857
+ set(func2) {
75858
+ ref.current = func2;
75859
+ }
75860
+ };
75861
+ }
75862
+ function useAsyncFuncRef(func) {
75863
+ const ref = React2.useRef(func);
75864
+ return {
75865
+ async call() {
75866
+ return ref == null ? void 0 : ref.current();
75867
+ },
75868
+ set(func2) {
75869
+ ref.current = func2;
75870
+ }
75871
+ };
75872
+ }
75815
75873
  function useSectionBox(adapter) {
75816
- const [enable, setEnable] = React2.useState(false);
75817
- const [visible2, setVisible] = React2.useState(false);
75818
- const [offsetsVisible, setOffsetsVisible] = React2.useState(false);
75819
- const [auto, setAuto] = React2.useState(false);
75820
- const [offsets, setOffsets] = React2.useState({
75821
- topOffset: "1",
75822
- sideOffset: "1",
75823
- bottomOffset: "1"
75824
- });
75874
+ const enable = useStateRef(false);
75875
+ const visible2 = useStateRef(false);
75876
+ const showOffsetPanel = useStateRef(false);
75877
+ const auto = useStateRef(false);
75878
+ const topOffset = useStateRef("1");
75879
+ const sideOffset = useStateRef("1");
75880
+ const bottomOffset = useStateRef("1");
75825
75881
  const boxRef = React2.useRef(adapter.getBox());
75826
- const offsetBox = React2.useMemo(() => offsetsToBox3(offsets), [offsets]);
75827
75882
  React2.useEffect(() => {
75828
- setVisible(enable);
75829
- setAuto(false);
75830
- setOffsetsVisible(false);
75831
- setOffsets({
75832
- topOffset: "1",
75833
- sideOffset: "1",
75834
- bottomOffset: "1"
75883
+ adapter.setVisible(false);
75884
+ adapter.setClip(false);
75885
+ return adapter.onSelectionChanged.sub(() => {
75886
+ if (auto.get() && enable.get()) sectionSelection.call();
75835
75887
  });
75836
- void resetBox();
75837
- }, [enable]);
75838
- React2.useEffect(() => {
75839
- if (auto) sectionSelection();
75840
- return auto ? adapter.onSelectionChanged.sub(sectionSelection) : () => {
75841
- };
75842
- }, [auto]);
75843
- React2.useEffect(() => {
75844
- setBox(boxRef.current);
75845
- }, [offsets]);
75846
- React2.useEffect(() => {
75847
- adapter.setVisible(visible2);
75848
- }, [visible2]);
75849
- const setText = (field, value) => {
75850
- const result = sanitize(value, false);
75851
- if (result !== void 0) {
75852
- setOffsets((prev) => ({ ...prev, [field]: result }));
75853
- }
75854
- };
75855
- const validate = (field) => {
75856
- const result = sanitize(offsets[field], true);
75857
- if (result !== void 0) {
75858
- setOffsets((prev) => ({ ...prev, [field]: result }));
75888
+ }, []);
75889
+ enable.useOnChange((v) => {
75890
+ adapter.setClip(v);
75891
+ visible2.set(v);
75892
+ showOffsetPanel.set(false);
75893
+ if (v && auto.get()) {
75894
+ sectionSelection.call();
75895
+ } else {
75896
+ sectionReset.call();
75859
75897
  }
75860
- };
75861
- const setBox = (baseBox) => {
75898
+ });
75899
+ visible2.useValidate((v) => enable.get() && v);
75900
+ showOffsetPanel.useValidate((v) => enable.get() && v);
75901
+ topOffset.useConfirm((v) => sanitize(v, true));
75902
+ sideOffset.useConfirm((v) => sanitize(v, true));
75903
+ bottomOffset.useConfirm((v) => sanitize(v, true));
75904
+ topOffset.useOnChange((v) => section.call(boxRef.current));
75905
+ sideOffset.useOnChange((v) => section.call(boxRef.current));
75906
+ bottomOffset.useOnChange((v) => section.call(boxRef.current));
75907
+ auto.useOnChange((v) => {
75908
+ if (v) sectionSelection.call();
75909
+ });
75910
+ visible2.useOnChange((v) => adapter.setVisible(v));
75911
+ const section = useArgActionRef((baseBox) => {
75862
75912
  boxRef.current = baseBox;
75863
- const newBox = addBox(baseBox, offsetBox);
75913
+ const newBox = addBox(baseBox, offsetsToBox3(topOffset.get(), sideOffset.get(), bottomOffset.get()));
75864
75914
  adapter.fitBox(newBox);
75865
- };
75866
- const sectionSelection = async () => {
75915
+ });
75916
+ const sectionSelection = useFuncRef(async () => {
75867
75917
  try {
75868
75918
  const box = await adapter.getSelectionBox() ?? await adapter.getRendererBox();
75869
- setBox(box);
75919
+ section.call(box);
75870
75920
  } catch (e) {
75871
75921
  console.error(e);
75872
75922
  }
75873
- };
75874
- const resetBox = async () => {
75923
+ });
75924
+ const sectionReset = useFuncRef(async () => {
75875
75925
  const box = await adapter.getRendererBox();
75876
- setBox(box);
75877
- };
75926
+ section.call(box);
75927
+ });
75878
75928
  return {
75879
- setEnable,
75880
- getEnable: () => enable,
75881
- getVisible: () => visible2,
75882
- setVisible,
75929
+ enable,
75930
+ visible: visible2,
75931
+ auto,
75932
+ showOffsetPanel,
75933
+ topOffset,
75934
+ sideOffset,
75935
+ bottomOffset,
75883
75936
  sectionSelection,
75884
- sectionReset: resetBox,
75885
- getOffsetVisible: () => offsetsVisible,
75886
- setOffsetsVisible,
75887
- getText: (field) => offsets[field],
75888
- setText,
75889
- getAuto: () => auto,
75890
- setAuto,
75891
- validate
75937
+ sectionReset,
75938
+ section
75892
75939
  };
75893
75940
  }
75894
75941
  const sanitize = (value, strict) => {
@@ -75901,18 +75948,21 @@ Averrage Date/Second ${avgDataRatePS} kb
75901
75948
  }
75902
75949
  return String(num);
75903
75950
  };
75904
- function offsetsToBox3(offsets) {
75905
- const getNumber = (field) => {
75906
- const num = parseFloat(offsets[field]);
75951
+ function offsetsToBox3(top, side, bottom) {
75952
+ const getNumber = (s) => {
75953
+ const num = parseFloat(s);
75907
75954
  return isNaN(num) ? 0 : num;
75908
75955
  };
75909
75956
  return new Box3(
75910
- new Vector3(-getNumber("sideOffset"), -getNumber("sideOffset"), -getNumber("bottomOffset")),
75911
- new Vector3(getNumber("sideOffset"), getNumber("sideOffset"), getNumber("topOffset"))
75957
+ new Vector3(-getNumber(side), -getNumber(side), -getNumber(bottom)),
75958
+ new Vector3(getNumber(side), getNumber(side), getNumber(top))
75912
75959
  );
75913
75960
  }
75914
75961
  function useWebglSectionBox(viewer) {
75915
75962
  const vimAdapter = {
75963
+ setClip: (b) => {
75964
+ viewer.gizmos.sectionBox.clip = b;
75965
+ },
75916
75966
  setVisible: (b) => {
75917
75967
  viewer.gizmos.sectionBox.visible = b;
75918
75968
  viewer.gizmos.sectionBox.interactive = b;
@@ -75921,12 +75971,59 @@ Averrage Date/Second ${avgDataRatePS} kb
75921
75971
  fitBox: (box) => viewer.gizmos.sectionBox.fitBox(box),
75922
75972
  getSelectionBox: () => Promise.resolve(viewer.selection.getBoundingBox()),
75923
75973
  getRendererBox: () => Promise.resolve(viewer.renderer.getBoundingBox()),
75924
- onSceneChanged: viewer.renderer.onBoxUpdated,
75925
75974
  onSelectionChanged: viewer.selection.onValueChanged
75926
75975
  };
75927
- viewer.gizmos.sectionBox.clip = true;
75928
75976
  return useSectionBox(vimAdapter);
75929
75977
  }
75978
+ function useCamera(adapter) {
75979
+ const autoCamera2 = useStateRef(false);
75980
+ autoCamera2.useOnChange((v) => {
75981
+ if (v) {
75982
+ frameSelection2.call();
75983
+ }
75984
+ });
75985
+ React2.useEffect(() => {
75986
+ adapter.onSelectionChanged.sub(() => {
75987
+ if (autoCamera2.get()) {
75988
+ frameSelection2.call();
75989
+ }
75990
+ });
75991
+ }, []);
75992
+ const reset = useActionRef(() => adapter.resetCamera(1));
75993
+ const frameSelection2 = useAsyncFuncRef(async () => {
75994
+ if (!adapter.hasSelection()) {
75995
+ frameScene.call();
75996
+ return;
75997
+ }
75998
+ const box = await adapter.getSelectionBox();
75999
+ if (!box) {
76000
+ return;
76001
+ }
76002
+ adapter.frameCamera(box, 1);
76003
+ });
76004
+ const frameScene = useAsyncFuncRef(async () => {
76005
+ adapter.frameAll(1);
76006
+ });
76007
+ return {
76008
+ autoCamera: autoCamera2,
76009
+ reset,
76010
+ frameSelection: frameSelection2,
76011
+ frameScene
76012
+ };
76013
+ }
76014
+ function useWebglCamera(viewer) {
76015
+ return useCamera({
76016
+ onSelectionChanged: viewer.selection.onValueChanged,
76017
+ frameCamera: (box, duration) => viewer.camera.lerp(duration).frame(box),
76018
+ resetCamera: (duration) => viewer.camera.lerp(duration).reset(),
76019
+ frameAll: (duration) => {
76020
+ const box = viewer.renderer.getBoundingBox();
76021
+ viewer.camera.lerp(duration).frame(box);
76022
+ },
76023
+ hasSelection: () => viewer.selection.count > 0,
76024
+ getSelectionBox: () => Promise.resolve(viewer.selection.getBoundingBox())
76025
+ });
76026
+ }
75930
76027
  function createWebglComponent(container, componentSettings = {}, viewerSettings = {}) {
75931
76028
  const promise2 = new DeferredPromise();
75932
76029
  const cmpContainer = container instanceof HTMLElement ? createContainer(container) : container ?? createContainer();
@@ -75958,7 +76055,7 @@ Averrage Date/Second ${avgDataRatePS} kb
75958
76055
  var _a2;
75959
76056
  const settings2 = useSettings(props.viewer, props.settings ?? {});
75960
76057
  const modal = useModal(settings2.value.capacity.canFollowUrl);
75961
- const camera2 = React2.useMemo(() => new ComponentCamera(props.viewer), []);
76058
+ const camera2 = useWebglCamera(props.viewer);
75962
76059
  const cursor = React2.useMemo(() => new CursorManager(props.viewer), []);
75963
76060
  const loader = React2.useRef(new ComponentLoader(props.viewer, modal));
75964
76061
  const [isolation] = React2.useState(() => new Isolation(props.viewer, camera2, settings2.value));
@@ -75999,6 +76096,9 @@ Averrage Date/Second ${avgDataRatePS} kb
75999
76096
  isolation,
76000
76097
  camera: camera2,
76001
76098
  settings: settings2,
76099
+ get sectionBox() {
76100
+ return sectionBox2;
76101
+ },
76002
76102
  contextMenu: {
76003
76103
  customize: (v) => setcontextMenu(() => v)
76004
76104
  },
@@ -76172,11 +76272,13 @@ Averrage Date/Second ${avgDataRatePS} kb
76172
76272
  vcRoboto
76173
76273
  }, Symbol.toStringTag, { value: "Module" }));
76174
76274
  const support = "https://docs.vimaec.com";
76275
+ const supportUltra = "https://docs.vimaec.com/docs/vim-for-windows/configuring-vim-ultra";
76175
76276
  const supportControls = "https://docs.vimaec.com/docs/vim-cloud/webgl-navigation-and-controls-guide";
76176
76277
  const urls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
76177
76278
  __proto__: null,
76178
76279
  support,
76179
- supportControls
76280
+ supportControls,
76281
+ supportUltra
76180
76282
  }, Symbol.toStringTag, { value: "Module" }));
76181
76283
  function fileOpeningError(url) {
76182
76284
  return {
@@ -76222,12 +76324,12 @@ Averrage Date/Second ${avgDataRatePS} kb
76222
76324
  }
76223
76325
  return {
76224
76326
  title: "File Downloading Error",
76225
- body: body$4(server, authToken, server),
76327
+ body: body$4(url, authToken, server),
76226
76328
  footer: footer(support),
76227
76329
  canClose: false
76228
76330
  };
76229
76331
  }
76230
- function body$4(url, server, authToken) {
76332
+ function body$4(url, authToken, server) {
76231
76333
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
76232
76334
  mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
76233
76335
  "Oops, it appears that there’s an ",
@@ -76292,7 +76394,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76292
76394
  /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
76293
76395
  "Ensure that VIM Ultra",
76294
76396
  " ",
76295
- link(support, "process is running"),
76397
+ link(supportUltra, "process is running"),
76296
76398
  " ",
76297
76399
  "at ",
76298
76400
  detailText(url)
@@ -76374,7 +76476,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76374
76476
  return serverStreamError(state.serverUrl);
76375
76477
  }
76376
76478
  }
76377
- function getRequestErrorMessage(source, error) {
76479
+ function getRequestErrorMessage(serverUrl, source, error) {
76378
76480
  console.log(error);
76379
76481
  switch (error) {
76380
76482
  case "loadingError":
@@ -76382,7 +76484,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76382
76484
  case "downloadingError":
76383
76485
  case "unknown":
76384
76486
  case "cancelled":
76385
- return serverFileDownloadingError(source.url);
76487
+ return serverFileDownloadingError(source.url, source.authToken, serverUrl);
76386
76488
  case "serverDisconnected":
76387
76489
  return serverConnectionError(source.url);
76388
76490
  }
@@ -76394,7 +76496,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76394
76496
  }
76395
76497
  if (state.status === "connecting") {
76396
76498
  if (modal.current === void 0 || modal.current.type === "loading") {
76397
- modal.loading({ message: "Connecting to VIM Ultra server..." });
76499
+ modal.loading({ message: "Initializing..." });
76398
76500
  }
76399
76501
  }
76400
76502
  if (state.status === "error") {
@@ -76410,6 +76512,9 @@ Averrage Date/Second ${avgDataRatePS} kb
76410
76512
  }
76411
76513
  function useUltraSectionBox(viewer) {
76412
76514
  const ultraAdapter = {
76515
+ setClip: (b) => {
76516
+ viewer.sectionBox.clip = b;
76517
+ },
76413
76518
  setVisible: (b) => {
76414
76519
  viewer.sectionBox.visible = b;
76415
76520
  viewer.sectionBox.interactive = b;
@@ -76418,15 +76523,26 @@ Averrage Date/Second ${avgDataRatePS} kb
76418
76523
  fitBox: (box) => viewer.sectionBox.fitBox(box),
76419
76524
  getSelectionBox: () => viewer.selection.getBoundingBox(),
76420
76525
  getRendererBox: () => viewer.renderer.getBoundingBox(),
76421
- onSelectionChanged: viewer.selection.onValueChanged,
76422
- onSceneChanged: viewer.vims.onChanged
76526
+ onSelectionChanged: viewer.selection.onValueChanged
76423
76527
  };
76424
76528
  return useSectionBox(ultraAdapter);
76425
76529
  }
76426
- function useUltraControlBar(viewer, section, customization) {
76427
- let controlBar2 = [controlBarSectionBox(section, viewer.selection.count > 0)];
76428
- controlBar2 = (customization == null ? void 0 : customization(controlBar2)) ?? controlBar2;
76429
- return controlBar2;
76530
+ function useUltraControlBar(viewer, section, camera2, customization) {
76531
+ const sectionSectionBox = controlBarSectionBox(section, viewer.selection.count > 0);
76532
+ const sectionCamera = controlBarCamera(camera2);
76533
+ let bar = [sectionCamera, sectionSectionBox];
76534
+ bar = (customization == null ? void 0 : customization(bar)) ?? bar;
76535
+ return bar;
76536
+ }
76537
+ function useUltraCamera(viewer) {
76538
+ return useCamera({
76539
+ onSelectionChanged: viewer.selection.onValueChanged,
76540
+ frameCamera: (box, duration) => void viewer.camera.frameBox(box, duration),
76541
+ frameAll: (duration) => viewer.camera.frameAll(duration),
76542
+ resetCamera: (duration) => viewer.camera.restoreSavedPosition(duration),
76543
+ hasSelection: () => viewer.selection.count > 0,
76544
+ getSelectionBox: () => viewer.selection.getBoundingBox()
76545
+ });
76430
76546
  }
76431
76547
  function createUltraComponent(container) {
76432
76548
  const promise2 = new DeferredPromise();
@@ -76456,15 +76572,28 @@ Averrage Date/Second ${avgDataRatePS} kb
76456
76572
  function UltraComponent(props) {
76457
76573
  const modal = useModal(true);
76458
76574
  const sectionBox2 = useUltraSectionBox(props.viewer);
76459
- const controlBar2 = useUltraControlBar(props.viewer, sectionBox2, (_2) => _2);
76575
+ const camera2 = useUltraCamera(props.viewer);
76460
76576
  const side = useSideState(true, 400);
76461
76577
  const [_, setSelectState] = React2.useState(0);
76578
+ const [controlBarCustom, setControlBarCustom] = React2.useState(() => (c) => c);
76579
+ const controlBar2 = useUltraControlBar(props.viewer, sectionBox2, camera2, (_2) => _2);
76462
76580
  React2.useEffect(() => {
76463
76581
  props.viewer.onStateChanged.subscribe((state) => updateModal(modal, state));
76464
76582
  props.viewer.selection.onValueChanged.subscribe(() => {
76465
76583
  setSelectState((i2) => (i2 + 1) % 2);
76466
76584
  });
76467
- props.onMount(createComponentRef(props.viewer, modal));
76585
+ props.onMount({
76586
+ viewer: props.viewer,
76587
+ modal,
76588
+ sectionBox: sectionBox2,
76589
+ camera: camera2,
76590
+ dispose: () => {
76591
+ },
76592
+ controlBar: {
76593
+ customize: (v) => setControlBarCustom(() => v)
76594
+ },
76595
+ load: patchLoad(props.viewer, modal)
76596
+ });
76468
76597
  }, []);
76469
76598
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
76470
76599
  /* @__PURE__ */ jsxRuntimeExports.jsx(RestOfScreen, { side, content: () => {
@@ -76474,24 +76603,34 @@ Averrage Date/Second ${avgDataRatePS} kb
76474
76603
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76475
76604
  ControlBar,
76476
76605
  {
76477
- content: controlBar2,
76606
+ content: controlBarCustom(controlBar2),
76478
76607
  show: true
76479
76608
  }
76480
76609
  ),
76481
76610
  /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { state: sectionBox2 })
76482
76611
  ] });
76483
76612
  } }),
76484
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { state: modal })
76613
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { state: modal }),
76614
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76615
+ ReactTooltip,
76616
+ {
76617
+ multiline: true,
76618
+ arrowColor: "transparent",
76619
+ type: "light",
76620
+ className: "!vc-max-w-xs !vc-border !vc-border-solid !vc-border-gray-medium !vc-bg-white !vc-text-xs !vc-text-gray-darkest !vc-opacity-100 !vc-shadow-[2px_6px_15px_rgba(0,0,0,0.3)] !vc-transition-opacity",
76621
+ delayShow: 200
76622
+ }
76623
+ )
76485
76624
  ] });
76486
76625
  }
76487
- function createComponentRef(viewer, modal) {
76488
- function load(source) {
76626
+ function patchLoad(viewer, modal) {
76627
+ return function load(source) {
76489
76628
  const request2 = viewer.loadVim(source);
76490
76629
  void updateProgress(request2, modal);
76491
76630
  void request2.getResult().then(
76492
76631
  (result) => {
76493
76632
  if (result.isError) {
76494
- modal.message(getRequestErrorMessage(source, result.error));
76633
+ modal.message(getRequestErrorMessage(viewer.serverUrl, source, result.error));
76495
76634
  return;
76496
76635
  }
76497
76636
  if (result.isSuccess) {
@@ -76500,13 +76639,6 @@ Averrage Date/Second ${avgDataRatePS} kb
76500
76639
  }
76501
76640
  );
76502
76641
  return request2;
76503
- }
76504
- return {
76505
- viewer,
76506
- modal,
76507
- dispose: () => {
76508
- },
76509
- load
76510
76642
  };
76511
76643
  }
76512
76644
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -76514,6 +76646,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76514
76646
  UltraComponent,
76515
76647
  createUltraComponent
76516
76648
  }, Symbol.toStringTag, { value: "Module" }));
76649
+ exports.ControlBar = controlBar;
76517
76650
  exports.ErrorStyle = errorStyle;
76518
76651
  exports.Errors = errors;
76519
76652
  exports.Icons = icons;