vim-web 0.5.0-dev.8 → 0.5.1

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 (59) hide show
  1. package/dist/style.css +34 -7
  2. package/dist/types/core-viewers/shared/inputAdapter.d.ts +1 -0
  3. package/dist/types/core-viewers/shared/keyboardHandler.d.ts +1 -1
  4. package/dist/types/core-viewers/shared/mouseHandler.d.ts +3 -0
  5. package/dist/types/core-viewers/ultra/rpcClient.d.ts +5 -3
  6. package/dist/types/core-viewers/ultra/rpcSafeClient.d.ts +12 -1
  7. package/dist/types/core-viewers/ultra/viewer.d.ts +5 -0
  8. package/dist/types/core-viewers/ultra/viewport.d.ts +6 -0
  9. package/dist/types/core-viewers/ultra/vim.d.ts +3 -1
  10. package/dist/types/core-viewers/webgl/loader/mesh.d.ts +3 -1
  11. package/dist/types/core-viewers/webgl/loader/progressive/insertableMesh.d.ts +4 -2
  12. package/dist/types/core-viewers/webgl/loader/progressive/instancedMesh.d.ts +5 -0
  13. package/dist/types/core-viewers/webgl/loader/vim.d.ts +5 -0
  14. package/dist/types/core-viewers/webgl/viewer/gizmos/markers/gizmoMarker.d.ts +1 -0
  15. package/dist/types/core-viewers/webgl/viewer/rendering/renderer.d.ts +7 -0
  16. package/dist/types/core-viewers/webgl/viewer/viewer.d.ts +5 -0
  17. package/dist/types/core-viewers/webgl/viewer/viewport.d.ts +1 -1
  18. package/dist/types/react-viewers/bim/bimPanel.d.ts +3 -3
  19. package/dist/types/react-viewers/controlbar/controlBarIds.d.ts +32 -36
  20. package/dist/types/react-viewers/errors/errorStyle.d.ts +1 -1
  21. package/dist/types/react-viewers/helpers/reactUtils.d.ts +2 -1
  22. package/dist/types/react-viewers/helpers/utils.d.ts +8 -0
  23. package/dist/types/react-viewers/panels/axesPanel.d.ts +2 -1
  24. package/dist/types/react-viewers/panels/index.d.ts +1 -0
  25. package/dist/types/react-viewers/panels/isolationPanel.d.ts +2 -0
  26. package/dist/types/react-viewers/panels/messageBox.d.ts +2 -0
  27. package/dist/types/react-viewers/panels/sidePanel.d.ts +1 -1
  28. package/dist/types/react-viewers/settings/anySettings.d.ts +7 -0
  29. package/dist/types/react-viewers/settings/index.d.ts +1 -1
  30. package/dist/types/react-viewers/settings/settingsInputBox.d.ts +4 -0
  31. package/dist/types/react-viewers/settings/settingsItem.d.ts +30 -0
  32. package/dist/types/react-viewers/settings/settingsKeys.d.ts +46 -0
  33. package/dist/types/react-viewers/settings/settingsPanel.d.ts +5 -4
  34. package/dist/types/react-viewers/settings/settingsPanelContent.d.ts +6 -0
  35. package/dist/types/react-viewers/settings/settingsState.d.ts +11 -11
  36. package/dist/types/react-viewers/settings/settingsStorage.d.ts +3 -3
  37. package/dist/types/react-viewers/settings/settingsSubtitle.d.ts +2 -0
  38. package/dist/types/react-viewers/settings/settingsToggle.d.ts +11 -0
  39. package/dist/types/react-viewers/state/controlBarState.d.ts +41 -7
  40. package/dist/types/react-viewers/state/sharedIsolation.d.ts +2 -0
  41. package/dist/types/react-viewers/ultra/controlBar.d.ts +4 -1
  42. package/dist/types/react-viewers/ultra/index.d.ts +1 -0
  43. package/dist/types/react-viewers/ultra/settings.d.ts +13 -0
  44. package/dist/types/react-viewers/ultra/settingsPanel.d.ts +5 -0
  45. package/dist/types/react-viewers/ultra/viewer.d.ts +3 -1
  46. package/dist/types/react-viewers/ultra/viewerRef.d.ts +3 -0
  47. package/dist/types/react-viewers/urls.d.ts +0 -1
  48. package/dist/types/react-viewers/webgl/index.d.ts +1 -0
  49. package/dist/types/react-viewers/webgl/loading.d.ts +2 -2
  50. package/dist/types/react-viewers/webgl/settings.d.ts +36 -0
  51. package/dist/types/react-viewers/webgl/settingsPanel.d.ts +12 -0
  52. package/dist/types/react-viewers/webgl/viewer.d.ts +3 -3
  53. package/dist/types/react-viewers/webgl/viewerRef.d.ts +12 -5
  54. package/dist/vim-web.iife.js +1449 -765
  55. package/dist/vim-web.iife.js.map +1 -1
  56. package/dist/vim-web.js +1449 -765
  57. package/dist/vim-web.js.map +1 -1
  58. package/package.json +1 -1
  59. package/dist/types/react-viewers/settings/settings.d.ts +0 -61
package/dist/vim-web.js CHANGED
@@ -46769,6 +46769,11 @@ let Vim$1 = class Vim {
46769
46769
  * @param {boolean} isLegacy - Indicates whether the Vim object uses a legacy loading pipeline.
46770
46770
  */
46771
46771
  constructor(header, document2, g3d2, scene, settings2, map, builder, source, format) {
46772
+ /**
46773
+ * The type of the viewer, indicating it is a WebGL viewer.
46774
+ * Useful for distinguishing between different viewer types in a multi-viewer application.
46775
+ */
46776
+ __publicField(this, "type", "webgl");
46772
46777
  /**
46773
46778
  * Indicates whether the vim was opened from a vim or vimx file.
46774
46779
  */
@@ -48846,19 +48851,38 @@ class InsertableMesh {
48846
48851
  return new InsertableSubmesh(this, index2);
48847
48852
  }
48848
48853
  /**
48849
- * Overrides mesh material, set to undefine to restore initial material.
48850
- */
48854
+ * Sets the material for this mesh.
48855
+ * Set to undefined to reset to original materials.
48856
+ */
48851
48857
  setMaterial(value) {
48852
- if (this._material === value) return;
48853
48858
  if (this.ignoreSceneMaterial) return;
48854
- this.mesh.material = value ?? this._material;
48859
+ const base = this._material;
48860
+ let mat;
48861
+ if (Array.isArray(value)) {
48862
+ mat = this._mergeMaterials(value, base);
48863
+ } else {
48864
+ mat = value ?? base;
48865
+ }
48866
+ this.mesh.material = mat;
48855
48867
  this.mesh.geometry.clearGroups();
48856
- if (value instanceof Array) {
48857
- value.forEach((m, i) => {
48868
+ if (Array.isArray(mat)) {
48869
+ mat.forEach((_m, i) => {
48858
48870
  this.mesh.geometry.addGroup(0, Infinity, i);
48859
48871
  });
48860
48872
  }
48861
48873
  }
48874
+ _mergeMaterials(value, base) {
48875
+ const baseArr = Array.isArray(base) ? base : [base];
48876
+ const result = [];
48877
+ for (const v of value) {
48878
+ if (v === void 0) {
48879
+ result.push(...baseArr);
48880
+ } else {
48881
+ result.push(v);
48882
+ }
48883
+ }
48884
+ return result;
48885
+ }
48862
48886
  }
48863
48887
  class InstancedSubmesh {
48864
48888
  constructor(mesh, index2) {
@@ -48945,17 +48969,39 @@ class InstancedMesh2 {
48945
48969
  }
48946
48970
  return submeshes;
48947
48971
  }
48972
+ /**
48973
+ * Sets the material for this mesh.
48974
+ * Set to undefined to reset to original materials.
48975
+ */
48948
48976
  setMaterial(value) {
48949
- if (this._material === value) return;
48950
48977
  if (this.ignoreSceneMaterial) return;
48951
- this.mesh.material = value ?? this._material;
48978
+ const base = this._material;
48979
+ let mat;
48980
+ if (Array.isArray(value)) {
48981
+ mat = this._mergeMaterials(value, base);
48982
+ } else {
48983
+ mat = value ?? base;
48984
+ }
48985
+ this.mesh.material = mat;
48952
48986
  this.mesh.geometry.clearGroups();
48953
- if (value instanceof Array) {
48954
- value.forEach((m, i) => {
48987
+ if (Array.isArray(mat)) {
48988
+ mat.forEach((_m, i) => {
48955
48989
  this.mesh.geometry.addGroup(0, Infinity, i);
48956
48990
  });
48957
48991
  }
48958
48992
  }
48993
+ _mergeMaterials(value, base) {
48994
+ const baseArr = Array.isArray(base) ? base : [base];
48995
+ const result = [];
48996
+ for (const v of value) {
48997
+ if (v === void 0) {
48998
+ result.push(...baseArr);
48999
+ } else {
49000
+ result.push(v);
49001
+ }
49002
+ }
49003
+ return result;
49004
+ }
48959
49005
  computeBoundingBoxes() {
48960
49006
  this.mesh.geometry.computeBoundingBox();
48961
49007
  const boxes = new Array(this.mesh.count);
@@ -50095,6 +50141,9 @@ const _Marker = class _Marker {
50095
50141
  get index() {
50096
50142
  return this._submesh.index;
50097
50143
  }
50144
+ get isRoom() {
50145
+ return false;
50146
+ }
50098
50147
  /**
50099
50148
  * Updates the underlying submesh and rebinds all attributes to the new mesh.
50100
50149
  * @param mesh - The new submesh to bind to this marker.
@@ -52581,7 +52630,11 @@ class KeyboardHandler extends BaseInputHandler {
52581
52630
  * @param handler Callback invoked on key up.
52582
52631
  */
52583
52632
  registerKeyUp(code, mode, handler) {
52584
- this.registerKey(this.keyUpHandlers, code, mode, handler);
52633
+ if (Array.isArray(code)) {
52634
+ code.forEach((c) => this.registerKey(this.keyUpHandlers, c, mode, handler));
52635
+ } else {
52636
+ this.registerKey(this.keyUpHandlers, code, mode, handler);
52637
+ }
52585
52638
  }
52586
52639
  registerKey(map, code, mode, callback) {
52587
52640
  mode = map.has(code) ? mode : "replace";
@@ -52619,6 +52672,7 @@ class MouseHandler extends BaseInputHandler {
52619
52672
  __publicField(this, "_capture");
52620
52673
  __publicField(this, "_dragHandler");
52621
52674
  __publicField(this, "_doubleClickHandler", new DoubleClickHandler());
52675
+ __publicField(this, "_clickHandler", new ClickHandler());
52622
52676
  __publicField(this, "onButtonDown");
52623
52677
  __publicField(this, "onButtonUp");
52624
52678
  __publicField(this, "onMouseMove");
@@ -52627,6 +52681,7 @@ class MouseHandler extends BaseInputHandler {
52627
52681
  __publicField(this, "onClick");
52628
52682
  __publicField(this, "onDoubleClick");
52629
52683
  __publicField(this, "onWheel");
52684
+ __publicField(this, "onContextMenu");
52630
52685
  this._capture = new CaptureHandler(canvas);
52631
52686
  this._dragHandler = new DragHandler((delta, button) => this.onDrag(delta, button));
52632
52687
  }
@@ -52654,22 +52709,28 @@ class MouseHandler extends BaseInputHandler {
52654
52709
  (_a3 = this.onButtonDown) == null ? void 0 : _a3.call(this, pos, event.button);
52655
52710
  this._lastMouseDownPosition = pos;
52656
52711
  this._dragHandler.onPointerDown(pos, event.button);
52712
+ this._clickHandler.onPointerDown(pos);
52657
52713
  this._capture.onPointerDown(event);
52658
52714
  event.preventDefault();
52659
52715
  }
52660
52716
  handlePointerUp(event) {
52661
52717
  var _a3;
52662
52718
  if (event.pointerType !== "mouse") return;
52719
+ event.preventDefault();
52663
52720
  const pos = this.relativePosition(event);
52664
52721
  (_a3 = this.onButtonUp) == null ? void 0 : _a3.call(this, pos, event.button);
52665
52722
  this._capture.onPointerUp(event);
52666
52723
  this._dragHandler.onPointerUp();
52667
- if (this._doubleClickHandler.checkForDoubleClick(event)) {
52724
+ this._clickHandler.onPointerUp();
52725
+ if (this._doubleClickHandler.isDoubleClick(event)) {
52668
52726
  this.handleDoubleClick(event);
52669
- } else {
52727
+ return;
52728
+ }
52729
+ if (this._clickHandler.isClick(event)) {
52670
52730
  this.handleMouseClick(event);
52731
+ return;
52671
52732
  }
52672
- event.preventDefault();
52733
+ this.handleContextMenu(event);
52673
52734
  }
52674
52735
  async handleMouseClick(event) {
52675
52736
  var _a3;
@@ -52682,12 +52743,23 @@ class MouseHandler extends BaseInputHandler {
52682
52743
  const modif = event.getModifierState("Shift") || event.getModifierState("Control");
52683
52744
  (_a3 = this.onClick) == null ? void 0 : _a3.call(this, pos, modif);
52684
52745
  }
52746
+ async handleContextMenu(event) {
52747
+ var _a3;
52748
+ if (event.pointerType !== "mouse") return;
52749
+ if (event.button !== 2) return;
52750
+ const pos = this.relativePosition(event);
52751
+ if (!almostEqual(this._lastMouseDownPosition, pos, 0.01)) {
52752
+ return;
52753
+ }
52754
+ (_a3 = this.onContextMenu) == null ? void 0 : _a3.call(this, new Vector2(event.clientX, event.clientY));
52755
+ }
52685
52756
  handlePointerMove(event) {
52686
52757
  var _a3;
52687
52758
  if (event.pointerType !== "mouse") return;
52688
52759
  this._canvas.focus();
52689
52760
  const pos = this.relativePosition(event);
52690
52761
  this._dragHandler.onPointerMove(pos);
52762
+ this._clickHandler.onPointerMove(pos);
52691
52763
  (_a3 = this.onMouseMove) == null ? void 0 : _a3.call(this, pos);
52692
52764
  }
52693
52765
  async handleDoubleClick(event) {
@@ -52731,17 +52803,46 @@ class CaptureHandler {
52731
52803
  }
52732
52804
  }
52733
52805
  }
52806
+ class ClickHandler {
52807
+ constructor() {
52808
+ __publicField(this, "_moved", false);
52809
+ __publicField(this, "_startPosition", new Vector2());
52810
+ __publicField(this, "_clickThreshold", 3e-3);
52811
+ }
52812
+ onPointerDown(pos) {
52813
+ this._moved = false;
52814
+ this._startPosition.copy(pos);
52815
+ }
52816
+ onPointerMove(pos) {
52817
+ if (pos.distanceTo(this._startPosition) > this._clickThreshold) {
52818
+ this._moved = true;
52819
+ }
52820
+ }
52821
+ onPointerUp() {
52822
+ }
52823
+ isClick(event) {
52824
+ if (event.button !== 0) return false;
52825
+ return !this._moved;
52826
+ }
52827
+ }
52734
52828
  class DoubleClickHandler {
52735
52829
  constructor() {
52736
52830
  __publicField(this, "_lastClickTime", 0);
52737
52831
  __publicField(this, "_clickDelay", 300);
52832
+ // Max time between clicks for double-click
52833
+ __publicField(this, "_lastClickPosition", null);
52834
+ __publicField(this, "_positionThreshold", 5);
52738
52835
  }
52739
- // Delay in milliseconds to consider a double click
52740
- checkForDoubleClick(event) {
52836
+ // Max pixel distance between clicks
52837
+ isDoubleClick(event) {
52741
52838
  const currentTime = Date.now();
52839
+ const currentPosition = new Vector2(event.clientX, event.clientY);
52742
52840
  const timeDiff = currentTime - this._lastClickTime;
52841
+ const isClose = this._lastClickPosition !== null && this._lastClickPosition.distanceTo(currentPosition) < this._positionThreshold;
52842
+ const isWithinTime = timeDiff < this._clickDelay;
52743
52843
  this._lastClickTime = currentTime;
52744
- return timeDiff < this._clickDelay;
52844
+ this._lastClickPosition = currentPosition;
52845
+ return isClose && isWithinTime;
52745
52846
  }
52746
52847
  }
52747
52848
  class DragHandler {
@@ -52981,23 +53082,15 @@ class InputHandler extends BaseInputHandler {
52981
53082
  this._moveSpeed = settings2.moveSpeed ?? 1;
52982
53083
  this.rotateSpeed = settings2.rotateSpeed ?? 1;
52983
53084
  this.orbitSpeed = settings2.orbitSpeed ?? 1;
52984
- this.reg(document, "contextmenu", (e) => {
52985
- this._onContextMenu.dispatch(new Vector2(e.clientX, e.clientY));
52986
- e.preventDefault();
52987
- });
52988
53085
  this.keyboard = new KeyboardHandler(canvas);
52989
53086
  this.mouse = new MouseHandler(canvas);
52990
53087
  this.touch = new TouchHandler(canvas);
52991
53088
  this.keyboard.onKeyDown = (key) => adapter.keyDown(key);
52992
53089
  this.keyboard.onKeyUp = (key) => adapter.keyUp(key);
52993
53090
  this.keyboard.registerKeyUp("KeyP", "replace", () => adapter.toggleOrthographic());
52994
- this.keyboard.registerKeyUp("Equal", "replace", () => this.moveSpeed++);
52995
- this.keyboard.registerKeyUp("Minus", "replace", () => this.moveSpeed--);
52996
- this.keyboard.registerKeyUp("Space", "replace", () => {
52997
- this._pointerActive = this._pointerActive === "orbit" ? "look" : "orbit";
52998
- this._pointerFallback = this._pointerActive;
52999
- this._onPointerModeChanged.dispatch();
53000
- });
53091
+ this.keyboard.registerKeyUp(["Equal", "NumpadAdd"], "replace", () => this.moveSpeed++);
53092
+ this.keyboard.registerKeyUp(["Minus", "NumpadSubtract"], "replace", () => this.moveSpeed--);
53093
+ this.keyboard.registerKeyUp("Space", "replace", () => adapter.toggleCameraOrbitMode());
53001
53094
  this.keyboard.registerKeyUp("Home", "replace", () => adapter.resetCamera());
53002
53095
  this.keyboard.registerKeyUp("Escape", "replace", () => adapter.clearSelection());
53003
53096
  this.keyboard.registerKeyUp("KeyF", "replace", () => {
@@ -53007,18 +53100,28 @@ class InputHandler extends BaseInputHandler {
53007
53100
  const mul = Math.pow(1.25, this._moveSpeed);
53008
53101
  adapter.moveCamera(value.multiplyScalar(mul));
53009
53102
  };
53103
+ this.mouse.onContextMenu = (pos) => this._onContextMenu.dispatch(pos);
53010
53104
  this.mouse.onButtonDown = adapter.mouseDown;
53011
53105
  this.mouse.onMouseMove = adapter.mouseMove;
53012
- this.mouse.onButtonUp = adapter.mouseUp;
53106
+ this.mouse.onButtonUp = (pos, button) => {
53107
+ this.pointerOverride = void 0;
53108
+ adapter.mouseUp(pos, button);
53109
+ };
53013
53110
  this.mouse.onDrag = (delta, button) => {
53014
53111
  if (button === 0) {
53015
- if (this._pointerActive === "orbit") adapter.orbitCamera(toRotation(delta, this.orbitSpeed));
53016
- if (this._pointerActive === "look") adapter.rotateCamera(toRotation(delta, this.rotateSpeed));
53017
- if (this._pointerActive === "pan") adapter.panCamera(delta);
53018
- if (this._pointerActive === "zoom") adapter.dollyCamera(delta);
53112
+ if (this.pointerActive === "orbit") adapter.orbitCamera(toRotation(delta, this.orbitSpeed));
53113
+ if (this.pointerActive === "look") adapter.rotateCamera(toRotation(delta, this.rotateSpeed));
53114
+ if (this.pointerActive === "pan") adapter.panCamera(delta);
53115
+ if (this.pointerActive === "zoom") adapter.dollyCamera(delta);
53116
+ }
53117
+ if (button === 2) {
53118
+ this.pointerOverride = "look";
53119
+ adapter.rotateCamera(toRotation(delta, 1));
53120
+ }
53121
+ if (button === 1) {
53122
+ this.pointerOverride = "pan";
53123
+ adapter.panCamera(delta);
53019
53124
  }
53020
- if (button === 2) adapter.rotateCamera(toRotation(delta, 1));
53021
- if (button === 1) adapter.panCamera(delta);
53022
53125
  };
53023
53126
  this.mouse.onClick = (pos, modif) => adapter.selectAtPointer(pos, modif);
53024
53127
  this.mouse.onDoubleClick = adapter.frameAtPointer;
@@ -55316,7 +55419,7 @@ class RenderScene {
55316
55419
  }
55317
55420
  unparent2dObjects(target) {
55318
55421
  if (target instanceof Group) {
55319
- for (const child of target.children) {
55422
+ for (const child of [...target.children]) {
55320
55423
  if (child instanceof CSS2DObject) {
55321
55424
  target.remove(child);
55322
55425
  }
@@ -55491,6 +55594,7 @@ class Selection {
55491
55594
  }
55492
55595
  add(objectOrObjects) {
55493
55596
  if (!this.enabled) return;
55597
+ if (!objectOrObjects) return;
55494
55598
  const objects = this.toArray(objectOrObjects);
55495
55599
  let changed = false;
55496
55600
  for (const obj of objects) {
@@ -55841,7 +55945,7 @@ let Viewport$1 = class Viewport {
55841
55945
  /**
55842
55946
  * Resizes the canvas and updates the camera to match new parent dimensions.
55843
55947
  */
55844
- ResizeToParent() {
55948
+ resizeToParent() {
55845
55949
  this._onResize.dispatch();
55846
55950
  }
55847
55951
  /**
@@ -55895,6 +55999,9 @@ function createAdapter$2(viewer) {
55895
55999
  toggleOrthographic: () => {
55896
56000
  viewer.camera.orthographic = !viewer.camera.orthographic;
55897
56001
  },
56002
+ toggleCameraOrbitMode: () => {
56003
+ viewer.inputs.pointerActive = viewer.inputs.pointerActive === PointerMode$1.ORBIT ? PointerMode$1.LOOK : PointerMode$1.ORBIT;
56004
+ },
55898
56005
  resetCamera: () => {
55899
56006
  viewer.camera.lerp(0.75).reset();
55900
56007
  },
@@ -55919,7 +56026,7 @@ function createAdapter$2(viewer) {
55919
56026
  },
55920
56027
  frameAtPointer: async (pos) => {
55921
56028
  const result = await viewer.raycaster.raycastFromScreen(pos);
55922
- viewer.camera.lerp(0.75).frame(result.object);
56029
+ viewer.camera.lerp(0.75).frame(result.object ?? "all");
55923
56030
  },
55924
56031
  zoom: (value) => {
55925
56032
  viewer.camera.lerp(0.75).zoom(value);
@@ -56930,6 +57037,10 @@ let Renderer$1 = class Renderer {
56930
57037
  * Indicates whether the scene should be re-rendered on change only.
56931
57038
  */
56932
57039
  __publicField(this, "onDemand");
57040
+ /**
57041
+ * The material that will be used when setting model material to undefined.
57042
+ */
57043
+ __publicField(this, "defaultModelMaterial");
56933
57044
  __publicField(this, "fitViewport", () => {
56934
57045
  const size = this._viewport.getParentSize();
56935
57046
  this.renderer.setPixelRatio(window.devicePixelRatio);
@@ -57001,11 +57112,14 @@ let Renderer$1 = class Renderer {
57001
57112
  this._scene.threeScene.background = color;
57002
57113
  this.needsUpdate = true;
57003
57114
  }
57115
+ /**
57116
+ * Sets the material used to render models. If set to undefined, the default model or mesh material is used.
57117
+ */
57004
57118
  get modelMaterial() {
57005
57119
  return this._scene.modelMaterial;
57006
57120
  }
57007
57121
  set modelMaterial(material) {
57008
- this._scene.modelMaterial = material;
57122
+ this._scene.modelMaterial = material ?? this.defaultModelMaterial;
57009
57123
  }
57010
57124
  /**
57011
57125
  * Signal dispatched at the end of each frame if the scene was updated, such as visibility changes.
@@ -57141,6 +57255,11 @@ let Renderer$1 = class Renderer {
57141
57255
  };
57142
57256
  let Viewer$3 = class Viewer {
57143
57257
  constructor(settings2) {
57258
+ /**
57259
+ * The type of the viewer, indicating it is a WebGL viewer.
57260
+ * Useful for distinguishing between different viewer types in a multi-viewer application.
57261
+ */
57262
+ __publicField(this, "type", "webgl");
57144
57263
  /**
57145
57264
  * The settings configuration used by the viewer.
57146
57265
  */
@@ -57927,9 +58046,22 @@ class RpcClient {
57927
58046
  get url() {
57928
58047
  return this._socket.url;
57929
58048
  }
57930
- RPCClearMaterialOverrides() {
58049
+ RPCClearMaterialOverridesForElements(vimIndex, elementIndices) {
58050
+ const marshal = new Marshal();
58051
+ marshal.writeString("RPCClearMaterialOverridesForElements");
58052
+ marshal.writeUInt(vimIndex);
58053
+ marshal.writeArrayOfUInt(elementIndices);
58054
+ this._socket.sendRPC(marshal);
58055
+ }
58056
+ RPCClearMaterialOverridesForScene() {
58057
+ const marshal = new Marshal();
58058
+ marshal.writeString("RPCClearMaterialOverridesForScene");
58059
+ this._socket.sendRPC(marshal);
58060
+ }
58061
+ RPCClearMaterialOverridesForVim(vimIndex) {
57931
58062
  const marshal = new Marshal();
57932
- marshal.writeString("RPCClearMaterialOverrides");
58063
+ marshal.writeString("RPCClearMaterialOverridesForVim");
58064
+ marshal.writeUInt(vimIndex);
57933
58065
  this._socket.sendRPC(marshal);
57934
58066
  }
57935
58067
  async RPCCreateMaterialInstances(materialHandle, smoothness, colors) {
@@ -58037,9 +58169,9 @@ class RpcClient {
58037
58169
  const ret = returnMarshal.readString();
58038
58170
  return ret;
58039
58171
  }
58040
- async RPCGetCameraView() {
58172
+ async RPCGetCameraPose() {
58041
58173
  const marshal = new Marshal();
58042
- marshal.writeString("RPCGetCameraView");
58174
+ marshal.writeString("RPCGetCameraPose");
58043
58175
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58044
58176
  const ret = returnMarshal.readSegment();
58045
58177
  return ret;
@@ -58182,6 +58314,13 @@ class RpcClient {
58182
58314
  marshal.writeBoolean(orbit2);
58183
58315
  this._socket.sendRPC(marshal);
58184
58316
  }
58317
+ RPCSetCameraPose(state, blendTime) {
58318
+ const marshal = new Marshal();
58319
+ marshal.writeString("RPCSetCameraPose");
58320
+ marshal.writeSegment(state);
58321
+ marshal.writeFloat(blendTime);
58322
+ this._socket.sendRPC(marshal);
58323
+ }
58185
58324
  RPCSetCameraPosition(position, blendTime) {
58186
58325
  const marshal = new Marshal();
58187
58326
  marshal.writeString("RPCSetCameraPosition");
@@ -58202,13 +58341,6 @@ class RpcClient {
58202
58341
  marshal.writeFloat(blendTime);
58203
58342
  this._socket.sendRPC(marshal);
58204
58343
  }
58205
- RPCSetCameraView(state, blendTime) {
58206
- const marshal = new Marshal();
58207
- marshal.writeString("RPCSetCameraView");
58208
- marshal.writeSegment(state);
58209
- marshal.writeFloat(blendTime);
58210
- this._socket.sendRPC(marshal);
58211
- }
58212
58344
  RPCSetGhostColor(ghostColor) {
58213
58345
  const marshal = new Marshal();
58214
58346
  marshal.writeString("RPCSetGhostColor");
@@ -58805,6 +58937,7 @@ class Decoder {
58805
58937
  }
58806
58938
  }
58807
58939
  const CODE_TO_KEYCODE = {
58940
+ "Space": 32,
58808
58941
  "ArrowUp": 38,
58809
58942
  "ArrowDown": 40,
58810
58943
  "ArrowLeft": 37,
@@ -58825,7 +58958,6 @@ function ultraInputAdapter(viewer) {
58825
58958
  function createAdapter$1(viewer) {
58826
58959
  return {
58827
58960
  init: () => {
58828
- viewer.rpc.RPCSetCameraSpeed(10);
58829
58961
  },
58830
58962
  orbitCamera: (value) => {
58831
58963
  },
@@ -58838,6 +58970,9 @@ function createAdapter$1(viewer) {
58838
58970
  toggleOrthographic: () => {
58839
58971
  console.log("toggleOrthographic. Not supported yet");
58840
58972
  },
58973
+ toggleCameraOrbitMode: () => {
58974
+ viewer.rpc.RPCKeyEvent(CODE_TO_KEYCODE["Space"], true);
58975
+ },
58841
58976
  resetCamera: () => {
58842
58977
  viewer.camera.restoreSavedPosition();
58843
58978
  },
@@ -59278,7 +59413,7 @@ class RpcSafeClient {
59278
59413
  */
59279
59414
  async RPCGetCameraView() {
59280
59415
  return await this.safeCall(
59281
- () => this.rpc.RPCGetCameraView(),
59416
+ () => this.rpc.RPCGetCameraPose(),
59282
59417
  void 0
59283
59418
  );
59284
59419
  }
@@ -59290,7 +59425,7 @@ class RpcSafeClient {
59290
59425
  RPCSetCameraView(segment, blendTime) {
59291
59426
  if (!Validation.isValidSegment(segment)) return;
59292
59427
  blendTime = Validation.clamp01(blendTime);
59293
- this.rpc.RPCSetCameraView(segment, blendTime);
59428
+ this.rpc.RPCSetCameraPose(segment, blendTime);
59294
59429
  }
59295
59430
  /**
59296
59431
  * Sets the camera's position without changing its target.
@@ -59672,8 +59807,23 @@ class RpcSafeClient {
59672
59807
  /**
59673
59808
  * Clears all material overrides for the entire scene.
59674
59809
  */
59675
- RPCClearMaterialOverrides() {
59676
- this.rpc.RPCClearMaterialOverrides();
59810
+ RPCClearMaterialOverridesForScene() {
59811
+ this.rpc.RPCClearMaterialOverridesForScene();
59812
+ }
59813
+ /**
59814
+ * Clears all material overrides for a specific loaded vim.
59815
+ * @param vimIndex - The index of the loaded vim
59816
+ */
59817
+ RPCClearMaterialOverridesForVim(vimIndex) {
59818
+ this.rpc.RPCClearMaterialOverridesForVim(vimIndex);
59819
+ }
59820
+ /**
59821
+ * Clears all material overrides for specific elements in a loaded vim.
59822
+ * @param vimIndex - The index of the loaded vim
59823
+ * @param vimElementIndices - Array of vim-based element indices to clear overrides for
59824
+ */
59825
+ RPCClearMaterialOverridesForElements(vimIndex, vimElementIndices) {
59826
+ this.rpc.RPCClearMaterialOverridesForElements(vimIndex, vimElementIndices);
59677
59827
  }
59678
59828
  /*******************************************************************************
59679
59829
  * DEBUG AND UTILITY METHODS
@@ -60791,6 +60941,12 @@ class Viewport2 {
60791
60941
  this._rpc.RPCSetCameraAspectRatio(this.canvas.offsetWidth, this.canvas.offsetHeight);
60792
60942
  }
60793
60943
  }
60944
+ /**
60945
+ * Resizes the viewport to match its parent's dimensions
60946
+ */
60947
+ resizeToParent() {
60948
+ this.update();
60949
+ }
60794
60950
  /**
60795
60951
  * Cleans up resources by removing resize observer and clearing timeouts
60796
60952
  */
@@ -60849,11 +61005,12 @@ class Element3D2 {
60849
61005
  * @returns A promise resolving to the element's bounding box.
60850
61006
  */
60851
61007
  async getBoundingBox() {
60852
- return this.vim.getBoundingBoxNodes([this.element]);
61008
+ return this.vim.getBoundingBoxForElements([this.element]);
60853
61009
  }
60854
61010
  }
60855
61011
  class Vim2 {
60856
61012
  constructor(rpc, color, renderer, source, logger) {
61013
+ __publicField(this, "type", "ultra");
60857
61014
  __publicField(this, "source");
60858
61015
  __publicField(this, "_handle", -1);
60859
61016
  __publicField(this, "_request");
@@ -60867,6 +61024,7 @@ class Vim2 {
60867
61024
  // Color tracking remains unchanged.
60868
61025
  __publicField(this, "_elementColors", /* @__PURE__ */ new Map());
60869
61026
  __publicField(this, "_updatedColors", /* @__PURE__ */ new Set());
61027
+ __publicField(this, "_removedColors", /* @__PURE__ */ new Set());
60870
61028
  // Delayed update flag.
60871
61029
  __publicField(this, "_updateScheduled", false);
60872
61030
  __publicField(this, "_elementCount", 0);
@@ -61004,14 +61162,14 @@ class Vim2 {
61004
61162
  }
61005
61163
  return handle;
61006
61164
  }
61007
- async getBoundingBoxNodes(nodes) {
61008
- if (!this.connected || nodes !== "all" && nodes.length === 0) {
61165
+ async getBoundingBoxForElements(elements) {
61166
+ if (!this.connected || elements !== "all" && elements.length === 0) {
61009
61167
  return Promise.resolve(void 0);
61010
61168
  }
61011
- if (nodes === "all") {
61169
+ if (elements === "all") {
61012
61170
  return await this._rpc.RPCGetAABBForVim(this._handle);
61013
61171
  }
61014
- return await this._rpc.RPCGetAABBForElements(this._handle, nodes);
61172
+ return await this._rpc.RPCGetAABBForElements(this._handle, elements);
61015
61173
  }
61016
61174
  async getBoundingBox() {
61017
61175
  if (!this.connected) {
@@ -61032,19 +61190,22 @@ class Vim2 {
61032
61190
  }
61033
61191
  this.applyColor(elements, color);
61034
61192
  }
61035
- applyColor(elements, color) {
61036
- for (let i = 0; i < color.length; i++) {
61037
- const c = color[i];
61193
+ applyColor(elements, colors) {
61194
+ for (let i = 0; i < colors.length; i++) {
61195
+ const color = colors[i];
61038
61196
  const element = elements[i];
61039
- if (c === void 0) {
61197
+ const existingColor = this._elementColors.get(element);
61198
+ if (color === void 0 && existingColor !== void 0) {
61040
61199
  this._elementColors.delete(element);
61041
- } else {
61042
- this._elementColors.set(element, c);
61200
+ this._removedColors.add(element);
61201
+ } else if (color !== existingColor) {
61202
+ this._elementColors.set(element, color);
61203
+ this._updatedColors.add(element);
61043
61204
  }
61044
- this._updatedColors.add(element);
61045
61205
  }
61046
61206
  this.scheduleColorUpdate();
61047
61207
  }
61208
+ //TODO: Remove and rely on element.color
61048
61209
  clearColor(elements) {
61049
61210
  if (elements === "all") {
61050
61211
  this._elementColors.clear();
@@ -61053,14 +61214,14 @@ class Vim2 {
61053
61214
  }
61054
61215
  if (!this.connected) return;
61055
61216
  if (elements === "all") {
61056
- this._rpc.RPCClearMaterialOverrides();
61217
+ this._rpc.RPCClearMaterialOverridesForVim(this._handle);
61057
61218
  } else {
61058
- const ids = new Array(elements.length).fill(MaterialHandles.Invalid);
61059
- this._rpc.RPCSetMaterialOverridesForElements(this._handle, elements, ids);
61219
+ this._rpc.RPCClearMaterialOverridesForElements(this._handle, elements);
61060
61220
  }
61061
61221
  }
61062
61222
  reapplyColors() {
61063
61223
  this._updatedColors.clear();
61224
+ this._removedColors.clear();
61064
61225
  this._elementColors.forEach((c, n) => this._updatedColors.add(n));
61065
61226
  this.scheduleColorUpdate();
61066
61227
  }
@@ -61077,12 +61238,15 @@ class Vim2 {
61077
61238
  this._renderer.notifySceneUpdated();
61078
61239
  }
61079
61240
  async updateRemoteColors() {
61080
- const elements = Array.from(this._updatedColors);
61081
- const colors = elements.map((n) => this._elementColors.get(n));
61241
+ const updatedElement = Array.from(this._updatedColors);
61242
+ const removedElement = Array.from(this._removedColors);
61243
+ const colors = updatedElement.map((n) => this._elementColors.get(n));
61082
61244
  const remoteColors = await this._colors.getColors(colors);
61083
61245
  const colorIds = remoteColors.map((c) => (c == null ? void 0 : c.id) ?? -1);
61084
- this._rpc.RPCSetMaterialOverridesForElements(this._handle, elements, colorIds);
61246
+ this._rpc.RPCClearMaterialOverridesForElements(this._handle, removedElement);
61247
+ this._rpc.RPCSetMaterialOverridesForElements(this._handle, updatedElement, colorIds);
61085
61248
  this._updatedColors.clear();
61249
+ this._removedColors.clear();
61086
61250
  }
61087
61251
  }
61088
61252
  function wait(ms) {
@@ -61159,6 +61323,11 @@ let Viewer$2 = class Viewer2 {
61159
61323
  * @param logger - Optional logger for logging messages.
61160
61324
  */
61161
61325
  constructor(canvas, logger) {
61326
+ /**
61327
+ * The type of the viewer, indicating it is a WebGL viewer.
61328
+ * Useful for distinguishing between different viewer types in a multi-viewer application.
61329
+ */
61330
+ __publicField(this, "type", "ultra");
61162
61331
  __publicField(this, "_decoder");
61163
61332
  __publicField(this, "_socketClient");
61164
61333
  __publicField(this, "_input");
@@ -61419,80 +61588,72 @@ const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
61419
61588
  Ultra: index$7,
61420
61589
  Webgl: index$8
61421
61590
  }, Symbol.toStringTag, { value: "Module" }));
61422
- const sectionSelection = "controlBar.sectionSelection";
61423
- const sectionCamera = "controlBar.sectionCamera";
61424
- const sectionInputs = "controlBar.sectionInputs";
61425
- const sectionActions = "controlBar.sectionActions";
61426
- const sectionTools = "controlBar.sectionTools";
61427
- const sectionSettings = "controlBar.sectionSettings";
61428
- const sectionMeasure = "controlBar.sectionMeasure";
61429
- const sectionSectionBox = "controlBar.sectionSectionBox";
61430
- const buttonCameraFrameSelection = "controlBar.camera.frameSelection";
61431
- const buttonCameraFrameScene = "controlBar.camera.frameScene";
61432
- const buttonCameraAuto = "controlBar.camera.auto";
61433
- const buttonCameraOrbit = "controlBar.camera.orbit";
61434
- const buttonCameraLook = "controlBarcamera.look";
61435
- const buttonCameraPan = "controlBar.camera.pan";
61436
- const buttonCameraZoom = "controlBar.camera.zoom";
61437
- const buttonCameraZoomWindow = "controlBar.camera.zoomWindow";
61438
- const buttonProjectInspector = "controlBar.projectInspector";
61439
- const buttonSettings = "controlBar.settings";
61440
- const buttonHelp = "controlBar.help";
61441
- const buttonMaximize = "controlBar.maximize";
61442
- const buttonClearSelection = "controlBar.action.clearSelection";
61443
- const buttonShowAll = "controlBar.selection.showAll";
61444
- const buttonIsolateSelection = "controlBar.selection.isolate";
61445
- const buttonHideSelection = "controlBar.selection.hide";
61446
- const buttonShowSelection = "controlBar.selection.show";
61447
- const buttonAutoIsolate = "controlBar.selection.autoIsolate";
61448
- const buttonIsolationSettings = "controlBar.selection.isolationSettings";
61449
- const buttonRenderSettings = "controlBar.action.renderSettings";
61450
- const buttonSectionBox = "controlBar.sectionBox";
61451
- const buttonMeasure = "controlBar.measure";
61452
- const buttonSectionBoxEnable = "controlBar.sectionBox.enable";
61453
- const buttonSectionBoxVisible = "controlBar.sectionBox.visible";
61454
- const buttonSectionBoxToSelection = "controlBar.sectionBox.sectionSelection";
61455
- const buttonSectionBoxToScene = "controlBar.sectionBox.sectionScene";
61456
- const buttonSectionBoxAuto = "controlBar.sectionBox.auto";
61457
- const buttonSectionBoxSettings = "controlBar.sectionBox.settings";
61591
+ const cameraSpan = "controlBar.cameraSpan";
61592
+ const cameraFrameSelection = "controlBar.cameraFrameSelection";
61593
+ const cameraFrameScene = "controlBar.cameraFrameScene";
61594
+ const cameraAuto = "controlBar.cameraAuto";
61595
+ const cursorSpan = "controlBar.cursorSpan";
61596
+ const cursorOrbit = "controlBar.cursorOrbit";
61597
+ const cursorLook = "controlBar.cursorLook";
61598
+ const cursorPan = "controlBar.cursorPan";
61599
+ const cursorZoom = "controlBar.cursorZoom";
61600
+ const cursorZoomWindow = "controlBar.cursorZoomWindow";
61601
+ const visibilitySpan = "controlBar.visibilitySpan";
61602
+ const visibilityClearSelection = "controlBar.visibilityClearSelection";
61603
+ const visibilityShowAll = "controlBar.visibilityShowAll";
61604
+ const visibilityIsolateSelection = "controlBar.visibilityIsolateSelection";
61605
+ const visibilityHideSelection = "controlBar.visibilityHideSelection";
61606
+ const visibilityShowSelection = "controlBar.visibilityShowSelection";
61607
+ const visibilityAutoIsolate = "controlBar.visibilityAutoIsolate";
61608
+ const visibilitySettings = "controlBar.visibilitySettings";
61609
+ const sectioningSpan = "controlBar.sectioningSpan";
61610
+ const sectioningEnable = "controlBar.sectioningEnable";
61611
+ const sectioningVisible = "controlBar.sectioningVisible";
61612
+ const sectioningFitSelection = "controlBar.sectioningFitSelection";
61613
+ const sectioningFitScene = "controlBar.sectioningFitScene";
61614
+ const sectioningAuto = "controlBar.sectioningAuto";
61615
+ const sectioningSettings = "controlBar.sectioningSettings";
61616
+ const measureSpan = "controlBar.measureSpan";
61617
+ const measureEnable = "controlBar.measureEnable";
61618
+ const miscSpan = "controlBar.miscSpan";
61619
+ const miscInspector = "controlBar.miscInspector";
61620
+ const miscSettings = "controlBar.miscSettings";
61621
+ const miscHelp = "controlBar.miscHelp";
61622
+ const miscMaximize = "controlBar.miscMaximize";
61458
61623
  const controlBarIds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
61459
61624
  __proto__: null,
61460
- buttonAutoIsolate,
61461
- buttonCameraAuto,
61462
- buttonCameraFrameScene,
61463
- buttonCameraFrameSelection,
61464
- buttonCameraLook,
61465
- buttonCameraOrbit,
61466
- buttonCameraPan,
61467
- buttonCameraZoom,
61468
- buttonCameraZoomWindow,
61469
- buttonClearSelection,
61470
- buttonHelp,
61471
- buttonHideSelection,
61472
- buttonIsolateSelection,
61473
- buttonIsolationSettings,
61474
- buttonMaximize,
61475
- buttonMeasure,
61476
- buttonProjectInspector,
61477
- buttonRenderSettings,
61478
- buttonSectionBox,
61479
- buttonSectionBoxAuto,
61480
- buttonSectionBoxEnable,
61481
- buttonSectionBoxSettings,
61482
- buttonSectionBoxToScene,
61483
- buttonSectionBoxToSelection,
61484
- buttonSectionBoxVisible,
61485
- buttonSettings,
61486
- buttonShowAll,
61487
- buttonShowSelection,
61488
- sectionActions,
61489
- sectionCamera,
61490
- sectionInputs,
61491
- sectionMeasure,
61492
- sectionSectionBox,
61493
- sectionSelection,
61494
- sectionSettings,
61495
- sectionTools
61625
+ cameraAuto,
61626
+ cameraFrameScene,
61627
+ cameraFrameSelection,
61628
+ cameraSpan,
61629
+ cursorLook,
61630
+ cursorOrbit,
61631
+ cursorPan,
61632
+ cursorSpan,
61633
+ cursorZoom,
61634
+ cursorZoomWindow,
61635
+ measureEnable,
61636
+ measureSpan,
61637
+ miscHelp,
61638
+ miscInspector,
61639
+ miscMaximize,
61640
+ miscSettings,
61641
+ miscSpan,
61642
+ sectioningAuto,
61643
+ sectioningEnable,
61644
+ sectioningFitScene,
61645
+ sectioningFitSelection,
61646
+ sectioningSettings,
61647
+ sectioningSpan,
61648
+ sectioningVisible,
61649
+ visibilityAutoIsolate,
61650
+ visibilityClearSelection,
61651
+ visibilityHideSelection,
61652
+ visibilityIsolateSelection,
61653
+ visibilitySettings,
61654
+ visibilityShowAll,
61655
+ visibilityShowSelection,
61656
+ visibilitySpan
61496
61657
  }, Symbol.toStringTag, { value: "Module" }));
61497
61658
  const baseSectionStyle = "vc-flex vc-items-center vc-rounded-full vc-mb-2 vc-shadow-md";
61498
61659
  const sectionDefaultStyle = baseSectionStyle + " vc-bg-white";
@@ -63585,50 +63746,6 @@ const icons = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
63585
63746
  visible,
63586
63747
  zoom
63587
63748
  }, Symbol.toStringTag, { value: "Module" }));
63588
- function getDefaultSettings() {
63589
- return {
63590
- capacity: {
63591
- canFollowUrl: true,
63592
- canGoFullScreen: true,
63593
- canDownload: true,
63594
- canReadLocalStorage: true
63595
- },
63596
- ui: {
63597
- logo: true,
63598
- performance: false,
63599
- bimTreePanel: true,
63600
- bimInfoPanel: true,
63601
- // axesPanel
63602
- axesPanel: true,
63603
- orthographic: true,
63604
- resetCamera: true,
63605
- // Control bar
63606
- controlBar: true,
63607
- // Control bar - cursors
63608
- orbit: true,
63609
- lookAround: true,
63610
- pan: true,
63611
- zoom: true,
63612
- zoomWindow: true,
63613
- // Control bar - camera
63614
- autoCamera: true,
63615
- frameScene: true,
63616
- frameSelection: true,
63617
- // Control bar - tools
63618
- sectioningMode: true,
63619
- measuringMode: true,
63620
- toggleIsolation: true,
63621
- // Control bar - settings
63622
- projectInspector: true,
63623
- settings: true,
63624
- help: true,
63625
- maximise: true
63626
- }
63627
- };
63628
- }
63629
- function createSettings(settings2) {
63630
- return settings2 !== void 0 ? deepmerge(getDefaultSettings(), settings2) : getDefaultSettings();
63631
- }
63632
63749
  function getLocalSettings(settings2 = {}) {
63633
63750
  try {
63634
63751
  const json = localStorage.getItem("viewer.settings");
@@ -63683,8 +63800,6 @@ function isFalse(value) {
63683
63800
  }
63684
63801
  const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
63685
63802
  __proto__: null,
63686
- createSettings,
63687
- getDefaultSettings,
63688
63803
  getLocalSettings,
63689
63804
  isFalse,
63690
63805
  isTrue,
@@ -67220,7 +67335,7 @@ function whenSomeTrue(value, element) {
67220
67335
  return value.some(isTrue) ? element : null;
67221
67336
  }
67222
67337
  function anyUiAxesButton(settings2) {
67223
- return settings2.ui.orthographic || settings2.ui.resetCamera;
67338
+ return settings2.ui.axesOrthographic || settings2.ui.axesHome;
67224
67339
  }
67225
67340
  const AxesPanelMemo = React__default.memo(AxesPanel);
67226
67341
  function AxesPanel(props) {
@@ -67280,15 +67395,15 @@ function AxesPanel(props) {
67280
67395
  children: ortho ? /* @__PURE__ */ jsxRuntimeExports.jsx(orthographic, { height: 20, width: 20, fill: "currentColor" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(perspective, { height: 20, width: 20, fill: "currentColor" })
67281
67396
  }
67282
67397
  );
67283
- const hidden2 = isTrue(props.settings.value.ui.axesPanel) ? "" : " vc-hidden";
67398
+ const hidden2 = isTrue(props.settings.value.ui.panelAxes) ? "" : " vc-hidden";
67284
67399
  const empty2 = !anyUiAxesButton(props.settings.value);
67285
67400
  const createBar = () => {
67286
67401
  if (empty2) return null;
67287
67402
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "vim-axes-panel-bar vc-absolute vc-top-[75%] vc-bottom-0 vc-right-0 vc-left-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vim-axes-panel-buttons vc-absolute vc-inset-0 vc-pointer-events-auto vc-order-2 vc-flex vc-items-center vc-justify-evenly vc-bg-white", children: [
67288
67403
  whenAllTrue([
67289
- props.settings.value.ui.orthographic
67404
+ props.settings.value.ui.axesOrthographic
67290
67405
  ], btnOrtho),
67291
- whenTrue(props.settings.value.ui.resetCamera, btnHome)
67406
+ whenTrue(props.settings.value.ui.axesHome, btnHome)
67292
67407
  ] }) });
67293
67408
  };
67294
67409
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -67516,77 +67631,78 @@ function getMeasureState(viewer, cursor) {
67516
67631
  }
67517
67632
  const Style = style;
67518
67633
  const Ids$2 = controlBarIds;
67519
- function controlBarSectionBox(section, hasSelection) {
67634
+ function controlBarSectionBox(section, hasSelection, settings2) {
67520
67635
  return {
67521
- id: Ids$2.sectionSectionBox,
67636
+ id: Ids$2.sectioningSpan,
67522
67637
  style: section.enable.get() ? Style.sectionNoPadStyle : Style.sectionDefaultStyle,
67523
67638
  //enable: () => section.getEnable(),
67524
67639
  buttons: [
67525
67640
  {
67526
- id: Ids$2.buttonSectionBoxEnable,
67641
+ id: Ids$2.sectioningEnable,
67642
+ enabled: () => isTrue(settings2.sectioningEnable),
67527
67643
  tip: "Enable Section Box",
67528
67644
  isOn: () => section.enable.get(),
67529
- style: (on) => Style.buttonExpandStyle(on),
67645
+ style: Style.buttonExpandStyle,
67530
67646
  action: () => section.enable.set(!section.enable.get()),
67531
67647
  icon: sectionBox
67532
67648
  },
67533
67649
  {
67534
- id: Ids$2.buttonSectionBoxToSelection,
67650
+ id: Ids$2.sectioningFitSelection,
67535
67651
  tip: "Fit Section",
67536
- enabled: () => section.enable.get(),
67652
+ enabled: () => section.enable.get() && isTrue(settings2.sectioningFitToSelection),
67537
67653
  isOn: () => hasSelection,
67538
- style: (on) => Style.buttonDisableStyle(on),
67654
+ style: Style.buttonDisableStyle,
67539
67655
  action: () => section.sectionSelection.call(),
67540
67656
  icon: sectionBoxShrink
67541
67657
  },
67542
67658
  {
67543
- id: Ids$2.buttonSectionBoxToScene,
67659
+ id: Ids$2.sectioningFitScene,
67544
67660
  tip: "Reset Section",
67545
- enabled: () => section.enable.get(),
67546
- style: (on) => Style.buttonDefaultStyle(on),
67661
+ enabled: () => section.enable.get() && isTrue(settings2.sectioningReset),
67662
+ style: Style.buttonDefaultStyle,
67547
67663
  action: () => section.sectionScene.call(),
67548
67664
  icon: sectionBoxReset
67549
67665
  },
67550
67666
  {
67551
- id: Ids$2.buttonSectionBoxVisible,
67667
+ id: Ids$2.sectioningVisible,
67552
67668
  tip: "Show Section Box",
67553
- enabled: () => section.enable.get(),
67669
+ enabled: () => section.enable.get() && isTrue(settings2.sectioningShow),
67554
67670
  isOn: () => section.visible.get(),
67555
- style: (on) => Style.buttonDefaultStyle(on),
67671
+ style: Style.buttonDefaultStyle,
67556
67672
  action: () => section.visible.set(!section.visible.get()),
67557
67673
  icon: visible
67558
67674
  },
67559
67675
  {
67560
- id: Ids$2.buttonSectionBoxAuto,
67676
+ id: Ids$2.sectioningAuto,
67561
67677
  tip: "Auto Section",
67562
- enabled: () => section.enable.get(),
67678
+ enabled: () => section.enable.get() && isTrue(settings2.sectioningAuto),
67563
67679
  isOn: () => section.auto.get(),
67564
- style: (on) => Style.buttonDefaultStyle(on),
67680
+ style: Style.buttonDefaultStyle,
67565
67681
  action: () => section.auto.set(!section.auto.get()),
67566
67682
  icon: sectionBoxAuto
67567
67683
  },
67568
67684
  {
67569
- id: Ids$2.buttonSectionBoxSettings,
67685
+ id: Ids$2.sectioningSettings,
67570
67686
  tip: "Section Settings",
67571
- enabled: () => section.enable.get(),
67687
+ enabled: () => section.enable.get() && isTrue(settings2.sectioningSettings),
67572
67688
  isOn: () => section.showOffsetPanel.get(),
67573
- style: (on) => Style.buttonDefaultStyle(on),
67689
+ style: Style.buttonDefaultStyle,
67574
67690
  action: () => section.showOffsetPanel.set(!section.showOffsetPanel.get()),
67575
67691
  icon: slidersHoriz
67576
67692
  }
67577
67693
  ]
67578
67694
  };
67579
67695
  }
67580
- function controlBarPointer(viewer, camera2, settings2, section) {
67696
+ function controlBarPointer(viewer, settings2) {
67581
67697
  const pointer2 = getPointerState(viewer);
67582
67698
  return {
67583
- id: Ids$2.sectionInputs,
67699
+ id: Ids$2.cursorSpan,
67584
67700
  enable: () => anyUiCursorButton(settings2),
67585
67701
  style: Style.sectionDefaultStyle,
67586
67702
  buttons: [
67587
67703
  {
67588
- id: Ids$2.buttonCameraOrbit,
67589
- enabled: () => isTrue(settings2.ui.orbit),
67704
+ id: Ids$2.cursorOrbit,
67705
+ enabled: () => isTrue(settings2.cursorOrbit),
67590
67706
  tip: "Orbit",
67591
67707
  action: () => pointer2.onButton(PointerMode$1.ORBIT),
67592
67708
  icon: orbit,
@@ -67594,8 +67710,8 @@ function controlBarPointer(viewer, camera2, settings2, section) {
67594
67710
  style: Style.buttonDefaultStyle
67595
67711
  },
67596
67712
  {
67597
- id: Ids$2.buttonCameraLook,
67598
- enabled: () => isTrue(settings2.ui.lookAround),
67713
+ id: Ids$2.cursorLook,
67714
+ enabled: () => isTrue(settings2.cursorLookAround),
67599
67715
  tip: "Look Around",
67600
67716
  action: () => pointer2.onButton(PointerMode$1.LOOK),
67601
67717
  icon: look,
@@ -67603,8 +67719,8 @@ function controlBarPointer(viewer, camera2, settings2, section) {
67603
67719
  style: Style.buttonDefaultStyle
67604
67720
  },
67605
67721
  {
67606
- id: Ids$2.buttonCameraPan,
67607
- enabled: () => isTrue(settings2.ui.pan),
67722
+ id: Ids$2.cursorPan,
67723
+ enabled: () => isTrue(settings2.cursorPan),
67608
67724
  tip: "Pan",
67609
67725
  action: () => pointer2.onButton(PointerMode$1.PAN),
67610
67726
  icon: pan,
@@ -67612,8 +67728,8 @@ function controlBarPointer(viewer, camera2, settings2, section) {
67612
67728
  style: Style.buttonDefaultStyle
67613
67729
  },
67614
67730
  {
67615
- id: Ids$2.buttonCameraZoom,
67616
- enabled: () => isTrue(settings2.ui.zoom),
67731
+ id: Ids$2.cursorZoom,
67732
+ enabled: () => isTrue(settings2.cursorZoom),
67617
67733
  tip: "Zoom",
67618
67734
  action: () => pointer2.onButton(PointerMode$1.ZOOM),
67619
67735
  icon: zoom,
@@ -67623,15 +67739,15 @@ function controlBarPointer(viewer, camera2, settings2, section) {
67623
67739
  ]
67624
67740
  };
67625
67741
  }
67626
- function controlBarMeasure(settings2, measure$1) {
67742
+ function controlBarMeasure(measure$1, settings2) {
67627
67743
  return {
67628
- id: Ids$2.sectionActions,
67744
+ id: Ids$2.measureSpan,
67629
67745
  enable: () => true,
67630
67746
  style: Style.sectionDefaultStyle,
67631
67747
  buttons: [
67632
67748
  {
67633
- id: Ids$2.buttonMeasure,
67634
- enabled: () => isTrue(settings2.ui.measuringMode),
67749
+ id: Ids$2.measureEnable,
67750
+ enabled: () => isTrue(settings2.measureEnable),
67635
67751
  isOn: () => measure$1.active,
67636
67752
  tip: "Measuring Mode",
67637
67753
  action: () => measure$1.toggle(),
@@ -67641,40 +67757,57 @@ function controlBarMeasure(settings2, measure$1) {
67641
67757
  ]
67642
67758
  };
67643
67759
  }
67644
- function controlBarSettings(modal, side, settings$1) {
67760
+ function createMiscSettingsButton(side, settings$1) {
67761
+ return {
67762
+ id: Ids$2.miscSettings,
67763
+ enabled: () => isTrue(settings$1.ui.miscSettings),
67764
+ tip: "Settings",
67765
+ action: () => side.toggleContent("settings"),
67766
+ icon: settings,
67767
+ style: Style.buttonDefaultStyle
67768
+ };
67769
+ }
67770
+ function createMiscHelpButton(modal, settings2) {
67771
+ return {
67772
+ id: Ids$2.miscHelp,
67773
+ enabled: () => isTrue(settings2.ui.miscHelp),
67774
+ tip: "Help",
67775
+ action: () => modal.help(true),
67776
+ icon: help,
67777
+ style: Style.buttonDefaultStyle
67778
+ };
67779
+ }
67780
+ function controlBarMiscUltra(modal, side, settings2) {
67781
+ return {
67782
+ id: Ids$2.miscSpan,
67783
+ enable: () => anyUltraMiscButton(settings2),
67784
+ style: Style.sectionDefaultStyle,
67785
+ buttons: [
67786
+ createMiscSettingsButton(side, settings2),
67787
+ createMiscHelpButton(modal, settings2)
67788
+ ]
67789
+ };
67790
+ }
67791
+ function controlBarMisc(modal, side, settings2) {
67645
67792
  const fullScreen = getFullScreenState();
67646
67793
  return {
67647
- id: Ids$2.sectionSettings,
67648
- enable: () => anyUiSettingButton(settings$1),
67794
+ id: Ids$2.miscSpan,
67795
+ enable: () => anyWebglMiscButton(settings2),
67649
67796
  style: Style.sectionDefaultStyle,
67650
67797
  buttons: [
67651
67798
  {
67652
- id: Ids$2.buttonProjectInspector,
67653
- enabled: () => isTrue(settings$1.ui.projectInspector) && (isTrue(settings$1.ui.bimTreePanel) || isTrue(settings$1.ui.bimInfoPanel)),
67799
+ id: Ids$2.miscInspector,
67800
+ enabled: () => showBimButton(settings2),
67654
67801
  tip: "Project Inspector",
67655
67802
  action: () => side.toggleContent("bim"),
67656
67803
  icon: treeView,
67657
67804
  style: Style.buttonDefaultStyle
67658
67805
  },
67806
+ createMiscSettingsButton(side, settings2),
67807
+ createMiscHelpButton(modal, settings2),
67659
67808
  {
67660
- id: Ids$2.buttonSettings,
67661
- enabled: () => isTrue(settings$1.ui.settings),
67662
- tip: "Settings",
67663
- action: () => side.toggleContent("settings"),
67664
- icon: settings,
67665
- style: Style.buttonDefaultStyle
67666
- },
67667
- {
67668
- id: Ids$2.buttonHelp,
67669
- enabled: () => isTrue(settings$1.ui.help),
67670
- tip: "Help",
67671
- action: () => modal.help(true),
67672
- icon: help,
67673
- style: Style.buttonDefaultStyle
67674
- },
67675
- {
67676
- id: Ids$2.buttonMaximize,
67677
- enabled: () => isTrue(settings$1.ui.maximise) && settings$1.capacity.canGoFullScreen,
67809
+ id: Ids$2.miscMaximize,
67810
+ enabled: () => isTrue(settings2.ui.miscMaximise) && settings2.capacity.canGoFullScreen,
67678
67811
  tip: fullScreen.get() ? "Minimize" : "Fullscreen",
67679
67812
  action: () => fullScreen.toggle(),
67680
67813
  icon: fullScreen.get() ? minimize : fullsScreen,
@@ -67683,14 +67816,15 @@ function controlBarSettings(modal, side, settings$1) {
67683
67816
  ]
67684
67817
  };
67685
67818
  }
67686
- function controlBarCamera(camera2) {
67819
+ function controlBarCamera(camera2, settings2) {
67687
67820
  return {
67688
- id: Ids$2.sectionCamera,
67821
+ id: Ids$2.cameraSpan,
67689
67822
  enable: () => true,
67690
67823
  style: Style.sectionDefaultStyle,
67691
67824
  buttons: [
67692
67825
  {
67693
- id: Ids$2.buttonCameraAuto,
67826
+ id: Ids$2.cameraAuto,
67827
+ enabled: () => isTrue(settings2.cameraAuto),
67694
67828
  tip: "Auto Camera",
67695
67829
  isOn: () => camera2.autoCamera.get(),
67696
67830
  action: () => camera2.autoCamera.set(!camera2.autoCamera.get()),
@@ -67698,8 +67832,8 @@ function controlBarCamera(camera2) {
67698
67832
  style: Style.buttonDefaultStyle
67699
67833
  },
67700
67834
  {
67701
- id: Ids$2.buttonCameraFrameSelection,
67702
- // enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
67835
+ id: Ids$2.cameraFrameSelection,
67836
+ enabled: () => isTrue(settings2.cameraFrameSelection),
67703
67837
  tip: "Frame Selection",
67704
67838
  action: () => camera2.frameSelection.call(),
67705
67839
  icon: frameSelection,
@@ -67707,8 +67841,8 @@ function controlBarCamera(camera2) {
67707
67841
  style: Style.buttonDefaultStyle
67708
67842
  },
67709
67843
  {
67710
- id: Ids$2.buttonCameraFrameScene,
67711
- // enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
67844
+ id: Ids$2.cameraFrameScene,
67845
+ enabled: () => isTrue(settings2.cameraFrameScene),
67712
67846
  tip: "Frame All",
67713
67847
  action: () => camera2.frameScene.call(),
67714
67848
  icon: frameScene,
@@ -67718,16 +67852,17 @@ function controlBarCamera(camera2) {
67718
67852
  ]
67719
67853
  };
67720
67854
  }
67721
- function controlBarSelection(isolation) {
67855
+ function controlBarVisibility(isolation, settings2) {
67722
67856
  const adapter = isolation.adapter.current;
67723
67857
  const someVisible = adapter.hasVisibleSelection() || !adapter.hasHiddenSelection();
67724
67858
  return {
67725
- id: Ids$2.sectionSelection,
67859
+ id: Ids$2.visibilitySpan,
67726
67860
  enable: () => true,
67727
- style: `${Style.sectionDefaultStyle}`,
67861
+ style: Style.sectionDefaultStyle,
67728
67862
  buttons: [
67729
67863
  {
67730
- id: Ids$2.buttonClearSelection,
67864
+ id: Ids$2.visibilityClearSelection,
67865
+ enabled: () => isTrue(settings2.visibilityClearSelection),
67731
67866
  tip: "Clear Selection",
67732
67867
  action: () => adapter.clearSelection(),
67733
67868
  icon: pointer,
@@ -67735,16 +67870,17 @@ function controlBarSelection(isolation) {
67735
67870
  style: Style.buttonDisableDefaultStyle
67736
67871
  },
67737
67872
  {
67738
- id: Ids$2.buttonShowAll,
67873
+ id: Ids$2.visibilityShowAll,
67739
67874
  tip: "Show All",
67875
+ enabled: () => isTrue(settings2.visibilityShowAll),
67740
67876
  action: () => adapter.showAll(),
67741
67877
  icon: showAll,
67742
67878
  isOn: () => !isolation.autoIsolate.get() && isolation.visibility.get() !== "all",
67743
67879
  style: Style.buttonDisableStyle
67744
67880
  },
67745
67881
  {
67746
- id: Ids$2.buttonHideSelection,
67747
- enabled: () => someVisible,
67882
+ id: Ids$2.visibilityHideSelection,
67883
+ enabled: () => someVisible && isTrue(settings2.visibilityToggle),
67748
67884
  tip: "Hide Selection",
67749
67885
  action: () => adapter.hideSelection(),
67750
67886
  icon: hideSelection,
@@ -67752,8 +67888,8 @@ function controlBarSelection(isolation) {
67752
67888
  style: Style.buttonDisableStyle
67753
67889
  },
67754
67890
  {
67755
- id: Ids$2.buttonShowSelection,
67756
- enabled: () => !someVisible,
67891
+ id: Ids$2.visibilityShowSelection,
67892
+ enabled: () => !someVisible && isTrue(settings2.visibilityToggle),
67757
67893
  tip: "Show Selection",
67758
67894
  action: () => adapter.showSelection(),
67759
67895
  icon: showSelection,
@@ -67761,7 +67897,8 @@ function controlBarSelection(isolation) {
67761
67897
  style: Style.buttonDisableStyle
67762
67898
  },
67763
67899
  {
67764
- id: Ids$2.buttonIsolateSelection,
67900
+ id: Ids$2.visibilityIsolateSelection,
67901
+ enabled: () => isTrue(settings2.visibilityIsolate),
67765
67902
  tip: "Isolate Selection",
67766
67903
  action: () => adapter.isolateSelection(),
67767
67904
  icon: isolateSelection,
@@ -67769,14 +67906,16 @@ function controlBarSelection(isolation) {
67769
67906
  style: Style.buttonDisableStyle
67770
67907
  },
67771
67908
  {
67772
- id: Ids$2.buttonAutoIsolate,
67909
+ id: Ids$2.visibilityAutoIsolate,
67910
+ enabled: () => isTrue(settings2.visibilityAutoIsolate),
67773
67911
  tip: "Auto Isolate",
67774
67912
  action: () => isolation.autoIsolate.set(!isolation.autoIsolate.get()),
67775
67913
  isOn: () => isolation.autoIsolate.get(),
67776
67914
  icon: autoIsolate
67777
67915
  },
67778
67916
  {
67779
- id: Ids$2.buttonIsolationSettings,
67917
+ id: Ids$2.visibilitySettings,
67918
+ enabled: () => isTrue(settings2.visibilitySettings),
67780
67919
  tip: "Isolation Settings",
67781
67920
  action: () => isolation.showPanel.set(!isolation.showPanel.get()),
67782
67921
  icon: slidersHoriz,
@@ -67787,28 +67926,31 @@ function controlBarSelection(isolation) {
67787
67926
  }
67788
67927
  function useControlBar(viewer, camera2, modal, side, cursor, settings2, section, isolationRef, customization) {
67789
67928
  const measure2 = getMeasureState(viewer, cursor);
67790
- const pointerSection = controlBarPointer(viewer, camera2, settings2);
67791
- const actionSection = controlBarMeasure(settings2, measure2);
67792
- const sectionBoxSection = controlBarSectionBox(section, viewer.selection.any());
67793
- const settingsSection = controlBarSettings(modal, side, settings2);
67794
- const cameraSection = controlBarCamera(camera2);
67795
- const selectionSection = controlBarSelection(isolationRef);
67796
67929
  let controlBarSections = [
67797
- pointerSection,
67798
- actionSection,
67799
- cameraSection,
67800
- sectionBoxSection,
67801
- selectionSection,
67802
- settingsSection
67930
+ controlBarPointer(viewer, settings2.ui),
67931
+ controlBarCamera(camera2, settings2.ui),
67932
+ controlBarVisibility(isolationRef, settings2.ui),
67933
+ controlBarMeasure(measure2, settings2.ui),
67934
+ controlBarSectionBox(section, viewer.selection.any(), settings2.ui),
67935
+ controlBarMisc(modal, side, settings2)
67803
67936
  ];
67804
67937
  controlBarSections = (customization == null ? void 0 : customization(controlBarSections)) ?? controlBarSections;
67805
67938
  return controlBarSections;
67806
67939
  }
67940
+ function showBimButton(settings2) {
67941
+ if (isFalse(settings2.ui.miscProjectInspector)) return false;
67942
+ if (isTrue(settings2.ui.panelBimTree)) return true;
67943
+ if (isTrue(settings2.ui.panelBimInfo)) return true;
67944
+ return false;
67945
+ }
67807
67946
  function anyUiCursorButton(settings2) {
67808
- return isTrue(settings2.ui.orbit) || isTrue(settings2.ui.lookAround) || isTrue(settings2.ui.pan) || isTrue(settings2.ui.zoom) || isTrue(settings2.ui.zoomWindow);
67947
+ return isTrue(settings2.cursorOrbit) || isTrue(settings2.cursorLookAround) || isTrue(settings2.cursorPan) || isTrue(settings2.cursorZoom);
67809
67948
  }
67810
- function anyUiSettingButton(settings2) {
67811
- return isTrue(settings2.ui.projectInspector) || isTrue(settings2.ui.settings) || isTrue(settings2.ui.help) || isTrue(settings2.ui.maximise);
67949
+ function anyWebglMiscButton(settings2) {
67950
+ return isTrue(settings2.ui.miscProjectInspector) || isTrue(settings2.ui.miscSettings) || isTrue(settings2.ui.miscHelp) || isTrue(settings2.ui.miscMaximise);
67951
+ }
67952
+ function anyUltraMiscButton(settings2) {
67953
+ return isTrue(settings2.ui.miscSettings) || isTrue(settings2.ui.miscHelp);
67812
67954
  }
67813
67955
  function RestOfScreen(props) {
67814
67956
  const [, setVersion] = useState(0);
@@ -72709,7 +72851,7 @@ function scrollToSelection(div) {
72709
72851
  return;
72710
72852
  }
72711
72853
  if (rectElem.top < rectContainer.top || rectElem.top < 0) {
72712
- selection.scrollIntoView();
72854
+ selection.scrollIntoView({ block: "nearest", inline: "nearest" });
72713
72855
  }
72714
72856
  }
72715
72857
  const isControlKey = (e) => {
@@ -72914,8 +73056,8 @@ function range(size, startAt = 0) {
72914
73056
  function OptionalBimPanel(props) {
72915
73057
  return whenSomeTrue(
72916
73058
  [
72917
- props.settings.ui.bimTreePanel,
72918
- props.settings.ui.bimInfoPanel
73059
+ props.settings.ui.panelBimTree,
73060
+ props.settings.ui.panelBimInfo
72919
73061
  ],
72920
73062
  React__default.createElement(BimPanel, props)
72921
73063
  );
@@ -72928,11 +73070,11 @@ function BimPanel(props) {
72928
73070
  }, [props.viewerState.vim.get(), props.viewerState.elements.get()]);
72929
73071
  const selection = props.viewerState.selection.get();
72930
73072
  const last = selection[selection.length - 1];
72931
- const fullTree = isFalse(props.settings.ui.bimInfoPanel);
72932
- const fullInfo = isFalse(props.settings.ui.bimTreePanel);
73073
+ const fullTree = isFalse(props.settings.ui.panelBimInfo);
73074
+ const fullInfo = isFalse(props.settings.ui.panelBimTree);
72933
73075
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `vim-bim-panel vc-inset-0 vc-absolute vc-h-full vc-w-full ${fullTree ? "full-tree" : ""} ${props.visible ? "" : "vc-hidden"}`, children: [
72934
73076
  whenTrue(
72935
- props.settings.ui.bimTreePanel,
73077
+ props.settings.ui.panelBimTree,
72936
73078
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `vim-bim-upper vc-flex vc-flex-col vc-absolute vc-w-full ${fullTree ? "vc-h-full" : "vc-h-[49%]"} `, children: [
72937
73079
  /* @__PURE__ */ jsxRuntimeExports.jsx(
72938
73080
  "h2",
@@ -72966,21 +73108,21 @@ function BimPanel(props) {
72966
73108
  // Divider if needed.
72967
73109
  whenAllTrue(
72968
73110
  [
72969
- props.settings.ui.bimTreePanel,
72970
- props.settings.ui.bimInfoPanel,
73111
+ props.settings.ui.panelBimTree,
73112
+ props.settings.ui.panelBimInfo,
72971
73113
  ((_b2 = props.viewerState.elements.get()) == null ? void 0 : _b2.length) > 0
72972
73114
  ],
72973
73115
  divider$1()
72974
73116
  ),
72975
73117
  whenTrue(
72976
- props.settings.ui.bimInfoPanel,
73118
+ props.settings.ui.panelBimInfo,
72977
73119
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `vim-bim-lower-container vc-absolute ${fullInfo ? "vc-top-0" : "vc-top-[50%]"} vc-bottom-0 vc-bottom vc-left-0 vc-right-0`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
72978
73120
  BimInfoPanel,
72979
73121
  {
72980
73122
  object: last,
72981
73123
  vim: props.viewerState.vim.get(),
72982
73124
  elements: props.viewerState.elements.get(),
72983
- full: isFalse(props.settings.ui.bimTreePanel),
73125
+ full: isFalse(props.settings.ui.panelBimTree),
72984
73126
  bimInfoRef: props.bimInfoRef
72985
73127
  }
72986
73128
  ) })
@@ -73820,7 +73962,7 @@ function SidePanel(props) {
73820
73962
  } else {
73821
73963
  props.container.gfx.style.left = "0px";
73822
73964
  }
73823
- props.viewer.viewport.ResizeToParent();
73965
+ props.viewer.viewport.resizeToParent();
73824
73966
  };
73825
73967
  const getMaxSize = () => {
73826
73968
  return props.container.root.clientWidth * MAX_WIDTH;
@@ -73879,7 +74021,10 @@ function SidePanel(props) {
73879
74021
  style: {
73880
74022
  position: "absolute"
73881
74023
  },
73882
- className: `vim-side-panel vc-top-0 vc-left-0 vc-z-20 vc-bg-gray-lightest vc-text-gray-darker ${props.side.getContent() !== "none" ? "" : "vc-hidden"}`,
74024
+ className: `vim-side-panel vc-top-0 vc-left-0 vc-z-20
74025
+ vc-bg-gray-lightest vc-text-gray-darker
74026
+ vc-border-r vc-border-gray-light
74027
+ ${props.side.getContent() !== "none" ? "" : "vc-hidden"}`,
73883
74028
  children: [
73884
74029
  /* @__PURE__ */ jsxRuntimeExports.jsx(
73885
74030
  "button",
@@ -73962,180 +74107,6 @@ function useSideState(useInspector, defaultWidth) {
73962
74107
  [side, width]
73963
74108
  );
73964
74109
  }
73965
- function SettingsPanel(props) {
73966
- if (!props.visible) return null;
73967
- const toggleElement = (label, state, action) => {
73968
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "vc-m-1 vc-block vc-select-none vc-items-center vc-py-1 vc-text-gray-warm", children: [
73969
- /* @__PURE__ */ jsxRuntimeExports.jsx(
73970
- "input",
73971
- {
73972
- type: "checkbox",
73973
- checked: state,
73974
- onChange: action,
73975
- className: "vim-settings-checkbox vc-checked:bg-primary-royal vc-mr-2 vc-rounded vc-border vc-border-gray-medium "
73976
- }
73977
- ),
73978
- " ",
73979
- label
73980
- ] });
73981
- };
73982
- const settingsToggle = (label, getter, setter) => {
73983
- const value = getter(props.settings.value);
73984
- if (value === "AlwaysTrue" || value === "AlwaysFalse") {
73985
- return null;
73986
- }
73987
- return toggleElement(label, value, () => {
73988
- const value2 = getter(props.settings.value);
73989
- props.settings.update((s) => setter(s, !value2));
73990
- });
73991
- };
73992
- const settingsBox = (label, info, transform, getter, setter) => {
73993
- const ref = React__default.useRef(null);
73994
- useEffect(() => {
73995
- ref.current.value = props.viewer.inputs.scrollSpeed.toFixed(2);
73996
- }, []);
73997
- getter(props.settings.value).toString();
73998
- const update = (event) => {
73999
- const str = event.target.value;
74000
- const n = Number.parseFloat(str);
74001
- if (Number.isNaN(n)) {
74002
- event.target.value = getter(props.settings.value).toString();
74003
- } else {
74004
- const value2 = transform(n);
74005
- event.target.value = value2.toString();
74006
- props.settings.update((s) => setter(s, value2));
74007
- }
74008
- };
74009
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vc-box-input vc-my-1", children: [
74010
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: "textbox", className: "vc-w-3 vc-h-2", children: [
74011
- label,
74012
- ":"
74013
- ] }),
74014
- /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ref, type: "text", className: "vim-settings-textbox vc-w-14 vc-ml-1 vc-p-1", onBlur: (e) => update(e) }),
74015
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "textbox", className: "vc-w-3 vc-h-2 vc-text-gray vc-ml-1", children: info })
74016
- ] });
74017
- };
74018
- function settingsSubtitle(title2) {
74019
- return /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "vc-subtitle", children: title2 });
74020
- }
74021
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
74022
- "div",
74023
- {
74024
- className: "vc-absolute vc-inset-0",
74025
- children: [
74026
- /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "vc-title", children: "Settings " }),
74027
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vim-settings vc-absolute vc-top-6 vc-left-0 vc-bottom-0 vc-right-0 vc-overflow-y-auto", children: [
74028
- settingsSubtitle("Inputs"),
74029
- settingsBox(
74030
- "Scroll Speed",
74031
- "[0.1,10]",
74032
- (n) => MathUtils.clamp(n, 0.1, 10),
74033
- (s) => props.viewer.inputs.scrollSpeed,
74034
- (s, v) => {
74035
- props.viewer.inputs.scrollSpeed = v;
74036
- }
74037
- ),
74038
- settingsSubtitle("Panels"),
74039
- settingsToggle(
74040
- "Show Logo",
74041
- (settings2) => settings2.ui.logo,
74042
- (settings2, value) => settings2.ui.logo = value
74043
- ),
74044
- settingsToggle(
74045
- "Show Bim Tree",
74046
- (settings2) => settings2.ui.bimTreePanel,
74047
- (settings2, value) => settings2.ui.bimTreePanel = value
74048
- ),
74049
- settingsToggle(
74050
- "Show Bim Info",
74051
- (settings2) => settings2.ui.bimInfoPanel,
74052
- (settings2, value) => settings2.ui.bimInfoPanel = value
74053
- ),
74054
- settingsToggle(
74055
- "Show Axes Panel",
74056
- (settings2) => settings2.ui.axesPanel,
74057
- (settings2, value) => settings2.ui.axesPanel = value
74058
- ),
74059
- settingsToggle(
74060
- "Show Performance Panel",
74061
- (settings2) => settings2.ui.performance,
74062
- (settings2, value) => settings2.ui.performance = value
74063
- ),
74064
- settingsSubtitle("Axes"),
74065
- settingsToggle(
74066
- "Show Orthographic Button",
74067
- (settings2) => settings2.ui.orthographic,
74068
- (settings2, value) => settings2.ui.orthographic = value
74069
- ),
74070
- settingsToggle(
74071
- "Show Reset Camera Button",
74072
- (settings2) => settings2.ui.resetCamera,
74073
- (settings2, value) => settings2.ui.resetCamera = value
74074
- ),
74075
- settingsSubtitle("Control Bar"),
74076
- settingsToggle(
74077
- "Show Control Bar",
74078
- (settings2) => settings2.ui.controlBar,
74079
- (settings2, value) => settings2.ui.controlBar = value
74080
- ),
74081
- settingsSubtitle("Control Bar - Cursors"),
74082
- settingsToggle(
74083
- "Show Orbit Button",
74084
- (settings2) => settings2.ui.orbit,
74085
- (settings2, value) => settings2.ui.orbit = value
74086
- ),
74087
- settingsToggle(
74088
- "Show Look Around Button",
74089
- (settings2) => settings2.ui.lookAround,
74090
- (settings2, value) => settings2.ui.lookAround = value
74091
- ),
74092
- settingsToggle(
74093
- "Show Pan Button",
74094
- (settings2) => settings2.ui.pan,
74095
- (settings2, value) => settings2.ui.pan = value
74096
- ),
74097
- settingsToggle(
74098
- "Show Zoom Button",
74099
- (settings2) => settings2.ui.zoom,
74100
- (settings2, value) => settings2.ui.zoom = value
74101
- ),
74102
- settingsToggle(
74103
- "Show Zoom Window Button",
74104
- (settings2) => settings2.ui.zoomWindow,
74105
- (settings2, value) => settings2.ui.zoomWindow = value
74106
- ),
74107
- settingsSubtitle("Control Bar - Tools"),
74108
- settingsToggle(
74109
- "Show Measuring Mode Button",
74110
- (settings2) => settings2.ui.measuringMode,
74111
- (settings2, value) => settings2.ui.measuringMode = value
74112
- ),
74113
- settingsSubtitle("Control Bar - Settings"),
74114
- settingsToggle(
74115
- "Show Project Inspector Button",
74116
- (settings2) => settings2.ui.projectInspector,
74117
- (settings2, value) => settings2.ui.projectInspector = value
74118
- ),
74119
- settingsToggle(
74120
- "Show Settings Button",
74121
- (settings2) => settings2.ui.settings,
74122
- (settings2, value) => settings2.ui.settings = value
74123
- ),
74124
- settingsToggle(
74125
- "Show Help Button",
74126
- (settings2) => settings2.ui.help,
74127
- (settings2, value) => settings2.ui.help = value
74128
- ),
74129
- settingsToggle(
74130
- "Show Maximise Button",
74131
- (settings2) => settings2.ui.maximise,
74132
- (settings2, value) => settings2.ui.maximise = value
74133
- )
74134
- ] })
74135
- ]
74136
- }
74137
- );
74138
- }
74139
74110
  const MenuToastMemo = React__default.memo(MenuToast);
74140
74111
  function MenuToast(props) {
74141
74112
  const [visible2, setVisible] = useState();
@@ -74300,164 +74271,56 @@ function applyWebglBindings(viewer, camera2, isolation, sideState) {
74300
74271
  }
74301
74272
  });
74302
74273
  }
74303
- function useSettings(viewer, value) {
74304
- const merged = createSettings(value);
74305
- const [settings2, setSettings] = useState(merged);
74306
- const onUpdate = useRef();
74307
- const update = function(updater) {
74308
- var _a3;
74309
- const next = { ...settings2 };
74310
- updater(next);
74311
- saveSettingsToLocal(next);
74312
- setSettings(next);
74313
- (_a3 = onUpdate.current) == null ? void 0 : _a3.call(onUpdate, next);
74314
- };
74315
- useEffect(() => {
74316
- applySettings(viewer, settings2);
74317
- }, []);
74318
- useEffect(() => {
74319
- applySettings(viewer, settings2);
74320
- }, [settings2]);
74321
- return useMemo(
74322
- () => ({
74323
- value: settings2,
74324
- update,
74325
- register: (v) => onUpdate.current = v
74326
- }),
74327
- [settings2]
74328
- );
74329
- }
74330
- function applySettings(viewer, settings2) {
74331
- const performance2 = document.getElementsByClassName("vim-performance-div")[0];
74332
- if (performance2) {
74333
- if (isTrue(settings2.ui.performance)) {
74334
- performance2.classList.remove("vc-hidden");
74335
- } else {
74336
- performance2.classList.add("vc-hidden");
74337
- }
74274
+ class MutableState {
74275
+ constructor(initial) {
74276
+ __publicField(this, "_value");
74277
+ __publicField(this, "_onChange", new distExports.SimpleEventDispatcher());
74278
+ this._value = initial;
74338
74279
  }
74339
- }
74340
- function createContainer(element) {
74341
- let root = element;
74342
- if (root === void 0) {
74343
- root = document.createElement("div");
74344
- document.body.append(root);
74345
- root.classList.add("vc-inset-0");
74280
+ get() {
74281
+ return this._value;
74346
74282
  }
74347
- root.style.position = "absolute";
74348
- root.classList.add("vim-component");
74349
- const gfx = document.createElement("div");
74350
- gfx.className = "vim-gfx vc-absolute vc-inset-0 vc-pointer-events-none";
74351
- const ui = document.createElement("div");
74352
- ui.className = "vim-ui vc-absolute vc-inset-0";
74353
- root.append(gfx);
74354
- root.append(ui);
74355
- const dispose = () => {
74356
- if (element === void 0) {
74357
- root.remove();
74358
- } else {
74359
- root.classList.remove("vim-component");
74360
- gfx.remove();
74361
- ui.remove();
74283
+ set(value) {
74284
+ if (value === this._value) return;
74285
+ this._value = value;
74286
+ this._onChange.dispatch(value);
74287
+ }
74288
+ confirm() {
74289
+ }
74290
+ get onChange() {
74291
+ return this._onChange.asEvent();
74292
+ }
74293
+ }
74294
+ function useRefresher() {
74295
+ const [refresh, setRefresh] = useState(false);
74296
+ return {
74297
+ refresh: () => {
74298
+ setRefresh(!refresh);
74362
74299
  }
74363
74300
  };
74364
- return { root, ui, gfx, dispose };
74365
74301
  }
74366
- async function getElements(vim) {
74367
- var _a3, _b2, _c, _d, _e;
74368
- if (!vim.bim) return [];
74369
- const [elements, bimDocument, category, levels, worksets] = await Promise.all(
74370
- [
74371
- (_a3 = vim.bim.element) == null ? void 0 : _a3.getAll(),
74372
- (_b2 = vim.bim.bimDocument) == null ? void 0 : _b2.getAllTitle(),
74373
- (_c = vim.bim.category) == null ? void 0 : _c.getAllName(),
74374
- (_d = vim.bim.level) == null ? void 0 : _d.getAllElementIndex(),
74375
- (_e = vim.bim.workset) == null ? void 0 : _e.getAllName()
74376
- ]
74377
- );
74378
- const familyTypeMap = await getFamilyTypeNameMap(vim.bim);
74379
- if (!elements) return void 0;
74380
- const result = elements.map((e) => {
74381
- var _a4;
74382
- return {
74383
- ...e,
74384
- bimDocumentName: bimDocument ? bimDocument[e.bimDocumentIndex] : void 0,
74385
- categoryName: category ? category[e.categoryIndex] : void 0,
74386
- familyTypeName: familyTypeMap.get(e.index),
74387
- levelName: levels ? (_a4 = elements[levels[(e == null ? void 0 : e.levelIndex) ?? -1]]) == null ? void 0 : _a4.name : void 0,
74388
- worksetName: worksets ? worksets[(e == null ? void 0 : e.worksetIndex) ?? -1] : void 0
74389
- };
74390
- });
74391
- const real = result.filter((e) => vim.getElementFromIndex(e.index).hasMesh);
74392
- return real;
74393
- }
74394
- async function getFamilyTypeNameMap(document2) {
74395
- const [
74396
- familyInstanceElement,
74397
- familyInstanceFamilyType,
74398
- familyTypeElement,
74399
- elementName
74400
- ] = await Promise.all([
74401
- document2.familyInstance.getAllElementIndex(),
74402
- document2.familyInstance.getAllFamilyTypeIndex(),
74403
- document2.familyType.getAllElementIndex(),
74404
- document2.element.getAllName()
74405
- ]);
74406
- return new Map(
74407
- familyInstanceElement.map((e, i) => {
74408
- const familyType = familyInstanceFamilyType == null ? void 0 : familyInstanceFamilyType[i];
74409
- const element = Number.isInteger(familyType) ? familyTypeElement[familyType] : void 0;
74410
- const name = Number.isInteger(element) ? elementName == null ? void 0 : elementName[element] : void 0;
74411
- return [e, name];
74412
- })
74413
- );
74414
- }
74415
- class MutableState {
74416
- constructor(initial) {
74417
- __publicField(this, "_value");
74418
- __publicField(this, "_onChange", new distExports.SimpleEventDispatcher());
74419
- this._value = initial;
74420
- }
74421
- get() {
74422
- return this._value;
74423
- }
74424
- set(value) {
74425
- if (value === this._value) return;
74426
- this._value = value;
74427
- this._onChange.dispatch(value);
74428
- }
74429
- confirm() {
74430
- }
74431
- get onChange() {
74432
- return this._onChange.asEvent();
74433
- }
74434
- }
74435
- function useRefresher() {
74436
- const [refresh, setRefresh] = useState(false);
74437
- return {
74438
- refresh: () => {
74439
- setRefresh(!refresh);
74302
+ function useStateRef(initialValue, isLazy = false) {
74303
+ const getInitialValue = () => {
74304
+ if (isLazy && typeof initialValue === "function") {
74305
+ return initialValue();
74440
74306
  }
74307
+ return initialValue;
74441
74308
  };
74442
- }
74443
- function useStateRef(initialValue) {
74444
- const [value, setValue] = useState(initialValue);
74309
+ const [box, setBox] = useState(() => ({
74310
+ current: getInitialValue()
74311
+ }));
74445
74312
  const ref = useRef(void 0);
74446
74313
  if (ref.current === void 0) {
74447
- if (typeof initialValue === "function") {
74448
- ref.current = initialValue();
74449
- } else {
74450
- ref.current = initialValue;
74451
- }
74314
+ ref.current = getInitialValue();
74452
74315
  }
74453
74316
  const event = useRef(new distExports.SimpleEventDispatcher());
74454
74317
  const validate = useRef((next, current) => next);
74455
- const confirm = useRef((value2) => value2);
74456
- const set3 = (value2) => {
74457
- const finalValue = validate.current(value2, ref.current);
74318
+ const confirm = useRef((value) => value);
74319
+ const set3 = (value) => {
74320
+ const finalValue = validate.current(value, ref.current);
74458
74321
  if (finalValue === ref.current) return;
74459
74322
  ref.current = finalValue;
74460
- setValue(finalValue);
74323
+ setBox({ current: finalValue });
74461
74324
  event.current.dispatch(finalValue);
74462
74325
  };
74463
74326
  return {
@@ -74483,8 +74346,8 @@ function useStateRef(initialValue) {
74483
74346
  */
74484
74347
  useOnChange(on) {
74485
74348
  useEffect(() => {
74486
- return event.current.subscribe((value2) => {
74487
- const result = on(value2);
74349
+ return event.current.subscribe((value) => {
74350
+ const result = on(value);
74488
74351
  if (result instanceof Promise) {
74489
74352
  result.catch(console.error);
74490
74353
  }
@@ -74498,7 +74361,7 @@ function useStateRef(initialValue) {
74498
74361
  * @returns The memoized value.
74499
74362
  */
74500
74363
  useMemo(on, deps) {
74501
- return useMemo(() => on(value), [...deps || [], value]);
74364
+ return useMemo(() => on(box.current), [...deps || [], box.current]);
74502
74365
  },
74503
74366
  /**
74504
74367
  * Sets a validation function to process any new state value before updating.
@@ -74675,6 +74538,114 @@ const reactUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
74675
74538
  useRefresher,
74676
74539
  useStateRef
74677
74540
  }, Symbol.toStringTag, { value: "Module" }));
74541
+ function useSettings(value, defaultSettings, applySettings = () => {
74542
+ }) {
74543
+ const merged = createSettings(value, defaultSettings);
74544
+ const [settings2, setSettings] = useState(merged);
74545
+ const onUpdate = useRef();
74546
+ const customizer = useStateRef((settings22) => settings22);
74547
+ const update = function(updater) {
74548
+ var _a3;
74549
+ const next = { ...settings2 };
74550
+ updater(next);
74551
+ saveSettingsToLocal(next);
74552
+ setSettings(next);
74553
+ (_a3 = onUpdate.current) == null ? void 0 : _a3.call(onUpdate, next);
74554
+ };
74555
+ useEffect(() => {
74556
+ applySettings(settings2);
74557
+ }, []);
74558
+ useEffect(() => {
74559
+ applySettings(settings2);
74560
+ }, [settings2]);
74561
+ return useMemo(
74562
+ () => ({
74563
+ value: settings2,
74564
+ update,
74565
+ register: (v) => onUpdate.current = v,
74566
+ customizer
74567
+ }),
74568
+ [settings2]
74569
+ );
74570
+ }
74571
+ function createSettings(settings2, defaultSettings) {
74572
+ return settings2 !== void 0 ? deepmerge(defaultSettings, settings2) : defaultSettings;
74573
+ }
74574
+ function createContainer(element) {
74575
+ let root = element;
74576
+ if (root === void 0) {
74577
+ root = document.createElement("div");
74578
+ document.body.append(root);
74579
+ root.classList.add("vc-inset-0");
74580
+ }
74581
+ root.style.position = "absolute";
74582
+ root.classList.add("vim-component");
74583
+ const gfx = document.createElement("div");
74584
+ gfx.className = "vim-gfx vc-absolute vc-inset-0 vc-pointer-events-none";
74585
+ const ui = document.createElement("div");
74586
+ ui.className = "vim-ui vc-absolute vc-inset-0";
74587
+ root.append(gfx);
74588
+ root.append(ui);
74589
+ const dispose = () => {
74590
+ if (element === void 0) {
74591
+ root.remove();
74592
+ } else {
74593
+ root.classList.remove("vim-component");
74594
+ gfx.remove();
74595
+ ui.remove();
74596
+ }
74597
+ };
74598
+ return { root, ui, gfx, dispose };
74599
+ }
74600
+ async function getElements(vim) {
74601
+ var _a3, _b2, _c, _d, _e;
74602
+ if (!vim.bim) return [];
74603
+ const [elements, bimDocument, category, levels, worksets] = await Promise.all(
74604
+ [
74605
+ (_a3 = vim.bim.element) == null ? void 0 : _a3.getAll(),
74606
+ (_b2 = vim.bim.bimDocument) == null ? void 0 : _b2.getAllTitle(),
74607
+ (_c = vim.bim.category) == null ? void 0 : _c.getAllName(),
74608
+ (_d = vim.bim.level) == null ? void 0 : _d.getAllElementIndex(),
74609
+ (_e = vim.bim.workset) == null ? void 0 : _e.getAllName()
74610
+ ]
74611
+ );
74612
+ const familyTypeMap = await getFamilyTypeNameMap(vim.bim);
74613
+ if (!elements) return void 0;
74614
+ const result = elements.map((e) => {
74615
+ var _a4;
74616
+ return {
74617
+ ...e,
74618
+ bimDocumentName: bimDocument ? bimDocument[e.bimDocumentIndex] : void 0,
74619
+ categoryName: category ? category[e.categoryIndex] : void 0,
74620
+ familyTypeName: familyTypeMap.get(e.index),
74621
+ levelName: levels ? (_a4 = elements[levels[(e == null ? void 0 : e.levelIndex) ?? -1]]) == null ? void 0 : _a4.name : void 0,
74622
+ worksetName: worksets ? worksets[(e == null ? void 0 : e.worksetIndex) ?? -1] : void 0
74623
+ };
74624
+ });
74625
+ const real = result.filter((e) => vim.getElementFromIndex(e.index).hasMesh);
74626
+ return real;
74627
+ }
74628
+ async function getFamilyTypeNameMap(document2) {
74629
+ const [
74630
+ familyInstanceElement,
74631
+ familyInstanceFamilyType,
74632
+ familyTypeElement,
74633
+ elementName
74634
+ ] = await Promise.all([
74635
+ document2.familyInstance.getAllElementIndex(),
74636
+ document2.familyInstance.getAllFamilyTypeIndex(),
74637
+ document2.familyType.getAllElementIndex(),
74638
+ document2.element.getAllName()
74639
+ ]);
74640
+ return new Map(
74641
+ familyInstanceElement.map((e, i) => {
74642
+ const familyType = familyInstanceFamilyType == null ? void 0 : familyInstanceFamilyType[i];
74643
+ const element = Number.isInteger(familyType) ? familyTypeElement[familyType] : void 0;
74644
+ const name = Number.isInteger(element) ? elementName == null ? void 0 : elementName[element] : void 0;
74645
+ return [e, name];
74646
+ })
74647
+ );
74648
+ }
74678
74649
  function useViewerState(viewer) {
74679
74650
  const getVim = () => {
74680
74651
  var _a3;
@@ -74816,12 +74787,8 @@ const vcColorLink = "vc-text-[#0590CC]";
74816
74787
  const vcLink = `${vcColorLink} vc-underline`;
74817
74788
  const vcLabel = "vc-text-[#3F444F]";
74818
74789
  const vcRoboto = "vc-font-['Roboto',sans-serif]";
74819
- function footer$1(url) {
74820
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: `vc-text-xs vc-font-normal ${vcColorSecondary}`, children: [
74821
- "More troubleshooting tips can be found",
74822
- " ",
74823
- link(url, "here")
74824
- ] });
74790
+ function footer$1() {
74791
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
74825
74792
  }
74826
74793
  function mainText(text) {
74827
74794
  return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `vim-main-text vc-text-base ${vcColorPrimary} vc-mb-4 vc-font-normal`, children: text });
@@ -74869,31 +74836,18 @@ const errorStyle = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
74869
74836
  vcLink,
74870
74837
  vcRoboto
74871
74838
  }, Symbol.toStringTag, { value: "Module" }));
74872
- const support = "https://docs.vimaec.com";
74873
- const supportUltra = "https://docs.vimaec.com/docs/vim-for-windows/configuring-vim-ultra";
74874
- const supportControls = "https://docs.vimaec.com/docs/vim-cloud/webgl-navigation-and-controls-guide";
74875
- const urls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
74876
- __proto__: null,
74877
- support,
74878
- supportControls,
74879
- supportUltra
74880
- }, Symbol.toStringTag, { value: "Module" }));
74881
74839
  function fileOpeningError(url) {
74882
74840
  return {
74883
- title: "File Opening Error",
74841
+ title: "VIM Ultra File Error",
74884
74842
  body: serverFileOpeningErrorBody(url),
74885
- footer: footer$1(support),
74843
+ footer: footer$1(),
74886
74844
  canClose: false
74887
74845
  };
74888
74846
  }
74889
74847
  function serverFileOpeningErrorBody(url) {
74890
74848
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
74891
- mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
74892
- "Oops, it appears that there's an ",
74893
- bold("error opening the VIM file"),
74894
- ". Please check the file exists at the path noted below."
74895
- ] })),
74896
- subTitle("Error details:"),
74849
+ mainText(/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "We encountered an error opening the VIM file in VIM Ultra." })),
74850
+ subTitle("Details"),
74897
74851
  dotList([bullet("File path:", url)])
74898
74852
  ] });
74899
74853
  }
@@ -74902,136 +74856,110 @@ function serverFileDownloadingError(url, authToken, server) {
74902
74856
  return fileOpeningError(url);
74903
74857
  }
74904
74858
  return {
74905
- title: "File Downloading Error",
74859
+ title: "VIM Ultra Download Error",
74906
74860
  body: body$5(url, authToken, server),
74907
- footer: footer$1(support),
74861
+ footer: footer$1(),
74908
74862
  canClose: false
74909
74863
  };
74910
74864
  }
74911
74865
  function body$5(url, authToken, server) {
74912
74866
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
74913
- mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
74914
- "Oops, it appears that there’s an ",
74915
- bold("error downloading the VIM file"),
74916
- ". Please check the following conditions to get back up and running quickly."
74917
- ] })),
74918
- subTitle("Error details:"),
74867
+ mainText(/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "We encountered an error downloading the VIM file in VIM Ultra." })),
74868
+ subTitle("Details"),
74919
74869
  dotList([
74920
- server ? bullet("VIM ULTRA Server:", server) : null,
74921
- bullet("File URL:", url),
74922
- authToken ? bullet("Auth Token:", authToken) : null
74870
+ server ? bullet("VIM Ultra:", server) : null,
74871
+ bullet("VIM URL:", url),
74872
+ authToken ? bullet("Access Token:", authToken) : null
74923
74873
  ]),
74924
- subTitle("Troubleshooting tips:"),
74874
+ subTitle("Tips"),
74925
74875
  numList([
74926
- "Make sure the VIM exists at the url listed above.",
74927
- "Reprocess the VIM file and refresh the Power BI report dataset.",
74928
- server ? "Check network access policies to allow the VIM Ultra Server access to the VIM File url." : ""
74876
+ "Ensure the VIM URL is valid",
74877
+ "Check your network connection and access policies"
74929
74878
  ])
74930
74879
  ] });
74931
74880
  }
74932
74881
  function serverFileLoadingError(url) {
74933
74882
  return {
74934
- title: "File Loading Error",
74883
+ title: "VIM Ultra Loading Error",
74935
74884
  body: body$4(url),
74936
- footer: footer$1(support),
74885
+ footer: footer$1(),
74937
74886
  canClose: false
74938
74887
  };
74939
74888
  }
74940
74889
  function body$4(url) {
74941
74890
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
74942
- mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
74943
- "Oops, it appears that we ",
74944
- bold("couldn’t load the VIM file"),
74945
- ". This could be due to a couple of reasons, including that the file could be corrupt or not recognizable."
74946
- ] })),
74947
- subTitle("Error details:"),
74891
+ mainText(/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "We encountered an error loading the VIM file in VIM Ultra." })),
74892
+ subTitle("Details"),
74948
74893
  dotList([bullet("File path:", url)]),
74949
- subTitle("Troubleshooting tips:"),
74894
+ subTitle("Tips"),
74950
74895
  numList([
74951
- "Reload this Power BI report",
74952
- "Reprocess the VIM file and refresh the Power BI report dataset"
74896
+ "Reload the page",
74897
+ "Ensure the VIM URL points to a valid VIM file",
74898
+ "Clear your VIM Ultra download cache"
74953
74899
  ])
74954
74900
  ] });
74955
74901
  }
74956
74902
  function serverConnectionError(url) {
74957
74903
  return {
74958
- title: "Connection Error",
74904
+ title: "VIM Ultra Connection",
74959
74905
  body: body$3(url, isLocalUrl(url)),
74960
- footer: footer$1(support),
74906
+ footer: footer$1(),
74961
74907
  canClose: false
74962
74908
  };
74963
74909
  }
74964
74910
  function body$3(url, local) {
74965
74911
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
74966
- mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
74967
- "Oops, it appears that there’s an ",
74968
- bold("error connecting to the ULTRA server"),
74969
- ". Please check the following conditions to get back up and running quickly."
74970
- ] })),
74971
- subTitle("Troubleshooting tips:"),
74912
+ mainText(/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "We encountered an error connecting to VIM Ultra." })),
74913
+ subTitle("Tips"),
74972
74914
  numList([
74973
74915
  /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
74974
- "Ensure that VIM Ultra",
74975
- " ",
74976
- link(supportUltra, "process is running"),
74977
- " ",
74978
- "at ",
74916
+ "Ensure that VIM Ultra is running at ",
74979
74917
  detailText(url)
74980
74918
  ] }),
74981
- "Check your internet connection.",
74982
- "Check firewall permissions."
74919
+ "Check your network connection and access policies"
74983
74920
  ])
74984
74921
  ] });
74985
74922
  }
74986
74923
  function serverCompatibilityError(url, localVersion, remoteVersion) {
74987
74924
  return {
74988
- title: "Compatibility Error",
74925
+ title: "VIM Ultra Compatibility",
74989
74926
  body: body$2(url, localVersion, remoteVersion),
74990
- footer: footer$1(support),
74927
+ footer: footer$1(),
74991
74928
  canClose: false
74992
74929
  };
74993
74930
  }
74994
74931
  function body$2(url, localVersion, remoteVersion) {
74995
74932
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
74996
- mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
74997
- "Oops, it appears that you’re running a ",
74998
- " ",
74999
- bold("version of VIM Ultra Server that isn’t compatible with this visual"),
75000
- ". Please check the following conditions to get back up and running quickly."
75001
- ] })),
75002
- subTitle("Error details:"),
74933
+ mainText(/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "The VIM Ultra version is incompatible with this visual." })),
74934
+ subTitle("Details"),
75003
74935
  dotList([
75004
74936
  bullet("Url:", url),
75005
74937
  bullet("Local Version:", localVersion),
75006
74938
  bullet("Remote Version:", remoteVersion)
75007
74939
  ]),
75008
- subTitle("Troubleshooting tips:"),
74940
+ subTitle("Tips"),
75009
74941
  numList([
75010
- "Update your PowerBI visual with the compatible version.",
75011
- "Or, run the compatible version of VIM Ultra."
74942
+ "Update this visual to a compatible version.",
74943
+ "Start a compatible version of VIM Ultra."
75012
74944
  ])
75013
74945
  ] });
75014
74946
  }
75015
74947
  function serverStreamError(url) {
75016
74948
  return {
75017
- title: "Stream Error",
74949
+ title: "VIM Ultra Stream Error",
75018
74950
  body: body$1(),
75019
- footer: footer$1(support),
74951
+ footer: footer$1(),
75020
74952
  canClose: false
75021
74953
  };
75022
74954
  }
75023
74955
  function body$1(url) {
75024
74956
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
75025
- mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
75026
- "Oops, it appears that there’s an ",
75027
- bold("error starting a stream on the VIM Ultra Server"),
75028
- ". Please check the following conditions to get back up and running quickly."
75029
- ] })),
75030
- subTitle("Troubleshooting tips:"),
74957
+ mainText(/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "We encountered a streaming error with VIM Ultra." })),
74958
+ subTitle("Tips"),
75031
74959
  numList([
75032
- "Close other applications that may be using the server.",
75033
- "Try reconnecting to the server.",
75034
- "Restart the server."
74960
+ "Reload the page",
74961
+ "Close other applications that may be using VIM Ultra",
74962
+ "Restart VIM Ultra"
75035
74963
  ])
75036
74964
  ] });
75037
74965
  }
@@ -75263,16 +75191,19 @@ class ComponentLoader {
75263
75191
  }
75264
75192
  }
75265
75193
  function MessageBox(props) {
75194
+ const [minimized, setMinimized] = React__default.useState(props.value.minimize ?? false);
75266
75195
  const p = props.value;
75267
75196
  if (!p.title || !p.body) return null;
75268
75197
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vim-message-box vc-p-6 vc-max-h-[80%] vc-max-w-[80%] vc-w-[424px] vc-bg-white vc-rounded-md vc-shadow-message vc-shadow-[0px_4px_16px_rgba(33,39,51,0.5)] vc-font-roboto", children: [
75269
75198
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vc-flex vc-justify-between vc-items-center", children: [
75199
+ props.value.icon,
75270
75200
  title(p.title),
75271
- closeBtn(p.onClose)
75201
+ props.value.canClose && closeBtn(p.onClose),
75202
+ props.value.minimize && minimizeButton(minimized, setMinimized)
75272
75203
  ] }),
75273
- divider(),
75274
- body(p.body),
75275
- footer(p.footer)
75204
+ !minimized && divider(),
75205
+ !minimized && body(p.body),
75206
+ !minimized && footer(p.footer)
75276
75207
  ] });
75277
75208
  }
75278
75209
  function title(title2) {
@@ -75282,6 +75213,9 @@ function closeBtn(onClose) {
75282
75213
  if (!onClose) return null;
75283
75214
  return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: onClose, className: "vc-text-[#212733] vc-text-xl", children: "×" });
75284
75215
  }
75216
+ function minimizeButton(minimized, setMinimized) {
75217
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: () => setMinimized(!minimized), className: "vc-text-[#212733] vc-text-xl", children: minimized ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "▼" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "▲" }) });
75218
+ }
75285
75219
  function body(content2) {
75286
75220
  if (content2 === void 0) return null;
75287
75221
  if (typeof content2 === "string") {
@@ -75640,7 +75574,7 @@ function useSectionBox(adapter) {
75640
75574
  adapter.setVisible(false);
75641
75575
  adapter.setClip(false);
75642
75576
  return adapter.onSelectionChanged.sub(() => {
75643
- if (auto.get() && enable.get()) sectionSelection2.call();
75577
+ if (auto.get() && enable.get()) sectionSelection.call();
75644
75578
  });
75645
75579
  }, []);
75646
75580
  enable.useOnChange((v) => {
@@ -75648,7 +75582,7 @@ function useSectionBox(adapter) {
75648
75582
  visible2.set(v);
75649
75583
  showOffsetPanel.set(false);
75650
75584
  if (v && auto.get()) {
75651
- sectionSelection2.call();
75585
+ sectionSelection.call();
75652
75586
  } else {
75653
75587
  sectionScene.call();
75654
75588
  }
@@ -75659,7 +75593,7 @@ function useSectionBox(adapter) {
75659
75593
  sideOffset.useOnChange((v) => sectionBox2.call(boxRef.current));
75660
75594
  bottomOffset.useOnChange((v) => sectionBox2.call(boxRef.current));
75661
75595
  auto.useOnChange((v) => {
75662
- if (v) sectionSelection2.call();
75596
+ if (v) sectionSelection.call();
75663
75597
  });
75664
75598
  visible2.useOnChange((v) => adapter.setVisible(v));
75665
75599
  const sectionBox2 = useArgActionRef((box) => {
@@ -75669,7 +75603,7 @@ function useSectionBox(adapter) {
75669
75603
  const newBox = addBox(box, offsetsToBox3_(topOffset.get(), sideOffset.get(), bottomOffset.get()));
75670
75604
  adapter.setBox(newBox);
75671
75605
  });
75672
- const sectionSelection2 = useFuncRef(async () => {
75606
+ const sectionSelection = useFuncRef(async () => {
75673
75607
  const id2 = requestId.current;
75674
75608
  const box = await getSelectionBox.call() ?? await getSceneBox.call();
75675
75609
  if (requestId.current !== id2) return;
@@ -75689,7 +75623,7 @@ function useSectionBox(adapter) {
75689
75623
  topOffset,
75690
75624
  sideOffset,
75691
75625
  bottomOffset,
75692
- sectionSelection: sectionSelection2,
75626
+ sectionSelection,
75693
75627
  sectionScene,
75694
75628
  sectionBox: sectionBox2,
75695
75629
  getBox: () => adapter.getBox(),
@@ -75787,7 +75721,8 @@ function useViewerInput(handler, camera2) {
75787
75721
  }
75788
75722
  const Ids = {
75789
75723
  showGhost: "isolationPanel.showGhost",
75790
- ghostOpacity: "isolationPanel.ghostOpacity"
75724
+ ghostOpacity: "isolationPanel.ghostOpacity",
75725
+ transparency: "isolationPanel.transparency"
75791
75726
  };
75792
75727
  const IsolationPanel$1 = forwardRef(
75793
75728
  (props, ref) => {
@@ -75799,8 +75734,20 @@ const IsolationPanel$1 = forwardRef(
75799
75734
  anchorElement: document.getElementById("vim-control-bar"),
75800
75735
  showPanel: props.state.showPanel,
75801
75736
  entries: [
75802
- { type: "bool", id: Ids.showGhost, label: "Show Ghost", state: props.state.showGhost },
75803
- // { type: "bool", id: "showRooms", label: "Show Rooms", state: props.state.showRooms },
75737
+ {
75738
+ type: "bool",
75739
+ id: Ids.showGhost,
75740
+ label: "Show Ghost",
75741
+ state: props.state.showGhost
75742
+ },
75743
+ /*
75744
+ {
75745
+ type: "bool",
75746
+ id: "showRooms",
75747
+ label: "Show Rooms",
75748
+ state: props.state.showRooms
75749
+ },
75750
+ */
75804
75751
  {
75805
75752
  type: "number",
75806
75753
  id: Ids.ghostOpacity,
@@ -75810,6 +75757,13 @@ const IsolationPanel$1 = forwardRef(
75810
75757
  min: 0,
75811
75758
  max: 1,
75812
75759
  step: 0.05
75760
+ },
75761
+ {
75762
+ type: "bool",
75763
+ visible: () => props.transparency,
75764
+ id: Ids.transparency,
75765
+ label: "Transparency",
75766
+ state: props.state.transparency
75813
75767
  }
75814
75768
  ]
75815
75769
  }
@@ -75818,12 +75772,13 @@ const IsolationPanel$1 = forwardRef(
75818
75772
  );
75819
75773
  function useSharedIsolation(adapter) {
75820
75774
  const _adapter = useRef(adapter);
75821
- const visibility = useStateRef(() => adapter.computeVisibility());
75775
+ const visibility = useStateRef(() => adapter.computeVisibility(), true);
75822
75776
  const autoIsolate2 = useStateRef(false);
75823
75777
  const showPanel = useStateRef(false);
75824
75778
  const showRooms = useStateRef(false);
75825
75779
  const showGhost = useStateRef(false);
75826
- const ghostOpacity = useStateRef(() => adapter.getGhostOpacity());
75780
+ const ghostOpacity = useStateRef(() => adapter.getGhostOpacity(), true);
75781
+ const transparency = useStateRef(true);
75827
75782
  const onAutoIsolate = useFuncRef(() => {
75828
75783
  if (adapter.hasSelection()) {
75829
75784
  adapter.isolateSelection();
@@ -75848,6 +75803,7 @@ function useSharedIsolation(adapter) {
75848
75803
  });
75849
75804
  showGhost.useOnChange((v) => adapter.showGhost(v));
75850
75805
  showRooms.useOnChange((v) => adapter.setShowRooms(v));
75806
+ transparency.useOnChange((v) => adapter.enableTransparency(v));
75851
75807
  ghostOpacity.useValidate((next, current) => {
75852
75808
  return next <= 0 ? current : next;
75853
75809
  });
@@ -75861,7 +75817,8 @@ function useSharedIsolation(adapter) {
75861
75817
  showRooms,
75862
75818
  ghostOpacity,
75863
75819
  onAutoIsolate,
75864
- onVisibilityChange
75820
+ onVisibilityChange,
75821
+ transparency
75865
75822
  };
75866
75823
  }
75867
75824
  function useWebglIsolation(viewer) {
@@ -75869,6 +75826,29 @@ function useWebglIsolation(viewer) {
75869
75826
  return useSharedIsolation(adapter);
75870
75827
  }
75871
75828
  function createWebglIsolationAdapter(viewer) {
75829
+ var transparency = true;
75830
+ var ghost2 = false;
75831
+ var rooms = false;
75832
+ function updateMaterials() {
75833
+ viewer.renderer.modelMaterial = !ghost2 && transparency ? void 0 : ghost2 && transparency ? [void 0, viewer.materials.ghost] : !ghost2 && !transparency ? viewer.materials.simple : ghost2 && !transparency ? [viewer.materials.simple, viewer.materials.ghost] : (() => {
75834
+ throw new Error("Unreachable state in isolation materials");
75835
+ })();
75836
+ }
75837
+ function updateVisibility(elements, predicate) {
75838
+ if (elements === "all") {
75839
+ for (let v of viewer.vims) {
75840
+ for (let o of v.getAllElements()) {
75841
+ if (o.type === "Element3D") {
75842
+ o.visible = o.isRoom ? rooms : predicate(o);
75843
+ }
75844
+ }
75845
+ }
75846
+ } else {
75847
+ for (let o of elements) {
75848
+ o.visible = o.isRoom ? rooms : predicate(o);
75849
+ }
75850
+ }
75851
+ }
75872
75852
  return {
75873
75853
  onVisibilityChange: viewer.renderer.onSceneUpdated,
75874
75854
  onSelectionChanged: viewer.selection.onSelectionChanged,
@@ -75877,28 +75857,28 @@ function createWebglIsolationAdapter(viewer) {
75877
75857
  hasVisibleSelection: () => viewer.selection.any() && viewer.selection.getAll().every((o) => o.visible),
75878
75858
  hasHiddenSelection: () => viewer.selection.any() && viewer.selection.getAll().every((o) => !o.visible),
75879
75859
  clearSelection: () => viewer.selection.clear(),
75880
- isolateSelection: () => updateAllVisibility(viewer, (o) => viewer.selection.has(o)),
75860
+ isolateSelection: () => updateVisibility("all", (o) => viewer.selection.has(o)),
75881
75861
  hideSelection: () => {
75882
- viewer.selection.getAll().forEach((o) => o.visible = false);
75862
+ updateVisibility(viewer.selection.getAll(), (o) => false);
75883
75863
  },
75884
75864
  showSelection: () => {
75885
- viewer.selection.getAll().forEach((o) => o.visible = true);
75865
+ updateVisibility(viewer.selection.getAll(), (o) => true);
75886
75866
  },
75887
75867
  hideAll: () => {
75888
- updateAllVisibility(viewer, (o) => false);
75868
+ updateVisibility("all", (o) => false);
75889
75869
  },
75890
75870
  showAll: () => {
75891
- updateAllVisibility(viewer, (o) => true);
75871
+ updateVisibility("all", (o) => true);
75892
75872
  },
75893
75873
  isolate: (instances) => {
75894
75874
  const set3 = new Set(instances);
75895
- updateAllVisibility(viewer, (o) => o.instances.some((i) => set3.has(i)));
75875
+ updateVisibility("all", (o) => o.instances.some((i) => set3.has(i)));
75896
75876
  },
75897
75877
  show: (instances) => {
75898
75878
  for (let i of instances) {
75899
75879
  for (let v of viewer.vims) {
75900
75880
  const o = v.getElement(i);
75901
- o.visible = true;
75881
+ o.visible = o.isRoom ? rooms : true;
75902
75882
  }
75903
75883
  }
75904
75884
  },
@@ -75906,29 +75886,30 @@ function createWebglIsolationAdapter(viewer) {
75906
75886
  for (let i of instances) {
75907
75887
  for (let v of viewer.vims) {
75908
75888
  const o = v.getElement(i);
75909
- o.visible = false;
75889
+ o.visible = o.isRoom ? rooms : false;
75910
75890
  }
75911
75891
  }
75912
75892
  },
75893
+ enableTransparency: (enable) => {
75894
+ if (transparency !== enable) {
75895
+ transparency = enable;
75896
+ updateMaterials();
75897
+ }
75898
+ },
75913
75899
  showGhost: (show) => {
75914
- viewer.renderer.modelMaterial = show ? [viewer.materials.simple, viewer.materials.ghost] : void 0;
75900
+ ghost2 = show;
75901
+ updateMaterials();
75915
75902
  },
75916
75903
  getGhostOpacity: () => viewer.materials.ghostOpacity,
75917
75904
  setGhostOpacity: (opacity) => viewer.materials.ghostOpacity = opacity,
75918
- getShowRooms: () => true,
75905
+ getShowRooms: () => rooms,
75919
75906
  setShowRooms: (show) => {
75920
- console.log("setShowRooms not implemented");
75921
- }
75922
- };
75923
- }
75924
- function updateAllVisibility(viewer, predicate) {
75925
- for (let v of viewer.vims) {
75926
- for (let o of v.getAllElements()) {
75927
- if (o.type === "Element3D") {
75928
- o.visible = predicate(o);
75907
+ if (rooms !== show) {
75908
+ rooms = show;
75909
+ updateVisibility("all", (o) => o.visible);
75929
75910
  }
75930
75911
  }
75931
- }
75912
+ };
75932
75913
  }
75933
75914
  function getVisibilityState$1(viewer) {
75934
75915
  let all = true;
@@ -75954,6 +75935,572 @@ function getVisibilityState$1(viewer) {
75954
75935
  if (onlySelectionFlag) return "onlySelection";
75955
75936
  return "some";
75956
75937
  }
75938
+ function getDefaultSettings() {
75939
+ return {
75940
+ capacity: {
75941
+ canFollowUrl: true,
75942
+ canGoFullScreen: true,
75943
+ canDownload: true,
75944
+ canReadLocalStorage: true
75945
+ },
75946
+ ui: {
75947
+ panelLogo: true,
75948
+ panelPerformance: false,
75949
+ panelBimTree: true,
75950
+ panelBimInfo: true,
75951
+ panelAxes: true,
75952
+ panelControlBar: true,
75953
+ axesOrthographic: true,
75954
+ axesHome: true,
75955
+ // Control bar - cursors
75956
+ cursorOrbit: true,
75957
+ cursorLookAround: true,
75958
+ cursorPan: true,
75959
+ cursorZoom: true,
75960
+ // Control bar - camera
75961
+ cameraAuto: true,
75962
+ cameraFrameScene: true,
75963
+ cameraFrameSelection: true,
75964
+ // Control bar - tools
75965
+ sectioningEnable: true,
75966
+ sectioningFitToSelection: true,
75967
+ sectioningReset: true,
75968
+ sectioningShow: true,
75969
+ sectioningAuto: true,
75970
+ sectioningSettings: true,
75971
+ measureEnable: true,
75972
+ // Control bar - Visibility
75973
+ visibilityClearSelection: true,
75974
+ visibilityShowAll: true,
75975
+ visibilityToggle: true,
75976
+ visibilityIsolate: true,
75977
+ visibilityAutoIsolate: true,
75978
+ visibilitySettings: true,
75979
+ // Control bar - settings
75980
+ miscProjectInspector: true,
75981
+ miscSettings: true,
75982
+ miscHelp: true,
75983
+ miscMaximise: true
75984
+ }
75985
+ };
75986
+ }
75987
+ function renderSettingsInputBox(settings2, item) {
75988
+ const ref = React__default.useRef(null);
75989
+ useEffect(() => {
75990
+ var _a3;
75991
+ ref.current.value = (_a3 = item.getter(settings2.value)) == null ? void 0 : _a3.toString();
75992
+ }, []);
75993
+ const update = (event) => {
75994
+ const str = event.target.value;
75995
+ const n = Number.parseFloat(str);
75996
+ if (Number.isNaN(n)) {
75997
+ event.target.value = item.getter(settings2.value).toString();
75998
+ } else {
75999
+ const value = item.transform(n);
76000
+ event.target.value = value.toString();
76001
+ settings2.update((s) => item.setter(s, value));
76002
+ }
76003
+ };
76004
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vc-box-input vc-my-1 ", children: [
76005
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: "textbox", className: "vc-w-3 vc-h-2", children: [
76006
+ item.label,
76007
+ ":"
76008
+ ] }),
76009
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76010
+ "input",
76011
+ {
76012
+ ref,
76013
+ type: "text",
76014
+ className: "vim-settings-textbox vc-border vc-rounded-sm vc-border-gray vc-w-14 vc-ml-1 vc-p-1",
76015
+ onBlur: update
76016
+ }
76017
+ ),
76018
+ /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "textbox", className: "vc-w-3 vc-h-2 vc-text-gray vc-ml-1", children: item.info })
76019
+ ] });
76020
+ }
76021
+ function renderSettingsToggle(settings2, item) {
76022
+ const value = item.getter(settings2.value);
76023
+ if (value === "AlwaysTrue" || value === "AlwaysFalse") return null;
76024
+ const handleChange = () => {
76025
+ const current = item.getter(settings2.value);
76026
+ settings2.update((s) => item.setter(s, !current));
76027
+ };
76028
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "vc-m-1 vc-block vc-select-none vc-items-center vc-py-1 vc-text-gray-warm", children: [
76029
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76030
+ "input",
76031
+ {
76032
+ type: "checkbox",
76033
+ checked: value,
76034
+ onChange: handleChange,
76035
+ className: "vim-settings-checkbox vc-checked:bg-primary-royal vc-mr-2 vc-rounded vc-border vc-border-gray-medium"
76036
+ }
76037
+ ),
76038
+ " ",
76039
+ item.label
76040
+ ] });
76041
+ }
76042
+ function renderSettingsSubtitle(item) {
76043
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "vc-subtitle", children: item.title });
76044
+ }
76045
+ function SettingsPanel(props) {
76046
+ if (!props.visible) return null;
76047
+ function renderItem(settings2, item) {
76048
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: (() => {
76049
+ switch (item.type) {
76050
+ case "subtitle":
76051
+ return renderSettingsSubtitle(item);
76052
+ case "toggle":
76053
+ return renderSettingsToggle(settings2, item);
76054
+ case "box":
76055
+ return renderSettingsInputBox(settings2, item);
76056
+ case "element":
76057
+ return item.element;
76058
+ default:
76059
+ return null;
76060
+ }
76061
+ })() }, item.key);
76062
+ }
76063
+ const customizer = props.settings.customizer.get();
76064
+ const content2 = customizer ? customizer(props.content) : props.content;
76065
+ const sections = buildSections(content2);
76066
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vc-absolute vc-inset-0", children: [
76067
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "vc-title vc-mb-2", children: "Settings" }),
76068
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "\r\n vim-settings\r\n vc-absolute vc-top-8 vc-left-0 vc-right-0 vc-bottom-0\r\n vc-overflow-y-auto\r\n vc-pr-2\r\n vc-space-y-2\r\n vc-box-border\r\n ", children: sections.map((section) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
76069
+ "details",
76070
+ {
76071
+ open: true,
76072
+ className: "\r\n vim-settings-section\r\n vc-bg-white\r\n vc-rounded-md\r\n vc-shadow-sm\r\n vc-border\r\n vc-border-slate-200\r\n vc-p-2\r\n vc-space-y-2\r\n ",
76073
+ children: [
76074
+ /* @__PURE__ */ jsxRuntimeExports.jsx("summary", { className: "vim-settings-section-title vc-font-medium vc-text-sm vc-cursor-pointer", children: section.title }),
76075
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "vim-settings-section-content vc-mt-2 vc-space-y-2", children: section.items.map(
76076
+ (item) => renderItem(props.settings, item)
76077
+ ) })
76078
+ ]
76079
+ },
76080
+ section.key
76081
+ )) })
76082
+ ] });
76083
+ }
76084
+ function buildSections(items) {
76085
+ const sections = [];
76086
+ let current = null;
76087
+ for (const item of items) {
76088
+ if (item.type === "subtitle") {
76089
+ current = {
76090
+ key: item.key,
76091
+ title: item.title,
76092
+ items: []
76093
+ };
76094
+ sections.push(current);
76095
+ } else {
76096
+ if (!current) {
76097
+ current = {
76098
+ key: "default",
76099
+ title: "",
76100
+ items: []
76101
+ };
76102
+ sections.push(current);
76103
+ }
76104
+ current.items.push(item);
76105
+ }
76106
+ }
76107
+ return sections;
76108
+ }
76109
+ class SettingsPanelKeys {
76110
+ }
76111
+ // === Inputs ===
76112
+ __publicField(SettingsPanelKeys, "InputsSubtitle", "inputs");
76113
+ __publicField(SettingsPanelKeys, "InputsScrollSpeedBox", "scrollSpeed");
76114
+ // === Panels ===
76115
+ __publicField(SettingsPanelKeys, "PanelsSubtitle", "panels");
76116
+ __publicField(SettingsPanelKeys, "PanelsShowLogoToggle", "logo");
76117
+ __publicField(SettingsPanelKeys, "PanelsShowBimTreeToggle", "bimTree");
76118
+ __publicField(SettingsPanelKeys, "PanelsShowBimInfoToggle", "bimInfo");
76119
+ __publicField(SettingsPanelKeys, "PanelsShowAxesPanelToggle", "axesPanel");
76120
+ __publicField(SettingsPanelKeys, "PanelsShowPerformancePanelToggle", "performance");
76121
+ // === Axes ===
76122
+ __publicField(SettingsPanelKeys, "AxesSubtitle", "axes");
76123
+ __publicField(SettingsPanelKeys, "AxesShowOrthographicButtonToggle", "orthographic");
76124
+ __publicField(SettingsPanelKeys, "AxesShowResetCameraButtonToggle", "resetCamera");
76125
+ // === Control Bar ===
76126
+ __publicField(SettingsPanelKeys, "ControlBarSubtitle", "controlBar");
76127
+ __publicField(SettingsPanelKeys, "ControlBarShowControlBarToggle", "controlBarVisible");
76128
+ // --- Control Bar - Cursors ---
76129
+ __publicField(SettingsPanelKeys, "ControlBarCursorsSubtitle", "controlBarCursors");
76130
+ __publicField(SettingsPanelKeys, "ControlBarCursorsShowOrbitButtonToggle", "orbit");
76131
+ __publicField(SettingsPanelKeys, "ControlBarCursorsShowLookAroundButtonToggle", "lookAround");
76132
+ __publicField(SettingsPanelKeys, "ControlBarCursorsShowPanButtonToggle", "pan");
76133
+ __publicField(SettingsPanelKeys, "ControlBarCursorsShowZoomButtonToggle", "zoom");
76134
+ __publicField(SettingsPanelKeys, "ControlBarCursorsShowZoomWindowButtonToggle", "zoomWindow");
76135
+ // --- Control Bar - Tools ---
76136
+ __publicField(SettingsPanelKeys, "ControlBarToolsSubtitle", "controlBarTools");
76137
+ __publicField(SettingsPanelKeys, "ControlBarToolsShowMeasuringModeButtonToggle", "measuringMode");
76138
+ // --- Control Bar Camera ---
76139
+ __publicField(SettingsPanelKeys, "ControlBarCameraSubtitle", "settingsPanel.controlBar.Camera");
76140
+ __publicField(SettingsPanelKeys, "ControlBarAutoCamera", "settingsPanel.controlBar.autoCamera");
76141
+ __publicField(SettingsPanelKeys, "ControlBarFrameSelection", "settingsPanel.controlBar.frameSelection");
76142
+ __publicField(SettingsPanelKeys, "ControlBarFrameAll", "settingsPanel.controlBar.frameAll");
76143
+ // --- Control Bar - Sectioning ---
76144
+ __publicField(SettingsPanelKeys, "ControlBarSectioningSubtitle", "settingsPanel.controlBar.sectioning");
76145
+ __publicField(SettingsPanelKeys, "ControlBarSectioningEnable", "settingsPanel.controlBar.enableSectioning");
76146
+ __publicField(SettingsPanelKeys, "ControlBarSectioningFitToSelection", "settingsPanel.controlBar.fitToSelection");
76147
+ __publicField(SettingsPanelKeys, "ControlBarSectioningReset", "settingsPanel.controlBar.reset");
76148
+ __publicField(SettingsPanelKeys, "ControlBarSectioningShow", "settingsPanel.controlBar.show");
76149
+ __publicField(SettingsPanelKeys, "ControlBarSectioningAuto", "settingsPanel.controlBar.auto");
76150
+ __publicField(SettingsPanelKeys, "ControlBarSectioningSettings", "settingsPanel.controlBar.settings");
76151
+ // --- Control Bar - Visibility ---
76152
+ __publicField(SettingsPanelKeys, "ControlBarVisibilitySubtitle", "controlBar.visibility.subtitle");
76153
+ __publicField(SettingsPanelKeys, "ControlBarVisibilityClearSelection", "controlBar.visibility.clearSelection");
76154
+ __publicField(SettingsPanelKeys, "ControlBarVisibilityShowAll", "controlBar.visibility.showAll");
76155
+ __publicField(SettingsPanelKeys, "ControlBarVisibilityToggle", "controlBar.visibility.toggle");
76156
+ __publicField(SettingsPanelKeys, "ControlBarVisibilityIsolate", "controlBar.visibility.isolate");
76157
+ __publicField(SettingsPanelKeys, "ControlBarVisibilityAutoIsolate", "controlBar.visibility.autoIsolate");
76158
+ __publicField(SettingsPanelKeys, "ControlBarVisibilitySettings", "controlBar.visibility.settings");
76159
+ // --- Control Bar - Settings ---
76160
+ __publicField(SettingsPanelKeys, "ControlBarMiscSubtitle", "controlBarSettings");
76161
+ __publicField(SettingsPanelKeys, "ControlBarMiscShowProjectInspectorButtonToggle", "projectInspector");
76162
+ __publicField(SettingsPanelKeys, "ControlBarMiscShowSettingsButtonToggle", "settingsButton");
76163
+ __publicField(SettingsPanelKeys, "ControlBarMiscShowHelpButtonToggle", "help");
76164
+ __publicField(SettingsPanelKeys, "ControlBarMiscShowMaximiseButtonToggle", "maximise");
76165
+ function getControlBarCursorSettings() {
76166
+ return [
76167
+ {
76168
+ type: "subtitle",
76169
+ key: SettingsPanelKeys.ControlBarCursorsSubtitle,
76170
+ title: "Control Bar - Cursors"
76171
+ },
76172
+ {
76173
+ type: "toggle",
76174
+ key: SettingsPanelKeys.ControlBarCursorsShowOrbitButtonToggle,
76175
+ label: "Orbit",
76176
+ getter: (s) => s.ui.cursorOrbit,
76177
+ setter: (s, v) => s.ui.cursorOrbit = v
76178
+ },
76179
+ {
76180
+ type: "toggle",
76181
+ key: SettingsPanelKeys.ControlBarCursorsShowLookAroundButtonToggle,
76182
+ label: "Look Around",
76183
+ getter: (s) => s.ui.cursorLookAround,
76184
+ setter: (s, v) => s.ui.cursorLookAround = v
76185
+ },
76186
+ {
76187
+ type: "toggle",
76188
+ key: SettingsPanelKeys.ControlBarCursorsShowPanButtonToggle,
76189
+ label: "Pan",
76190
+ getter: (s) => s.ui.cursorPan,
76191
+ setter: (s, v) => s.ui.cursorPan = v
76192
+ },
76193
+ {
76194
+ type: "toggle",
76195
+ key: SettingsPanelKeys.ControlBarCursorsShowZoomButtonToggle,
76196
+ label: "Zoom",
76197
+ getter: (s) => s.ui.cursorZoom,
76198
+ setter: (s, v) => s.ui.cursorZoom = v
76199
+ }
76200
+ ];
76201
+ }
76202
+ function getControlBarCameraSettings() {
76203
+ return [
76204
+ {
76205
+ type: "subtitle",
76206
+ key: SettingsPanelKeys.ControlBarCameraSubtitle,
76207
+ title: "Control Bar - Camera"
76208
+ },
76209
+ {
76210
+ type: "toggle",
76211
+ key: SettingsPanelKeys.ControlBarAutoCamera,
76212
+ label: "Auto Camera",
76213
+ getter: (s) => s.ui.cameraAuto,
76214
+ setter: (s, v) => s.ui.cameraAuto = v
76215
+ },
76216
+ {
76217
+ type: "toggle",
76218
+ key: SettingsPanelKeys.ControlBarFrameSelection,
76219
+ label: "Frame Selection",
76220
+ getter: (s) => s.ui.cameraFrameSelection,
76221
+ setter: (s, v) => s.ui.cameraFrameSelection = v
76222
+ },
76223
+ {
76224
+ type: "toggle",
76225
+ key: SettingsPanelKeys.ControlBarFrameAll,
76226
+ label: "Frame All",
76227
+ getter: (s) => s.ui.cameraFrameScene,
76228
+ setter: (s, v) => s.ui.cameraFrameScene = v
76229
+ }
76230
+ ];
76231
+ }
76232
+ function getControlBarSectionBoxSettings() {
76233
+ return [
76234
+ {
76235
+ type: "subtitle",
76236
+ key: SettingsPanelKeys.ControlBarSectioningSubtitle,
76237
+ title: "Control Bar - Sectioning"
76238
+ },
76239
+ {
76240
+ type: "toggle",
76241
+ key: SettingsPanelKeys.ControlBarSectioningEnable,
76242
+ label: "Enable Sectioning",
76243
+ getter: (s) => s.ui.sectioningEnable,
76244
+ setter: (s, v) => s.ui.sectioningEnable = v
76245
+ },
76246
+ {
76247
+ type: "toggle",
76248
+ key: SettingsPanelKeys.ControlBarSectioningFitToSelection,
76249
+ label: "Fit To Selection",
76250
+ getter: (s) => s.ui.sectioningFitToSelection,
76251
+ setter: (s, v) => s.ui.sectioningFitToSelection = v
76252
+ },
76253
+ {
76254
+ type: "toggle",
76255
+ key: SettingsPanelKeys.ControlBarSectioningReset,
76256
+ label: "Reset",
76257
+ getter: (s) => s.ui.sectioningReset,
76258
+ setter: (s, v) => s.ui.sectioningReset = v
76259
+ },
76260
+ {
76261
+ type: "toggle",
76262
+ key: SettingsPanelKeys.ControlBarSectioningShow,
76263
+ label: "Show",
76264
+ getter: (s) => s.ui.sectioningShow,
76265
+ setter: (s, v) => s.ui.sectioningShow = v
76266
+ },
76267
+ {
76268
+ type: "toggle",
76269
+ key: SettingsPanelKeys.ControlBarSectioningAuto,
76270
+ label: "Auto",
76271
+ getter: (s) => s.ui.sectioningAuto,
76272
+ setter: (s, v) => s.ui.sectioningAuto = v
76273
+ },
76274
+ {
76275
+ type: "toggle",
76276
+ key: SettingsPanelKeys.ControlBarSectioningSettings,
76277
+ label: "Settings",
76278
+ getter: (s) => s.ui.sectioningSettings,
76279
+ setter: (s, v) => s.ui.sectioningSettings = v
76280
+ }
76281
+ ];
76282
+ }
76283
+ function getControlBarVisibilitySettings() {
76284
+ return [
76285
+ {
76286
+ type: "subtitle",
76287
+ key: SettingsPanelKeys.ControlBarVisibilitySubtitle,
76288
+ title: "Control Bar - Visibility"
76289
+ },
76290
+ {
76291
+ type: "toggle",
76292
+ key: SettingsPanelKeys.ControlBarVisibilityClearSelection,
76293
+ label: "Clear Selection",
76294
+ getter: (s) => s.ui.visibilityClearSelection,
76295
+ setter: (s, v) => s.ui.visibilityClearSelection = v
76296
+ },
76297
+ {
76298
+ type: "toggle",
76299
+ key: SettingsPanelKeys.ControlBarVisibilityShowAll,
76300
+ label: "Show All",
76301
+ getter: (s) => s.ui.visibilityShowAll,
76302
+ setter: (s, v) => s.ui.visibilityShowAll = v
76303
+ },
76304
+ {
76305
+ type: "toggle",
76306
+ key: SettingsPanelKeys.ControlBarVisibilityToggle,
76307
+ label: "Toggle",
76308
+ getter: (s) => s.ui.visibilityToggle,
76309
+ setter: (s, v) => s.ui.visibilityToggle = v
76310
+ },
76311
+ {
76312
+ type: "toggle",
76313
+ key: SettingsPanelKeys.ControlBarVisibilityIsolate,
76314
+ label: "Isolate",
76315
+ getter: (s) => s.ui.visibilityIsolate,
76316
+ setter: (s, v) => s.ui.visibilityIsolate = v
76317
+ },
76318
+ {
76319
+ type: "toggle",
76320
+ key: SettingsPanelKeys.ControlBarVisibilityAutoIsolate,
76321
+ label: "Auto Isolate",
76322
+ getter: (s) => s.ui.visibilityAutoIsolate,
76323
+ setter: (s, v) => s.ui.visibilityAutoIsolate = v
76324
+ },
76325
+ {
76326
+ type: "toggle",
76327
+ key: SettingsPanelKeys.ControlBarVisibilitySettings,
76328
+ label: "Settings",
76329
+ getter: (s) => s.ui.visibilitySettings,
76330
+ setter: (s, v) => s.ui.visibilitySettings = v
76331
+ }
76332
+ ];
76333
+ }
76334
+ function getControlBarVariousSettings() {
76335
+ return [
76336
+ {
76337
+ type: "subtitle",
76338
+ key: SettingsPanelKeys.ControlBarMiscSubtitle,
76339
+ title: "Control Bar - Settings"
76340
+ },
76341
+ {
76342
+ type: "toggle",
76343
+ key: SettingsPanelKeys.ControlBarMiscShowProjectInspectorButtonToggle,
76344
+ label: "Project Inspector",
76345
+ getter: (s) => s.ui.miscProjectInspector,
76346
+ setter: (s, v) => s.ui.miscProjectInspector = v
76347
+ },
76348
+ {
76349
+ type: "toggle",
76350
+ key: SettingsPanelKeys.ControlBarMiscShowSettingsButtonToggle,
76351
+ label: "Settings",
76352
+ getter: (s) => s.ui.miscSettings,
76353
+ setter: (s, v) => s.ui.miscSettings = v
76354
+ },
76355
+ {
76356
+ type: "toggle",
76357
+ key: SettingsPanelKeys.ControlBarMiscShowHelpButtonToggle,
76358
+ label: "Help",
76359
+ getter: (s) => s.ui.miscHelp,
76360
+ setter: (s, v) => s.ui.miscHelp = v
76361
+ },
76362
+ {
76363
+ type: "toggle",
76364
+ key: SettingsPanelKeys.ControlBarMiscShowMaximiseButtonToggle,
76365
+ label: "Maximise",
76366
+ getter: (s) => s.ui.miscMaximise,
76367
+ setter: (s, v) => s.ui.miscMaximise = v
76368
+ }
76369
+ ];
76370
+ }
76371
+ function getPanelsVisibilitySettings() {
76372
+ return [
76373
+ {
76374
+ type: "subtitle",
76375
+ key: SettingsPanelKeys.PanelsSubtitle,
76376
+ title: "Panels Visibility"
76377
+ },
76378
+ {
76379
+ type: "toggle",
76380
+ key: SettingsPanelKeys.PanelsShowLogoToggle,
76381
+ label: "Logo",
76382
+ getter: (s) => s.ui.panelLogo,
76383
+ setter: (s, v) => s.ui.panelLogo = v
76384
+ },
76385
+ {
76386
+ type: "toggle",
76387
+ key: SettingsPanelKeys.PanelsShowBimTreeToggle,
76388
+ label: "Bim Tree",
76389
+ getter: (s) => s.ui.panelBimTree,
76390
+ setter: (s, v) => s.ui.panelBimTree = v
76391
+ },
76392
+ {
76393
+ type: "toggle",
76394
+ key: SettingsPanelKeys.PanelsShowBimInfoToggle,
76395
+ label: "Bim Info",
76396
+ getter: (s) => s.ui.panelBimInfo,
76397
+ setter: (s, v) => s.ui.panelBimInfo = v
76398
+ },
76399
+ {
76400
+ type: "toggle",
76401
+ key: SettingsPanelKeys.PanelsShowAxesPanelToggle,
76402
+ label: "Axes",
76403
+ getter: (s) => s.ui.panelAxes,
76404
+ setter: (s, v) => s.ui.panelAxes = v
76405
+ },
76406
+ {
76407
+ type: "toggle",
76408
+ key: SettingsPanelKeys.PanelsShowPerformancePanelToggle,
76409
+ label: "Performance",
76410
+ getter: (s) => s.ui.panelPerformance,
76411
+ setter: (s, v) => s.ui.panelPerformance = v
76412
+ },
76413
+ {
76414
+ type: "toggle",
76415
+ key: SettingsPanelKeys.ControlBarShowControlBarToggle,
76416
+ label: "Control Bar",
76417
+ getter: (s) => s.ui.panelControlBar,
76418
+ setter: (s, v) => s.ui.panelControlBar = v
76419
+ }
76420
+ ];
76421
+ }
76422
+ function getInputsSettings(viewer) {
76423
+ return [
76424
+ {
76425
+ type: "subtitle",
76426
+ key: SettingsPanelKeys.InputsSubtitle,
76427
+ title: "Inputs"
76428
+ },
76429
+ {
76430
+ type: "box",
76431
+ key: SettingsPanelKeys.InputsScrollSpeedBox,
76432
+ label: "Scroll Speed",
76433
+ info: "[0.1,10]",
76434
+ transform: (n) => MathUtils.clamp(n, 0.1, 10),
76435
+ getter: (_s) => viewer.inputs.scrollSpeed,
76436
+ setter: (_s, v) => {
76437
+ viewer.inputs.scrollSpeed = v;
76438
+ }
76439
+ }
76440
+ ];
76441
+ }
76442
+ function getAxesPanelSettings() {
76443
+ return [
76444
+ {
76445
+ type: "subtitle",
76446
+ key: SettingsPanelKeys.AxesSubtitle,
76447
+ title: "Axes Panel"
76448
+ },
76449
+ {
76450
+ type: "toggle",
76451
+ key: SettingsPanelKeys.AxesShowOrthographicButtonToggle,
76452
+ label: "Orthographic Camera",
76453
+ getter: (s) => s.ui.axesOrthographic,
76454
+ setter: (s, v) => s.ui.axesOrthographic = v
76455
+ },
76456
+ {
76457
+ type: "toggle",
76458
+ key: SettingsPanelKeys.AxesShowResetCameraButtonToggle,
76459
+ label: "Reset Camera",
76460
+ getter: (s) => s.ui.axesHome,
76461
+ setter: (s, v) => s.ui.axesHome = v
76462
+ }
76463
+ ];
76464
+ }
76465
+ function getControlBarMeasureSettings() {
76466
+ return [
76467
+ {
76468
+ type: "subtitle",
76469
+ key: SettingsPanelKeys.ControlBarToolsSubtitle,
76470
+ title: "Control Bar - Measurement"
76471
+ },
76472
+ {
76473
+ type: "toggle",
76474
+ key: SettingsPanelKeys.ControlBarToolsShowMeasuringModeButtonToggle,
76475
+ label: "Enable",
76476
+ getter: (s) => s.ui.measureEnable,
76477
+ setter: (s, v) => s.ui.measureEnable = v
76478
+ }
76479
+ ];
76480
+ }
76481
+ function getWebglSettingsContent(viewer) {
76482
+ return [
76483
+ ...getInputsSettings(viewer),
76484
+ ...getPanelsVisibilitySettings(),
76485
+ ...getAxesPanelSettings(),
76486
+ ...getControlBarCursorSettings(),
76487
+ ...getControlBarCameraSettings(),
76488
+ ...getControlBarVisibilitySettings(),
76489
+ ...getControlBarMeasureSettings(),
76490
+ ...getControlBarSectionBoxSettings(),
76491
+ ...getControlBarVariousSettings()
76492
+ ];
76493
+ }
76494
+ function applyWebglSettings(settings2) {
76495
+ const performance2 = document.getElementsByClassName("vim-performance-div")[0];
76496
+ if (performance2) {
76497
+ if (isTrue(settings2.ui.panelPerformance)) {
76498
+ performance2.classList.remove("vc-hidden");
76499
+ } else {
76500
+ performance2.classList.add("vc-hidden");
76501
+ }
76502
+ }
76503
+ }
75957
76504
  function createViewer$1(container, settings2 = {}, coreSettings = {}) {
75958
76505
  const controllablePromise = new ControllablePromise();
75959
76506
  const cmpContainer = container instanceof HTMLElement ? createContainer(container) : container ?? createContainer();
@@ -75984,7 +76531,7 @@ function createViewer$1(container, settings2 = {}, coreSettings = {}) {
75984
76531
  return controllablePromise.promise;
75985
76532
  }
75986
76533
  function Viewer$1(props) {
75987
- const settings2 = useSettings(props.viewer, props.settings ?? {});
76534
+ const settings2 = useSettings(props.settings ?? {}, getDefaultSettings(), (s) => applyWebglSettings(s));
75988
76535
  const modal = useRef(null);
75989
76536
  const sectionBoxRef = useWebglSectionBox(props.viewer);
75990
76537
  const isolationPanelHandle = useRef(null);
@@ -75994,7 +76541,7 @@ function Viewer$1(props) {
75994
76541
  const loader = useRef(new ComponentLoader(props.viewer, modal, settings2.value));
75995
76542
  useViewerInput(props.viewer.inputs, camera2);
75996
76543
  const side = useSideState(
75997
- isTrue(settings2.value.ui.bimTreePanel) || isTrue(settings2.value.ui.bimInfoPanel),
76544
+ isTrue(settings2.value.ui.panelBimTree) || isTrue(settings2.value.ui.panelBimInfo),
75998
76545
  Math.min(props.container.root.clientWidth * 0.25, 340)
75999
76546
  );
76000
76547
  const [contextMenu2, setcontextMenu] = useState();
@@ -76010,6 +76557,16 @@ function Viewer$1(props) {
76010
76557
  side.setHasBim(((_a3 = viewerState.vim.get()) == null ? void 0 : _a3.bim) !== void 0);
76011
76558
  });
76012
76559
  useEffect(() => {
76560
+ sectionBoxRef.showOffsetPanel.onChange.subscribe((show) => {
76561
+ if (show) {
76562
+ isolationRef.showPanel.set(false);
76563
+ }
76564
+ });
76565
+ isolationRef.showPanel.onChange.subscribe((show) => {
76566
+ if (show) {
76567
+ sectionBoxRef.showOffsetPanel.set(false);
76568
+ }
76569
+ });
76013
76570
  if (performanceRef.current) {
76014
76571
  addPerformanceCounter(performanceRef.current);
76015
76572
  }
@@ -76023,7 +76580,11 @@ function Viewer$1(props) {
76023
76580
  loader: loader.current,
76024
76581
  isolation: isolationRef,
76025
76582
  camera: camera2,
76026
- settings: settings2,
76583
+ settings: {
76584
+ update: settings2.update,
76585
+ register: settings2.register,
76586
+ customize: (c) => settings2.customizer.set(c)
76587
+ },
76027
76588
  get isolationPanel() {
76028
76589
  return isolationPanelHandle.current;
76029
76590
  },
@@ -76069,7 +76630,7 @@ function Viewer$1(props) {
76069
76630
  SettingsPanel,
76070
76631
  {
76071
76632
  visible: side.getContent() === "settings",
76072
- viewer: props.viewer,
76633
+ content: getWebglSettingsContent(props.viewer),
76073
76634
  settings: settings2
76074
76635
  }
76075
76636
  )
@@ -76089,16 +76650,16 @@ function Viewer$1(props) {
76089
76650
  /* @__PURE__ */ jsxRuntimeExports.jsx(RestOfScreen, { side, content: () => {
76090
76651
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
76091
76652
  /* @__PURE__ */ jsxRuntimeExports.jsx(Overlay, { canvas: props.viewer.viewport.canvas }),
76092
- whenTrue(settings2.value.ui.logo, /* @__PURE__ */ jsxRuntimeExports.jsx(LogoMemo, {})),
76653
+ whenTrue(settings2.value.ui.panelLogo, /* @__PURE__ */ jsxRuntimeExports.jsx(LogoMemo, {})),
76093
76654
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76094
76655
  ControlBar,
76095
76656
  {
76096
76657
  content: controlBar,
76097
- show: isTrue(settings2.value.ui.controlBar)
76658
+ show: isTrue(settings2.value.ui.panelControlBar)
76098
76659
  }
76099
76660
  ),
76100
76661
  /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel$1, { ref: sectionBoxPanelHandle, state: sectionBoxRef }),
76101
- /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel$1, { ref: isolationPanelHandle, state: isolationRef }),
76662
+ /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel$1, { ref: isolationPanelHandle, state: isolationRef, transparency: true }),
76102
76663
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76103
76664
  AxesPanelMemo,
76104
76665
  {
@@ -76137,7 +76698,8 @@ function Viewer$1(props) {
76137
76698
  const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
76138
76699
  __proto__: null,
76139
76700
  Viewer: Viewer$1,
76140
- createViewer: createViewer$1
76701
+ createViewer: createViewer$1,
76702
+ getDefaultSettings
76141
76703
  }, Symbol.toStringTag, { value: "Module" }));
76142
76704
  function getErrorMessage(state) {
76143
76705
  if (state.status !== "error") return void 0;
@@ -76203,11 +76765,13 @@ function useUltraSectionBox(viewer) {
76203
76765
  };
76204
76766
  return useSectionBox(ultraAdapter);
76205
76767
  }
76206
- function useUltraControlBar(viewer, section, isolation, camera2, customization) {
76207
- const sectionSectionBox2 = controlBarSectionBox(section, viewer.selection.any());
76208
- const selection = controlBarSelection(isolation);
76209
- const sectionCamera2 = controlBarCamera(camera2);
76210
- let bar = [selection, sectionCamera2, sectionSectionBox2];
76768
+ function useUltraControlBar(viewer, section, isolation, camera2, settings2, side, modal, customization) {
76769
+ let bar = [
76770
+ controlBarCamera(camera2, settings2.ui),
76771
+ controlBarVisibility(isolation, settings2.ui),
76772
+ controlBarSectionBox(section, viewer.selection.any(), settings2.ui),
76773
+ controlBarMiscUltra(modal, side, settings2)
76774
+ ];
76211
76775
  bar = (customization == null ? void 0 : customization(bar)) ?? bar;
76212
76776
  return bar;
76213
76777
  }
@@ -76311,6 +76875,9 @@ function createAdapter(viewer) {
76311
76875
  }
76312
76876
  }
76313
76877
  },
76878
+ enableTransparency: (enable) => {
76879
+ console.log("enableTransparency not implemented");
76880
+ },
76314
76881
  getGhostOpacity: () => viewer.renderer.ghostOpacity,
76315
76882
  setGhostOpacity: (opacity) => {
76316
76883
  viewer.renderer.ghostOpacity = opacity;
@@ -76352,7 +76919,73 @@ function onlySelection(viewer, vim) {
76352
76919
  function allButSelection(viewer, vim) {
76353
76920
  return false;
76354
76921
  }
76355
- function createViewer(container) {
76922
+ function getDefaultUltraSettings() {
76923
+ return {
76924
+ ui: {
76925
+ // panels
76926
+ panelLogo: true,
76927
+ panelControlBar: true,
76928
+ // Control bar - cursors
76929
+ cursorOrbit: true,
76930
+ cursorLookAround: true,
76931
+ cursorPan: true,
76932
+ cursorZoom: true,
76933
+ // Control bar - camera
76934
+ cameraAuto: true,
76935
+ cameraFrameScene: true,
76936
+ cameraFrameSelection: true,
76937
+ // Control bar - tools
76938
+ sectioningEnable: true,
76939
+ sectioningFitToSelection: true,
76940
+ sectioningReset: true,
76941
+ sectioningShow: true,
76942
+ sectioningAuto: true,
76943
+ sectioningSettings: true,
76944
+ // Control bar - Visibility
76945
+ visibilityClearSelection: true,
76946
+ visibilityShowAll: true,
76947
+ visibilityToggle: true,
76948
+ visibilityIsolate: true,
76949
+ visibilityAutoIsolate: true,
76950
+ visibilitySettings: true,
76951
+ // Control bar - misc
76952
+ miscSettings: true,
76953
+ miscHelp: true
76954
+ }
76955
+ };
76956
+ }
76957
+ function getControlBarUltraSettings() {
76958
+ return [
76959
+ {
76960
+ type: "subtitle",
76961
+ key: SettingsPanelKeys.ControlBarMiscSubtitle,
76962
+ title: "Control Bar - Settings"
76963
+ },
76964
+ {
76965
+ type: "toggle",
76966
+ key: SettingsPanelKeys.ControlBarMiscShowSettingsButtonToggle,
76967
+ label: "Settings",
76968
+ getter: (s) => s.ui.miscSettings,
76969
+ setter: (s, v) => s.ui.miscSettings = v
76970
+ },
76971
+ {
76972
+ type: "toggle",
76973
+ key: SettingsPanelKeys.ControlBarMiscShowHelpButtonToggle,
76974
+ label: "Help",
76975
+ getter: (s) => s.ui.miscHelp,
76976
+ setter: (s, v) => s.ui.miscHelp = v
76977
+ }
76978
+ ];
76979
+ }
76980
+ function getUltraSettingsContent(viewer) {
76981
+ return [
76982
+ ...getControlBarCameraSettings(),
76983
+ ...getControlBarVisibilitySettings(),
76984
+ ...getControlBarSectionBoxSettings(),
76985
+ ...getControlBarUltraSettings()
76986
+ ];
76987
+ }
76988
+ function createViewer(container, settings2) {
76356
76989
  const controllablePromise = new ControllablePromise();
76357
76990
  const cmpContainer = container instanceof HTMLElement ? createContainer(container) : container ?? createContainer();
76358
76991
  const core = Viewer$2.createWithCanvas(cmpContainer.gfx);
@@ -76371,6 +77004,7 @@ function createViewer(container) {
76371
77004
  {
76372
77005
  container: cmpContainer,
76373
77006
  core,
77007
+ settings: settings2,
76374
77008
  onMount: (cmp) => controllablePromise.resolve(attachDispose(cmp))
76375
77009
  }
76376
77010
  )
@@ -76378,18 +77012,38 @@ function createViewer(container) {
76378
77012
  return controllablePromise.promise;
76379
77013
  }
76380
77014
  function Viewer3(props) {
76381
- const sectionBox2 = useUltraSectionBox(props.core);
76382
- const camera2 = useUltraCamera(props.core, sectionBox2);
77015
+ const settings2 = useSettings(props.settings ?? {}, getDefaultUltraSettings());
77016
+ const sectionBoxRef = useUltraSectionBox(props.core);
77017
+ const camera2 = useUltraCamera(props.core, sectionBoxRef);
76383
77018
  const isolationPanelHandle = useRef(null);
76384
77019
  const sectionBoxPanelHandle = useRef(null);
76385
77020
  const modalHandle = useRef(null);
76386
77021
  const side = useSideState(true, 400);
76387
77022
  const [_, setSelectState] = useState(0);
76388
77023
  const [controlBarCustom, setControlBarCustom] = useState(() => (c) => c);
76389
- const isolation = useUltraIsolation(props.core);
76390
- const controlBar = useUltraControlBar(props.core, sectionBox2, isolation, camera2, (_2) => _2);
77024
+ const isolationRef = useUltraIsolation(props.core);
77025
+ const controlBar = useUltraControlBar(
77026
+ props.core,
77027
+ sectionBoxRef,
77028
+ isolationRef,
77029
+ camera2,
77030
+ settings2.value,
77031
+ side,
77032
+ modalHandle.current,
77033
+ (_2) => _2
77034
+ );
76391
77035
  useViewerInput(props.core.inputs, camera2);
76392
77036
  useEffect(() => {
77037
+ sectionBoxRef.showOffsetPanel.onChange.subscribe((show) => {
77038
+ if (show) {
77039
+ isolationRef.showPanel.set(false);
77040
+ }
77041
+ });
77042
+ isolationRef.showPanel.onChange.subscribe((show) => {
77043
+ if (show) {
77044
+ sectionBoxRef.showOffsetPanel.set(false);
77045
+ }
77046
+ });
76393
77047
  props.core.onStateChanged.subscribe((state) => updateModal(modalHandle, state));
76394
77048
  props.core.selection.onSelectionChanged.subscribe(() => {
76395
77049
  setSelectState((i) => (i + 1) % 2);
@@ -76399,9 +77053,14 @@ function Viewer3(props) {
76399
77053
  get modal() {
76400
77054
  return modalHandle.current;
76401
77055
  },
76402
- isolation,
76403
- sectionBox: sectionBox2,
77056
+ isolation: isolationRef,
77057
+ sectionBox: sectionBoxRef,
76404
77058
  camera: camera2,
77059
+ settings: {
77060
+ update: settings2.update,
77061
+ register: settings2.register,
77062
+ customize: (c) => settings2.customizer.set(c)
77063
+ },
76405
77064
  get isolationPanel() {
76406
77065
  return isolationPanelHandle.current;
76407
77066
  },
@@ -76416,20 +77075,37 @@ function Viewer3(props) {
76416
77075
  load: patchLoad(props.core, modalHandle)
76417
77076
  });
76418
77077
  }, []);
77078
+ const sidePanel = () => /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
77079
+ SettingsPanel,
77080
+ {
77081
+ visible: side.getContent() === "settings",
77082
+ content: getUltraSettingsContent(props.core),
77083
+ settings: settings2
77084
+ }
77085
+ ) });
76419
77086
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
77087
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
77088
+ SidePanelMemo,
77089
+ {
77090
+ container: props.container,
77091
+ viewer: props.core,
77092
+ side,
77093
+ content: sidePanel
77094
+ }
77095
+ ),
76420
77096
  /* @__PURE__ */ jsxRuntimeExports.jsx(RestOfScreen, { side, content: () => {
76421
77097
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
76422
- whenTrue(true, /* @__PURE__ */ jsxRuntimeExports.jsx(LogoMemo, {})),
77098
+ whenTrue(settings2.value.ui.panelLogo, /* @__PURE__ */ jsxRuntimeExports.jsx(LogoMemo, {})),
76423
77099
  /* @__PURE__ */ jsxRuntimeExports.jsx(Overlay, { canvas: props.core.viewport.canvas }),
76424
77100
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76425
77101
  ControlBar,
76426
77102
  {
76427
77103
  content: controlBarCustom(controlBar),
76428
- show: true
77104
+ show: isTrue(settings2.value.ui.panelControlBar)
76429
77105
  }
76430
77106
  ),
76431
- /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel$1, { ref: sectionBoxPanelHandle, state: sectionBox2 }),
76432
- /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel$1, { ref: isolationPanelHandle, state: isolation })
77107
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel$1, { ref: sectionBoxPanelHandle, state: sectionBoxRef }),
77108
+ /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel$1, { ref: isolationPanelHandle, state: isolationRef, transparency: false })
76433
77109
  ] });
76434
77110
  } }),
76435
77111
  /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ref: modalHandle, canFollowLinks: true }),
@@ -76467,7 +77143,15 @@ function patchLoad(viewer, modal) {
76467
77143
  const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
76468
77144
  __proto__: null,
76469
77145
  Viewer: Viewer3,
76470
- createViewer
77146
+ createViewer,
77147
+ getDefaultUltraSettings
77148
+ }, Symbol.toStringTag, { value: "Module" }));
77149
+ const supportUltra = "https://docs.vimaec.com/docs/vim-for-windows/configuring-vim-ultra";
77150
+ const supportControls = "https://docs.vimaec.com/docs/vim-cloud/webgl-navigation-and-controls-guide";
77151
+ const urls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
77152
+ __proto__: null,
77153
+ supportControls,
77154
+ supportUltra
76471
77155
  }, Symbol.toStringTag, { value: "Module" }));
76472
77156
  const SectionBoxPanel = {
76473
77157
  Ids