vim-web 0.5.0-dev.2 → 0.5.0-dev.20

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 (69) hide show
  1. package/dist/style.css +37 -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 +2 -0
  5. package/dist/types/core-viewers/ultra/camera.d.ts +2 -2
  6. package/dist/types/core-viewers/ultra/colorManager.d.ts +4 -4
  7. package/dist/types/core-viewers/ultra/element3d.d.ts +4 -4
  8. package/dist/types/core-viewers/ultra/index.d.ts +1 -1
  9. package/dist/types/core-viewers/ultra/remoteColor.d.ts +3 -23
  10. package/dist/types/core-viewers/ultra/renderer.d.ts +14 -11
  11. package/dist/types/core-viewers/ultra/rpcClient.d.ts +22 -19
  12. package/dist/types/core-viewers/ultra/rpcSafeClient.d.ts +200 -85
  13. package/dist/types/core-viewers/ultra/rpcTypes.d.ts +6 -3
  14. package/dist/types/core-viewers/ultra/rpcUtils.d.ts +8 -0
  15. package/dist/types/core-viewers/ultra/sectionBox.d.ts +1 -1
  16. package/dist/types/core-viewers/ultra/viewer.d.ts +6 -0
  17. package/dist/types/core-viewers/ultra/viewport.d.ts +6 -0
  18. package/dist/types/core-viewers/ultra/vim.d.ts +11 -9
  19. package/dist/types/core-viewers/ultra/visibility.d.ts +2 -2
  20. package/dist/types/core-viewers/webgl/loader/mesh.d.ts +3 -1
  21. package/dist/types/core-viewers/webgl/loader/progressive/insertableMesh.d.ts +4 -2
  22. package/dist/types/core-viewers/webgl/loader/progressive/instancedMesh.d.ts +5 -0
  23. package/dist/types/core-viewers/webgl/loader/vim.d.ts +5 -0
  24. package/dist/types/core-viewers/webgl/viewer/gizmos/markers/gizmoMarker.d.ts +1 -0
  25. package/dist/types/core-viewers/webgl/viewer/rendering/renderer.d.ts +7 -0
  26. package/dist/types/core-viewers/webgl/viewer/viewer.d.ts +5 -0
  27. package/dist/types/core-viewers/webgl/viewer/viewport.d.ts +1 -1
  28. package/dist/types/react-viewers/bim/bimPanel.d.ts +3 -3
  29. package/dist/types/react-viewers/errors/errorStyle.d.ts +1 -1
  30. package/dist/types/react-viewers/helpers/reactUtils.d.ts +2 -1
  31. package/dist/types/react-viewers/helpers/utils.d.ts +8 -0
  32. package/dist/types/react-viewers/panels/axesPanel.d.ts +2 -1
  33. package/dist/types/react-viewers/panels/index.d.ts +1 -0
  34. package/dist/types/react-viewers/panels/isolationPanel.d.ts +2 -0
  35. package/dist/types/react-viewers/panels/messageBox.d.ts +2 -0
  36. package/dist/types/react-viewers/panels/sidePanel.d.ts +1 -1
  37. package/dist/types/react-viewers/settings/anySettings.d.ts +7 -0
  38. package/dist/types/react-viewers/settings/index.d.ts +1 -1
  39. package/dist/types/react-viewers/settings/settingsInputBox.d.ts +4 -0
  40. package/dist/types/react-viewers/settings/settingsItem.d.ts +30 -0
  41. package/dist/types/react-viewers/settings/settingsKeys.d.ts +46 -0
  42. package/dist/types/react-viewers/settings/settingsPanel.d.ts +5 -4
  43. package/dist/types/react-viewers/settings/settingsPanelContent.d.ts +6 -0
  44. package/dist/types/react-viewers/settings/settingsState.d.ts +11 -11
  45. package/dist/types/react-viewers/settings/settingsStorage.d.ts +3 -3
  46. package/dist/types/react-viewers/settings/settingsSubtitle.d.ts +2 -0
  47. package/dist/types/react-viewers/settings/settingsToggle.d.ts +11 -0
  48. package/dist/types/react-viewers/state/controlBarState.d.ts +40 -7
  49. package/dist/types/react-viewers/state/sharedIsolation.d.ts +2 -0
  50. package/dist/types/react-viewers/ultra/controlBar.d.ts +3 -1
  51. package/dist/types/react-viewers/ultra/index.d.ts +1 -0
  52. package/dist/types/react-viewers/ultra/settings.d.ts +10 -0
  53. package/dist/types/react-viewers/ultra/settingsPanel.d.ts +5 -0
  54. package/dist/types/react-viewers/ultra/viewer.d.ts +3 -1
  55. package/dist/types/react-viewers/ultra/viewerRef.d.ts +3 -0
  56. package/dist/types/react-viewers/urls.d.ts +0 -1
  57. package/dist/types/react-viewers/webgl/index.d.ts +1 -0
  58. package/dist/types/react-viewers/webgl/loading.d.ts +2 -2
  59. package/dist/types/react-viewers/webgl/settings.d.ts +36 -0
  60. package/dist/types/react-viewers/webgl/settingsPanel.d.ts +12 -0
  61. package/dist/types/react-viewers/webgl/viewer.d.ts +3 -3
  62. package/dist/types/react-viewers/webgl/viewerRef.d.ts +12 -5
  63. package/dist/types/utils/validation.d.ts +6 -6
  64. package/dist/vim-web.iife.js +1751 -1030
  65. package/dist/vim-web.iife.js.map +1 -1
  66. package/dist/vim-web.js +1751 -1030
  67. package/dist/vim-web.js.map +1 -1
  68. package/package.json +2 -2
  69. package/dist/types/react-viewers/settings/settings.d.ts +0 -61
@@ -46785,6 +46785,11 @@ void main() {
46785
46785
  * @param {boolean} isLegacy - Indicates whether the Vim object uses a legacy loading pipeline.
46786
46786
  */
46787
46787
  constructor(header, document2, g3d2, scene, settings2, map, builder, source, format) {
46788
+ /**
46789
+ * The type of the viewer, indicating it is a WebGL viewer.
46790
+ * Useful for distinguishing between different viewer types in a multi-viewer application.
46791
+ */
46792
+ __publicField(this, "type", "webgl");
46788
46793
  /**
46789
46794
  * Indicates whether the vim was opened from a vim or vimx file.
46790
46795
  */
@@ -48862,19 +48867,38 @@ void main() {
48862
48867
  return new InsertableSubmesh(this, index2);
48863
48868
  }
48864
48869
  /**
48865
- * Overrides mesh material, set to undefine to restore initial material.
48866
- */
48870
+ * Sets the material for this mesh.
48871
+ * Set to undefined to reset to original materials.
48872
+ */
48867
48873
  setMaterial(value) {
48868
- if (this._material === value) return;
48869
48874
  if (this.ignoreSceneMaterial) return;
48870
- this.mesh.material = value ?? this._material;
48875
+ const base = this._material;
48876
+ let mat;
48877
+ if (Array.isArray(value)) {
48878
+ mat = this._mergeMaterials(value, base);
48879
+ } else {
48880
+ mat = value ?? base;
48881
+ }
48882
+ this.mesh.material = mat;
48871
48883
  this.mesh.geometry.clearGroups();
48872
- if (value instanceof Array) {
48873
- value.forEach((m, i2) => {
48884
+ if (Array.isArray(mat)) {
48885
+ mat.forEach((_m, i2) => {
48874
48886
  this.mesh.geometry.addGroup(0, Infinity, i2);
48875
48887
  });
48876
48888
  }
48877
48889
  }
48890
+ _mergeMaterials(value, base) {
48891
+ const baseArr = Array.isArray(base) ? base : [base];
48892
+ const result = [];
48893
+ for (const v of value) {
48894
+ if (v === void 0) {
48895
+ result.push(...baseArr);
48896
+ } else {
48897
+ result.push(v);
48898
+ }
48899
+ }
48900
+ return result;
48901
+ }
48878
48902
  }
48879
48903
  class InstancedSubmesh {
48880
48904
  constructor(mesh, index2) {
@@ -48961,17 +48985,39 @@ void main() {
48961
48985
  }
48962
48986
  return submeshes;
48963
48987
  }
48988
+ /**
48989
+ * Sets the material for this mesh.
48990
+ * Set to undefined to reset to original materials.
48991
+ */
48964
48992
  setMaterial(value) {
48965
- if (this._material === value) return;
48966
48993
  if (this.ignoreSceneMaterial) return;
48967
- this.mesh.material = value ?? this._material;
48994
+ const base = this._material;
48995
+ let mat;
48996
+ if (Array.isArray(value)) {
48997
+ mat = this._mergeMaterials(value, base);
48998
+ } else {
48999
+ mat = value ?? base;
49000
+ }
49001
+ this.mesh.material = mat;
48968
49002
  this.mesh.geometry.clearGroups();
48969
- if (value instanceof Array) {
48970
- value.forEach((m, i2) => {
49003
+ if (Array.isArray(mat)) {
49004
+ mat.forEach((_m, i2) => {
48971
49005
  this.mesh.geometry.addGroup(0, Infinity, i2);
48972
49006
  });
48973
49007
  }
48974
49008
  }
49009
+ _mergeMaterials(value, base) {
49010
+ const baseArr = Array.isArray(base) ? base : [base];
49011
+ const result = [];
49012
+ for (const v of value) {
49013
+ if (v === void 0) {
49014
+ result.push(...baseArr);
49015
+ } else {
49016
+ result.push(v);
49017
+ }
49018
+ }
49019
+ return result;
49020
+ }
48975
49021
  computeBoundingBoxes() {
48976
49022
  this.mesh.geometry.computeBoundingBox();
48977
49023
  const boxes = new Array(this.mesh.count);
@@ -50111,6 +50157,9 @@ void main() {
50111
50157
  get index() {
50112
50158
  return this._submesh.index;
50113
50159
  }
50160
+ get isRoom() {
50161
+ return false;
50162
+ }
50114
50163
  /**
50115
50164
  * Updates the underlying submesh and rebinds all attributes to the new mesh.
50116
50165
  * @param mesh - The new submesh to bind to this marker.
@@ -50841,6 +50890,164 @@ void main() {
50841
50890
  }
50842
50891
  return true;
50843
50892
  }
50893
+ class Segment {
50894
+ constructor(origin = new Vector3(), target = new Vector3()) {
50895
+ __publicField(this, "origin");
50896
+ __publicField(this, "target");
50897
+ this.origin = origin;
50898
+ this.target = target;
50899
+ }
50900
+ static fromArray(array) {
50901
+ return new Segment(
50902
+ new Vector3(array[0], array[1], array[2]),
50903
+ new Vector3(array[3], array[4], array[5])
50904
+ );
50905
+ }
50906
+ toArray() {
50907
+ return [this.origin.x, this.origin.y, this.origin.z, this.target.x, this.target.y, this.target.z];
50908
+ }
50909
+ isValid() {
50910
+ return !this.origin.equals(this.target);
50911
+ }
50912
+ equals(segment) {
50913
+ return this.origin.equals(segment.origin) && this.target.equals(segment.target);
50914
+ }
50915
+ }
50916
+ class RGBA {
50917
+ constructor(r, g, b, a = 1) {
50918
+ __publicField(this, "r");
50919
+ __publicField(this, "g");
50920
+ __publicField(this, "b");
50921
+ __publicField(this, "a");
50922
+ this.r = r;
50923
+ this.g = g;
50924
+ this.b = b;
50925
+ this.a = a;
50926
+ }
50927
+ static fromThree(color, opacity = 1) {
50928
+ return new RGBA(color.r, color.g, color.b, opacity);
50929
+ }
50930
+ toThree() {
50931
+ return new Color(this.r, this.g, this.b);
50932
+ }
50933
+ clone() {
50934
+ return new RGBA(this.r, this.g, this.b, this.a);
50935
+ }
50936
+ isValid() {
50937
+ return Number.isFinite(this.r) && Number.isFinite(this.g) && Number.isFinite(this.b) && Number.isFinite(this.a);
50938
+ }
50939
+ equals(color) {
50940
+ return this.r === color.r && this.g === color.g && this.b === color.b && this.a === color.a;
50941
+ }
50942
+ static fromString(str) {
50943
+ str = str.trim();
50944
+ if (str.startsWith("(")) {
50945
+ str = str.substring(1);
50946
+ }
50947
+ if (str.endsWith(")")) {
50948
+ str = str.substring(0, str.length - 1);
50949
+ }
50950
+ const parts = str.split(",");
50951
+ if (parts.length < 3 || parts.length > 4) {
50952
+ throw new Error("Invalid color string format. Expected 3 or 4 components.");
50953
+ }
50954
+ const r = parseFloat(parts[0]);
50955
+ const g = parseFloat(parts[1]);
50956
+ const b = parseFloat(parts[2]);
50957
+ const a = parts.length === 4 ? parseFloat(parts[3]) : 1;
50958
+ if ([r, g, b, a].some((n) => isNaN(n))) {
50959
+ throw new Error("Invalid number in color string.");
50960
+ }
50961
+ return new RGBA(r, g, b, a);
50962
+ }
50963
+ }
50964
+ class RGB {
50965
+ constructor(r, g, b) {
50966
+ __publicField(this, "r");
50967
+ __publicField(this, "g");
50968
+ __publicField(this, "b");
50969
+ this.r = r;
50970
+ this.g = g;
50971
+ this.b = b;
50972
+ }
50973
+ }
50974
+ class RGBA32 {
50975
+ constructor(hex) {
50976
+ __publicField(this, "hex");
50977
+ if (!Number.isInteger(hex) || hex < 0 || hex > 4294967295) {
50978
+ throw new Error("Invalid value: must be a 32-bit unsigned integer");
50979
+ }
50980
+ this.hex = hex;
50981
+ }
50982
+ static fromThree(color, opacity = 1) {
50983
+ return this.fromFloats(color.r, color.g, color.b, opacity);
50984
+ }
50985
+ static fromInts(r, g, b, a = 1) {
50986
+ if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255 || a < 0 || a > 255) {
50987
+ throw new Error("Each RGBA component must be in the range 0-255.");
50988
+ }
50989
+ const hex = r * 2 ** 24 + g * 2 ** 16 + b * 2 ** 8 + a;
50990
+ return new RGBA32(hex);
50991
+ }
50992
+ static fromFloats(r, g, b, a = 1) {
50993
+ return this.fromInts(
50994
+ remap(r, 255),
50995
+ remap(g, 255),
50996
+ remap(b, 255),
50997
+ remap(a, 255)
50998
+ );
50999
+ }
51000
+ static fromString(str) {
51001
+ if (str.startsWith("#")) {
51002
+ str = str.slice(1);
51003
+ }
51004
+ if (str.length === 3 || str.length === 4) {
51005
+ str = str.split("").map((c) => c + c).join("");
51006
+ }
51007
+ let r = 0;
51008
+ let g = 0;
51009
+ let b = 0;
51010
+ let a = 255;
51011
+ if (str.length === 6 || str.length === 8) {
51012
+ r = parseInt(str.slice(0, 2), 16);
51013
+ g = parseInt(str.slice(2, 4), 16);
51014
+ b = parseInt(str.slice(4, 6), 16);
51015
+ if (str.length === 8) {
51016
+ a = parseInt(str.slice(6, 8), 16);
51017
+ }
51018
+ } else {
51019
+ throw new Error("Invalid color string format");
51020
+ }
51021
+ if ([r, g, b, a].some((v) => isNaN(v))) {
51022
+ throw new Error("Invalid color string format");
51023
+ }
51024
+ return this.fromInts(r, g, b, a);
51025
+ }
51026
+ /**
51027
+ * The red component of the color in the range [0-255].
51028
+ */
51029
+ get r() {
51030
+ return this.hex >>> 24;
51031
+ }
51032
+ /**
51033
+ * The green component of the color in the range [0-255].
51034
+ */
51035
+ get g() {
51036
+ return this.hex >>> 16 & 255;
51037
+ }
51038
+ /**
51039
+ * The blue component of the color in the range [0-255].
51040
+ */
51041
+ get b() {
51042
+ return this.hex >>> 8 & 255;
51043
+ }
51044
+ /**
51045
+ * The alpha component of the color in the range [0-255].
51046
+ */
51047
+ get a() {
51048
+ return this.hex & 255;
51049
+ }
51050
+ }
50844
51051
  class Validation {
50845
51052
  //= ===========================================================================
50846
51053
  // BASIC NUMBER VALIDATIONS
@@ -50892,16 +51099,16 @@ void main() {
50892
51099
  //= ===========================================================================
50893
51100
  // HANDLE VALIDATIONS
50894
51101
  //= ===========================================================================
50895
- static isComponentHandle(handle) {
50896
- if (!this.isPositiveInteger(handle)) return false;
50897
- if (handle === INVALID_HANDLE) {
50898
- console.warn(`Invalid handle ${handle}. Aborting operation.`);
51102
+ static isIndex(index2) {
51103
+ if (!this.isPositiveInteger(index2)) return false;
51104
+ if (index2 === INVALID_HANDLE) {
51105
+ console.warn(`Invalid index ${index2}. Aborting operation.`);
50899
51106
  return false;
50900
51107
  }
50901
51108
  return true;
50902
51109
  }
50903
- static areComponentHandles(handles) {
50904
- return handles.every((h) => this.isComponentHandle(h));
51110
+ static areIndices(indices) {
51111
+ return indices.every((h) => this.isIndex(h));
50905
51112
  }
50906
51113
  static isMaterialHandle(handle) {
50907
51114
  if (!materialHandles.includes(handle)) {
@@ -50950,23 +51157,6 @@ void main() {
50950
51157
  return true;
50951
51158
  }
50952
51159
  //= ===========================================================================
50953
- // COLOR VALIDATIONS
50954
- //= ===========================================================================
50955
- static isRelativeRGBA(color) {
50956
- if (color.r < 0 || color.r > 1 || color.g < 0 || color.g > 1 || color.b < 0 || color.b > 1) {
50957
- console.warn("Invalid value: must be a relative color (0-1, 0-1, 0-1)");
50958
- return false;
50959
- }
50960
- return true;
50961
- }
50962
- static isRelativeRGB(color) {
50963
- if (color.r < 0 || color.r > 1 || color.g < 0 || color.g > 1 || color.b < 0 || color.b > 1) {
50964
- console.warn("Invalid value: must be a relative color (0-1, 0-1, 0-1)");
50965
- return false;
50966
- }
50967
- return true;
50968
- }
50969
- //= ===========================================================================
50970
51160
  // STRING AND URL VALIDATIONS
50971
51161
  //= ===========================================================================
50972
51162
  static isNonEmptyString(value) {
@@ -51053,6 +51243,13 @@ void main() {
51053
51243
  }
51054
51244
  return value;
51055
51245
  }
51246
+ static clampColor01(value) {
51247
+ return new Color(
51248
+ this.clamp01(value.r),
51249
+ this.clamp01(value.g),
51250
+ this.clamp01(value.b)
51251
+ );
51252
+ }
51056
51253
  static clampRGBA01(value) {
51057
51254
  return new RGBA(
51058
51255
  this.clamp01(value.r),
@@ -52449,7 +52646,11 @@ void main() {
52449
52646
  * @param handler Callback invoked on key up.
52450
52647
  */
52451
52648
  registerKeyUp(code, mode, handler) {
52452
- this.registerKey(this.keyUpHandlers, code, mode, handler);
52649
+ if (Array.isArray(code)) {
52650
+ code.forEach((c) => this.registerKey(this.keyUpHandlers, c, mode, handler));
52651
+ } else {
52652
+ this.registerKey(this.keyUpHandlers, code, mode, handler);
52653
+ }
52453
52654
  }
52454
52655
  registerKey(map, code, mode, callback) {
52455
52656
  mode = map.has(code) ? mode : "replace";
@@ -52495,6 +52696,7 @@ void main() {
52495
52696
  __publicField(this, "onClick");
52496
52697
  __publicField(this, "onDoubleClick");
52497
52698
  __publicField(this, "onWheel");
52699
+ __publicField(this, "onContextMenu");
52498
52700
  this._capture = new CaptureHandler(canvas);
52499
52701
  this._dragHandler = new DragHandler((delta, button) => this.onDrag(delta, button));
52500
52702
  }
@@ -52536,6 +52738,7 @@ void main() {
52536
52738
  this.handleDoubleClick(event);
52537
52739
  } else {
52538
52740
  this.handleMouseClick(event);
52741
+ this.handleContextMenu(event);
52539
52742
  }
52540
52743
  event.preventDefault();
52541
52744
  }
@@ -52550,6 +52753,16 @@ void main() {
52550
52753
  const modif = event.getModifierState("Shift") || event.getModifierState("Control");
52551
52754
  (_a3 = this.onClick) == null ? void 0 : _a3.call(this, pos, modif);
52552
52755
  }
52756
+ async handleContextMenu(event) {
52757
+ var _a3;
52758
+ if (event.pointerType !== "mouse") return;
52759
+ if (event.button !== 2) return;
52760
+ const pos = this.relativePosition(event);
52761
+ if (!almostEqual(this._lastMouseDownPosition, pos, 0.01)) {
52762
+ return;
52763
+ }
52764
+ (_a3 = this.onContextMenu) == null ? void 0 : _a3.call(this, new Vector2(event.clientX, event.clientY));
52765
+ }
52553
52766
  handlePointerMove(event) {
52554
52767
  var _a3;
52555
52768
  if (event.pointerType !== "mouse") return;
@@ -52603,13 +52816,20 @@ void main() {
52603
52816
  constructor() {
52604
52817
  __publicField(this, "_lastClickTime", 0);
52605
52818
  __publicField(this, "_clickDelay", 300);
52819
+ // Max time between clicks for double-click
52820
+ __publicField(this, "_lastClickPosition", null);
52821
+ __publicField(this, "_positionThreshold", 5);
52606
52822
  }
52607
- // Delay in milliseconds to consider a double click
52823
+ // Max pixel distance between clicks
52608
52824
  checkForDoubleClick(event) {
52609
52825
  const currentTime = Date.now();
52826
+ const currentPosition = new Vector2(event.clientX, event.clientY);
52610
52827
  const timeDiff = currentTime - this._lastClickTime;
52828
+ const isClose = this._lastClickPosition !== null && this._lastClickPosition.distanceTo(currentPosition) < this._positionThreshold;
52829
+ const isWithinTime = timeDiff < this._clickDelay;
52611
52830
  this._lastClickTime = currentTime;
52612
- return timeDiff < this._clickDelay;
52831
+ this._lastClickPosition = currentPosition;
52832
+ return isClose && isWithinTime;
52613
52833
  }
52614
52834
  }
52615
52835
  class DragHandler {
@@ -52849,23 +53069,15 @@ void main() {
52849
53069
  this._moveSpeed = settings2.moveSpeed ?? 1;
52850
53070
  this.rotateSpeed = settings2.rotateSpeed ?? 1;
52851
53071
  this.orbitSpeed = settings2.orbitSpeed ?? 1;
52852
- this.reg(document, "contextmenu", (e) => {
52853
- this._onContextMenu.dispatch(new Vector2(e.clientX, e.clientY));
52854
- e.preventDefault();
52855
- });
52856
53072
  this.keyboard = new KeyboardHandler(canvas);
52857
53073
  this.mouse = new MouseHandler(canvas);
52858
53074
  this.touch = new TouchHandler(canvas);
52859
53075
  this.keyboard.onKeyDown = (key) => adapter.keyDown(key);
52860
53076
  this.keyboard.onKeyUp = (key) => adapter.keyUp(key);
52861
53077
  this.keyboard.registerKeyUp("KeyP", "replace", () => adapter.toggleOrthographic());
52862
- this.keyboard.registerKeyUp("Equal", "replace", () => this.moveSpeed++);
52863
- this.keyboard.registerKeyUp("Minus", "replace", () => this.moveSpeed--);
52864
- this.keyboard.registerKeyUp("Space", "replace", () => {
52865
- this._pointerActive = this._pointerActive === "orbit" ? "look" : "orbit";
52866
- this._pointerFallback = this._pointerActive;
52867
- this._onPointerModeChanged.dispatch();
52868
- });
53078
+ this.keyboard.registerKeyUp(["Equal", "NumpadAdd"], "replace", () => this.moveSpeed++);
53079
+ this.keyboard.registerKeyUp(["Minus", "NumpadSubtract"], "replace", () => this.moveSpeed--);
53080
+ this.keyboard.registerKeyUp("Space", "replace", () => adapter.toggleCameraOrbitMode());
52869
53081
  this.keyboard.registerKeyUp("Home", "replace", () => adapter.resetCamera());
52870
53082
  this.keyboard.registerKeyUp("Escape", "replace", () => adapter.clearSelection());
52871
53083
  this.keyboard.registerKeyUp("KeyF", "replace", () => {
@@ -52875,18 +53087,28 @@ void main() {
52875
53087
  const mul = Math.pow(1.25, this._moveSpeed);
52876
53088
  adapter.moveCamera(value.multiplyScalar(mul));
52877
53089
  };
53090
+ this.mouse.onContextMenu = (pos) => this._onContextMenu.dispatch(pos);
52878
53091
  this.mouse.onButtonDown = adapter.mouseDown;
52879
53092
  this.mouse.onMouseMove = adapter.mouseMove;
52880
- this.mouse.onButtonUp = adapter.mouseUp;
53093
+ this.mouse.onButtonUp = (pos, button) => {
53094
+ this.pointerOverride = void 0;
53095
+ adapter.mouseUp(pos, button);
53096
+ };
52881
53097
  this.mouse.onDrag = (delta, button) => {
52882
53098
  if (button === 0) {
52883
- if (this._pointerActive === "orbit") adapter.orbitCamera(toRotation(delta, this.orbitSpeed));
52884
- if (this._pointerActive === "look") adapter.rotateCamera(toRotation(delta, this.rotateSpeed));
52885
- if (this._pointerActive === "pan") adapter.panCamera(delta);
52886
- if (this._pointerActive === "zoom") adapter.dollyCamera(delta);
53099
+ if (this.pointerActive === "orbit") adapter.orbitCamera(toRotation(delta, this.orbitSpeed));
53100
+ if (this.pointerActive === "look") adapter.rotateCamera(toRotation(delta, this.rotateSpeed));
53101
+ if (this.pointerActive === "pan") adapter.panCamera(delta);
53102
+ if (this.pointerActive === "zoom") adapter.dollyCamera(delta);
53103
+ }
53104
+ if (button === 2) {
53105
+ this.pointerOverride = "look";
53106
+ adapter.rotateCamera(toRotation(delta, 1));
53107
+ }
53108
+ if (button === 1) {
53109
+ this.pointerOverride = "pan";
53110
+ adapter.panCamera(delta);
52887
53111
  }
52888
- if (button === 2) adapter.rotateCamera(toRotation(delta, 1));
52889
- if (button === 1) adapter.panCamera(delta);
52890
53112
  };
52891
53113
  this.mouse.onClick = (pos, modif) => adapter.selectAtPointer(pos, modif);
52892
53114
  this.mouse.onDoubleClick = adapter.frameAtPointer;
@@ -55709,7 +55931,7 @@ void main() {
55709
55931
  /**
55710
55932
  * Resizes the canvas and updates the camera to match new parent dimensions.
55711
55933
  */
55712
- ResizeToParent() {
55934
+ resizeToParent() {
55713
55935
  this._onResize.dispatch();
55714
55936
  }
55715
55937
  /**
@@ -55763,6 +55985,9 @@ void main() {
55763
55985
  toggleOrthographic: () => {
55764
55986
  viewer.camera.orthographic = !viewer.camera.orthographic;
55765
55987
  },
55988
+ toggleCameraOrbitMode: () => {
55989
+ viewer.inputs.pointerActive = viewer.inputs.pointerActive === PointerMode$1.ORBIT ? PointerMode$1.LOOK : PointerMode$1.ORBIT;
55990
+ },
55766
55991
  resetCamera: () => {
55767
55992
  viewer.camera.lerp(0.75).reset();
55768
55993
  },
@@ -55787,7 +56012,7 @@ void main() {
55787
56012
  },
55788
56013
  frameAtPointer: async (pos) => {
55789
56014
  const result = await viewer.raycaster.raycastFromScreen(pos);
55790
- viewer.camera.lerp(0.75).frame(result.object);
56015
+ viewer.camera.lerp(0.75).frame(result.object ?? "all");
55791
56016
  },
55792
56017
  zoom: (value) => {
55793
56018
  viewer.camera.lerp(0.75).zoom(value);
@@ -56798,6 +57023,10 @@ void main() {
56798
57023
  * Indicates whether the scene should be re-rendered on change only.
56799
57024
  */
56800
57025
  __publicField(this, "onDemand");
57026
+ /**
57027
+ * The material that will be used when setting model material to undefined.
57028
+ */
57029
+ __publicField(this, "defaultModelMaterial");
56801
57030
  __publicField(this, "fitViewport", () => {
56802
57031
  const size = this._viewport.getParentSize();
56803
57032
  this.renderer.setPixelRatio(window.devicePixelRatio);
@@ -56869,11 +57098,14 @@ void main() {
56869
57098
  this._scene.threeScene.background = color;
56870
57099
  this.needsUpdate = true;
56871
57100
  }
57101
+ /**
57102
+ * Sets the material used to render models. If set to undefined, the default model or mesh material is used.
57103
+ */
56872
57104
  get modelMaterial() {
56873
57105
  return this._scene.modelMaterial;
56874
57106
  }
56875
57107
  set modelMaterial(material) {
56876
- this._scene.modelMaterial = material;
57108
+ this._scene.modelMaterial = material ?? this.defaultModelMaterial;
56877
57109
  }
56878
57110
  /**
56879
57111
  * Signal dispatched at the end of each frame if the scene was updated, such as visibility changes.
@@ -57009,6 +57241,11 @@ void main() {
57009
57241
  };
57010
57242
  let Viewer$3 = class Viewer {
57011
57243
  constructor(settings2) {
57244
+ /**
57245
+ * The type of the viewer, indicating it is a WebGL viewer.
57246
+ * Useful for distinguishing between different viewer types in a multi-viewer application.
57247
+ */
57248
+ __publicField(this, "type", "webgl");
57012
57249
  /**
57013
57250
  * The settings configuration used by the viewer.
57014
57251
  */
@@ -57333,180 +57570,31 @@ void main() {
57333
57570
  getDefaultVimSettings,
57334
57571
  request: requestVim
57335
57572
  }, Symbol.toStringTag, { value: "Module" }));
57336
- class Segment {
57337
- constructor(origin = new Vector3(), target = new Vector3()) {
57338
- __publicField(this, "origin");
57339
- __publicField(this, "target");
57340
- this.origin = origin;
57341
- this.target = target;
57342
- }
57343
- static fromArray(array) {
57344
- return new Segment(
57345
- new Vector3(array[0], array[1], array[2]),
57346
- new Vector3(array[3], array[4], array[5])
57347
- );
57573
+ class Camera {
57574
+ /**
57575
+ * Creates a new Camera instance
57576
+ * @param rpc - RPC client for camera communication
57577
+ */
57578
+ constructor(rpc) {
57579
+ __publicField(this, "_rpc");
57580
+ __publicField(this, "_lastPosition");
57581
+ __publicField(this, "_defaultBlendTime", 0.5);
57582
+ __publicField(this, "_savedPosition");
57583
+ this._rpc = rpc;
57348
57584
  }
57349
- toArray() {
57350
- return [this.origin.x, this.origin.y, this.origin.z, this.target.x, this.target.y, this.target.z];
57585
+ /**
57586
+ * Saves the current camera position for later restoration
57587
+ * @param segment - Optional segment to save as the camera position
57588
+ */
57589
+ async save(segment) {
57590
+ this._savedPosition = segment ?? await this._rpc.RPCGetCameraView();
57351
57591
  }
57352
- isValid() {
57353
- return !this.origin.equals(this.target);
57354
- }
57355
- equals(segment) {
57356
- return this.origin.equals(segment.origin) && this.target.equals(segment.target);
57357
- }
57358
- }
57359
- class RGBA {
57360
- constructor(r, g, b, a = 1) {
57361
- __publicField(this, "r");
57362
- __publicField(this, "g");
57363
- __publicField(this, "b");
57364
- __publicField(this, "a");
57365
- this.r = r;
57366
- this.g = g;
57367
- this.b = b;
57368
- this.a = a;
57369
- }
57370
- clone() {
57371
- return new RGBA(this.r, this.g, this.b, this.a);
57372
- }
57373
- isValid() {
57374
- return Number.isFinite(this.r) && Number.isFinite(this.g) && Number.isFinite(this.b) && Number.isFinite(this.a);
57375
- }
57376
- equals(color) {
57377
- return this.r === color.r && this.g === color.g && this.b === color.b && this.a === color.a;
57378
- }
57379
- static fromString(str) {
57380
- str = str.trim();
57381
- if (str.startsWith("(")) {
57382
- str = str.substring(1);
57383
- }
57384
- if (str.endsWith(")")) {
57385
- str = str.substring(0, str.length - 1);
57386
- }
57387
- const parts = str.split(",");
57388
- if (parts.length < 3 || parts.length > 4) {
57389
- throw new Error("Invalid color string format. Expected 3 or 4 components.");
57390
- }
57391
- const r = parseFloat(parts[0]);
57392
- const g = parseFloat(parts[1]);
57393
- const b = parseFloat(parts[2]);
57394
- const a = parts.length === 4 ? parseFloat(parts[3]) : 1;
57395
- if ([r, g, b, a].some((n) => isNaN(n))) {
57396
- throw new Error("Invalid number in color string.");
57397
- }
57398
- return new RGBA(r, g, b, a);
57399
- }
57400
- }
57401
- class RGB {
57402
- constructor(r, g, b) {
57403
- __publicField(this, "r");
57404
- __publicField(this, "g");
57405
- __publicField(this, "b");
57406
- this.r = r;
57407
- this.g = g;
57408
- this.b = b;
57409
- }
57410
- }
57411
- class RGBA32 {
57412
- constructor(hex) {
57413
- __publicField(this, "hex");
57414
- if (!Number.isInteger(hex) || hex < 0 || hex > 4294967295) {
57415
- throw new Error("Invalid value: must be a 32-bit unsigned integer");
57416
- }
57417
- this.hex = hex;
57418
- }
57419
- static fromInts(r, g, b, a = 1) {
57420
- if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255 || a < 0 || a > 255) {
57421
- throw new Error("Each RGBA component must be in the range 0-255.");
57422
- }
57423
- const hex = r * 2 ** 24 + g * 2 ** 16 + b * 2 ** 8 + a;
57424
- return new RGBA32(hex);
57425
- }
57426
- static fromFloats(r, g, b, a = 1) {
57427
- return this.fromInts(
57428
- remap(r, 255),
57429
- remap(g, 255),
57430
- remap(b, 255),
57431
- remap(a, 255)
57432
- );
57433
- }
57434
- static fromString(str) {
57435
- if (str.startsWith("#")) {
57436
- str = str.slice(1);
57437
- }
57438
- if (str.length === 3 || str.length === 4) {
57439
- str = str.split("").map((c) => c + c).join("");
57440
- }
57441
- let r = 0;
57442
- let g = 0;
57443
- let b = 0;
57444
- let a = 255;
57445
- if (str.length === 6 || str.length === 8) {
57446
- r = parseInt(str.slice(0, 2), 16);
57447
- g = parseInt(str.slice(2, 4), 16);
57448
- b = parseInt(str.slice(4, 6), 16);
57449
- if (str.length === 8) {
57450
- a = parseInt(str.slice(6, 8), 16);
57451
- }
57452
- } else {
57453
- throw new Error("Invalid color string format");
57454
- }
57455
- if ([r, g, b, a].some((v) => isNaN(v))) {
57456
- throw new Error("Invalid color string format");
57457
- }
57458
- return this.fromInts(r, g, b, a);
57459
- }
57460
- /**
57461
- * The red component of the color in the range [0-255].
57462
- */
57463
- get r() {
57464
- return this.hex >>> 24;
57465
- }
57466
- /**
57467
- * The green component of the color in the range [0-255].
57468
- */
57469
- get g() {
57470
- return this.hex >>> 16 & 255;
57471
- }
57472
- /**
57473
- * The blue component of the color in the range [0-255].
57474
- */
57475
- get b() {
57476
- return this.hex >>> 8 & 255;
57477
- }
57478
- /**
57479
- * The alpha component of the color in the range [0-255].
57480
- */
57481
- get a() {
57482
- return this.hex & 255;
57483
- }
57484
- }
57485
- class Camera {
57486
- /**
57487
- * Creates a new Camera instance
57488
- * @param rpc - RPC client for camera communication
57489
- */
57490
- constructor(rpc) {
57491
- __publicField(this, "_rpc");
57492
- __publicField(this, "_lastPosition");
57493
- __publicField(this, "_defaultBlendTime", 0.5);
57494
- __publicField(this, "_savedPosition");
57495
- this._rpc = rpc;
57496
- }
57497
- /**
57498
- * Saves the current camera position for later restoration
57499
- * @param segment - Optional segment to save as the camera position
57500
- */
57501
- async save(segment) {
57502
- this._savedPosition = segment ?? await this._rpc.RPCGetCameraView();
57503
- }
57504
- /**
57505
- * Resets the camera to the last saved position
57506
- */
57507
- restoreSavedPosition(blendTime = this._defaultBlendTime) {
57508
- if (!this._savedPosition) return;
57509
- this._rpc.RPCSetCameraView(this._savedPosition, blendTime);
57592
+ /**
57593
+ * Resets the camera to the last saved position
57594
+ */
57595
+ restoreSavedPosition(blendTime = this._defaultBlendTime) {
57596
+ if (!this._savedPosition) return;
57597
+ this._rpc.RPCSetCameraView(this._savedPosition, blendTime);
57510
57598
  }
57511
57599
  /**
57512
57600
  * Restores the camera to its last tracked position
@@ -57545,7 +57633,7 @@ void main() {
57545
57633
  * @returns Promise that resolves when the framing animation is complete
57546
57634
  */
57547
57635
  async frameAll(blendTime = this._defaultBlendTime) {
57548
- const segment = await this._rpc.RPCFrameAll(blendTime);
57636
+ const segment = await this._rpc.RPCFrameScene(blendTime);
57549
57637
  this._savedPosition = this._savedPosition ?? segment;
57550
57638
  return segment;
57551
57639
  }
@@ -57562,16 +57650,16 @@ void main() {
57562
57650
  /**
57563
57651
  * Frames specific nodes of a Vim model in the camera view
57564
57652
  * @param vim - The Vim model containing the nodes to frame
57565
- * @param nodes - Array of node indices to frame, or 'all' to frame the entire model
57653
+ * @param elements - Array of element indices to frame, or 'all' to frame the entire model
57566
57654
  * @param blendTime - Duration of the camera animation in seconds (defaults to 0.5)
57567
57655
  * @returns Promise that resolves when the framing animation is complete
57568
57656
  */
57569
- async frameVim(vim, nodes, blendTime = this._defaultBlendTime) {
57657
+ async frameVim(vim, elements, blendTime = this._defaultBlendTime) {
57570
57658
  let segment;
57571
- if (nodes === "all") {
57659
+ if (elements === "all") {
57572
57660
  segment = await this._rpc.RPCFrameVim(vim.handle, blendTime);
57573
57661
  } else {
57574
- segment = await this._rpc.RPCFrameElements(vim.handle, nodes, blendTime);
57662
+ segment = await this._rpc.RPCFrameElements(vim.handle, elements, blendTime);
57575
57663
  }
57576
57664
  this._savedPosition = this._savedPosition ?? segment;
57577
57665
  return segment;
@@ -57654,9 +57742,9 @@ void main() {
57654
57742
  // -------------------- HitCheckResult -------------------
57655
57743
  writeHitCheckResult(data2) {
57656
57744
  this.ensureCapacity(4 + 4 + 4 + 4 * 3 + 4 * 3);
57657
- this.writeUInt(data2.vimHandle);
57658
- this.writeUInt(data2.nodeIndex);
57659
- this.writeUInt(data2.elementIndex);
57745
+ this.writeUInt(data2.vimIndex);
57746
+ this.writeUInt(data2.vimElementIndex);
57747
+ this.writeUInt(data2.sceneElementIndex);
57660
57748
  this.writeVector3(data2.worldPosition);
57661
57749
  this.writeVector3(data2.worldNormal);
57662
57750
  }
@@ -57804,15 +57892,15 @@ void main() {
57804
57892
  return textDecoder.decode(stringData);
57805
57893
  }
57806
57894
  readHitCheckResult() {
57807
- const vimHandle = this.readUInt();
57808
- const nodeIndex = this.readUInt();
57809
- const mElementIndex = this.readUInt();
57895
+ const vimIndex = this.readUInt();
57896
+ const vimElementIndex = this.readUInt();
57897
+ const sceneElementIndex = this.readUInt();
57810
57898
  const worldPosition = this.readVector3();
57811
57899
  const worldNormal = this.readVector3();
57812
57900
  return {
57813
- vimHandle,
57814
- nodeIndex,
57815
- elementIndex: mElementIndex,
57901
+ vimIndex,
57902
+ vimElementIndex,
57903
+ sceneElementIndex,
57816
57904
  worldPosition,
57817
57905
  worldNormal
57818
57906
  };
@@ -57944,10 +58032,22 @@ void main() {
57944
58032
  get url() {
57945
58033
  return this._socket.url;
57946
58034
  }
57947
- RPCClearMaterialOverrides(componentHandle) {
58035
+ RPCClearMaterialOverridesForElements(vimIndex, elementIndices) {
57948
58036
  const marshal = new Marshal();
57949
- marshal.writeString("RPCClearMaterialOverrides");
57950
- marshal.writeUInt(componentHandle);
58037
+ marshal.writeString("RPCClearMaterialOverridesForElements");
58038
+ marshal.writeUInt(vimIndex);
58039
+ marshal.writeArrayOfUInt(elementIndices);
58040
+ this._socket.sendRPC(marshal);
58041
+ }
58042
+ RPCClearMaterialOverridesForScene() {
58043
+ const marshal = new Marshal();
58044
+ marshal.writeString("RPCClearMaterialOverridesForScene");
58045
+ this._socket.sendRPC(marshal);
58046
+ }
58047
+ RPCClearMaterialOverridesForVim(vimIndex) {
58048
+ const marshal = new Marshal();
58049
+ marshal.writeString("RPCClearMaterialOverridesForVim");
58050
+ marshal.writeUInt(vimIndex);
57951
58051
  this._socket.sendRPC(marshal);
57952
58052
  }
57953
58053
  async RPCCreateMaterialInstances(materialHandle, smoothness, colors) {
@@ -57970,10 +58070,10 @@ void main() {
57970
58070
  const ret = returnMarshal.readUInt();
57971
58071
  return ret;
57972
58072
  }
57973
- RPCDestroyMaterialInstances(materialInstanceHandle) {
58073
+ RPCDestroyMaterialInstances(materialInstanceHandles) {
57974
58074
  const marshal = new Marshal();
57975
58075
  marshal.writeString("RPCDestroyMaterialInstances");
57976
- marshal.writeArrayOfUInt(materialInstanceHandle);
58076
+ marshal.writeArrayOfUInt(materialInstanceHandles);
57977
58077
  this._socket.sendRPC(marshal);
57978
58078
  }
57979
58079
  RPCDestroyText(componentHandle) {
@@ -57997,53 +58097,53 @@ void main() {
57997
58097
  const ret = returnMarshal.readSegment();
57998
58098
  return ret;
57999
58099
  }
58000
- async RPCFrameAll(blendTime) {
58100
+ async RPCFrameElements(vimIndex, elementIndices, blendTime) {
58001
58101
  const marshal = new Marshal();
58002
- marshal.writeString("RPCFrameAll");
58102
+ marshal.writeString("RPCFrameElements");
58103
+ marshal.writeUInt(vimIndex);
58104
+ marshal.writeArrayOfUInt(elementIndices);
58003
58105
  marshal.writeFloat(blendTime);
58004
58106
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58005
58107
  const ret = returnMarshal.readSegment();
58006
58108
  return ret;
58007
58109
  }
58008
- async RPCFrameElements(componentHandle, elementIndices, blendTime) {
58110
+ async RPCFrameScene(blendTime) {
58009
58111
  const marshal = new Marshal();
58010
- marshal.writeString("RPCFrameElements");
58011
- marshal.writeUInt(componentHandle);
58012
- marshal.writeArrayOfUInt(elementIndices);
58112
+ marshal.writeString("RPCFrameScene");
58013
58113
  marshal.writeFloat(blendTime);
58014
58114
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58015
58115
  const ret = returnMarshal.readSegment();
58016
58116
  return ret;
58017
58117
  }
58018
- async RPCFrameVim(componentHandle, blendTime) {
58118
+ async RPCFrameVim(vimIndex, blendTime) {
58019
58119
  const marshal = new Marshal();
58020
58120
  marshal.writeString("RPCFrameVim");
58021
- marshal.writeUInt(componentHandle);
58121
+ marshal.writeUInt(vimIndex);
58022
58122
  marshal.writeFloat(blendTime);
58023
58123
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58024
58124
  const ret = returnMarshal.readSegment();
58025
58125
  return ret;
58026
58126
  }
58027
- async RPCGetAABBForAll() {
58127
+ async RPCGetAABBForElements(vimIndex, elementIndices) {
58028
58128
  const marshal = new Marshal();
58029
- marshal.writeString("RPCGetAABBForAll");
58129
+ marshal.writeString("RPCGetAABBForElements");
58130
+ marshal.writeUInt(vimIndex);
58131
+ marshal.writeArrayOfUInt(elementIndices);
58030
58132
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58031
58133
  const ret = returnMarshal.readBox3();
58032
58134
  return ret;
58033
58135
  }
58034
- async RPCGetAABBForElements(componentHandle, elementIndices) {
58136
+ async RPCGetAABBForScene() {
58035
58137
  const marshal = new Marshal();
58036
- marshal.writeString("RPCGetAABBForElements");
58037
- marshal.writeUInt(componentHandle);
58038
- marshal.writeArrayOfUInt(elementIndices);
58138
+ marshal.writeString("RPCGetAABBForScene");
58039
58139
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58040
58140
  const ret = returnMarshal.readBox3();
58041
58141
  return ret;
58042
58142
  }
58043
- async RPCGetAABBForVim(componentHandle) {
58143
+ async RPCGetAABBForVim(vimIndex) {
58044
58144
  const marshal = new Marshal();
58045
58145
  marshal.writeString("RPCGetAABBForVim");
58046
- marshal.writeUInt(componentHandle);
58146
+ marshal.writeUInt(vimIndex);
58047
58147
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58048
58148
  const ret = returnMarshal.readBox3();
58049
58149
  return ret;
@@ -58055,25 +58155,32 @@ void main() {
58055
58155
  const ret = returnMarshal.readString();
58056
58156
  return ret;
58057
58157
  }
58058
- async RPCGetCameraView() {
58158
+ async RPCGetCameraPose() {
58059
58159
  const marshal = new Marshal();
58060
- marshal.writeString("RPCGetCameraView");
58160
+ marshal.writeString("RPCGetCameraPose");
58061
58161
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58062
58162
  const ret = returnMarshal.readSegment();
58063
58163
  return ret;
58064
58164
  }
58065
- async RPCGetElementCount(componentHandle) {
58165
+ async RPCGetElementCountForScene() {
58066
58166
  const marshal = new Marshal();
58067
- marshal.writeString("RPCGetElementCount");
58068
- marshal.writeUInt(componentHandle);
58167
+ marshal.writeString("RPCGetElementCountForScene");
58168
+ const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58169
+ const ret = returnMarshal.readUInt();
58170
+ return ret;
58171
+ }
58172
+ async RPCGetElementCountForVim(vimIndex) {
58173
+ const marshal = new Marshal();
58174
+ marshal.writeString("RPCGetElementCountForVim");
58175
+ marshal.writeUInt(vimIndex);
58069
58176
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58070
58177
  const ret = returnMarshal.readUInt();
58071
58178
  return ret;
58072
58179
  }
58073
- async RPCGetElementIds(componentHandle) {
58180
+ async RPCGetElementIds(vimIndex) {
58074
58181
  const marshal = new Marshal();
58075
58182
  marshal.writeString("RPCGetElementIds");
58076
- marshal.writeUInt(componentHandle);
58183
+ marshal.writeUInt(vimIndex);
58077
58184
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58078
58185
  const ret = returnMarshal.readArrayOfUInt64();
58079
58186
  return ret;
@@ -58085,10 +58192,10 @@ void main() {
58085
58192
  const ret = returnMarshal.readString();
58086
58193
  return ret;
58087
58194
  }
58088
- async RPCGetRoomElements(componentHandle) {
58195
+ async RPCGetRoomElements(vimIndex) {
58089
58196
  const marshal = new Marshal();
58090
58197
  marshal.writeString("RPCGetRoomElements");
58091
- marshal.writeUInt(componentHandle);
58198
+ marshal.writeUInt(vimIndex);
58092
58199
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58093
58200
  const ret = returnMarshal.readArrayOfUInt();
58094
58201
  return ret;
@@ -58100,10 +58207,10 @@ void main() {
58100
58207
  const ret = returnMarshal.readSectionBoxState();
58101
58208
  return ret;
58102
58209
  }
58103
- async RPCGetVimLoadingState(componentHandle) {
58210
+ async RPCGetVimLoadingState(vimIndex) {
58104
58211
  const marshal = new Marshal();
58105
58212
  marshal.writeString("RPCGetVimLoadingState");
58106
- marshal.writeUInt(componentHandle);
58213
+ marshal.writeUInt(vimIndex);
58107
58214
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58108
58215
  const ret = returnMarshal.readVimStatus();
58109
58216
  return ret;
@@ -58193,6 +58300,13 @@ void main() {
58193
58300
  marshal.writeBoolean(orbit2);
58194
58301
  this._socket.sendRPC(marshal);
58195
58302
  }
58303
+ RPCSetCameraPose(state, blendTime) {
58304
+ const marshal = new Marshal();
58305
+ marshal.writeString("RPCSetCameraPose");
58306
+ marshal.writeSegment(state);
58307
+ marshal.writeFloat(blendTime);
58308
+ this._socket.sendRPC(marshal);
58309
+ }
58196
58310
  RPCSetCameraPosition(position, blendTime) {
58197
58311
  const marshal = new Marshal();
58198
58312
  marshal.writeString("RPCSetCameraPosition");
@@ -58213,13 +58327,6 @@ void main() {
58213
58327
  marshal.writeFloat(blendTime);
58214
58328
  this._socket.sendRPC(marshal);
58215
58329
  }
58216
- RPCSetCameraView(state, blendTime) {
58217
- const marshal = new Marshal();
58218
- marshal.writeString("RPCSetCameraView");
58219
- marshal.writeSegment(state);
58220
- marshal.writeFloat(blendTime);
58221
- this._socket.sendRPC(marshal);
58222
- }
58223
58330
  RPCSetGhostColor(ghostColor) {
58224
58331
  const marshal = new Marshal();
58225
58332
  marshal.writeString("RPCSetGhostColor");
@@ -58237,10 +58344,10 @@ void main() {
58237
58344
  marshal.writeRGBA(backgroundColor);
58238
58345
  this._socket.sendRPC(marshal);
58239
58346
  }
58240
- RPCSetMaterialOverrides(componentHandle, elementIndices, materialInstanceHandles) {
58347
+ RPCSetMaterialOverridesForElements(vimIndex, elementIndices, materialInstanceHandles) {
58241
58348
  const marshal = new Marshal();
58242
- marshal.writeString("RPCSetMaterialOverrides");
58243
- marshal.writeUInt(componentHandle);
58349
+ marshal.writeString("RPCSetMaterialOverridesForElements");
58350
+ marshal.writeUInt(vimIndex);
58244
58351
  marshal.writeArrayOfUInt(elementIndices);
58245
58352
  marshal.writeArrayOfUInt(materialInstanceHandles);
58246
58353
  this._socket.sendRPC(marshal);
@@ -58251,25 +58358,31 @@ void main() {
58251
58358
  marshal.writeSectionBoxState(state);
58252
58359
  this._socket.sendRPC(marshal);
58253
58360
  }
58254
- RPCSetStateVim(componentHandle, state) {
58361
+ RPCSetStateElements(vimIndex, elementIndices, state) {
58255
58362
  const marshal = new Marshal();
58256
- marshal.writeString("RPCSetStateVim");
58257
- marshal.writeUInt(componentHandle);
58363
+ marshal.writeString("RPCSetStateElements");
58364
+ marshal.writeUInt(vimIndex);
58365
+ marshal.writeArrayOfUInt(elementIndices);
58258
58366
  marshal.writeUInt(state);
58259
58367
  this._socket.sendRPC(marshal);
58260
58368
  }
58261
- RPCSetStateElements(componentHandle, elementIndices, state) {
58369
+ RPCSetStateScene(state) {
58262
58370
  const marshal = new Marshal();
58263
- marshal.writeString("RPCSetStateElements");
58264
- marshal.writeUInt(componentHandle);
58265
- marshal.writeArrayOfUInt(elementIndices);
58371
+ marshal.writeString("RPCSetStateScene");
58372
+ marshal.writeUInt(state);
58373
+ this._socket.sendRPC(marshal);
58374
+ }
58375
+ RPCSetStateVim(vimIndex, state) {
58376
+ const marshal = new Marshal();
58377
+ marshal.writeString("RPCSetStateVim");
58378
+ marshal.writeUInt(vimIndex);
58266
58379
  marshal.writeUInt(state);
58267
58380
  this._socket.sendRPC(marshal);
58268
58381
  }
58269
- RPCSetStatesElements(componentHandle, elementIndices, states) {
58382
+ RPCSetStatesElements(vimIndex, elementIndices, states) {
58270
58383
  const marshal = new Marshal();
58271
58384
  marshal.writeString("RPCSetStatesElements");
58272
- marshal.writeUInt(componentHandle);
58385
+ marshal.writeUInt(vimIndex);
58273
58386
  marshal.writeArrayOfUInt(elementIndices);
58274
58387
  marshal.writeArrayOfUInt(states);
58275
58388
  this._socket.sendRPC(marshal);
@@ -58297,12 +58410,6 @@ void main() {
58297
58410
  marshal.writeString("RPCUnloadAll");
58298
58411
  this._socket.sendRPC(marshal);
58299
58412
  }
58300
- RPCUnloadVim(componentHandle) {
58301
- const marshal = new Marshal();
58302
- marshal.writeString("RPCUnloadVim");
58303
- marshal.writeUInt(componentHandle);
58304
- this._socket.sendRPC(marshal);
58305
- }
58306
58413
  }
58307
58414
  class RemoteColor {
58308
58415
  /**
@@ -58334,35 +58441,7 @@ void main() {
58334
58441
  * @returns {number} The color value as a hexadecimal number.
58335
58442
  */
58336
58443
  get hex() {
58337
- return this.color.hex;
58338
- }
58339
- /**
58340
- * Gets the red component of the color.
58341
- * @returns {number} The red component value in the range [0-255].
58342
- */
58343
- get r() {
58344
- return this.color.r;
58345
- }
58346
- /**
58347
- * Gets the green component of the color.
58348
- * @returns {number} The green component value in the range [0-255].
58349
- */
58350
- get g() {
58351
- return this.color.g;
58352
- }
58353
- /**
58354
- * Gets the blue component of the color.
58355
- * @returns {number} The blue component value in the range [0-255].
58356
- */
58357
- get b() {
58358
- return this.color.b;
58359
- }
58360
- /**
58361
- * Gets the alpha (opacity) component of the color.
58362
- * @returns {number} The alpha component value in the range [0-255].
58363
- */
58364
- get a() {
58365
- return this.color.a;
58444
+ return this.color.getHex();
58366
58445
  }
58367
58446
  /**
58368
58447
  * Disposes of the color handle and releases associated resources.
@@ -58375,6 +58454,12 @@ void main() {
58375
58454
  this._disposed = true;
58376
58455
  }
58377
58456
  }
58457
+ function RGBAfromThree(color, opacity = 1) {
58458
+ return new RGBA(color.r, color.g, color.b, opacity);
58459
+ }
58460
+ function RGBA32fromThree(color, opacity = 1) {
58461
+ return RGBA32.fromFloats(color.r, color.g, color.b, opacity);
58462
+ }
58378
58463
  const MAX_BATCH_SIZE = 3e3;
58379
58464
  class ColorManager {
58380
58465
  /**
@@ -58394,39 +58479,48 @@ void main() {
58394
58479
  * @param hex - The RGBA32 color value
58395
58480
  * @returns Promise resolving to a ColorHandle, or undefined if creation fails
58396
58481
  */
58397
- async getColor(hex) {
58398
- const colors = await this.getColors([hex]);
58482
+ async getColor(color) {
58483
+ const colors = await this.getColors([color]);
58399
58484
  if (!colors) return void 0;
58400
58485
  return colors[0];
58401
58486
  }
58402
58487
  /**
58403
58488
  * Creates or retrieves cached color instances for multiple hex values.
58404
- * @param c - Array of RGBA32 color values
58489
+ * @param colors - Array of color values or undefined for no color
58405
58490
  * @returns Promise resolving to an array of ColorHandles in the same order as input, or undefined if creation fails
58406
58491
  * @remarks Duplicate hex values will be mapped to the same color instance for efficiency
58407
58492
  */
58408
- async getColors(c) {
58409
- const result = new Array(c.length);
58493
+ async getColors(colors) {
58494
+ const result = new Array(colors.length);
58410
58495
  const hexToIndices = /* @__PURE__ */ new Map();
58411
58496
  const toCreate = [];
58412
- for (let i2 = 0; i2 < c.length; i2++) {
58413
- const color = c[i2];
58414
- if (this._hexToColor.has(color.hex)) {
58415
- result[i2] = this._hexToColor.get(color.hex);
58416
- } else if (hexToIndices.has(color.hex)) {
58417
- hexToIndices.get(color.hex).push(i2);
58418
- } else {
58419
- toCreate.push(color);
58420
- hexToIndices.set(color.hex, [i2]);
58497
+ for (let i2 = 0; i2 < colors.length; i2++) {
58498
+ const color = colors[i2];
58499
+ if (color === void 0) {
58500
+ result[i2] = void 0;
58501
+ continue;
58502
+ }
58503
+ const hex = (color == null ? void 0 : color.getHex()) ?? -1;
58504
+ const remoteColor = this._hexToColor.get(hex);
58505
+ if (remoteColor) {
58506
+ result[i2] = remoteColor;
58507
+ continue;
58508
+ }
58509
+ const indices = hexToIndices.get(hex);
58510
+ if (indices) {
58511
+ hexToIndices.get(hex).push(i2);
58512
+ continue;
58421
58513
  }
58514
+ toCreate.push(color);
58515
+ hexToIndices.set(hex, [i2]);
58422
58516
  }
58423
- const colors = await this._createColors(toCreate);
58424
- if (!colors) return void 0;
58425
- for (let i2 = 0; i2 < colors.length; i2++) {
58517
+ const remoteColors = await this._createColors(toCreate);
58518
+ if (!remoteColors) return void 0;
58519
+ for (let i2 = 0; i2 < remoteColors.length; i2++) {
58426
58520
  const color = toCreate[i2];
58427
- const indices = hexToIndices.get(color.hex);
58521
+ const indices = hexToIndices.get(color.getHex());
58428
58522
  for (const index2 of indices) {
58429
- result[index2] = colors[i2];
58523
+ result[index2] = remoteColors[i2];
58430
58524
  }
58431
58525
  }
58432
58526
  return result;
@@ -58469,7 +58563,8 @@ void main() {
58469
58563
  if (colors.length === 0) {
58470
58564
  return result;
58471
58565
  }
58472
- const instances = await this._rpc.RPCCreateMaterialInstances(MaterialHandles.StandardOpaque, 1, colors);
58566
+ const rpcColors = colors.map((c) => RGBA32fromThree(c));
58567
+ const instances = await this._rpc.RPCCreateMaterialInstances(MaterialHandles.StandardOpaque, 1, rpcColors);
58473
58568
  if (!instances) return void 0;
58474
58569
  for (let i2 = 0; i2 < colors.length; i2++) {
58475
58570
  const color = this._createColor(colors[i2], instances[i2]);
@@ -58486,7 +58581,7 @@ void main() {
58486
58581
  */
58487
58582
  _createColor(color, id2) {
58488
58583
  const handle = new RemoteColor(color, id2, this);
58489
- this._hexToColor.set(color.hex, handle);
58584
+ this._hexToColor.set(color.getHex(), handle);
58490
58585
  this._idToColor.set(handle.id, handle);
58491
58586
  return handle;
58492
58587
  }
@@ -58828,6 +58923,7 @@ void main() {
58828
58923
  }
58829
58924
  }
58830
58925
  const CODE_TO_KEYCODE = {
58926
+ "Space": 32,
58831
58927
  "ArrowUp": 38,
58832
58928
  "ArrowDown": 40,
58833
58929
  "ArrowLeft": 37,
@@ -58861,6 +58957,9 @@ void main() {
58861
58957
  toggleOrthographic: () => {
58862
58958
  console.log("toggleOrthographic. Not supported yet");
58863
58959
  },
58960
+ toggleCameraOrbitMode: () => {
58961
+ viewer.rpc.RPCKeyEvent(CODE_TO_KEYCODE["Space"], true);
58962
+ },
58864
58963
  resetCamera: () => {
58865
58964
  viewer.camera.restoreSavedPosition();
58866
58965
  },
@@ -59053,9 +59152,9 @@ void main() {
59053
59152
  if (!Validation.isRelativeVector2(position)) return void 0;
59054
59153
  const test2 = await this._rpc.RPCPerformHitTest(position);
59055
59154
  if (!test2) return void 0;
59056
- const vim = this._vims.getFromHandle(test2.vimHandle);
59155
+ const vim = this._vims.getFromHandle(test2.vimIndex);
59057
59156
  if (!vim) return void 0;
59058
- const object = vim.getElement(test2.elementIndex);
59157
+ const object = vim.getElement(test2.vimElementIndex);
59059
59158
  if (!object) return void 0;
59060
59159
  return new UltraRaycastResult(
59061
59160
  object,
@@ -59084,7 +59183,7 @@ void main() {
59084
59183
  hdrScale: 1.37,
59085
59184
  hdrBackgroundScale: 1,
59086
59185
  hdrBackgroundSaturation: 1,
59087
- backGroundBlur: 1,
59186
+ backgroundBlur: 1,
59088
59187
  backgroundColor: new RGBA(0.9, 0.9, 0.9, 1)
59089
59188
  };
59090
59189
  var VimLoadingStatus = /* @__PURE__ */ ((VimLoadingStatus2) => {
@@ -59097,15 +59196,26 @@ void main() {
59097
59196
  return VimLoadingStatus2;
59098
59197
  })(VimLoadingStatus || {});
59099
59198
  class RpcSafeClient {
59199
+ /**
59200
+ * Creates a new RpcSafeClient instance.
59201
+ * @param rpc - The underlying RpcClient used for communication
59202
+ * @param batchSize - Maximum size of batched data for operations (default: 10000)
59203
+ */
59100
59204
  constructor(rpc, batchSize = defaultBatchSize) {
59101
59205
  __publicField(this, "rpc");
59102
59206
  __publicField(this, "batchSize");
59103
59207
  this.rpc = rpc;
59104
59208
  this.batchSize = batchSize;
59105
59209
  }
59210
+ /**
59211
+ * The URL used by the underlying RPC connection.
59212
+ */
59106
59213
  get url() {
59107
59214
  return this.rpc.url;
59108
59215
  }
59216
+ /**
59217
+ * Indicates whether the RPC client is currently connected.
59218
+ */
59109
59219
  get connected() {
59110
59220
  return this.rpc.connected;
59111
59221
  }
@@ -59115,9 +59225,10 @@ void main() {
59115
59225
  * and scene-wide settings.
59116
59226
  ******************************************************************************/
59117
59227
  /**
59118
- * Initializes and starts the scene with specified settings.
59228
+ * Initializes and starts the scene with the given settings.
59119
59229
  * @param settings - Optional partial scene settings to override defaults
59120
- * @remarks If no settings are provided, default values will be used
59230
+ * @returns Promise resolving to true if the scene started successfully, false otherwise
59231
+ * @remarks Missing values will be filled from {@link defaultSceneSettings}
59121
59232
  */
59122
59233
  async RPCStartScene(settings2) {
59123
59234
  const s = { ...defaultSceneSettings, ...settings2 ?? {} };
@@ -59127,15 +59238,15 @@ void main() {
59127
59238
  Validation.min0(s.hdrScale),
59128
59239
  Validation.clamp01(s.hdrBackgroundScale),
59129
59240
  Validation.clamp01(s.hdrBackgroundSaturation),
59130
- Validation.clamp01(s.backGroundBlur),
59241
+ Validation.clamp01(s.backgroundBlur),
59131
59242
  Validation.clampRGBA01(s.backgroundColor)
59132
59243
  ),
59133
59244
  false
59134
59245
  );
59135
59246
  }
59136
59247
  /**
59137
- * Sets the lighting settings for the scene.
59138
- * @param settings - The lighting settings to apply
59248
+ * Updates the scene’s lighting configuration.
59249
+ * @param settings - The complete lighting and background settings to apply
59139
59250
  */
59140
59251
  RPCSetLighting(settings2) {
59141
59252
  const s = settings2;
@@ -59144,43 +59255,80 @@ void main() {
59144
59255
  Validation.min0(s.hdrScale),
59145
59256
  Validation.clamp01(s.hdrBackgroundScale),
59146
59257
  Validation.clamp01(s.hdrBackgroundSaturation),
59147
- Validation.clamp01(s.backGroundBlur),
59258
+ Validation.clamp01(s.backgroundBlur),
59148
59259
  Validation.clampRGBA01(s.backgroundColor)
59149
59260
  );
59150
59261
  }
59151
- /*******************************************************************************
59152
- * NODE VISIBILITY METHODS
59153
- * Methods for controlling node visibility, including show/hide, ghosting,
59154
- * and highlighting functionality.
59155
- ******************************************************************************/
59156
59262
  /**
59157
- * Highlights specified nodes in a component.
59158
- * Large node arrays are automatically processed in batches.
59159
- * @param componentHandle - The component containing the nodes
59160
- * @param nodes - Array of node indices to highlight
59161
- * @throws {Error} If the component handle is invalid or nodes array is invalid
59162
- */
59163
- RPCSetStateElements(componentHandle, elements, state) {
59164
- if (elements.length === 0) return;
59165
- if (!Validation.isComponentHandle(componentHandle)) return;
59166
- if (!Validation.areComponentHandles(elements)) return;
59167
- const batches = batchArray(elements, this.batchSize);
59168
- for (const batch of batches) {
59169
- this.rpc.RPCSetStateElements(componentHandle, batch, state);
59170
- }
59171
- }
59172
- RPCSetStatesElements(componentHandle, elements, states) {
59173
- if (!Validation.isComponentHandle(componentHandle)) return;
59174
- if (!Validation.areComponentHandles(elements)) return;
59175
- if (!Validation.areSameLength(elements, states)) return;
59176
- const batches = batchArrays(elements, states, this.batchSize);
59177
- for (const [batchedElements, batchedStates] of batches) {
59178
- this.rpc.RPCSetStatesElements(componentHandle, batchedElements, batchedStates);
59263
+ * Retrieves the total number of elements across the entire scene.
59264
+ * @returns Promise resolving to the total number of elements (0 on failure).
59265
+ */
59266
+ RPCGetElementCountForScene() {
59267
+ return this.safeCall(
59268
+ () => this.rpc.RPCGetElementCountForScene(),
59269
+ 0
59270
+ );
59271
+ }
59272
+ /**
59273
+ * Retrieves the number of elements within a specific loaded vim.
59274
+ * @param vimIndex - Index of the loaded vim to query
59275
+ * @returns Promise resolving to the element count (0 on failure)
59276
+ */
59277
+ RPCGetElementCountForVim(vimIndex) {
59278
+ return this.safeCall(
59279
+ () => this.rpc.RPCGetElementCountForVim(vimIndex),
59280
+ 0
59281
+ );
59282
+ }
59283
+ /*******************************************************************************
59284
+ * ELEMENTS VISIBILITY METHODS
59285
+ * Methods for controlling element visibility, including show/hide, ghosting,
59286
+ * and highlighting functionality.
59287
+ ******************************************************************************/
59288
+ /**
59289
+ * Sets a single visibility state for given elements within a loaded vim.
59290
+ * The operation is automatically split into batches if the array is large.
59291
+ *
59292
+ * @param vimIndex - The index of the loaded vim containing the elements
59293
+ * @param vimElementIndices - Array of vim-based element indices to apply the state to
59294
+ * @param state - The visibility state to apply (e.g., VISIBLE, HIDDEN)
59295
+ */
59296
+ RPCSetStateElements(vimIndex, vimElementIndices, state) {
59297
+ if (vimElementIndices.length === 0) return;
59298
+ if (!Validation.isIndex(vimIndex)) return;
59299
+ if (!Validation.areIndices(vimElementIndices)) return;
59300
+ const batches = batchArray(vimElementIndices, this.batchSize);
59301
+ for (const batch of batches) {
59302
+ this.rpc.RPCSetStateElements(vimIndex, batch, state);
59303
+ }
59304
+ }
59305
+ /**
59306
+ * Sets individual visibility states for multiple elements in a vim.
59307
+ * Each element receives a corresponding visibility state from the input array.
59308
+ * The operation is automatically split into batches if the array is large.
59309
+ *
59310
+ * @param vimIndex - The index of the loaded vim
59311
+ * @param vimElementIndices - Array of vim-based element indices
59312
+ * @param states - Array of visibility states to apply, one per element
59313
+ */
59314
+ RPCSetStatesElements(vimIndex, vimElementIndices, states) {
59315
+ if (!Validation.isIndex(vimIndex)) return;
59316
+ if (!Validation.areIndices(vimElementIndices)) return;
59317
+ if (!Validation.areSameLength(vimElementIndices, states)) return;
59318
+ const batches = batchArrays(vimElementIndices, states, this.batchSize);
59319
+ for (const [batchedElements, batchedStates] of batches) {
59320
+ this.rpc.RPCSetStatesElements(vimIndex, batchedElements, batchedStates);
59179
59321
  }
59180
59322
  }
59181
- RPCSetStateVim(componentHandle, state) {
59182
- if (!Validation.isComponentHandle(componentHandle)) return;
59183
- this.rpc.RPCSetStateVim(componentHandle, state);
59323
+ /**
59324
+ * Applies a single visibility state to all elements of a loaded vim.
59325
+ *
59326
+ * @param vimIndex - The index of the loaded vim
59327
+ * @param state - The visibility state to apply (e.g., VISIBLE, HIDDEN)
59328
+ */
59329
+ RPCSetStateVim(vimIndex, state) {
59330
+ if (!Validation.isIndex(vimIndex)) return;
59331
+ this.rpc.RPCSetStateVim(vimIndex, state);
59184
59332
  }
59185
59333
  /*******************************************************************************
59186
59334
  * TEXT AND UI METHODS
@@ -59192,7 +59340,6 @@ void main() {
59192
59340
  * @param color - The color of the text
59193
59341
  * @param text - The content to display
59194
59342
  * @returns Promise resolving to the handle of the created text component
59195
- * @throws {Error} If the text is empty
59196
59343
  */
59197
59344
  async RPCCreateText(position, color, text) {
59198
59345
  if (!Validation.isNonEmptyString(text)) return INVALID_HANDLE;
@@ -59205,19 +59352,26 @@ void main() {
59205
59352
  /**
59206
59353
  * Destroys a text component, removing it from the scene.
59207
59354
  * @param componentHandle - The handle of the text component to destroy
59208
- * @throws {Error} If the component handle is invalid
59209
59355
  */
59210
59356
  RPCDestroyText(componentHandle) {
59211
- if (!Validation.isComponentHandle(componentHandle)) return;
59357
+ if (!Validation.isIndex(componentHandle)) return;
59212
59358
  this.rpc.RPCDestroyText(componentHandle);
59213
59359
  }
59214
59360
  /*******************************************************************************
59215
59361
  * SECTION BOX METHODS
59216
59362
  * Methods for controlling section box visibility and position.
59217
59363
  ******************************************************************************/
59364
+ /**
59365
+ * Enables or disables the section box.
59366
+ * @param enable - True to enable the section box, false to disable it
59367
+ */
59218
59368
  RPCEnableSectionBox(enable) {
59219
59369
  this.rpc.RPCEnableSectionBox(enable);
59220
59370
  }
59371
+ /**
59372
+ * Sets the parameters of the section box.
59373
+ * @param state - The new section box state, including visibility and bounding box
59374
+ */
59221
59375
  RPCSetSectionBox(state) {
59222
59376
  this.rpc.RPCSetSectionBox(
59223
59377
  {
@@ -59226,6 +59380,10 @@ void main() {
59226
59380
  }
59227
59381
  );
59228
59382
  }
59383
+ /**
59384
+ * Retrieves the current section box state.
59385
+ * @returns Promise resolving to the section box state or undefined on failure
59386
+ */
59229
59387
  async RPCGetSectionBox() {
59230
59388
  return await this.safeCall(
59231
59389
  () => this.rpc.RPCGetSectionBox(),
@@ -59242,7 +59400,7 @@ void main() {
59242
59400
  */
59243
59401
  async RPCGetCameraView() {
59244
59402
  return await this.safeCall(
59245
- () => this.rpc.RPCGetCameraView(),
59403
+ () => this.rpc.RPCGetCameraPose(),
59246
59404
  void 0
59247
59405
  );
59248
59406
  }
@@ -59254,7 +59412,7 @@ void main() {
59254
59412
  RPCSetCameraView(segment, blendTime) {
59255
59413
  if (!Validation.isValidSegment(segment)) return;
59256
59414
  blendTime = Validation.clamp01(blendTime);
59257
- this.rpc.RPCSetCameraView(segment, blendTime);
59415
+ this.rpc.RPCSetCameraPose(segment, blendTime);
59258
59416
  }
59259
59417
  /**
59260
59418
  * Sets the camera's position without changing its target.
@@ -59282,52 +59440,52 @@ void main() {
59282
59440
  }
59283
59441
  /**
59284
59442
  * Retrieves the axis-aligned bounding box (AABB) that encompasses the entire scene.
59285
- * This includes all loaded geometry across all VIM components.
59443
+ * This includes all loaded geometry across all loaded vims.
59286
59444
  *
59287
59445
  * @returns Promise resolving to the global AABB of the scene, or undefined on failure
59288
59446
  */
59289
- RPCGetAABBForAll() {
59447
+ RPCGetAABBForScene() {
59290
59448
  return this.safeCall(
59291
- () => this.rpc.RPCGetAABBForAll(),
59449
+ () => this.rpc.RPCGetAABBForScene(),
59292
59450
  void 0
59293
59451
  );
59294
59452
  }
59295
59453
  /**
59296
- * Retrieves the axis-aligned bounding box (AABB) for a specific VIM component.
59297
- * This bounding box represents the spatial bounds of all geometry within the given component.
59454
+ * Retrieves the axis-aligned bounding box (AABB) for a specific loaded vim.
59455
+ * This bounding box represents the spatial bounds of all geometry within the given loaded vim.
59298
59456
  *
59299
- * @param componentHandle - The handle of the VIM component to query
59300
- * @returns Promise resolving to the component’s bounding box, or undefined on failure
59457
+ * @param vimIndex - The index of the loaded vim to query
59458
+ * @returns Promise resolving to the vim bounding box, or undefined on failure
59301
59459
  */
59302
- async RPCGetAABBForVim(componentHandle) {
59460
+ async RPCGetAABBForVim(vimIndex) {
59461
+ if (!Validation.isIndex(vimIndex)) return void 0;
59303
59462
  return await this.safeCall(
59304
- () => this.rpc.RPCGetAABBForVim(componentHandle),
59463
+ () => this.rpc.RPCGetAABBForVim(vimIndex),
59305
59464
  void 0
59306
59465
  );
59307
59466
  }
59308
59467
  /**
59309
- * Calculates the bounding box for specified nodes in a component.
59310
- * Large node arrays are automatically processed in batches for better performance.
59311
- * @param componentHandle - The component containing the nodes
59312
- * @param elements - Array of node indices to calculate bounds for
59313
- * @returns Promise resolving to the combined bounding box
59314
- * @throws {Error} If the component handle is invalid or nodes array is invalid
59468
+ * Calculates the bounding box for specified elements of a loaded vim.
59469
+ * Large element arrays are automatically processed in batches.
59470
+ * @param vimIndex - The index of the loaded vim
59471
+ * @param vimElementIndices - Array of vim-based element indices to calculate bounds for
59472
+ * @returns Promise resolving to the combined bounding box or undefined on failure
59315
59473
  */
59316
- async RPCGetAABBForElements(componentHandle, elements) {
59317
- if (!Validation.isComponentHandle(componentHandle)) return;
59318
- if (!Validation.areComponentHandles(elements)) return;
59474
+ async RPCGetAABBForElements(vimIndex, vimElementIndices) {
59475
+ if (!Validation.isIndex(vimIndex)) return;
59476
+ if (!Validation.areIndices(vimElementIndices)) return;
59319
59477
  return await this.safeCall(
59320
- () => this.RPCGetAABBForElementsBatched(componentHandle, elements),
59478
+ () => this.RPCGetAABBForElementsBatched(vimIndex, vimElementIndices),
59321
59479
  void 0
59322
59480
  );
59323
59481
  }
59324
- async RPCGetAABBForElementsBatched(componentHandle, elements) {
59325
- if (elements.length === 0) {
59482
+ async RPCGetAABBForElementsBatched(vimIndex, vimElementIndices) {
59483
+ if (vimElementIndices.length === 0) {
59326
59484
  return new Box3();
59327
59485
  }
59328
- const batches = batchArray(elements, this.batchSize);
59486
+ const batches = batchArray(vimElementIndices, this.batchSize);
59329
59487
  const promises = batches.map(async (batch) => {
59330
- const aabb = await this.rpc.RPCGetAABBForElements(componentHandle, batch);
59488
+ const aabb = await this.rpc.RPCGetAABBForElements(vimIndex, batch);
59331
59489
  const v1 = new Vector3(aabb.min.x, aabb.min.y, aabb.min.z);
59332
59490
  const v2 = new Vector3(aabb.max.x, aabb.max.y, aabb.max.z);
59333
59491
  return new Box3(v1, v2);
@@ -59338,53 +59496,51 @@ void main() {
59338
59496
  return box;
59339
59497
  }
59340
59498
  /**
59341
- * Frames the camera to show all components in the scene.
59499
+ * Frames the camera to show all elements in the scene.
59342
59500
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59343
59501
  * @returns Promise resolving to camera segment representing the final position
59344
59502
  */
59345
- async RPCFrameAll(blendTime) {
59503
+ async RPCFrameScene(blendTime) {
59346
59504
  blendTime = Validation.clamp01(blendTime);
59347
59505
  return await this.safeCall(
59348
- () => this.rpc.RPCFrameAll(blendTime),
59506
+ () => this.rpc.RPCFrameScene(blendTime),
59349
59507
  void 0
59350
59508
  );
59351
59509
  }
59352
59510
  /**
59353
- * Frames a specific VIM component in the scene.
59354
- * @param componentHandle - The handle of the VIM component to frame
59511
+ * Frames a specific vim in the scene.
59512
+ * @param vimIndex - The index of the loaded vim to frame
59355
59513
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59356
59514
  * @returns Promise resolving to camera segment representing the final position
59357
- * @throws {Error} If the component handle is invalid
59358
59515
  */
59359
- async RPCFrameVim(componentHandle, blendTime) {
59360
- if (!Validation.isComponentHandle(componentHandle)) return;
59516
+ async RPCFrameVim(vimIndex, blendTime) {
59517
+ if (!Validation.isIndex(vimIndex)) return;
59361
59518
  blendTime = Validation.clamp01(blendTime);
59362
59519
  return await this.safeCall(
59363
- () => this.rpc.RPCFrameVim(componentHandle, blendTime),
59520
+ () => this.rpc.RPCFrameVim(vimIndex, blendTime),
59364
59521
  void 0
59365
59522
  );
59366
59523
  }
59367
59524
  /**
59368
- * Frames specific instances within a component. For large numbers of instances,
59369
- * automatically switches to bounding box framing for better performance.
59370
- * @param componentHandle - The component containing the instances
59371
- * @param elements - Array of node indices to frame
59525
+ * Frames specific elements of a loaded vim.
59526
+ * Automatically batches large arrays of elements.
59527
+ * @param vimIndex - The index of the loaded vim
59528
+ * @param vimElementIndices - Array of vim-based element indices to frame
59372
59529
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59373
59530
  * @returns Promise resolving to camera segment representing the final position
59374
- * @throws {Error} If the component handle is invalid or nodes array is empty
59375
59531
  */
59376
- async RPCFrameElements(componentHandle, elements, blendTime) {
59377
- if (!Validation.isComponentHandle(componentHandle)) return;
59378
- if (!Validation.areComponentHandles(elements)) return;
59532
+ async RPCFrameElements(vimIndex, vimElementIndices, blendTime) {
59533
+ if (!Validation.isIndex(vimIndex)) return;
59534
+ if (!Validation.areIndices(vimElementIndices)) return;
59379
59535
  blendTime = Validation.clamp01(blendTime);
59380
- if (elements.length < this.batchSize) {
59536
+ if (vimElementIndices.length < this.batchSize) {
59381
59537
  return await this.safeCall(
59382
- () => this.rpc.RPCFrameElements(componentHandle, elements, blendTime),
59538
+ () => this.rpc.RPCFrameElements(vimIndex, vimElementIndices, blendTime),
59383
59539
  void 0
59384
59540
  );
59385
59541
  } else {
59386
59542
  const box = await this.safeCall(
59387
- () => this.RPCGetAABBForElementsBatched(componentHandle, elements),
59543
+ () => this.RPCGetAABBForElementsBatched(vimIndex, vimElementIndices),
59388
59544
  void 0
59389
59545
  );
59390
59546
  if (!box) return void 0;
@@ -59398,7 +59554,6 @@ void main() {
59398
59554
  * Frames the camera to show a specific bounding box.
59399
59555
  * @param box - The bounding box to frame
59400
59556
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59401
- * @throws {Error} If the box is invalid (min values must be less than max values)
59402
59557
  */
59403
59558
  async RPCFrameAABB(box, blendTime) {
59404
59559
  if (!Validation.isValidBox(box)) return;
@@ -59415,12 +59570,15 @@ void main() {
59415
59570
  /**
59416
59571
  * Sets the camera movement speed.
59417
59572
  * @param speed - The desired movement speed (must be positive)
59418
- * @throws {Error} If speed is not positive
59419
59573
  */
59420
59574
  RPCSetCameraSpeed(speed) {
59421
59575
  speed = Validation.min0(speed);
59422
59576
  this.rpc.RPCSetCameraSpeed(speed);
59423
59577
  }
59578
+ /**
59579
+ * Sets the camera control mode.
59580
+ * @param mode - The desired input mode (e.g., {@link InputMode.Orbit} or {@link InputMode.Free})
59581
+ */
59424
59582
  RPCSetCameraMode(mode) {
59425
59583
  this.rpc.RPCSetCameraMode(
59426
59584
  mode === "orbit"
@@ -59429,9 +59587,8 @@ void main() {
59429
59587
  }
59430
59588
  /**
59431
59589
  * Sets the viewer's aspect ratio.
59432
- * @param width - The width component of the aspect ratio
59433
- * @param height - The height component of the aspect ratio
59434
- * @throws {Error} If width or height are not positive integers
59590
+ * @param width - The width of the desired aspect ratio
59591
+ * @param height - The height of the desired aspect ratio
59435
59592
  */
59436
59593
  RPCSetCameraAspectRatio(width, height) {
59437
59594
  if (!Validation.isPositiveInteger(width)) return;
@@ -59440,13 +59597,12 @@ void main() {
59440
59597
  }
59441
59598
  /*******************************************************************************
59442
59599
  * VIM FILE MANAGEMENT METHODS
59443
- * Methods for loading, unloading, and managing VIM files and components.
59600
+ * Methods for loading, unloading, and managing VIM files.
59444
59601
  ******************************************************************************/
59445
59602
  /**
59446
59603
  * Loads a VIM file from the local filesystem.
59447
59604
  * @param source - The path to the VIM file (supports file:// protocol)
59448
- * @returns Promise resolving to the handle of the loaded VIM component
59449
- * @throws {Error} If the filename is invalid or empty
59605
+ * @returns Promise resolving to the index of the loaded vim
59450
59606
  */
59451
59607
  async RPCLoadVim(source) {
59452
59608
  if (!Validation.isNonEmptyString(source.url)) return INVALID_HANDLE;
@@ -59458,9 +59614,8 @@ void main() {
59458
59614
  }
59459
59615
  /**
59460
59616
  * Loads a VIM file from a remote URL.
59461
- * @param url - The URL of the VIM file to load
59462
- * @returns Promise resolving to the handle of the loaded VIM component
59463
- * @throws {Error} If the URL is invalid
59617
+ * @param source - The URL or file path of the VIM file to load
59618
+ * @returns Promise resolving to the index of the loaded vim
59464
59619
  */
59465
59620
  async RPCLoadVimURL(source) {
59466
59621
  if (!Validation.isURL(source.url)) return INVALID_HANDLE;
@@ -59470,17 +59625,16 @@ void main() {
59470
59625
  );
59471
59626
  }
59472
59627
  /**
59473
- * Retrieves the current loading state and progress of a VIM component.
59474
- * @param componentHandle - The handle of the VIM component
59628
+ * Retrieves the current loading state and progress of a vim.
59629
+ * @param vimIndex - The index of the vim being loaded
59475
59630
  * @returns Promise resolving to the current loading state and progress
59476
- * @throws {Error} If the component handle is invalid
59477
59631
  */
59478
- async RPCGetVimLoadingState(componentHandle) {
59479
- if (!Validation.isComponentHandle(componentHandle)) {
59632
+ async RPCGetVimLoadingState(vimIndex) {
59633
+ if (!Validation.isIndex(vimIndex)) {
59480
59634
  return { status: 0, progress: 0 };
59481
59635
  }
59482
59636
  const result = await this.safeCall(
59483
- () => this.rpc.RPCGetVimLoadingState(componentHandle),
59637
+ () => this.rpc.RPCGetVimLoadingState(vimIndex),
59484
59638
  { status: 0, progress: 0 }
59485
59639
  );
59486
59640
  if (!(result.status in VimLoadingStatus)) {
@@ -59489,16 +59643,7 @@ void main() {
59489
59643
  return result;
59490
59644
  }
59491
59645
  /**
59492
- * Unloads a VIM component and frees associated resources.
59493
- * @param componentHandle - The handle of the component to unload
59494
- * @throws {Error} If the component handle is invalid
59495
- */
59496
- RPCUnloadVim(componentHandle) {
59497
- if (!Validation.isComponentHandle(componentHandle)) return;
59498
- this.rpc.RPCUnloadVim(componentHandle);
59499
- }
59500
- /**
59501
- * Clears the entire scene, removing all components and resetting to initial state.
59646
+ * Clears the entire scene, unloading all vims and resetting to initial state.
59502
59647
  */
59503
59648
  RPCUnloadAll() {
59504
59649
  this.rpc.RPCUnloadAll();
@@ -59514,7 +59659,7 @@ void main() {
59514
59659
  /**
59515
59660
  * Performs hit testing at a specified screen position.
59516
59661
  * @param pos - Normalized screen coordinates (0-1, 0-1)
59517
- * @returns Promise resolving to hit test result if something was hit, undefined otherwise
59662
+ * @returns Promise resolving to hit test result if a valid hit was detected, undefined otherwise
59518
59663
  */
59519
59664
  async RPCPerformHitTest(pos) {
59520
59665
  if (!Validation.isRelativeVector2(pos)) return;
@@ -59522,7 +59667,7 @@ void main() {
59522
59667
  () => this.rpc.RPCPerformHitTest(pos),
59523
59668
  void 0
59524
59669
  );
59525
- if (!result || result.nodeIndex < 0) {
59670
+ if (!result || result.vimIndex === INVALID_HANDLE) {
59526
59671
  return void 0;
59527
59672
  }
59528
59673
  return result;
@@ -59532,7 +59677,6 @@ void main() {
59532
59677
  * @param position - The normalized screen coordinates (0-1, 0-1)
59533
59678
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
59534
59679
  * @param down - True if button is pressed down, false if released
59535
- * @throws {Error} If mouseButton is not a valid positive integer
59536
59680
  */
59537
59681
  RPCMouseButtonEvent(position, mouseButton, down) {
59538
59682
  if (!Validation.isPositiveInteger(mouseButton)) return;
@@ -59543,7 +59687,6 @@ void main() {
59543
59687
  * Sends a mouse double-click event to the viewer.
59544
59688
  * @param position - The normalized screen coordinates (0-1, 0-1)
59545
59689
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
59546
- * @throws {Error} If mouseButton is not a valid positive integer
59547
59690
  */
59548
59691
  RPCMouseDoubleClickEvent(position, mouseButton) {
59549
59692
  if (!Validation.isPositiveInteger(mouseButton)) return;
@@ -59570,7 +59713,6 @@ void main() {
59570
59713
  * Sends a mouse selection event to the viewer.
59571
59714
  * @param position - The normalized screen coordinates (0-1, 0-1)
59572
59715
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
59573
- * @throws {Error} If mouseButton is not a valid positive integer
59574
59716
  */
59575
59717
  RPCMouseSelectEvent(position, mouseButton) {
59576
59718
  if (!Validation.isPositiveInteger(mouseButton)) return;
@@ -59597,7 +59739,6 @@ void main() {
59597
59739
  * @param smoothness - The smoothness value to apply (clamped between 0 and 1)
59598
59740
  * @param colors - Array of colors for each material instance
59599
59741
  * @returns Array of handles for the created material instances
59600
- * @throws {Error} If the material handle is invalid or smoothness is out of range
59601
59742
  */
59602
59743
  async RPCCreateMaterialInstances(materialHandle, smoothness, colors) {
59603
59744
  if (!Validation.isMaterialHandle(materialHandle)) return;
@@ -59620,46 +59761,56 @@ void main() {
59620
59761
  }
59621
59762
  /**
59622
59763
  * Destroys multiple material instances, freeing associated resources.
59623
- * @param materialInstanceHandle - Array of handles for material instances to destroy
59624
- * @throws {Error} If any handle in the array is invalid
59764
+ * @param materialInstanceHandles - Array of handles for material instances to destroy
59625
59765
  */
59626
- RPCDestroyMaterialInstances(materialInstanceHandle) {
59627
- if (!Validation.areComponentHandles(materialInstanceHandle)) return;
59628
- this.rpc.RPCDestroyMaterialInstances(materialInstanceHandle);
59766
+ RPCDestroyMaterialInstances(materialInstanceHandles) {
59767
+ if (!Validation.areIndices(materialInstanceHandles)) return;
59768
+ this.rpc.RPCDestroyMaterialInstances(materialInstanceHandles);
59629
59769
  }
59630
59770
  /**
59631
- * Sets material overrides for specific nodes in a component.
59632
- * Large arrays are automatically processed in batches for better performance.
59633
- * @param componentHandle - The component containing the nodes
59634
- * @param nodes - Array of node indices to override
59635
- * @param materialInstanceHandles - Array of material instance handles to apply (must match nodes length)
59636
- * @throws {Error} If arrays have different lengths or any handle is invalid
59771
+ * Sets material overrides for specific elements in a loaded vim.
59772
+ * Large arrays are automatically processed in batches.
59773
+ * @param vimIndex - The index of the loaded vim
59774
+ * @param vimElementIndices - Array of vim-based element indices to override
59775
+ * @param materialInstanceHandles - Array of material instance handles to apply (must match element length)
59637
59776
  */
59638
- RPCSetMaterialOverrides(componentHandle, nodes, materialInstanceHandles) {
59639
- if (!Validation.areSameLength(nodes, materialInstanceHandles)) return;
59640
- if (!Validation.isComponentHandle(componentHandle)) return;
59641
- if (!Validation.areComponentHandles(nodes)) return;
59777
+ RPCSetMaterialOverridesForElements(vimIndex, vimElementIndices, materialInstanceHandles) {
59778
+ if (!Validation.areSameLength(vimElementIndices, materialInstanceHandles)) return;
59779
+ if (!Validation.isIndex(vimIndex)) return;
59780
+ if (!Validation.areIndices(vimElementIndices)) return;
59642
59781
  if (!Validation.areIntegers(materialInstanceHandles)) return;
59643
59782
  this.setMaterialOverridesBatched(
59644
- componentHandle,
59645
- nodes,
59783
+ vimIndex,
59784
+ vimElementIndices,
59646
59785
  materialInstanceHandles
59647
59786
  );
59648
59787
  }
59649
- setMaterialOverridesBatched(componentHandle, nodes, materialInstanceHandles) {
59650
- const batches = batchArrays(nodes, materialInstanceHandles, this.batchSize);
59651
- for (const [batchedNodes, batchedMaterials] of batches) {
59652
- this.rpc.RPCSetMaterialOverrides(componentHandle, batchedNodes, batchedMaterials);
59788
+ setMaterialOverridesBatched(vimIndex, vimElementIndices, materialInstanceHandles) {
59789
+ const batches = batchArrays(vimElementIndices, materialInstanceHandles, this.batchSize);
59790
+ for (const [batchedElements, batchedMaterials] of batches) {
59791
+ this.rpc.RPCSetMaterialOverridesForElements(vimIndex, batchedElements, batchedMaterials);
59653
59792
  }
59654
59793
  }
59655
59794
  /**
59656
- * Clears all material overrides for the specified component, restoring default materials.
59657
- * @param componentHandle - The unique identifier of the component
59658
- * @throws {Error} If the component handle is invalid or INVALID_HANDLE
59795
+ * Clears all material overrides for the entire scene.
59796
+ */
59797
+ RPCClearMaterialOverridesForScene() {
59798
+ this.rpc.RPCClearMaterialOverridesForScene();
59799
+ }
59800
+ /**
59801
+ * Clears all material overrides for a specific loaded vim.
59802
+ * @param vimIndex - The index of the loaded vim
59803
+ */
59804
+ RPCClearMaterialOverridesForVim(vimIndex) {
59805
+ this.rpc.RPCClearMaterialOverridesForVim(vimIndex);
59806
+ }
59807
+ /**
59808
+ * Clears all material overrides for specific elements in a loaded vim.
59809
+ * @param vimIndex - The index of the loaded vim
59810
+ * @param vimElementIndices - Array of vim-based element indices to clear overrides for
59659
59811
  */
59660
- RPCClearMaterialOverrides(componentHandle) {
59661
- if (!Validation.isComponentHandle(componentHandle)) return;
59662
- this.rpc.RPCClearMaterialOverrides(componentHandle);
59812
+ RPCClearMaterialOverridesForElements(vimIndex, vimElementIndices) {
59813
+ this.rpc.RPCClearMaterialOverridesForElements(vimIndex, vimElementIndices);
59663
59814
  }
59664
59815
  /*******************************************************************************
59665
59816
  * DEBUG AND UTILITY METHODS
@@ -59716,7 +59867,8 @@ void main() {
59716
59867
  }
59717
59868
  const defaultRenderSettings = {
59718
59869
  ...defaultSceneSettings,
59719
- ghostColor: new RGBA(14 / 255, 14 / 255, 14 / 255, 64 / 255)
59870
+ ghostColor: new Color(14 / 255, 14 / 255, 14 / 255),
59871
+ ghostOpacity: 64 / 255
59720
59872
  };
59721
59873
  class Renderer {
59722
59874
  /**
@@ -59763,7 +59915,8 @@ void main() {
59763
59915
  * Sets up initial scene settings, ghost color, and IBL rotation
59764
59916
  */
59765
59917
  onConnect() {
59766
- this._rpc.RPCSetGhostColor(this._settings.ghostColor);
59918
+ const color = RGBAfromThree(this._settings.ghostColor, this._settings.ghostOpacity);
59919
+ this._rpc.RPCSetGhostColor(color);
59767
59920
  }
59768
59921
  notifySceneUpdated() {
59769
59922
  this._onSceneUpdated.dispatch();
@@ -59771,11 +59924,14 @@ void main() {
59771
59924
  // Getters
59772
59925
  /**
59773
59926
  * Gets the ghost color used for transparent rendering
59774
- * @returns Current ghost color as RGBA
59927
+ * @returns Current ghost color as a THREE.Color
59775
59928
  */
59776
59929
  get ghostColor() {
59777
59930
  return this._settings.ghostColor;
59778
59931
  }
59932
+ get ghostOpacity() {
59933
+ return this._settings.ghostOpacity;
59934
+ }
59779
59935
  /**
59780
59936
  * Gets the tone mapping white point value
59781
59937
  * @returns Current tone mapping white point
@@ -59809,27 +59965,33 @@ void main() {
59809
59965
  * @returns Current background blur
59810
59966
  */
59811
59967
  get backgroundBlur() {
59812
- return this._settings.backGroundBlur;
59968
+ return this._settings.backgroundBlur;
59813
59969
  }
59814
59970
  /**
59815
59971
  * Gets the background color
59816
59972
  * @returns Current background color as RGBA
59817
59973
  */
59818
59974
  get backgroundColor() {
59819
- return this._settings.backgroundColor;
59975
+ return this._settings.backgroundColor.toThree();
59820
59976
  }
59821
59977
  // Setters
59822
59978
  /**
59823
59979
  * Updates the ghost color used for transparent rendering
59824
- * @param value - New ghost color as RGBA
59980
+ * @param value - New ghost color as THREE.Color
59825
59981
  */
59826
59982
  set ghostColor(value) {
59827
- value = Validation.clampRGBA01(value);
59828
59983
  if (this._settings.ghostColor.equals(value)) return;
59829
59984
  this._settings.ghostColor = value;
59830
59985
  this._updateGhostColor = true;
59831
59986
  this.requestSettingsUpdate();
59832
59987
  }
59988
+ set ghostOpacity(value) {
59989
+ value = Validation.clamp01(value);
59990
+ if (this._settings.ghostOpacity === value) return;
59991
+ this._settings.ghostOpacity = value;
59992
+ this._updateGhostColor = true;
59993
+ this.requestSettingsUpdate();
59994
+ }
59833
59995
  /**
59834
59996
  * Sets the tone mapping white point value
59835
59997
  * @param value - New tone mapping white point value
@@ -59880,24 +60042,24 @@ void main() {
59880
60042
  */
59881
60043
  set backgroundBlur(value) {
59882
60044
  value = Validation.clamp01(value);
59883
- if (this._settings.backGroundBlur === value) return;
59884
- this._settings.backGroundBlur = value;
60045
+ if (this._settings.backgroundBlur === value) return;
60046
+ this._settings.backgroundBlur = value;
59885
60047
  this._updateLighting = true;
59886
60048
  this.requestSettingsUpdate();
59887
60049
  }
59888
60050
  /**
59889
60051
  * Sets the background color
59890
- * @param value - New background color as RGBA
60052
+ * @param value - New background color as THREE.Color
59891
60053
  */
59892
60054
  set backgroundColor(value) {
59893
- value = Validation.clampRGBA01(value);
59894
- if (this._settings.backgroundColor.equals(value)) return;
59895
- this._settings.backgroundColor = value;
60055
+ const color = RGBAfromThree(value, 1);
60056
+ if (this._settings.backgroundColor.equals(color)) return;
60057
+ this._settings.backgroundColor = color;
59896
60058
  this._updateLighting = true;
59897
60059
  this.requestSettingsUpdate();
59898
60060
  }
59899
60061
  getBoundingBox() {
59900
- return this._rpc.RPCGetAABBForAll();
60062
+ return this._rpc.RPCGetAABBForScene();
59901
60063
  }
59902
60064
  /**
59903
60065
  * Requests an update to be performed on the next animation frame.
@@ -59912,7 +60074,10 @@ void main() {
59912
60074
  }
59913
60075
  async applySettings() {
59914
60076
  if (this._updateLighting) await this._rpc.RPCSetLighting(this._settings);
59915
- if (this._updateGhostColor) await this._rpc.RPCSetGhostColor(this._settings.ghostColor);
60077
+ if (this._updateGhostColor) {
60078
+ const color = RGBAfromThree(this._settings.ghostColor, this._settings.ghostOpacity);
60079
+ await this._rpc.RPCSetGhostColor(color);
60080
+ }
59916
60081
  this._updateLighting = false;
59917
60082
  this._updateGhostColor = false;
59918
60083
  this._animationFrame = void 0;
@@ -60012,7 +60177,7 @@ void main() {
60012
60177
  * Fits the given box, invalid dimensions will be reversed.
60013
60178
  * @param box - The new bounding box.
60014
60179
  */
60015
- fitBox(box) {
60180
+ setBox(box) {
60016
60181
  box = safeBox(box);
60017
60182
  this._box = box;
60018
60183
  this.scheduleUpdate();
@@ -60036,7 +60201,7 @@ void main() {
60036
60201
  VisibilityState2[VisibilityState2["GHOSTED_HIGHLIGHTED"] = 18] = "GHOSTED_HIGHLIGHTED";
60037
60202
  return VisibilityState2;
60038
60203
  })(VisibilityState$1 || {});
60039
- class StateSynchronizer {
60204
+ class VisibilitySynchronizer {
60040
60205
  /**
60041
60206
  * Creates a new StateSynchronizer instance.
60042
60207
  *
@@ -60054,7 +60219,7 @@ void main() {
60054
60219
  __publicField(this, "_onUpdate");
60055
60220
  __publicField(this, "_isConnected");
60056
60221
  __publicField(this, "_animationFrame");
60057
- this._tracker = new StateTracker(defaultState);
60222
+ this._tracker = new VisibilityTracker(defaultState);
60058
60223
  this._rpc = rpc;
60059
60224
  this._onUpdate = onUpdate;
60060
60225
  this._getHandle = getHandle;
@@ -60103,7 +60268,7 @@ void main() {
60103
60268
  * @param elementIndex - The element index to update
60104
60269
  * @param state - The new state to apply
60105
60270
  */
60106
- setElementState(elementIndex, state) {
60271
+ setStateForElement(elementIndex, state) {
60107
60272
  this._tracker.setState(elementIndex, state);
60108
60273
  this.scheduleUpdate();
60109
60274
  }
@@ -60167,7 +60332,7 @@ void main() {
60167
60332
  this._onUpdate();
60168
60333
  }
60169
60334
  }
60170
- class StateTracker {
60335
+ class VisibilityTracker {
60171
60336
  /**
60172
60337
  * Creates a new StateTracker instance.
60173
60338
  *
@@ -60763,6 +60928,12 @@ Averrage Date/Second ${avgDataRatePS} kb
60763
60928
  this._rpc.RPCSetCameraAspectRatio(this.canvas.offsetWidth, this.canvas.offsetHeight);
60764
60929
  }
60765
60930
  }
60931
+ /**
60932
+ * Resizes the viewport to match its parent's dimensions
60933
+ */
60934
+ resizeToParent() {
60935
+ this.update();
60936
+ }
60766
60937
  /**
60767
60938
  * Cleans up resources by removing resize observer and clearing timeouts
60768
60939
  */
@@ -60804,7 +60975,7 @@ Averrage Date/Second ${avgDataRatePS} kb
60804
60975
  return this.vim.visibility.getElementState(this.element);
60805
60976
  }
60806
60977
  set state(state) {
60807
- this.vim.visibility.setElementState(this.element, state);
60978
+ this.vim.visibility.setStateForElement(this.element, state);
60808
60979
  }
60809
60980
  /**
60810
60981
  * Gets or sets the color override of the element.
@@ -60821,11 +60992,12 @@ Averrage Date/Second ${avgDataRatePS} kb
60821
60992
  * @returns A promise resolving to the element's bounding box.
60822
60993
  */
60823
60994
  async getBoundingBox() {
60824
- return this.vim.getBoundingBoxNodes([this.element]);
60995
+ return this.vim.getBoundingBoxForElements([this.element]);
60825
60996
  }
60826
60997
  }
60827
60998
  class Vim {
60828
60999
  constructor(rpc, color, renderer, source, logger) {
61000
+ __publicField(this, "type", "ultra");
60829
61001
  __publicField(this, "source");
60830
61002
  __publicField(this, "_handle", -1);
60831
61003
  __publicField(this, "_request");
@@ -60834,19 +61006,22 @@ Averrage Date/Second ${avgDataRatePS} kb
60834
61006
  __publicField(this, "_renderer");
60835
61007
  __publicField(this, "_logger");
60836
61008
  // The StateSynchronizer wraps a StateTracker and handles RPC synchronization.
61009
+ // Should be private
60837
61010
  __publicField(this, "visibility");
60838
61011
  // Color tracking remains unchanged.
60839
- __publicField(this, "_nodeColors", /* @__PURE__ */ new Map());
61012
+ __publicField(this, "_elementColors", /* @__PURE__ */ new Map());
60840
61013
  __publicField(this, "_updatedColors", /* @__PURE__ */ new Set());
61014
+ __publicField(this, "_removedColors", /* @__PURE__ */ new Set());
60841
61015
  // Delayed update flag.
60842
61016
  __publicField(this, "_updateScheduled", false);
61017
+ __publicField(this, "_elementCount", 0);
60843
61018
  __publicField(this, "_objects", /* @__PURE__ */ new Map());
60844
61019
  this._rpc = rpc;
60845
61020
  this.source = source;
60846
61021
  this._colors = color;
60847
61022
  this._renderer = renderer;
60848
61023
  this._logger = logger;
60849
- this.visibility = new StateSynchronizer(
61024
+ this.visibility = new VisibilitySynchronizer(
60850
61025
  this._rpc,
60851
61026
  () => this._handle,
60852
61027
  () => this.connected,
@@ -60855,6 +61030,7 @@ Averrage Date/Second ${avgDataRatePS} kb
60855
61030
  // default state
60856
61031
  );
60857
61032
  }
61033
+ //TODO: Rename this to getElementFromNode, prefer using element instead
60858
61034
  getElement(elementIndex) {
60859
61035
  if (this._objects.has(elementIndex)) {
60860
61036
  return this._objects.get(elementIndex);
@@ -60867,13 +61043,16 @@ Averrage Date/Second ${avgDataRatePS} kb
60867
61043
  throw new Error("Method not implemented.");
60868
61044
  }
60869
61045
  getElementFromIndex(element) {
60870
- throw new Error("Method not implemented.");
61046
+ return this.getElement(element);
60871
61047
  }
60872
61048
  getObjectsInBox(box) {
60873
61049
  throw new Error("Method not implemented.");
60874
61050
  }
60875
61051
  getAllElements() {
60876
- throw new Error("Method not implemented.");
61052
+ for (var i2 = 0; i2 < this._elementCount; i2++) {
61053
+ this.getElement(i2);
61054
+ }
61055
+ return Array.from(this._objects.values());
60877
61056
  }
60878
61057
  get handle() {
60879
61058
  return this._handle;
@@ -60904,7 +61083,6 @@ Averrage Date/Second ${avgDataRatePS} kb
60904
61083
  (_a3 = this._request) == null ? void 0 : _a3.error("cancelled", "The request was cancelled");
60905
61084
  this._request = void 0;
60906
61085
  if (this.connected) {
60907
- this._rpc.RPCUnloadVim(this._handle);
60908
61086
  this._handle = -1;
60909
61087
  }
60910
61088
  }
@@ -60926,12 +61104,12 @@ Averrage Date/Second ${avgDataRatePS} kb
60926
61104
  case VimLoadingStatus.FailedToDownload:
60927
61105
  case VimLoadingStatus.FailedToLoad:
60928
61106
  case VimLoadingStatus.Unknown:
60929
- this._rpc.RPCUnloadVim(handle);
60930
61107
  const details = await this._rpc.RPCGetLastError();
60931
61108
  const error = this.getErrorType(state.status);
60932
61109
  return result.error(error, details);
60933
61110
  case VimLoadingStatus.Done:
60934
61111
  this._handle = handle;
61112
+ this._elementCount = await this._rpc.RPCGetElementCountForVim(handle);
60935
61113
  return result.success(this);
60936
61114
  }
60937
61115
  } catch (e) {
@@ -60971,14 +61149,14 @@ Averrage Date/Second ${avgDataRatePS} kb
60971
61149
  }
60972
61150
  return handle;
60973
61151
  }
60974
- async getBoundingBoxNodes(nodes) {
60975
- if (!this.connected || nodes !== "all" && nodes.length === 0) {
61152
+ async getBoundingBoxForElements(elements) {
61153
+ if (!this.connected || elements !== "all" && elements.length === 0) {
60976
61154
  return Promise.resolve(void 0);
60977
61155
  }
60978
- if (nodes === "all") {
61156
+ if (elements === "all") {
60979
61157
  return await this._rpc.RPCGetAABBForVim(this._handle);
60980
61158
  }
60981
- return await this._rpc.RPCGetAABBForElements(this._handle, nodes);
61159
+ return await this._rpc.RPCGetAABBForElements(this._handle, elements);
60982
61160
  }
60983
61161
  async getBoundingBox() {
60984
61162
  if (!this.connected) {
@@ -60986,49 +61164,52 @@ Averrage Date/Second ${avgDataRatePS} kb
60986
61164
  }
60987
61165
  return await this._rpc.RPCGetAABBForVim(this._handle);
60988
61166
  }
60989
- getColor(node) {
60990
- return this._nodeColors.get(node);
61167
+ getColor(elementIndex) {
61168
+ return this._elementColors.get(elementIndex);
60991
61169
  }
60992
- async setColor(nodes, color) {
60993
- const colors = new Array(nodes.length).fill(color);
60994
- this.applyColor(nodes, colors);
61170
+ async setColor(elementIndex, color) {
61171
+ const colors = new Array(elementIndex.length).fill(color);
61172
+ this.applyColor(elementIndex, colors);
60995
61173
  }
60996
- async setColors(nodes, color) {
60997
- if (color.length !== nodes.length) {
60998
- throw new Error("Color and nodes length must be equal");
61174
+ async setColors(elements, color) {
61175
+ if (color.length !== elements.length) {
61176
+ throw new Error("Color and elements length must be equal");
60999
61177
  }
61000
- this.applyColor(nodes, color);
61178
+ this.applyColor(elements, color);
61001
61179
  }
61002
- applyColor(nodes, color) {
61003
- for (let i2 = 0; i2 < color.length; i2++) {
61004
- const c = color[i2];
61005
- const n = nodes[i2];
61006
- if (c === void 0) {
61007
- this._nodeColors.delete(n);
61008
- } else {
61009
- this._nodeColors.set(n, c);
61180
+ applyColor(elements, colors) {
61181
+ for (let i2 = 0; i2 < colors.length; i2++) {
61182
+ const color = colors[i2];
61183
+ const element = elements[i2];
61184
+ const existingColor = this._elementColors.get(element);
61185
+ if (color === void 0 && existingColor !== void 0) {
61186
+ this._elementColors.delete(element);
61187
+ this._removedColors.add(element);
61188
+ } else if (color !== existingColor) {
61189
+ this._elementColors.set(element, color);
61190
+ this._updatedColors.add(element);
61010
61191
  }
61011
- this._updatedColors.add(n);
61012
61192
  }
61013
61193
  this.scheduleColorUpdate();
61014
61194
  }
61015
- clearColor(nodes) {
61016
- if (nodes === "all") {
61017
- this._nodeColors.clear();
61195
+ //TODO: Remove and rely on element.color
61196
+ clearColor(elements) {
61197
+ if (elements === "all") {
61198
+ this._elementColors.clear();
61018
61199
  } else {
61019
- nodes.forEach((n) => this._nodeColors.delete(n));
61200
+ elements.forEach((n) => this._elementColors.delete(n));
61020
61201
  }
61021
61202
  if (!this.connected) return;
61022
- if (nodes === "all") {
61023
- this._rpc.RPCClearMaterialOverrides(this._handle);
61203
+ if (elements === "all") {
61204
+ this._rpc.RPCClearMaterialOverridesForVim(this._handle);
61024
61205
  } else {
61025
- const ids = new Array(nodes.length).fill(MaterialHandles.Invalid);
61026
- this._rpc.RPCSetMaterialOverrides(this._handle, nodes, ids);
61206
+ this._rpc.RPCClearMaterialOverridesForElements(this._handle, elements);
61027
61207
  }
61028
61208
  }
61029
61209
  reapplyColors() {
61030
61210
  this._updatedColors.clear();
61031
- this._nodeColors.forEach((c, n) => this._updatedColors.add(n));
61211
+ this._removedColors.clear();
61212
+ this._elementColors.forEach((c, n) => this._updatedColors.add(n));
61032
61213
  this.scheduleColorUpdate();
61033
61214
  }
61034
61215
  scheduleColorUpdate() {
@@ -61044,12 +61225,15 @@ Averrage Date/Second ${avgDataRatePS} kb
61044
61225
  this._renderer.notifySceneUpdated();
61045
61226
  }
61046
61227
  async updateRemoteColors() {
61047
- const nodes = Array.from(this._updatedColors);
61048
- const colors = nodes.map((n) => this._nodeColors.get(n));
61228
+ const updatedElement = Array.from(this._updatedColors);
61229
+ const removedElement = Array.from(this._removedColors);
61230
+ const colors = updatedElement.map((n) => this._elementColors.get(n));
61049
61231
  const remoteColors = await this._colors.getColors(colors);
61050
61232
  const colorIds = remoteColors.map((c) => (c == null ? void 0 : c.id) ?? -1);
61051
- this._rpc.RPCSetMaterialOverrides(this._handle, nodes, colorIds);
61233
+ this._rpc.RPCClearMaterialOverridesForElements(this._handle, removedElement);
61234
+ this._rpc.RPCSetMaterialOverridesForElements(this._handle, updatedElement, colorIds);
61052
61235
  this._updatedColors.clear();
61236
+ this._removedColors.clear();
61053
61237
  }
61054
61238
  }
61055
61239
  function wait(ms) {
@@ -61126,6 +61310,11 @@ Averrage Date/Second ${avgDataRatePS} kb
61126
61310
  * @param logger - Optional logger for logging messages.
61127
61311
  */
61128
61312
  constructor(canvas, logger) {
61313
+ /**
61314
+ * The type of the viewer, indicating it is a WebGL viewer.
61315
+ * Useful for distinguishing between different viewer types in a multi-viewer application.
61316
+ */
61317
+ __publicField(this, "type", "ultra");
61129
61318
  __publicField(this, "_decoder");
61130
61319
  __publicField(this, "_socketClient");
61131
61320
  __publicField(this, "_input");
@@ -61349,6 +61538,9 @@ Averrage Date/Second ${avgDataRatePS} kb
61349
61538
  this._vims.getAll().forEach((vim) => vim.disconnect());
61350
61539
  this._vims.clear();
61351
61540
  }
61541
+ getElement3Ds() {
61542
+ return this.rpc.RPCGetElementCountForScene();
61543
+ }
61352
61544
  /**
61353
61545
  * Disposes all resources used by the viewer and disconnects from the server.
61354
61546
  */
@@ -61370,9 +61562,6 @@ Averrage Date/Second ${avgDataRatePS} kb
61370
61562
  INVALID_HANDLE,
61371
61563
  InputMode,
61372
61564
  MaterialHandles,
61373
- RGB,
61374
- RGBA,
61375
- RGBA32,
61376
61565
  Segment,
61377
61566
  Viewer: Viewer$2,
61378
61567
  VimLoadingStatus,
@@ -63552,50 +63741,6 @@ Averrage Date/Second ${avgDataRatePS} kb
63552
63741
  visible,
63553
63742
  zoom
63554
63743
  }, Symbol.toStringTag, { value: "Module" }));
63555
- function getDefaultSettings() {
63556
- return {
63557
- capacity: {
63558
- canFollowUrl: true,
63559
- canGoFullScreen: true,
63560
- canDownload: true,
63561
- canReadLocalStorage: true
63562
- },
63563
- ui: {
63564
- logo: true,
63565
- performance: false,
63566
- bimTreePanel: true,
63567
- bimInfoPanel: true,
63568
- // axesPanel
63569
- axesPanel: true,
63570
- orthographic: true,
63571
- resetCamera: true,
63572
- // Control bar
63573
- controlBar: true,
63574
- // Control bar - cursors
63575
- orbit: true,
63576
- lookAround: true,
63577
- pan: true,
63578
- zoom: true,
63579
- zoomWindow: true,
63580
- // Control bar - camera
63581
- autoCamera: true,
63582
- frameScene: true,
63583
- frameSelection: true,
63584
- // Control bar - tools
63585
- sectioningMode: true,
63586
- measuringMode: true,
63587
- toggleIsolation: true,
63588
- // Control bar - settings
63589
- projectInspector: true,
63590
- settings: true,
63591
- help: true,
63592
- maximise: true
63593
- }
63594
- };
63595
- }
63596
- function createSettings(settings2) {
63597
- return settings2 !== void 0 ? deepmerge(getDefaultSettings(), settings2) : getDefaultSettings();
63598
- }
63599
63744
  function getLocalSettings(settings2 = {}) {
63600
63745
  try {
63601
63746
  const json = localStorage.getItem("viewer.settings");
@@ -63650,8 +63795,6 @@ Averrage Date/Second ${avgDataRatePS} kb
63650
63795
  }
63651
63796
  const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
63652
63797
  __proto__: null,
63653
- createSettings,
63654
- getDefaultSettings,
63655
63798
  getLocalSettings,
63656
63799
  isFalse,
63657
63800
  isTrue,
@@ -67483,7 +67626,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67483
67626
  }
67484
67627
  const Style = style;
67485
67628
  const Ids$2 = controlBarIds;
67486
- function controlBarSectionBox(section, hasSelection) {
67629
+ function controlBarSectionBox(section, hasSelection, settings2) {
67487
67630
  return {
67488
67631
  id: Ids$2.sectionSectionBox,
67489
67632
  style: section.enable.get() ? Style.sectionNoPadStyle : Style.sectionDefaultStyle,
@@ -67491,6 +67634,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67491
67634
  buttons: [
67492
67635
  {
67493
67636
  id: Ids$2.buttonSectionBoxEnable,
67637
+ enabled: () => isTrue(settings2.sectioningEnable),
67494
67638
  tip: "Enable Section Box",
67495
67639
  isOn: () => section.enable.get(),
67496
67640
  style: (on) => Style.buttonExpandStyle(on),
@@ -67500,7 +67644,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67500
67644
  {
67501
67645
  id: Ids$2.buttonSectionBoxToSelection,
67502
67646
  tip: "Fit Section",
67503
- enabled: () => section.enable.get(),
67647
+ enabled: () => section.enable.get() && isTrue(settings2.sectioningFitToSelection),
67504
67648
  isOn: () => hasSelection,
67505
67649
  style: (on) => Style.buttonDisableStyle(on),
67506
67650
  action: () => section.sectionSelection.call(),
@@ -67509,7 +67653,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67509
67653
  {
67510
67654
  id: Ids$2.buttonSectionBoxToScene,
67511
67655
  tip: "Reset Section",
67512
- enabled: () => section.enable.get(),
67656
+ enabled: () => section.enable.get() && isTrue(settings2.sectioningReset),
67513
67657
  style: (on) => Style.buttonDefaultStyle(on),
67514
67658
  action: () => section.sectionScene.call(),
67515
67659
  icon: sectionBoxReset
@@ -67517,7 +67661,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67517
67661
  {
67518
67662
  id: Ids$2.buttonSectionBoxVisible,
67519
67663
  tip: "Show Section Box",
67520
- enabled: () => section.enable.get(),
67664
+ enabled: () => section.enable.get() && isTrue(settings2.sectioningShow),
67521
67665
  isOn: () => section.visible.get(),
67522
67666
  style: (on) => Style.buttonDefaultStyle(on),
67523
67667
  action: () => section.visible.set(!section.visible.get()),
@@ -67526,7 +67670,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67526
67670
  {
67527
67671
  id: Ids$2.buttonSectionBoxAuto,
67528
67672
  tip: "Auto Section",
67529
- enabled: () => section.enable.get(),
67673
+ enabled: () => section.enable.get() && isTrue(settings2.sectioningAuto),
67530
67674
  isOn: () => section.auto.get(),
67531
67675
  style: (on) => Style.buttonDefaultStyle(on),
67532
67676
  action: () => section.auto.set(!section.auto.get()),
@@ -67535,7 +67679,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67535
67679
  {
67536
67680
  id: Ids$2.buttonSectionBoxSettings,
67537
67681
  tip: "Section Settings",
67538
- enabled: () => section.enable.get(),
67682
+ enabled: () => section.enable.get() && isTrue(settings2.sectioningSettings),
67539
67683
  isOn: () => section.showOffsetPanel.get(),
67540
67684
  style: (on) => Style.buttonDefaultStyle(on),
67541
67685
  action: () => section.showOffsetPanel.set(!section.showOffsetPanel.get()),
@@ -67553,7 +67697,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67553
67697
  buttons: [
67554
67698
  {
67555
67699
  id: Ids$2.buttonCameraOrbit,
67556
- enabled: () => isTrue(settings2.ui.orbit),
67700
+ enabled: () => isTrue(settings2.cursorOrbit),
67557
67701
  tip: "Orbit",
67558
67702
  action: () => pointer2.onButton(PointerMode$1.ORBIT),
67559
67703
  icon: orbit,
@@ -67562,7 +67706,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67562
67706
  },
67563
67707
  {
67564
67708
  id: Ids$2.buttonCameraLook,
67565
- enabled: () => isTrue(settings2.ui.lookAround),
67709
+ enabled: () => isTrue(settings2.cursorLookAround),
67566
67710
  tip: "Look Around",
67567
67711
  action: () => pointer2.onButton(PointerMode$1.LOOK),
67568
67712
  icon: look,
@@ -67571,7 +67715,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67571
67715
  },
67572
67716
  {
67573
67717
  id: Ids$2.buttonCameraPan,
67574
- enabled: () => isTrue(settings2.ui.pan),
67718
+ enabled: () => isTrue(settings2.cursorPan),
67575
67719
  tip: "Pan",
67576
67720
  action: () => pointer2.onButton(PointerMode$1.PAN),
67577
67721
  icon: pan,
@@ -67580,7 +67724,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67580
67724
  },
67581
67725
  {
67582
67726
  id: Ids$2.buttonCameraZoom,
67583
- enabled: () => isTrue(settings2.ui.zoom),
67727
+ enabled: () => isTrue(settings2.cursorZoom),
67584
67728
  tip: "Zoom",
67585
67729
  action: () => pointer2.onButton(PointerMode$1.ZOOM),
67586
67730
  icon: zoom,
@@ -67590,7 +67734,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67590
67734
  ]
67591
67735
  };
67592
67736
  }
67593
- function controlBarMeasure(settings2, measure$1) {
67737
+ function controlBarMeasure(measure$1, settings2) {
67594
67738
  return {
67595
67739
  id: Ids$2.sectionActions,
67596
67740
  enable: () => true,
@@ -67598,7 +67742,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67598
67742
  buttons: [
67599
67743
  {
67600
67744
  id: Ids$2.buttonMeasure,
67601
- enabled: () => isTrue(settings2.ui.measuringMode),
67745
+ enabled: () => isTrue(settings2.measureEnable),
67602
67746
  isOn: () => measure$1.active,
67603
67747
  tip: "Measuring Mode",
67604
67748
  action: () => measure$1.toggle(),
@@ -67608,6 +67752,23 @@ Averrage Date/Second ${avgDataRatePS} kb
67608
67752
  ]
67609
67753
  };
67610
67754
  }
67755
+ function controlBarSettingsUltra(side, settings$1) {
67756
+ return {
67757
+ id: Ids$2.sectionSettings,
67758
+ enable: () => isTrue(settings$1.ui.settings),
67759
+ style: Style.sectionDefaultStyle,
67760
+ buttons: [
67761
+ {
67762
+ id: Ids$2.buttonSettings,
67763
+ enabled: () => isTrue(settings$1.ui.settings),
67764
+ tip: "Settings",
67765
+ action: () => side.toggleContent("settings"),
67766
+ icon: settings,
67767
+ style: Style.buttonDefaultStyle
67768
+ }
67769
+ ]
67770
+ };
67771
+ }
67611
67772
  function controlBarSettings(modal, side, settings$1) {
67612
67773
  const fullScreen = getFullScreenState();
67613
67774
  return {
@@ -67617,7 +67778,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67617
67778
  buttons: [
67618
67779
  {
67619
67780
  id: Ids$2.buttonProjectInspector,
67620
- enabled: () => isTrue(settings$1.ui.projectInspector) && (isTrue(settings$1.ui.bimTreePanel) || isTrue(settings$1.ui.bimInfoPanel)),
67781
+ enabled: () => isTrue(settings$1.ui.miscProjectInspector) && (isTrue(settings$1.ui.bimTreePanel) || isTrue(settings$1.ui.bimInfoPanel)),
67621
67782
  tip: "Project Inspector",
67622
67783
  action: () => side.toggleContent("bim"),
67623
67784
  icon: treeView,
@@ -67625,7 +67786,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67625
67786
  },
67626
67787
  {
67627
67788
  id: Ids$2.buttonSettings,
67628
- enabled: () => isTrue(settings$1.ui.settings),
67789
+ enabled: () => isTrue(settings$1.ui.miscSettings),
67629
67790
  tip: "Settings",
67630
67791
  action: () => side.toggleContent("settings"),
67631
67792
  icon: settings,
@@ -67633,7 +67794,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67633
67794
  },
67634
67795
  {
67635
67796
  id: Ids$2.buttonHelp,
67636
- enabled: () => isTrue(settings$1.ui.help),
67797
+ enabled: () => isTrue(settings$1.ui.miscHelp),
67637
67798
  tip: "Help",
67638
67799
  action: () => modal.help(true),
67639
67800
  icon: help,
@@ -67641,7 +67802,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67641
67802
  },
67642
67803
  {
67643
67804
  id: Ids$2.buttonMaximize,
67644
- enabled: () => isTrue(settings$1.ui.maximise) && settings$1.capacity.canGoFullScreen,
67805
+ enabled: () => isTrue(settings$1.ui.miscMaximise) && settings$1.capacity.canGoFullScreen,
67645
67806
  tip: fullScreen.get() ? "Minimize" : "Fullscreen",
67646
67807
  action: () => fullScreen.toggle(),
67647
67808
  icon: fullScreen.get() ? minimize : fullsScreen,
@@ -67650,7 +67811,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67650
67811
  ]
67651
67812
  };
67652
67813
  }
67653
- function controlBarCamera(camera2) {
67814
+ function controlBarCamera(camera2, settings2) {
67654
67815
  return {
67655
67816
  id: Ids$2.sectionCamera,
67656
67817
  enable: () => true,
@@ -67658,6 +67819,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67658
67819
  buttons: [
67659
67820
  {
67660
67821
  id: Ids$2.buttonCameraAuto,
67822
+ enabled: () => isTrue(settings2.cameraAuto),
67661
67823
  tip: "Auto Camera",
67662
67824
  isOn: () => camera2.autoCamera.get(),
67663
67825
  action: () => camera2.autoCamera.set(!camera2.autoCamera.get()),
@@ -67666,7 +67828,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67666
67828
  },
67667
67829
  {
67668
67830
  id: Ids$2.buttonCameraFrameSelection,
67669
- // enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
67831
+ enabled: () => isTrue(settings2.cameraFrameSelection),
67670
67832
  tip: "Frame Selection",
67671
67833
  action: () => camera2.frameSelection.call(),
67672
67834
  icon: frameSelection,
@@ -67675,7 +67837,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67675
67837
  },
67676
67838
  {
67677
67839
  id: Ids$2.buttonCameraFrameScene,
67678
- // enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
67840
+ enabled: () => isTrue(settings2.cameraFrameScene),
67679
67841
  tip: "Frame All",
67680
67842
  action: () => camera2.frameScene.call(),
67681
67843
  icon: frameScene,
@@ -67685,7 +67847,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67685
67847
  ]
67686
67848
  };
67687
67849
  }
67688
- function controlBarSelection(isolation) {
67850
+ function controlBarVisibility(isolation, settings2) {
67689
67851
  const adapter = isolation.adapter.current;
67690
67852
  const someVisible = adapter.hasVisibleSelection() || !adapter.hasHiddenSelection();
67691
67853
  return {
@@ -67695,6 +67857,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67695
67857
  buttons: [
67696
67858
  {
67697
67859
  id: Ids$2.buttonClearSelection,
67860
+ enabled: () => isTrue(settings2.visibilityClearSelection),
67698
67861
  tip: "Clear Selection",
67699
67862
  action: () => adapter.clearSelection(),
67700
67863
  icon: pointer,
@@ -67704,6 +67867,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67704
67867
  {
67705
67868
  id: Ids$2.buttonShowAll,
67706
67869
  tip: "Show All",
67870
+ enabled: () => isTrue(settings2.visibilityShowAll),
67707
67871
  action: () => adapter.showAll(),
67708
67872
  icon: showAll,
67709
67873
  isOn: () => !isolation.autoIsolate.get() && isolation.visibility.get() !== "all",
@@ -67711,7 +67875,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67711
67875
  },
67712
67876
  {
67713
67877
  id: Ids$2.buttonHideSelection,
67714
- enabled: () => someVisible,
67878
+ enabled: () => someVisible && isTrue(settings2.visibilityToggle),
67715
67879
  tip: "Hide Selection",
67716
67880
  action: () => adapter.hideSelection(),
67717
67881
  icon: hideSelection,
@@ -67720,7 +67884,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67720
67884
  },
67721
67885
  {
67722
67886
  id: Ids$2.buttonShowSelection,
67723
- enabled: () => !someVisible,
67887
+ enabled: () => !someVisible && isTrue(settings2.visibilityToggle),
67724
67888
  tip: "Show Selection",
67725
67889
  action: () => adapter.showSelection(),
67726
67890
  icon: showSelection,
@@ -67729,6 +67893,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67729
67893
  },
67730
67894
  {
67731
67895
  id: Ids$2.buttonIsolateSelection,
67896
+ enabled: () => isTrue(settings2.visibilityIsolate),
67732
67897
  tip: "Isolate Selection",
67733
67898
  action: () => adapter.isolateSelection(),
67734
67899
  icon: isolateSelection,
@@ -67737,6 +67902,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67737
67902
  },
67738
67903
  {
67739
67904
  id: Ids$2.buttonAutoIsolate,
67905
+ enabled: () => isTrue(settings2.visibilityAutoIsolate),
67740
67906
  tip: "Auto Isolate",
67741
67907
  action: () => isolation.autoIsolate.set(!isolation.autoIsolate.get()),
67742
67908
  isOn: () => isolation.autoIsolate.get(),
@@ -67744,6 +67910,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67744
67910
  },
67745
67911
  {
67746
67912
  id: Ids$2.buttonIsolationSettings,
67913
+ enabled: () => isTrue(settings2.visibilitySettings),
67747
67914
  tip: "Isolation Settings",
67748
67915
  action: () => isolation.showPanel.set(!isolation.showPanel.get()),
67749
67916
  icon: slidersHoriz,
@@ -67754,28 +67921,22 @@ Averrage Date/Second ${avgDataRatePS} kb
67754
67921
  }
67755
67922
  function useControlBar(viewer, camera2, modal, side, cursor, settings2, section, isolationRef, customization) {
67756
67923
  const measure2 = getMeasureState(viewer, cursor);
67757
- const pointerSection = controlBarPointer(viewer, camera2, settings2);
67758
- const actionSection = controlBarMeasure(settings2, measure2);
67759
- const sectionBoxSection = controlBarSectionBox(section, viewer.selection.any());
67760
- const settingsSection = controlBarSettings(modal, side, settings2);
67761
- const cameraSection = controlBarCamera(camera2);
67762
- const selectionSection = controlBarSelection(isolationRef);
67763
67924
  let controlBarSections = [
67764
- pointerSection,
67765
- actionSection,
67766
- cameraSection,
67767
- sectionBoxSection,
67768
- selectionSection,
67769
- settingsSection
67925
+ controlBarPointer(viewer, camera2, settings2.ui),
67926
+ controlBarCamera(camera2, settings2.ui),
67927
+ controlBarVisibility(isolationRef, settings2.ui),
67928
+ controlBarMeasure(measure2, settings2.ui),
67929
+ controlBarSectionBox(section, viewer.selection.any(), settings2.ui),
67930
+ controlBarSettings(modal, side, settings2)
67770
67931
  ];
67771
67932
  controlBarSections = (customization == null ? void 0 : customization(controlBarSections)) ?? controlBarSections;
67772
67933
  return controlBarSections;
67773
67934
  }
67774
67935
  function anyUiCursorButton(settings2) {
67775
- return isTrue(settings2.ui.orbit) || isTrue(settings2.ui.lookAround) || isTrue(settings2.ui.pan) || isTrue(settings2.ui.zoom) || isTrue(settings2.ui.zoomWindow);
67936
+ return isTrue(settings2.cursorOrbit) || isTrue(settings2.cursorLookAround) || isTrue(settings2.cursorPan) || isTrue(settings2.cursorZoom);
67776
67937
  }
67777
67938
  function anyUiSettingButton(settings2) {
67778
- return isTrue(settings2.ui.projectInspector) || isTrue(settings2.ui.settings) || isTrue(settings2.ui.help) || isTrue(settings2.ui.maximise);
67939
+ return isTrue(settings2.ui.miscProjectInspector) || isTrue(settings2.ui.miscSettings) || isTrue(settings2.ui.miscHelp) || isTrue(settings2.ui.miscMaximise);
67779
67940
  }
67780
67941
  function RestOfScreen(props) {
67781
67942
  const [, setVersion] = React2.useState(0);
@@ -72676,7 +72837,7 @@ Averrage Date/Second ${avgDataRatePS} kb
72676
72837
  return;
72677
72838
  }
72678
72839
  if (rectElem.top < rectContainer.top || rectElem.top < 0) {
72679
- selection.scrollIntoView();
72840
+ selection.scrollIntoView({ block: "nearest", inline: "nearest" });
72680
72841
  }
72681
72842
  }
72682
72843
  const isControlKey = (e) => {
@@ -73787,7 +73948,7 @@ Averrage Date/Second ${avgDataRatePS} kb
73787
73948
  } else {
73788
73949
  props.container.gfx.style.left = "0px";
73789
73950
  }
73790
- props.viewer.viewport.ResizeToParent();
73951
+ props.viewer.viewport.resizeToParent();
73791
73952
  };
73792
73953
  const getMaxSize = () => {
73793
73954
  return props.container.root.clientWidth * MAX_WIDTH;
@@ -73846,7 +74007,10 @@ Averrage Date/Second ${avgDataRatePS} kb
73846
74007
  style: {
73847
74008
  position: "absolute"
73848
74009
  },
73849
- 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"}`,
74010
+ className: `vim-side-panel vc-top-0 vc-left-0 vc-z-20
74011
+ vc-bg-gray-lightest vc-text-gray-darker
74012
+ vc-border-r vc-border-gray-light
74013
+ ${props.side.getContent() !== "none" ? "" : "vc-hidden"}`,
73850
74014
  children: [
73851
74015
  /* @__PURE__ */ jsxRuntimeExports.jsx(
73852
74016
  "button",
@@ -73929,180 +74093,6 @@ Averrage Date/Second ${avgDataRatePS} kb
73929
74093
  [side, width]
73930
74094
  );
73931
74095
  }
73932
- function SettingsPanel(props) {
73933
- if (!props.visible) return null;
73934
- const toggleElement = (label, state, action) => {
73935
- 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: [
73936
- /* @__PURE__ */ jsxRuntimeExports.jsx(
73937
- "input",
73938
- {
73939
- type: "checkbox",
73940
- checked: state,
73941
- onChange: action,
73942
- className: "vim-settings-checkbox vc-checked:bg-primary-royal vc-mr-2 vc-rounded vc-border vc-border-gray-medium "
73943
- }
73944
- ),
73945
- " ",
73946
- label
73947
- ] });
73948
- };
73949
- const settingsToggle = (label, getter, setter) => {
73950
- const value = getter(props.settings.value);
73951
- if (value === "AlwaysTrue" || value === "AlwaysFalse") {
73952
- return null;
73953
- }
73954
- return toggleElement(label, value, () => {
73955
- const value2 = getter(props.settings.value);
73956
- props.settings.update((s) => setter(s, !value2));
73957
- });
73958
- };
73959
- const settingsBox = (label, info, transform, getter, setter) => {
73960
- const ref = React2.useRef(null);
73961
- React2.useEffect(() => {
73962
- ref.current.value = props.viewer.inputs.scrollSpeed.toFixed(2);
73963
- }, []);
73964
- getter(props.settings.value).toString();
73965
- const update = (event) => {
73966
- const str = event.target.value;
73967
- const n = Number.parseFloat(str);
73968
- if (Number.isNaN(n)) {
73969
- event.target.value = getter(props.settings.value).toString();
73970
- } else {
73971
- const value2 = transform(n);
73972
- event.target.value = value2.toString();
73973
- props.settings.update((s) => setter(s, value2));
73974
- }
73975
- };
73976
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vc-box-input vc-my-1", children: [
73977
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: "textbox", className: "vc-w-3 vc-h-2", children: [
73978
- label,
73979
- ":"
73980
- ] }),
73981
- /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ref, type: "text", className: "vim-settings-textbox vc-w-14 vc-ml-1 vc-p-1", onBlur: (e) => update(e) }),
73982
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "textbox", className: "vc-w-3 vc-h-2 vc-text-gray vc-ml-1", children: info })
73983
- ] });
73984
- };
73985
- function settingsSubtitle(title2) {
73986
- return /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "vc-subtitle", children: title2 });
73987
- }
73988
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
73989
- "div",
73990
- {
73991
- className: "vc-absolute vc-inset-0",
73992
- children: [
73993
- /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "vc-title", children: "Settings " }),
73994
- /* @__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: [
73995
- settingsSubtitle("Inputs"),
73996
- settingsBox(
73997
- "Scroll Speed",
73998
- "[0.1,10]",
73999
- (n) => MathUtils.clamp(n, 0.1, 10),
74000
- (s) => props.viewer.inputs.scrollSpeed,
74001
- (s, v) => {
74002
- props.viewer.inputs.scrollSpeed = v;
74003
- }
74004
- ),
74005
- settingsSubtitle("Panels"),
74006
- settingsToggle(
74007
- "Show Logo",
74008
- (settings2) => settings2.ui.logo,
74009
- (settings2, value) => settings2.ui.logo = value
74010
- ),
74011
- settingsToggle(
74012
- "Show Bim Tree",
74013
- (settings2) => settings2.ui.bimTreePanel,
74014
- (settings2, value) => settings2.ui.bimTreePanel = value
74015
- ),
74016
- settingsToggle(
74017
- "Show Bim Info",
74018
- (settings2) => settings2.ui.bimInfoPanel,
74019
- (settings2, value) => settings2.ui.bimInfoPanel = value
74020
- ),
74021
- settingsToggle(
74022
- "Show Axes Panel",
74023
- (settings2) => settings2.ui.axesPanel,
74024
- (settings2, value) => settings2.ui.axesPanel = value
74025
- ),
74026
- settingsToggle(
74027
- "Show Performance Panel",
74028
- (settings2) => settings2.ui.performance,
74029
- (settings2, value) => settings2.ui.performance = value
74030
- ),
74031
- settingsSubtitle("Axes"),
74032
- settingsToggle(
74033
- "Show Orthographic Button",
74034
- (settings2) => settings2.ui.orthographic,
74035
- (settings2, value) => settings2.ui.orthographic = value
74036
- ),
74037
- settingsToggle(
74038
- "Show Reset Camera Button",
74039
- (settings2) => settings2.ui.resetCamera,
74040
- (settings2, value) => settings2.ui.resetCamera = value
74041
- ),
74042
- settingsSubtitle("Control Bar"),
74043
- settingsToggle(
74044
- "Show Control Bar",
74045
- (settings2) => settings2.ui.controlBar,
74046
- (settings2, value) => settings2.ui.controlBar = value
74047
- ),
74048
- settingsSubtitle("Control Bar - Cursors"),
74049
- settingsToggle(
74050
- "Show Orbit Button",
74051
- (settings2) => settings2.ui.orbit,
74052
- (settings2, value) => settings2.ui.orbit = value
74053
- ),
74054
- settingsToggle(
74055
- "Show Look Around Button",
74056
- (settings2) => settings2.ui.lookAround,
74057
- (settings2, value) => settings2.ui.lookAround = value
74058
- ),
74059
- settingsToggle(
74060
- "Show Pan Button",
74061
- (settings2) => settings2.ui.pan,
74062
- (settings2, value) => settings2.ui.pan = value
74063
- ),
74064
- settingsToggle(
74065
- "Show Zoom Button",
74066
- (settings2) => settings2.ui.zoom,
74067
- (settings2, value) => settings2.ui.zoom = value
74068
- ),
74069
- settingsToggle(
74070
- "Show Zoom Window Button",
74071
- (settings2) => settings2.ui.zoomWindow,
74072
- (settings2, value) => settings2.ui.zoomWindow = value
74073
- ),
74074
- settingsSubtitle("Control Bar - Tools"),
74075
- settingsToggle(
74076
- "Show Measuring Mode Button",
74077
- (settings2) => settings2.ui.measuringMode,
74078
- (settings2, value) => settings2.ui.measuringMode = value
74079
- ),
74080
- settingsSubtitle("Control Bar - Settings"),
74081
- settingsToggle(
74082
- "Show Project Inspector Button",
74083
- (settings2) => settings2.ui.projectInspector,
74084
- (settings2, value) => settings2.ui.projectInspector = value
74085
- ),
74086
- settingsToggle(
74087
- "Show Settings Button",
74088
- (settings2) => settings2.ui.settings,
74089
- (settings2, value) => settings2.ui.settings = value
74090
- ),
74091
- settingsToggle(
74092
- "Show Help Button",
74093
- (settings2) => settings2.ui.help,
74094
- (settings2, value) => settings2.ui.help = value
74095
- ),
74096
- settingsToggle(
74097
- "Show Maximise Button",
74098
- (settings2) => settings2.ui.maximise,
74099
- (settings2, value) => settings2.ui.maximise = value
74100
- )
74101
- ] })
74102
- ]
74103
- }
74104
- );
74105
- }
74106
74096
  const MenuToastMemo = React2.memo(MenuToast);
74107
74097
  function MenuToast(props) {
74108
74098
  const [visible2, setVisible] = React2.useState();
@@ -74267,118 +74257,6 @@ Averrage Date/Second ${avgDataRatePS} kb
74267
74257
  }
74268
74258
  });
74269
74259
  }
74270
- function useSettings(viewer, value) {
74271
- const merged = createSettings(value);
74272
- const [settings2, setSettings] = React2.useState(merged);
74273
- const onUpdate = React2.useRef();
74274
- const update = function(updater) {
74275
- var _a3;
74276
- const next = { ...settings2 };
74277
- updater(next);
74278
- saveSettingsToLocal(next);
74279
- setSettings(next);
74280
- (_a3 = onUpdate.current) == null ? void 0 : _a3.call(onUpdate, next);
74281
- };
74282
- React2.useEffect(() => {
74283
- applySettings(viewer, settings2);
74284
- }, []);
74285
- React2.useEffect(() => {
74286
- applySettings(viewer, settings2);
74287
- }, [settings2]);
74288
- return React2.useMemo(
74289
- () => ({
74290
- value: settings2,
74291
- update,
74292
- register: (v) => onUpdate.current = v
74293
- }),
74294
- [settings2]
74295
- );
74296
- }
74297
- function applySettings(viewer, settings2) {
74298
- const performance2 = document.getElementsByClassName("vim-performance-div")[0];
74299
- if (performance2) {
74300
- if (isTrue(settings2.ui.performance)) {
74301
- performance2.classList.remove("vc-hidden");
74302
- } else {
74303
- performance2.classList.add("vc-hidden");
74304
- }
74305
- }
74306
- }
74307
- function createContainer(element) {
74308
- let root = element;
74309
- if (root === void 0) {
74310
- root = document.createElement("div");
74311
- document.body.append(root);
74312
- root.classList.add("vc-inset-0");
74313
- }
74314
- root.style.position = "absolute";
74315
- root.classList.add("vim-component");
74316
- const gfx = document.createElement("div");
74317
- gfx.className = "vim-gfx vc-absolute vc-inset-0 vc-pointer-events-none";
74318
- const ui = document.createElement("div");
74319
- ui.className = "vim-ui vc-absolute vc-inset-0";
74320
- root.append(gfx);
74321
- root.append(ui);
74322
- const dispose = () => {
74323
- if (element === void 0) {
74324
- root.remove();
74325
- } else {
74326
- root.classList.remove("vim-component");
74327
- gfx.remove();
74328
- ui.remove();
74329
- }
74330
- };
74331
- return { root, ui, gfx, dispose };
74332
- }
74333
- async function getElements(vim) {
74334
- var _a3, _b2, _c, _d, _e;
74335
- if (!vim.bim) return [];
74336
- const [elements, bimDocument, category, levels, worksets] = await Promise.all(
74337
- [
74338
- (_a3 = vim.bim.element) == null ? void 0 : _a3.getAll(),
74339
- (_b2 = vim.bim.bimDocument) == null ? void 0 : _b2.getAllTitle(),
74340
- (_c = vim.bim.category) == null ? void 0 : _c.getAllName(),
74341
- (_d = vim.bim.level) == null ? void 0 : _d.getAllElementIndex(),
74342
- (_e = vim.bim.workset) == null ? void 0 : _e.getAllName()
74343
- ]
74344
- );
74345
- const familyTypeMap = await getFamilyTypeNameMap(vim.bim);
74346
- if (!elements) return void 0;
74347
- const result = elements.map((e) => {
74348
- var _a4;
74349
- return {
74350
- ...e,
74351
- bimDocumentName: bimDocument ? bimDocument[e.bimDocumentIndex] : void 0,
74352
- categoryName: category ? category[e.categoryIndex] : void 0,
74353
- familyTypeName: familyTypeMap.get(e.index),
74354
- levelName: levels ? (_a4 = elements[levels[(e == null ? void 0 : e.levelIndex) ?? -1]]) == null ? void 0 : _a4.name : void 0,
74355
- worksetName: worksets ? worksets[(e == null ? void 0 : e.worksetIndex) ?? -1] : void 0
74356
- };
74357
- });
74358
- const real = result.filter((e) => vim.getElementFromIndex(e.index).hasMesh);
74359
- return real;
74360
- }
74361
- async function getFamilyTypeNameMap(document2) {
74362
- const [
74363
- familyInstanceElement,
74364
- familyInstanceFamilyType,
74365
- familyTypeElement,
74366
- elementName
74367
- ] = await Promise.all([
74368
- document2.familyInstance.getAllElementIndex(),
74369
- document2.familyInstance.getAllFamilyTypeIndex(),
74370
- document2.familyType.getAllElementIndex(),
74371
- document2.element.getAllName()
74372
- ]);
74373
- return new Map(
74374
- familyInstanceElement.map((e, i2) => {
74375
- const familyType = familyInstanceFamilyType == null ? void 0 : familyInstanceFamilyType[i2];
74376
- const element = Number.isInteger(familyType) ? familyTypeElement[familyType] : void 0;
74377
- const name = Number.isInteger(element) ? elementName == null ? void 0 : elementName[element] : void 0;
74378
- return [e, name];
74379
- })
74380
- );
74381
- }
74382
74260
  class MutableState {
74383
74261
  constructor(initial) {
74384
74262
  __publicField(this, "_value");
@@ -74407,24 +74285,28 @@ Averrage Date/Second ${avgDataRatePS} kb
74407
74285
  }
74408
74286
  };
74409
74287
  }
74410
- function useStateRef(initialValue) {
74411
- const [value, setValue] = React2.useState(initialValue);
74288
+ function useStateRef(initialValue, isLazy = false) {
74289
+ const getInitialValue = () => {
74290
+ if (isLazy && typeof initialValue === "function") {
74291
+ return initialValue();
74292
+ }
74293
+ return initialValue;
74294
+ };
74295
+ const [box, setBox] = React2.useState(() => ({
74296
+ current: getInitialValue()
74297
+ }));
74412
74298
  const ref = React2.useRef(void 0);
74413
74299
  if (ref.current === void 0) {
74414
- if (typeof initialValue === "function") {
74415
- ref.current = initialValue();
74416
- } else {
74417
- ref.current = initialValue;
74418
- }
74300
+ ref.current = getInitialValue();
74419
74301
  }
74420
74302
  const event = React2.useRef(new distExports.SimpleEventDispatcher());
74421
74303
  const validate = React2.useRef((next, current) => next);
74422
- const confirm = React2.useRef((value2) => value2);
74423
- const set2 = (value2) => {
74424
- const finalValue = validate.current(value2, ref.current);
74304
+ const confirm = React2.useRef((value) => value);
74305
+ const set2 = (value) => {
74306
+ const finalValue = validate.current(value, ref.current);
74425
74307
  if (finalValue === ref.current) return;
74426
74308
  ref.current = finalValue;
74427
- setValue(finalValue);
74309
+ setBox({ current: finalValue });
74428
74310
  event.current.dispatch(finalValue);
74429
74311
  };
74430
74312
  return {
@@ -74450,8 +74332,8 @@ Averrage Date/Second ${avgDataRatePS} kb
74450
74332
  */
74451
74333
  useOnChange(on) {
74452
74334
  React2.useEffect(() => {
74453
- return event.current.subscribe((value2) => {
74454
- const result = on(value2);
74335
+ return event.current.subscribe((value) => {
74336
+ const result = on(value);
74455
74337
  if (result instanceof Promise) {
74456
74338
  result.catch(console.error);
74457
74339
  }
@@ -74465,7 +74347,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74465
74347
  * @returns The memoized value.
74466
74348
  */
74467
74349
  useMemo(on, deps) {
74468
- return React2.useMemo(() => on(value), [...deps || [], value]);
74350
+ return React2.useMemo(() => on(box.current), [...deps || [], box.current]);
74469
74351
  },
74470
74352
  /**
74471
74353
  * Sets a validation function to process any new state value before updating.
@@ -74642,14 +74524,122 @@ Averrage Date/Second ${avgDataRatePS} kb
74642
74524
  useRefresher,
74643
74525
  useStateRef
74644
74526
  }, Symbol.toStringTag, { value: "Module" }));
74645
- function useViewerState(viewer) {
74646
- const getVim = () => {
74527
+ function useSettings(value, defaultSettings, applySettings = () => {
74528
+ }) {
74529
+ const merged = createSettings(value, defaultSettings);
74530
+ const [settings2, setSettings] = React2.useState(merged);
74531
+ const onUpdate = React2.useRef();
74532
+ const customizer = useStateRef((settings22) => settings22);
74533
+ const update = function(updater) {
74647
74534
  var _a3;
74648
- const v = (_a3 = viewer.vims) == null ? void 0 : _a3[0];
74649
- return v;
74650
- };
74651
- const getSelection = () => {
74652
- return [...viewer.selection.getAll()].filter((o) => o.type === "Element3D");
74535
+ const next = { ...settings2 };
74536
+ updater(next);
74537
+ saveSettingsToLocal(next);
74538
+ setSettings(next);
74539
+ (_a3 = onUpdate.current) == null ? void 0 : _a3.call(onUpdate, next);
74540
+ };
74541
+ React2.useEffect(() => {
74542
+ applySettings(settings2);
74543
+ }, []);
74544
+ React2.useEffect(() => {
74545
+ applySettings(settings2);
74546
+ }, [settings2]);
74547
+ return React2.useMemo(
74548
+ () => ({
74549
+ value: settings2,
74550
+ update,
74551
+ register: (v) => onUpdate.current = v,
74552
+ customizer
74553
+ }),
74554
+ [settings2]
74555
+ );
74556
+ }
74557
+ function createSettings(settings2, defaultSettings) {
74558
+ return settings2 !== void 0 ? deepmerge(defaultSettings, settings2) : defaultSettings;
74559
+ }
74560
+ function createContainer(element) {
74561
+ let root = element;
74562
+ if (root === void 0) {
74563
+ root = document.createElement("div");
74564
+ document.body.append(root);
74565
+ root.classList.add("vc-inset-0");
74566
+ }
74567
+ root.style.position = "absolute";
74568
+ root.classList.add("vim-component");
74569
+ const gfx = document.createElement("div");
74570
+ gfx.className = "vim-gfx vc-absolute vc-inset-0 vc-pointer-events-none";
74571
+ const ui = document.createElement("div");
74572
+ ui.className = "vim-ui vc-absolute vc-inset-0";
74573
+ root.append(gfx);
74574
+ root.append(ui);
74575
+ const dispose = () => {
74576
+ if (element === void 0) {
74577
+ root.remove();
74578
+ } else {
74579
+ root.classList.remove("vim-component");
74580
+ gfx.remove();
74581
+ ui.remove();
74582
+ }
74583
+ };
74584
+ return { root, ui, gfx, dispose };
74585
+ }
74586
+ async function getElements(vim) {
74587
+ var _a3, _b2, _c, _d, _e;
74588
+ if (!vim.bim) return [];
74589
+ const [elements, bimDocument, category, levels, worksets] = await Promise.all(
74590
+ [
74591
+ (_a3 = vim.bim.element) == null ? void 0 : _a3.getAll(),
74592
+ (_b2 = vim.bim.bimDocument) == null ? void 0 : _b2.getAllTitle(),
74593
+ (_c = vim.bim.category) == null ? void 0 : _c.getAllName(),
74594
+ (_d = vim.bim.level) == null ? void 0 : _d.getAllElementIndex(),
74595
+ (_e = vim.bim.workset) == null ? void 0 : _e.getAllName()
74596
+ ]
74597
+ );
74598
+ const familyTypeMap = await getFamilyTypeNameMap(vim.bim);
74599
+ if (!elements) return void 0;
74600
+ const result = elements.map((e) => {
74601
+ var _a4;
74602
+ return {
74603
+ ...e,
74604
+ bimDocumentName: bimDocument ? bimDocument[e.bimDocumentIndex] : void 0,
74605
+ categoryName: category ? category[e.categoryIndex] : void 0,
74606
+ familyTypeName: familyTypeMap.get(e.index),
74607
+ levelName: levels ? (_a4 = elements[levels[(e == null ? void 0 : e.levelIndex) ?? -1]]) == null ? void 0 : _a4.name : void 0,
74608
+ worksetName: worksets ? worksets[(e == null ? void 0 : e.worksetIndex) ?? -1] : void 0
74609
+ };
74610
+ });
74611
+ const real = result.filter((e) => vim.getElementFromIndex(e.index).hasMesh);
74612
+ return real;
74613
+ }
74614
+ async function getFamilyTypeNameMap(document2) {
74615
+ const [
74616
+ familyInstanceElement,
74617
+ familyInstanceFamilyType,
74618
+ familyTypeElement,
74619
+ elementName
74620
+ ] = await Promise.all([
74621
+ document2.familyInstance.getAllElementIndex(),
74622
+ document2.familyInstance.getAllFamilyTypeIndex(),
74623
+ document2.familyType.getAllElementIndex(),
74624
+ document2.element.getAllName()
74625
+ ]);
74626
+ return new Map(
74627
+ familyInstanceElement.map((e, i2) => {
74628
+ const familyType = familyInstanceFamilyType == null ? void 0 : familyInstanceFamilyType[i2];
74629
+ const element = Number.isInteger(familyType) ? familyTypeElement[familyType] : void 0;
74630
+ const name = Number.isInteger(element) ? elementName == null ? void 0 : elementName[element] : void 0;
74631
+ return [e, name];
74632
+ })
74633
+ );
74634
+ }
74635
+ function useViewerState(viewer) {
74636
+ const getVim = () => {
74637
+ var _a3;
74638
+ const v = (_a3 = viewer.vims) == null ? void 0 : _a3[0];
74639
+ return v;
74640
+ };
74641
+ const getSelection = () => {
74642
+ return [...viewer.selection.getAll()].filter((o) => o.type === "Element3D");
74653
74643
  };
74654
74644
  const vim = useStateRef(getVim());
74655
74645
  const selection = useStateRef(getSelection());
@@ -74783,12 +74773,8 @@ Averrage Date/Second ${avgDataRatePS} kb
74783
74773
  const vcLink = `${vcColorLink} vc-underline`;
74784
74774
  const vcLabel = "vc-text-[#3F444F]";
74785
74775
  const vcRoboto = "vc-font-['Roboto',sans-serif]";
74786
- function footer$1(url) {
74787
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: `vc-text-xs vc-font-normal ${vcColorSecondary}`, children: [
74788
- "More troubleshooting tips can be found",
74789
- " ",
74790
- link(url, "here")
74791
- ] });
74776
+ function footer$1() {
74777
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
74792
74778
  }
74793
74779
  function mainText(text) {
74794
74780
  return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `vim-main-text vc-text-base ${vcColorPrimary} vc-mb-4 vc-font-normal`, children: text });
@@ -74836,20 +74822,11 @@ Averrage Date/Second ${avgDataRatePS} kb
74836
74822
  vcLink,
74837
74823
  vcRoboto
74838
74824
  }, Symbol.toStringTag, { value: "Module" }));
74839
- const support = "https://docs.vimaec.com";
74840
- const supportUltra = "https://docs.vimaec.com/docs/vim-for-windows/configuring-vim-ultra";
74841
- const supportControls = "https://docs.vimaec.com/docs/vim-cloud/webgl-navigation-and-controls-guide";
74842
- const urls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
74843
- __proto__: null,
74844
- support,
74845
- supportControls,
74846
- supportUltra
74847
- }, Symbol.toStringTag, { value: "Module" }));
74848
74825
  function fileOpeningError(url) {
74849
74826
  return {
74850
74827
  title: "File Opening Error",
74851
74828
  body: serverFileOpeningErrorBody(url),
74852
- footer: footer$1(support),
74829
+ footer: footer$1(),
74853
74830
  canClose: false
74854
74831
  };
74855
74832
  }
@@ -74871,7 +74848,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74871
74848
  return {
74872
74849
  title: "File Downloading Error",
74873
74850
  body: body$5(url, authToken, server),
74874
- footer: footer$1(support),
74851
+ footer: footer$1(),
74875
74852
  canClose: false
74876
74853
  };
74877
74854
  }
@@ -74900,7 +74877,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74900
74877
  return {
74901
74878
  title: "File Loading Error",
74902
74879
  body: body$4(url),
74903
- footer: footer$1(support),
74880
+ footer: footer$1(),
74904
74881
  canClose: false
74905
74882
  };
74906
74883
  }
@@ -74920,11 +74897,18 @@ Averrage Date/Second ${avgDataRatePS} kb
74920
74897
  ])
74921
74898
  ] });
74922
74899
  }
74900
+ const supportUltra = "https://docs.vimaec.com/docs/vim-for-windows/configuring-vim-ultra";
74901
+ const supportControls = "https://docs.vimaec.com/docs/vim-cloud/webgl-navigation-and-controls-guide";
74902
+ const urls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
74903
+ __proto__: null,
74904
+ supportControls,
74905
+ supportUltra
74906
+ }, Symbol.toStringTag, { value: "Module" }));
74923
74907
  function serverConnectionError(url) {
74924
74908
  return {
74925
74909
  title: "Connection Error",
74926
74910
  body: body$3(url, isLocalUrl(url)),
74927
- footer: footer$1(support),
74911
+ footer: footer$1(),
74928
74912
  canClose: false
74929
74913
  };
74930
74914
  }
@@ -74954,7 +74938,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74954
74938
  return {
74955
74939
  title: "Compatibility Error",
74956
74940
  body: body$2(url, localVersion, remoteVersion),
74957
- footer: footer$1(support),
74941
+ footer: footer$1(),
74958
74942
  canClose: false
74959
74943
  };
74960
74944
  }
@@ -74983,7 +74967,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74983
74967
  return {
74984
74968
  title: "Stream Error",
74985
74969
  body: body$1(),
74986
- footer: footer$1(support),
74970
+ footer: footer$1(),
74987
74971
  canClose: false
74988
74972
  };
74989
74973
  }
@@ -75230,16 +75214,19 @@ Averrage Date/Second ${avgDataRatePS} kb
75230
75214
  }
75231
75215
  }
75232
75216
  function MessageBox(props) {
75217
+ const [minimized, setMinimized] = React2.useState(props.value.minimize ?? false);
75233
75218
  const p = props.value;
75234
75219
  if (!p.title || !p.body) return null;
75235
75220
  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: [
75236
75221
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vc-flex vc-justify-between vc-items-center", children: [
75222
+ props.value.icon,
75237
75223
  title(p.title),
75238
- closeBtn(p.onClose)
75224
+ props.value.canClose && closeBtn(p.onClose),
75225
+ props.value.minimize && minimizeButton(minimized, setMinimized)
75239
75226
  ] }),
75240
- divider(),
75241
- body(p.body),
75242
- footer(p.footer)
75227
+ !minimized && divider(),
75228
+ !minimized && body(p.body),
75229
+ !minimized && footer(p.footer)
75243
75230
  ] });
75244
75231
  }
75245
75232
  function title(title2) {
@@ -75249,6 +75236,9 @@ Averrage Date/Second ${avgDataRatePS} kb
75249
75236
  if (!onClose) return null;
75250
75237
  return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: onClose, className: "vc-text-[#212733] vc-text-xl", children: "×" });
75251
75238
  }
75239
+ function minimizeButton(minimized, setMinimized) {
75240
+ 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: "▲" }) });
75241
+ }
75252
75242
  function body(content2) {
75253
75243
  if (content2 === void 0) return null;
75254
75244
  if (typeof content2 === "string") {
@@ -75754,7 +75744,8 @@ Averrage Date/Second ${avgDataRatePS} kb
75754
75744
  }
75755
75745
  const Ids = {
75756
75746
  showGhost: "isolationPanel.showGhost",
75757
- ghostOpacity: "isolationPanel.ghostOpacity"
75747
+ ghostOpacity: "isolationPanel.ghostOpacity",
75748
+ transparency: "isolationPanel.transparency"
75758
75749
  };
75759
75750
  const IsolationPanel$1 = React2.forwardRef(
75760
75751
  (props, ref) => {
@@ -75766,8 +75757,20 @@ Averrage Date/Second ${avgDataRatePS} kb
75766
75757
  anchorElement: document.getElementById("vim-control-bar"),
75767
75758
  showPanel: props.state.showPanel,
75768
75759
  entries: [
75769
- { type: "bool", id: Ids.showGhost, label: "Show Ghost", state: props.state.showGhost },
75770
- // { type: "bool", id: "showRooms", label: "Show Rooms", state: props.state.showRooms },
75760
+ {
75761
+ type: "bool",
75762
+ id: Ids.showGhost,
75763
+ label: "Show Ghost",
75764
+ state: props.state.showGhost
75765
+ },
75766
+ /*
75767
+ {
75768
+ type: "bool",
75769
+ id: "showRooms",
75770
+ label: "Show Rooms",
75771
+ state: props.state.showRooms
75772
+ },
75773
+ */
75771
75774
  {
75772
75775
  type: "number",
75773
75776
  id: Ids.ghostOpacity,
@@ -75777,6 +75780,13 @@ Averrage Date/Second ${avgDataRatePS} kb
75777
75780
  min: 0,
75778
75781
  max: 1,
75779
75782
  step: 0.05
75783
+ },
75784
+ {
75785
+ type: "bool",
75786
+ visible: () => props.transparency,
75787
+ id: Ids.transparency,
75788
+ label: "Transparency",
75789
+ state: props.state.transparency
75780
75790
  }
75781
75791
  ]
75782
75792
  }
@@ -75785,12 +75795,13 @@ Averrage Date/Second ${avgDataRatePS} kb
75785
75795
  );
75786
75796
  function useSharedIsolation(adapter) {
75787
75797
  const _adapter = React2.useRef(adapter);
75788
- const visibility = useStateRef(() => adapter.computeVisibility());
75798
+ const visibility = useStateRef(() => adapter.computeVisibility(), true);
75789
75799
  const autoIsolate2 = useStateRef(false);
75790
75800
  const showPanel = useStateRef(false);
75791
75801
  const showRooms = useStateRef(false);
75792
75802
  const showGhost = useStateRef(false);
75793
- const ghostOpacity = useStateRef(() => adapter.getGhostOpacity());
75803
+ const ghostOpacity = useStateRef(() => adapter.getGhostOpacity(), true);
75804
+ const transparency = useStateRef(true);
75794
75805
  const onAutoIsolate = useFuncRef(() => {
75795
75806
  if (adapter.hasSelection()) {
75796
75807
  adapter.isolateSelection();
@@ -75815,6 +75826,7 @@ Averrage Date/Second ${avgDataRatePS} kb
75815
75826
  });
75816
75827
  showGhost.useOnChange((v) => adapter.showGhost(v));
75817
75828
  showRooms.useOnChange((v) => adapter.setShowRooms(v));
75829
+ transparency.useOnChange((v) => adapter.enableTransparency(v));
75818
75830
  ghostOpacity.useValidate((next, current) => {
75819
75831
  return next <= 0 ? current : next;
75820
75832
  });
@@ -75828,7 +75840,8 @@ Averrage Date/Second ${avgDataRatePS} kb
75828
75840
  showRooms,
75829
75841
  ghostOpacity,
75830
75842
  onAutoIsolate,
75831
- onVisibilityChange
75843
+ onVisibilityChange,
75844
+ transparency
75832
75845
  };
75833
75846
  }
75834
75847
  function useWebglIsolation(viewer) {
@@ -75836,6 +75849,29 @@ Averrage Date/Second ${avgDataRatePS} kb
75836
75849
  return useSharedIsolation(adapter);
75837
75850
  }
75838
75851
  function createWebglIsolationAdapter(viewer) {
75852
+ var transparency = true;
75853
+ var ghost2 = false;
75854
+ var rooms = false;
75855
+ function updateMaterials() {
75856
+ 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] : (() => {
75857
+ throw new Error("Unreachable state in isolation materials");
75858
+ })();
75859
+ }
75860
+ function updateVisibility(elements, predicate) {
75861
+ if (elements === "all") {
75862
+ for (let v of viewer.vims) {
75863
+ for (let o of v.getAllElements()) {
75864
+ if (o.type === "Element3D") {
75865
+ o.visible = o.isRoom ? rooms : predicate(o);
75866
+ }
75867
+ }
75868
+ }
75869
+ } else {
75870
+ for (let o of elements) {
75871
+ o.visible = o.isRoom ? rooms : predicate(o);
75872
+ }
75873
+ }
75874
+ }
75839
75875
  return {
75840
75876
  onVisibilityChange: viewer.renderer.onSceneUpdated,
75841
75877
  onSelectionChanged: viewer.selection.onSelectionChanged,
@@ -75844,28 +75880,28 @@ Averrage Date/Second ${avgDataRatePS} kb
75844
75880
  hasVisibleSelection: () => viewer.selection.any() && viewer.selection.getAll().every((o) => o.visible),
75845
75881
  hasHiddenSelection: () => viewer.selection.any() && viewer.selection.getAll().every((o) => !o.visible),
75846
75882
  clearSelection: () => viewer.selection.clear(),
75847
- isolateSelection: () => updateAllVisibility(viewer, (o) => viewer.selection.has(o)),
75883
+ isolateSelection: () => updateVisibility("all", (o) => viewer.selection.has(o)),
75848
75884
  hideSelection: () => {
75849
- viewer.selection.getAll().forEach((o) => o.visible = false);
75885
+ updateVisibility(viewer.selection.getAll(), (o) => false);
75850
75886
  },
75851
75887
  showSelection: () => {
75852
- viewer.selection.getAll().forEach((o) => o.visible = true);
75888
+ updateVisibility(viewer.selection.getAll(), (o) => true);
75853
75889
  },
75854
75890
  hideAll: () => {
75855
- updateAllVisibility(viewer, (o) => false);
75891
+ updateVisibility("all", (o) => false);
75856
75892
  },
75857
75893
  showAll: () => {
75858
- updateAllVisibility(viewer, (o) => true);
75894
+ updateVisibility("all", (o) => true);
75859
75895
  },
75860
75896
  isolate: (instances) => {
75861
75897
  const set2 = new Set(instances);
75862
- updateAllVisibility(viewer, (o) => o.instances.some((i2) => set2.has(i2)));
75898
+ updateVisibility("all", (o) => o.instances.some((i2) => set2.has(i2)));
75863
75899
  },
75864
75900
  show: (instances) => {
75865
75901
  for (let i2 of instances) {
75866
75902
  for (let v of viewer.vims) {
75867
75903
  const o = v.getElement(i2);
75868
- o.visible = true;
75904
+ o.visible = o.isRoom ? rooms : true;
75869
75905
  }
75870
75906
  }
75871
75907
  },
@@ -75873,29 +75909,30 @@ Averrage Date/Second ${avgDataRatePS} kb
75873
75909
  for (let i2 of instances) {
75874
75910
  for (let v of viewer.vims) {
75875
75911
  const o = v.getElement(i2);
75876
- o.visible = false;
75912
+ o.visible = o.isRoom ? rooms : false;
75877
75913
  }
75878
75914
  }
75879
75915
  },
75916
+ enableTransparency: (enable) => {
75917
+ if (transparency !== enable) {
75918
+ transparency = enable;
75919
+ updateMaterials();
75920
+ }
75921
+ },
75880
75922
  showGhost: (show) => {
75881
- viewer.renderer.modelMaterial = show ? [viewer.materials.simple, viewer.materials.ghost] : void 0;
75923
+ ghost2 = show;
75924
+ updateMaterials();
75882
75925
  },
75883
75926
  getGhostOpacity: () => viewer.materials.ghostOpacity,
75884
75927
  setGhostOpacity: (opacity) => viewer.materials.ghostOpacity = opacity,
75885
- getShowRooms: () => true,
75928
+ getShowRooms: () => rooms,
75886
75929
  setShowRooms: (show) => {
75887
- console.log("setShowRooms not implemented");
75888
- }
75889
- };
75890
- }
75891
- function updateAllVisibility(viewer, predicate) {
75892
- for (let v of viewer.vims) {
75893
- for (let o of v.getAllElements()) {
75894
- if (o.type === "Element3D") {
75895
- o.visible = predicate(o);
75930
+ if (rooms !== show) {
75931
+ rooms = show;
75932
+ updateVisibility("all", (o) => o.visible);
75896
75933
  }
75897
75934
  }
75898
- }
75935
+ };
75899
75936
  }
75900
75937
  function getVisibilityState$1(viewer) {
75901
75938
  let all = true;
@@ -75921,6 +75958,574 @@ Averrage Date/Second ${avgDataRatePS} kb
75921
75958
  if (onlySelectionFlag) return "onlySelection";
75922
75959
  return "some";
75923
75960
  }
75961
+ function getDefaultSettings() {
75962
+ return {
75963
+ capacity: {
75964
+ canFollowUrl: true,
75965
+ canGoFullScreen: true,
75966
+ canDownload: true,
75967
+ canReadLocalStorage: true
75968
+ },
75969
+ ui: {
75970
+ logo: true,
75971
+ performance: false,
75972
+ bimTreePanel: true,
75973
+ bimInfoPanel: true,
75974
+ // axesPanel
75975
+ axesPanel: true,
75976
+ orthographic: true,
75977
+ resetCamera: true,
75978
+ // Control bar
75979
+ controlBar: true,
75980
+ // Control bar - cursors
75981
+ cursorOrbit: true,
75982
+ cursorLookAround: true,
75983
+ cursorPan: true,
75984
+ cursorZoom: true,
75985
+ // Control bar - camera
75986
+ cameraAuto: true,
75987
+ cameraFrameScene: true,
75988
+ cameraFrameSelection: true,
75989
+ // Control bar - tools
75990
+ sectioningEnable: true,
75991
+ sectioningFitToSelection: true,
75992
+ sectioningReset: true,
75993
+ sectioningShow: true,
75994
+ sectioningAuto: true,
75995
+ sectioningSettings: true,
75996
+ measureEnable: true,
75997
+ // Control bar - Visibility
75998
+ visibilityClearSelection: true,
75999
+ visibilityShowAll: true,
76000
+ visibilityToggle: true,
76001
+ visibilityIsolate: true,
76002
+ visibilityAutoIsolate: true,
76003
+ visibilitySettings: true,
76004
+ // Control bar - settings
76005
+ miscProjectInspector: true,
76006
+ miscSettings: true,
76007
+ miscHelp: true,
76008
+ miscMaximise: true
76009
+ }
76010
+ };
76011
+ }
76012
+ function renderSettingsInputBox(settings2, item) {
76013
+ const ref = React2.useRef(null);
76014
+ React2.useEffect(() => {
76015
+ var _a3;
76016
+ ref.current.value = (_a3 = item.getter(settings2.value)) == null ? void 0 : _a3.toString();
76017
+ }, []);
76018
+ const update = (event) => {
76019
+ const str = event.target.value;
76020
+ const n = Number.parseFloat(str);
76021
+ if (Number.isNaN(n)) {
76022
+ event.target.value = item.getter(settings2.value).toString();
76023
+ } else {
76024
+ const value = item.transform(n);
76025
+ event.target.value = value.toString();
76026
+ settings2.update((s) => item.setter(s, value));
76027
+ }
76028
+ };
76029
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vc-box-input vc-my-1 ", children: [
76030
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: "textbox", className: "vc-w-3 vc-h-2", children: [
76031
+ item.label,
76032
+ ":"
76033
+ ] }),
76034
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76035
+ "input",
76036
+ {
76037
+ ref,
76038
+ type: "text",
76039
+ className: "vim-settings-textbox vc-border vc-rounded-sm vc-border-gray vc-w-14 vc-ml-1 vc-p-1",
76040
+ onBlur: update
76041
+ }
76042
+ ),
76043
+ /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "textbox", className: "vc-w-3 vc-h-2 vc-text-gray vc-ml-1", children: item.info })
76044
+ ] });
76045
+ }
76046
+ function renderSettingsToggle(settings2, item) {
76047
+ const value = item.getter(settings2.value);
76048
+ if (value === "AlwaysTrue" || value === "AlwaysFalse") return null;
76049
+ const handleChange = () => {
76050
+ const current = item.getter(settings2.value);
76051
+ settings2.update((s) => item.setter(s, !current));
76052
+ };
76053
+ 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: [
76054
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76055
+ "input",
76056
+ {
76057
+ type: "checkbox",
76058
+ checked: value,
76059
+ onChange: handleChange,
76060
+ className: "vim-settings-checkbox vc-checked:bg-primary-royal vc-mr-2 vc-rounded vc-border vc-border-gray-medium"
76061
+ }
76062
+ ),
76063
+ " ",
76064
+ item.label
76065
+ ] });
76066
+ }
76067
+ function renderSettingsSubtitle(item) {
76068
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "vc-subtitle", children: item.title });
76069
+ }
76070
+ function SettingsPanel(props) {
76071
+ if (!props.visible) return null;
76072
+ function renderItem(settings2, item) {
76073
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(React2.Fragment, { children: (() => {
76074
+ switch (item.type) {
76075
+ case "subtitle":
76076
+ return renderSettingsSubtitle(item);
76077
+ case "toggle":
76078
+ return renderSettingsToggle(settings2, item);
76079
+ case "box":
76080
+ return renderSettingsInputBox(settings2, item);
76081
+ case "element":
76082
+ return item.element;
76083
+ default:
76084
+ return null;
76085
+ }
76086
+ })() }, item.key);
76087
+ }
76088
+ const customizer = props.settings.customizer.get();
76089
+ const content2 = customizer ? customizer(props.content) : props.content;
76090
+ const sections = buildSections(content2);
76091
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vc-absolute vc-inset-0", children: [
76092
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "vc-title vc-mb-2", children: "Settings" }),
76093
+ /* @__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(
76094
+ "details",
76095
+ {
76096
+ open: true,
76097
+ 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 ",
76098
+ children: [
76099
+ /* @__PURE__ */ jsxRuntimeExports.jsx("summary", { className: "vim-settings-section-title vc-font-medium vc-text-sm vc-cursor-pointer", children: section.title }),
76100
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "vim-settings-section-content vc-mt-2 vc-space-y-2", children: section.items.map(
76101
+ (item) => renderItem(props.settings, item)
76102
+ ) })
76103
+ ]
76104
+ },
76105
+ section.key
76106
+ )) })
76107
+ ] });
76108
+ }
76109
+ function buildSections(items) {
76110
+ const sections = [];
76111
+ let current = null;
76112
+ for (const item of items) {
76113
+ if (item.type === "subtitle") {
76114
+ current = {
76115
+ key: item.key,
76116
+ title: item.title,
76117
+ items: []
76118
+ };
76119
+ sections.push(current);
76120
+ } else {
76121
+ if (!current) {
76122
+ current = {
76123
+ key: "default",
76124
+ title: "",
76125
+ items: []
76126
+ };
76127
+ sections.push(current);
76128
+ }
76129
+ current.items.push(item);
76130
+ }
76131
+ }
76132
+ return sections;
76133
+ }
76134
+ class SettingsPanelKeys {
76135
+ }
76136
+ // === Inputs ===
76137
+ __publicField(SettingsPanelKeys, "InputsSubtitle", "inputs");
76138
+ __publicField(SettingsPanelKeys, "InputsScrollSpeedBox", "scrollSpeed");
76139
+ // === Panels ===
76140
+ __publicField(SettingsPanelKeys, "PanelsSubtitle", "panels");
76141
+ __publicField(SettingsPanelKeys, "PanelsShowLogoToggle", "logo");
76142
+ __publicField(SettingsPanelKeys, "PanelsShowBimTreeToggle", "bimTree");
76143
+ __publicField(SettingsPanelKeys, "PanelsShowBimInfoToggle", "bimInfo");
76144
+ __publicField(SettingsPanelKeys, "PanelsShowAxesPanelToggle", "axesPanel");
76145
+ __publicField(SettingsPanelKeys, "PanelsShowPerformancePanelToggle", "performance");
76146
+ // === Axes ===
76147
+ __publicField(SettingsPanelKeys, "AxesSubtitle", "axes");
76148
+ __publicField(SettingsPanelKeys, "AxesShowOrthographicButtonToggle", "orthographic");
76149
+ __publicField(SettingsPanelKeys, "AxesShowResetCameraButtonToggle", "resetCamera");
76150
+ // === Control Bar ===
76151
+ __publicField(SettingsPanelKeys, "ControlBarSubtitle", "controlBar");
76152
+ __publicField(SettingsPanelKeys, "ControlBarShowControlBarToggle", "controlBarVisible");
76153
+ // --- Control Bar - Cursors ---
76154
+ __publicField(SettingsPanelKeys, "ControlBarCursorsSubtitle", "controlBarCursors");
76155
+ __publicField(SettingsPanelKeys, "ControlBarCursorsShowOrbitButtonToggle", "orbit");
76156
+ __publicField(SettingsPanelKeys, "ControlBarCursorsShowLookAroundButtonToggle", "lookAround");
76157
+ __publicField(SettingsPanelKeys, "ControlBarCursorsShowPanButtonToggle", "pan");
76158
+ __publicField(SettingsPanelKeys, "ControlBarCursorsShowZoomButtonToggle", "zoom");
76159
+ __publicField(SettingsPanelKeys, "ControlBarCursorsShowZoomWindowButtonToggle", "zoomWindow");
76160
+ // --- Control Bar - Tools ---
76161
+ __publicField(SettingsPanelKeys, "ControlBarToolsSubtitle", "controlBarTools");
76162
+ __publicField(SettingsPanelKeys, "ControlBarToolsShowMeasuringModeButtonToggle", "measuringMode");
76163
+ // --- Control Bar Camera ---
76164
+ __publicField(SettingsPanelKeys, "ControlBarCameraSubtitle", "settingsPanel.controlBar.Camera");
76165
+ __publicField(SettingsPanelKeys, "ControlBarAutoCamera", "settingsPanel.controlBar.autoCamera");
76166
+ __publicField(SettingsPanelKeys, "ControlBarFrameSelection", "settingsPanel.controlBar.frameSelection");
76167
+ __publicField(SettingsPanelKeys, "ControlBarFrameAll", "settingsPanel.controlBar.frameAll");
76168
+ // --- Control Bar - Sectioning ---
76169
+ __publicField(SettingsPanelKeys, "ControlBarSectioningSubtitle", "settingsPanel.controlBar.sectioning");
76170
+ __publicField(SettingsPanelKeys, "ControlBarSectioningEnable", "settingsPanel.controlBar.enableSectioning");
76171
+ __publicField(SettingsPanelKeys, "ControlBarSectioningFitToSelection", "settingsPanel.controlBar.fitToSelection");
76172
+ __publicField(SettingsPanelKeys, "ControlBarSectioningReset", "settingsPanel.controlBar.reset");
76173
+ __publicField(SettingsPanelKeys, "ControlBarSectioningShow", "settingsPanel.controlBar.show");
76174
+ __publicField(SettingsPanelKeys, "ControlBarSectioningAuto", "settingsPanel.controlBar.auto");
76175
+ __publicField(SettingsPanelKeys, "ControlBarSectioningSettings", "settingsPanel.controlBar.settings");
76176
+ // --- Control Bar - Visibility ---
76177
+ __publicField(SettingsPanelKeys, "ControlBarVisibilitySubtitle", "controlBar.visibility.subtitle");
76178
+ __publicField(SettingsPanelKeys, "ControlBarVisibilityClearSelection", "controlBar.visibility.clearSelection");
76179
+ __publicField(SettingsPanelKeys, "ControlBarVisibilityShowAll", "controlBar.visibility.showAll");
76180
+ __publicField(SettingsPanelKeys, "ControlBarVisibilityToggle", "controlBar.visibility.toggle");
76181
+ __publicField(SettingsPanelKeys, "ControlBarVisibilityIsolate", "controlBar.visibility.isolate");
76182
+ __publicField(SettingsPanelKeys, "ControlBarVisibilityAutoIsolate", "controlBar.visibility.autoIsolate");
76183
+ __publicField(SettingsPanelKeys, "ControlBarVisibilitySettings", "controlBar.visibility.settings");
76184
+ // --- Control Bar - Settings ---
76185
+ __publicField(SettingsPanelKeys, "ControlBarSettingsSubtitle", "controlBarSettings");
76186
+ __publicField(SettingsPanelKeys, "ControlBarSettingsShowProjectInspectorButtonToggle", "projectInspector");
76187
+ __publicField(SettingsPanelKeys, "ControlBarSettingsShowSettingsButtonToggle", "settingsButton");
76188
+ __publicField(SettingsPanelKeys, "ControlBarSettingsShowHelpButtonToggle", "help");
76189
+ __publicField(SettingsPanelKeys, "ControlBarSettingsShowMaximiseButtonToggle", "maximise");
76190
+ function getControlBarCursorSettings() {
76191
+ return [
76192
+ {
76193
+ type: "subtitle",
76194
+ key: SettingsPanelKeys.ControlBarCursorsSubtitle,
76195
+ title: "Control Bar - Cursors"
76196
+ },
76197
+ {
76198
+ type: "toggle",
76199
+ key: SettingsPanelKeys.ControlBarCursorsShowOrbitButtonToggle,
76200
+ label: "Orbit",
76201
+ getter: (s) => s.ui.cursorOrbit,
76202
+ setter: (s, v) => s.ui.cursorOrbit = v
76203
+ },
76204
+ {
76205
+ type: "toggle",
76206
+ key: SettingsPanelKeys.ControlBarCursorsShowLookAroundButtonToggle,
76207
+ label: "Look Around",
76208
+ getter: (s) => s.ui.cursorLookAround,
76209
+ setter: (s, v) => s.ui.cursorLookAround = v
76210
+ },
76211
+ {
76212
+ type: "toggle",
76213
+ key: SettingsPanelKeys.ControlBarCursorsShowPanButtonToggle,
76214
+ label: "Pan",
76215
+ getter: (s) => s.ui.cursorPan,
76216
+ setter: (s, v) => s.ui.cursorPan = v
76217
+ },
76218
+ {
76219
+ type: "toggle",
76220
+ key: SettingsPanelKeys.ControlBarCursorsShowZoomButtonToggle,
76221
+ label: "Zoom",
76222
+ getter: (s) => s.ui.cursorZoom,
76223
+ setter: (s, v) => s.ui.cursorZoom = v
76224
+ }
76225
+ ];
76226
+ }
76227
+ function getControlBarCameraSettings() {
76228
+ return [
76229
+ {
76230
+ type: "subtitle",
76231
+ key: SettingsPanelKeys.ControlBarCameraSubtitle,
76232
+ title: "Control Bar - Camera"
76233
+ },
76234
+ {
76235
+ type: "toggle",
76236
+ key: SettingsPanelKeys.ControlBarAutoCamera,
76237
+ label: "Auto Camera",
76238
+ getter: (s) => s.ui.cameraAuto,
76239
+ setter: (s, v) => s.ui.cameraAuto = v
76240
+ },
76241
+ {
76242
+ type: "toggle",
76243
+ key: SettingsPanelKeys.ControlBarFrameSelection,
76244
+ label: "Frame Selection",
76245
+ getter: (s) => s.ui.cameraFrameSelection,
76246
+ setter: (s, v) => s.ui.cameraFrameSelection = v
76247
+ },
76248
+ {
76249
+ type: "toggle",
76250
+ key: SettingsPanelKeys.ControlBarFrameAll,
76251
+ label: "Frame All",
76252
+ getter: (s) => s.ui.cameraFrameScene,
76253
+ setter: (s, v) => s.ui.cameraFrameScene = v
76254
+ }
76255
+ ];
76256
+ }
76257
+ function getControlBarSectionBoxSettings() {
76258
+ return [
76259
+ {
76260
+ type: "subtitle",
76261
+ key: SettingsPanelKeys.ControlBarSectioningSubtitle,
76262
+ title: "Control Bar - Sectioning"
76263
+ },
76264
+ {
76265
+ type: "toggle",
76266
+ key: SettingsPanelKeys.ControlBarSectioningEnable,
76267
+ label: "Enable Sectioning",
76268
+ getter: (s) => s.ui.sectioningEnable,
76269
+ setter: (s, v) => s.ui.sectioningEnable = v
76270
+ },
76271
+ {
76272
+ type: "toggle",
76273
+ key: SettingsPanelKeys.ControlBarSectioningFitToSelection,
76274
+ label: "Fit To Selection",
76275
+ getter: (s) => s.ui.sectioningFitToSelection,
76276
+ setter: (s, v) => s.ui.sectioningFitToSelection = v
76277
+ },
76278
+ {
76279
+ type: "toggle",
76280
+ key: SettingsPanelKeys.ControlBarSectioningReset,
76281
+ label: "Reset",
76282
+ getter: (s) => s.ui.sectioningReset,
76283
+ setter: (s, v) => s.ui.sectioningReset = v
76284
+ },
76285
+ {
76286
+ type: "toggle",
76287
+ key: SettingsPanelKeys.ControlBarSectioningShow,
76288
+ label: "Show",
76289
+ getter: (s) => s.ui.sectioningShow,
76290
+ setter: (s, v) => s.ui.sectioningShow = v
76291
+ },
76292
+ {
76293
+ type: "toggle",
76294
+ key: SettingsPanelKeys.ControlBarSectioningAuto,
76295
+ label: "Auto",
76296
+ getter: (s) => s.ui.sectioningAuto,
76297
+ setter: (s, v) => s.ui.sectioningAuto = v
76298
+ },
76299
+ {
76300
+ type: "toggle",
76301
+ key: SettingsPanelKeys.ControlBarSectioningSettings,
76302
+ label: "Settings",
76303
+ getter: (s) => s.ui.sectioningSettings,
76304
+ setter: (s, v) => s.ui.sectioningSettings = v
76305
+ }
76306
+ ];
76307
+ }
76308
+ function getControlBarVisibilitySettings() {
76309
+ return [
76310
+ {
76311
+ type: "subtitle",
76312
+ key: SettingsPanelKeys.ControlBarVisibilitySubtitle,
76313
+ title: "Control Bar - Visibility"
76314
+ },
76315
+ {
76316
+ type: "toggle",
76317
+ key: SettingsPanelKeys.ControlBarVisibilityClearSelection,
76318
+ label: "Clear Selection",
76319
+ getter: (s) => s.ui.visibilityClearSelection,
76320
+ setter: (s, v) => s.ui.visibilityClearSelection = v
76321
+ },
76322
+ {
76323
+ type: "toggle",
76324
+ key: SettingsPanelKeys.ControlBarVisibilityShowAll,
76325
+ label: "Show All",
76326
+ getter: (s) => s.ui.visibilityShowAll,
76327
+ setter: (s, v) => s.ui.visibilityShowAll = v
76328
+ },
76329
+ {
76330
+ type: "toggle",
76331
+ key: SettingsPanelKeys.ControlBarVisibilityToggle,
76332
+ label: "Toggle",
76333
+ getter: (s) => s.ui.visibilityToggle,
76334
+ setter: (s, v) => s.ui.visibilityToggle = v
76335
+ },
76336
+ {
76337
+ type: "toggle",
76338
+ key: SettingsPanelKeys.ControlBarVisibilityIsolate,
76339
+ label: "Isolate",
76340
+ getter: (s) => s.ui.visibilityIsolate,
76341
+ setter: (s, v) => s.ui.visibilityIsolate = v
76342
+ },
76343
+ {
76344
+ type: "toggle",
76345
+ key: SettingsPanelKeys.ControlBarVisibilityAutoIsolate,
76346
+ label: "Auto Isolate",
76347
+ getter: (s) => s.ui.visibilityAutoIsolate,
76348
+ setter: (s, v) => s.ui.visibilityAutoIsolate = v
76349
+ },
76350
+ {
76351
+ type: "toggle",
76352
+ key: SettingsPanelKeys.ControlBarVisibilitySettings,
76353
+ label: "Settings",
76354
+ getter: (s) => s.ui.visibilitySettings,
76355
+ setter: (s, v) => s.ui.visibilitySettings = v
76356
+ }
76357
+ ];
76358
+ }
76359
+ function getControlBarVariousSettings() {
76360
+ return [
76361
+ {
76362
+ type: "subtitle",
76363
+ key: SettingsPanelKeys.ControlBarSettingsSubtitle,
76364
+ title: "Control Bar - Settings"
76365
+ },
76366
+ {
76367
+ type: "toggle",
76368
+ key: SettingsPanelKeys.ControlBarSettingsShowProjectInspectorButtonToggle,
76369
+ label: "Project Inspector",
76370
+ getter: (s) => s.ui.miscProjectInspector,
76371
+ setter: (s, v) => s.ui.miscProjectInspector = v
76372
+ },
76373
+ {
76374
+ type: "toggle",
76375
+ key: SettingsPanelKeys.ControlBarSettingsShowSettingsButtonToggle,
76376
+ label: "Settings",
76377
+ getter: (s) => s.ui.miscSettings,
76378
+ setter: (s, v) => s.ui.miscSettings = v
76379
+ },
76380
+ {
76381
+ type: "toggle",
76382
+ key: SettingsPanelKeys.ControlBarSettingsShowHelpButtonToggle,
76383
+ label: "Help",
76384
+ getter: (s) => s.ui.miscHelp,
76385
+ setter: (s, v) => s.ui.miscHelp = v
76386
+ },
76387
+ {
76388
+ type: "toggle",
76389
+ key: SettingsPanelKeys.ControlBarSettingsShowMaximiseButtonToggle,
76390
+ label: "Maximise",
76391
+ getter: (s) => s.ui.miscMaximise,
76392
+ setter: (s, v) => s.ui.miscMaximise = v
76393
+ }
76394
+ ];
76395
+ }
76396
+ function getPanelsVisibilitySettings() {
76397
+ return [
76398
+ {
76399
+ type: "subtitle",
76400
+ key: SettingsPanelKeys.PanelsSubtitle,
76401
+ title: "Panels Visibility"
76402
+ },
76403
+ {
76404
+ type: "toggle",
76405
+ key: SettingsPanelKeys.PanelsShowLogoToggle,
76406
+ label: "Logo",
76407
+ getter: (s) => s.ui.logo,
76408
+ setter: (s, v) => s.ui.logo = v
76409
+ },
76410
+ {
76411
+ type: "toggle",
76412
+ key: SettingsPanelKeys.PanelsShowBimTreeToggle,
76413
+ label: "Bim Tree",
76414
+ getter: (s) => s.ui.bimTreePanel,
76415
+ setter: (s, v) => s.ui.bimTreePanel = v
76416
+ },
76417
+ {
76418
+ type: "toggle",
76419
+ key: SettingsPanelKeys.PanelsShowBimInfoToggle,
76420
+ label: "Bim Info",
76421
+ getter: (s) => s.ui.bimInfoPanel,
76422
+ setter: (s, v) => s.ui.bimInfoPanel = v
76423
+ },
76424
+ {
76425
+ type: "toggle",
76426
+ key: SettingsPanelKeys.PanelsShowAxesPanelToggle,
76427
+ label: "Axes",
76428
+ getter: (s) => s.ui.axesPanel,
76429
+ setter: (s, v) => s.ui.axesPanel = v
76430
+ },
76431
+ {
76432
+ type: "toggle",
76433
+ key: SettingsPanelKeys.PanelsShowPerformancePanelToggle,
76434
+ label: "Performance",
76435
+ getter: (s) => s.ui.performance,
76436
+ setter: (s, v) => s.ui.performance = v
76437
+ },
76438
+ {
76439
+ type: "toggle",
76440
+ key: SettingsPanelKeys.ControlBarShowControlBarToggle,
76441
+ label: "Control Bar",
76442
+ getter: (s) => s.ui.controlBar,
76443
+ setter: (s, v) => s.ui.controlBar = v
76444
+ }
76445
+ ];
76446
+ }
76447
+ function getInputsSettings(viewer) {
76448
+ return [
76449
+ {
76450
+ type: "subtitle",
76451
+ key: SettingsPanelKeys.InputsSubtitle,
76452
+ title: "Inputs"
76453
+ },
76454
+ {
76455
+ type: "box",
76456
+ key: SettingsPanelKeys.InputsScrollSpeedBox,
76457
+ label: "Scroll Speed",
76458
+ info: "[0.1,10]",
76459
+ transform: (n) => MathUtils.clamp(n, 0.1, 10),
76460
+ getter: (_s) => viewer.inputs.scrollSpeed,
76461
+ setter: (_s, v) => {
76462
+ viewer.inputs.scrollSpeed = v;
76463
+ }
76464
+ }
76465
+ ];
76466
+ }
76467
+ function getAxesPanelSettings() {
76468
+ return [
76469
+ {
76470
+ type: "subtitle",
76471
+ key: SettingsPanelKeys.AxesSubtitle,
76472
+ title: "Axes Panel"
76473
+ },
76474
+ {
76475
+ type: "toggle",
76476
+ key: SettingsPanelKeys.AxesShowOrthographicButtonToggle,
76477
+ label: "Orthographic Camera",
76478
+ getter: (s) => s.ui.orthographic,
76479
+ setter: (s, v) => s.ui.orthographic = v
76480
+ },
76481
+ {
76482
+ type: "toggle",
76483
+ key: SettingsPanelKeys.AxesShowResetCameraButtonToggle,
76484
+ label: "Reset Camera",
76485
+ getter: (s) => s.ui.resetCamera,
76486
+ setter: (s, v) => s.ui.resetCamera = v
76487
+ }
76488
+ ];
76489
+ }
76490
+ function getControlBarMeasureSettings() {
76491
+ return [
76492
+ {
76493
+ type: "subtitle",
76494
+ key: SettingsPanelKeys.ControlBarToolsSubtitle,
76495
+ title: "Control Bar - Measurement"
76496
+ },
76497
+ {
76498
+ type: "toggle",
76499
+ key: SettingsPanelKeys.ControlBarToolsShowMeasuringModeButtonToggle,
76500
+ label: "Enable",
76501
+ getter: (s) => s.ui.measureEnable,
76502
+ setter: (s, v) => s.ui.measureEnable = v
76503
+ }
76504
+ ];
76505
+ }
76506
+ function getWebglSettingsContent(viewer) {
76507
+ return [
76508
+ ...getInputsSettings(viewer),
76509
+ ...getPanelsVisibilitySettings(),
76510
+ ...getAxesPanelSettings(),
76511
+ ...getControlBarCursorSettings(),
76512
+ ...getControlBarCameraSettings(),
76513
+ ...getControlBarVisibilitySettings(),
76514
+ ...getControlBarMeasureSettings(),
76515
+ ...getControlBarSectionBoxSettings(),
76516
+ ...getControlBarVariousSettings()
76517
+ ];
76518
+ }
76519
+ function applyWebglSettings(settings2) {
76520
+ const performance2 = document.getElementsByClassName("vim-performance-div")[0];
76521
+ if (performance2) {
76522
+ if (isTrue(settings2.ui.performance)) {
76523
+ performance2.classList.remove("vc-hidden");
76524
+ } else {
76525
+ performance2.classList.add("vc-hidden");
76526
+ }
76527
+ }
76528
+ }
75924
76529
  function createViewer$1(container, settings2 = {}, coreSettings = {}) {
75925
76530
  const controllablePromise = new ControllablePromise();
75926
76531
  const cmpContainer = container instanceof HTMLElement ? createContainer(container) : container ?? createContainer();
@@ -75951,7 +76556,7 @@ Averrage Date/Second ${avgDataRatePS} kb
75951
76556
  return controllablePromise.promise;
75952
76557
  }
75953
76558
  function Viewer$1(props) {
75954
- const settings2 = useSettings(props.viewer, props.settings ?? {});
76559
+ const settings2 = useSettings(props.settings ?? {}, getDefaultSettings(), (s) => applyWebglSettings(s));
75955
76560
  const modal = React2.useRef(null);
75956
76561
  const sectionBoxRef = useWebglSectionBox(props.viewer);
75957
76562
  const isolationPanelHandle = React2.useRef(null);
@@ -75977,6 +76582,16 @@ Averrage Date/Second ${avgDataRatePS} kb
75977
76582
  side.setHasBim(((_a3 = viewerState.vim.get()) == null ? void 0 : _a3.bim) !== void 0);
75978
76583
  });
75979
76584
  React2.useEffect(() => {
76585
+ sectionBoxRef.showOffsetPanel.onChange.subscribe((show) => {
76586
+ if (show) {
76587
+ isolationRef.showPanel.set(false);
76588
+ }
76589
+ });
76590
+ isolationRef.showPanel.onChange.subscribe((show) => {
76591
+ if (show) {
76592
+ sectionBoxRef.showOffsetPanel.set(false);
76593
+ }
76594
+ });
75980
76595
  if (performanceRef.current) {
75981
76596
  addPerformanceCounter(performanceRef.current);
75982
76597
  }
@@ -75990,7 +76605,11 @@ Averrage Date/Second ${avgDataRatePS} kb
75990
76605
  loader: loader.current,
75991
76606
  isolation: isolationRef,
75992
76607
  camera: camera2,
75993
- settings: settings2,
76608
+ settings: {
76609
+ update: settings2.update,
76610
+ register: settings2.register,
76611
+ customize: (c) => settings2.customizer.set(c)
76612
+ },
75994
76613
  get isolationPanel() {
75995
76614
  return isolationPanelHandle.current;
75996
76615
  },
@@ -76036,7 +76655,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76036
76655
  SettingsPanel,
76037
76656
  {
76038
76657
  visible: side.getContent() === "settings",
76039
- viewer: props.viewer,
76658
+ content: getWebglSettingsContent(props.viewer),
76040
76659
  settings: settings2
76041
76660
  }
76042
76661
  )
@@ -76065,7 +76684,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76065
76684
  }
76066
76685
  ),
76067
76686
  /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel$1, { ref: sectionBoxPanelHandle, state: sectionBoxRef }),
76068
- /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel$1, { ref: isolationPanelHandle, state: isolationRef }),
76687
+ /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel$1, { ref: isolationPanelHandle, state: isolationRef, transparency: true }),
76069
76688
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76070
76689
  AxesPanelMemo,
76071
76690
  {
@@ -76104,7 +76723,8 @@ Averrage Date/Second ${avgDataRatePS} kb
76104
76723
  const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
76105
76724
  __proto__: null,
76106
76725
  Viewer: Viewer$1,
76107
- createViewer: createViewer$1
76726
+ createViewer: createViewer$1,
76727
+ getDefaultSettings
76108
76728
  }, Symbol.toStringTag, { value: "Module" }));
76109
76729
  function getErrorMessage(state) {
76110
76730
  if (state.status !== "error") return void 0;
@@ -76163,18 +76783,20 @@ Averrage Date/Second ${avgDataRatePS} kb
76163
76783
  viewer.sectionBox.interactive = b;
76164
76784
  },
76165
76785
  getBox: () => viewer.sectionBox.getBox(),
76166
- setBox: (box) => viewer.sectionBox.fitBox(box),
76786
+ setBox: (box) => viewer.sectionBox.setBox(box),
76167
76787
  onSelectionChanged: viewer.selection.onSelectionChanged,
76168
76788
  getSelectionBox: () => viewer.selection.getBoundingBox(),
76169
76789
  getSceneBox: () => viewer.renderer.getBoundingBox()
76170
76790
  };
76171
76791
  return useSectionBox(ultraAdapter);
76172
76792
  }
76173
- function useUltraControlBar(viewer, section, isolation, camera2, customization) {
76174
- const sectionSectionBox2 = controlBarSectionBox(section, viewer.selection.any());
76175
- const selection = controlBarSelection(isolation);
76176
- const sectionCamera2 = controlBarCamera(camera2);
76177
- let bar = [selection, sectionCamera2, sectionSectionBox2];
76793
+ function useUltraControlBar(viewer, section, isolation, camera2, settings2, side, customization) {
76794
+ let bar = [
76795
+ controlBarCamera(camera2, settings2.ui),
76796
+ controlBarVisibility(isolation, settings2.ui),
76797
+ controlBarSectionBox(section, viewer.selection.any(), settings2.ui),
76798
+ controlBarSettingsUltra(side, settings2)
76799
+ ];
76178
76800
  bar = (customization == null ? void 0 : customization(bar)) ?? bar;
76179
76801
  return bar;
76180
76802
  }
@@ -76244,6 +76866,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76244
76866
  obj.state = VisibilityState.HIGHLIGHTED;
76245
76867
  });
76246
76868
  },
76869
+ // TODO: Change this api to use elements
76247
76870
  isolate: (instances) => {
76248
76871
  hide("all");
76249
76872
  viewer.selection.getAll().forEach((obj) => {
@@ -76277,11 +76900,12 @@ Averrage Date/Second ${avgDataRatePS} kb
76277
76900
  }
76278
76901
  }
76279
76902
  },
76280
- getGhostOpacity: () => viewer.renderer.ghostColor.a,
76903
+ enableTransparency: (enable) => {
76904
+ console.log("enableTransparency not implemented");
76905
+ },
76906
+ getGhostOpacity: () => viewer.renderer.ghostOpacity,
76281
76907
  setGhostOpacity: (opacity) => {
76282
- const c = viewer.renderer.ghostColor.clone();
76283
- c.a = opacity;
76284
- viewer.renderer.ghostColor = c;
76908
+ viewer.renderer.ghostOpacity = opacity;
76285
76909
  },
76286
76910
  getShowRooms: () => true,
76287
76911
  setShowRooms: (show) => {
@@ -76320,7 +76944,61 @@ Averrage Date/Second ${avgDataRatePS} kb
76320
76944
  function allButSelection(viewer, vim) {
76321
76945
  return false;
76322
76946
  }
76323
- function createViewer(container) {
76947
+ function getDefaultUltraSettings() {
76948
+ return {
76949
+ ui: {
76950
+ // Control bar - cursors
76951
+ cursorOrbit: true,
76952
+ cursorLookAround: true,
76953
+ cursorPan: true,
76954
+ cursorZoom: true,
76955
+ // Control bar - camera
76956
+ cameraAuto: true,
76957
+ cameraFrameScene: true,
76958
+ cameraFrameSelection: true,
76959
+ // Control bar - tools
76960
+ sectioningEnable: true,
76961
+ sectioningFitToSelection: true,
76962
+ sectioningReset: true,
76963
+ sectioningShow: true,
76964
+ sectioningAuto: true,
76965
+ sectioningSettings: true,
76966
+ // Control bar - Visibility
76967
+ visibilityClearSelection: true,
76968
+ visibilityShowAll: true,
76969
+ visibilityToggle: true,
76970
+ visibilityIsolate: true,
76971
+ visibilityAutoIsolate: true,
76972
+ visibilitySettings: true,
76973
+ settings: true
76974
+ }
76975
+ };
76976
+ }
76977
+ function getControlBarUltraSettings() {
76978
+ return [
76979
+ {
76980
+ type: "subtitle",
76981
+ key: SettingsPanelKeys.ControlBarSettingsSubtitle,
76982
+ title: "Control Bar - Settings"
76983
+ },
76984
+ {
76985
+ type: "toggle",
76986
+ key: SettingsPanelKeys.ControlBarSettingsShowSettingsButtonToggle,
76987
+ label: "Settings",
76988
+ getter: (s) => s.ui.settings,
76989
+ setter: (s, v) => s.ui.settings = v
76990
+ }
76991
+ ];
76992
+ }
76993
+ function getUltraSettingsContent(viewer) {
76994
+ return [
76995
+ ...getControlBarCameraSettings(),
76996
+ ...getControlBarVisibilitySettings(),
76997
+ ...getControlBarSectionBoxSettings(),
76998
+ ...getControlBarUltraSettings()
76999
+ ];
77000
+ }
77001
+ function createViewer(container, settings2) {
76324
77002
  const controllablePromise = new ControllablePromise();
76325
77003
  const cmpContainer = container instanceof HTMLElement ? createContainer(container) : container ?? createContainer();
76326
77004
  const core = Viewer$2.createWithCanvas(cmpContainer.gfx);
@@ -76339,6 +77017,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76339
77017
  {
76340
77018
  container: cmpContainer,
76341
77019
  core,
77020
+ settings: settings2,
76342
77021
  onMount: (cmp) => controllablePromise.resolve(attachDispose(cmp))
76343
77022
  }
76344
77023
  )
@@ -76346,18 +77025,37 @@ Averrage Date/Second ${avgDataRatePS} kb
76346
77025
  return controllablePromise.promise;
76347
77026
  }
76348
77027
  function Viewer(props) {
76349
- const sectionBox2 = useUltraSectionBox(props.core);
76350
- const camera2 = useUltraCamera(props.core, sectionBox2);
77028
+ const settings2 = useSettings(props.settings ?? {}, getDefaultUltraSettings());
77029
+ const sectionBoxRef = useUltraSectionBox(props.core);
77030
+ const camera2 = useUltraCamera(props.core, sectionBoxRef);
76351
77031
  const isolationPanelHandle = React2.useRef(null);
76352
77032
  const sectionBoxPanelHandle = React2.useRef(null);
76353
77033
  const modalHandle = React2.useRef(null);
76354
77034
  const side = useSideState(true, 400);
76355
77035
  const [_, setSelectState] = React2.useState(0);
76356
77036
  const [controlBarCustom, setControlBarCustom] = React2.useState(() => (c) => c);
76357
- const isolation = useUltraIsolation(props.core);
76358
- const controlBar = useUltraControlBar(props.core, sectionBox2, isolation, camera2, (_2) => _2);
77037
+ const isolationRef = useUltraIsolation(props.core);
77038
+ const controlBar = useUltraControlBar(
77039
+ props.core,
77040
+ sectionBoxRef,
77041
+ isolationRef,
77042
+ camera2,
77043
+ settings2.value,
77044
+ side,
77045
+ (_2) => _2
77046
+ );
76359
77047
  useViewerInput(props.core.inputs, camera2);
76360
77048
  React2.useEffect(() => {
77049
+ sectionBoxRef.showOffsetPanel.onChange.subscribe((show) => {
77050
+ if (show) {
77051
+ isolationRef.showPanel.set(false);
77052
+ }
77053
+ });
77054
+ isolationRef.showPanel.onChange.subscribe((show) => {
77055
+ if (show) {
77056
+ sectionBoxRef.showOffsetPanel.set(false);
77057
+ }
77058
+ });
76361
77059
  props.core.onStateChanged.subscribe((state) => updateModal(modalHandle, state));
76362
77060
  props.core.selection.onSelectionChanged.subscribe(() => {
76363
77061
  setSelectState((i2) => (i2 + 1) % 2);
@@ -76367,9 +77065,14 @@ Averrage Date/Second ${avgDataRatePS} kb
76367
77065
  get modal() {
76368
77066
  return modalHandle.current;
76369
77067
  },
76370
- isolation,
76371
- sectionBox: sectionBox2,
77068
+ isolation: isolationRef,
77069
+ sectionBox: sectionBoxRef,
76372
77070
  camera: camera2,
77071
+ settings: {
77072
+ update: settings2.update,
77073
+ register: settings2.register,
77074
+ customize: (c) => settings2.customizer.set(c)
77075
+ },
76373
77076
  get isolationPanel() {
76374
77077
  return isolationPanelHandle.current;
76375
77078
  },
@@ -76384,7 +77087,24 @@ Averrage Date/Second ${avgDataRatePS} kb
76384
77087
  load: patchLoad(props.core, modalHandle)
76385
77088
  });
76386
77089
  }, []);
77090
+ const sidePanel = () => /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
77091
+ SettingsPanel,
77092
+ {
77093
+ visible: side.getContent() === "settings",
77094
+ content: getUltraSettingsContent(props.core),
77095
+ settings: settings2
77096
+ }
77097
+ ) });
76387
77098
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
77099
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
77100
+ SidePanelMemo,
77101
+ {
77102
+ container: props.container,
77103
+ viewer: props.core,
77104
+ side,
77105
+ content: sidePanel
77106
+ }
77107
+ ),
76388
77108
  /* @__PURE__ */ jsxRuntimeExports.jsx(RestOfScreen, { side, content: () => {
76389
77109
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
76390
77110
  whenTrue(true, /* @__PURE__ */ jsxRuntimeExports.jsx(LogoMemo, {})),
@@ -76396,8 +77116,8 @@ Averrage Date/Second ${avgDataRatePS} kb
76396
77116
  show: true
76397
77117
  }
76398
77118
  ),
76399
- /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel$1, { ref: sectionBoxPanelHandle, state: sectionBox2 }),
76400
- /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel$1, { ref: isolationPanelHandle, state: isolation })
77119
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel$1, { ref: sectionBoxPanelHandle, state: sectionBoxRef }),
77120
+ /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel$1, { ref: isolationPanelHandle, state: isolationRef, transparency: false })
76401
77121
  ] });
76402
77122
  } }),
76403
77123
  /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ref: modalHandle, canFollowLinks: true }),
@@ -76435,7 +77155,8 @@ Averrage Date/Second ${avgDataRatePS} kb
76435
77155
  const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
76436
77156
  __proto__: null,
76437
77157
  Viewer,
76438
- createViewer
77158
+ createViewer,
77159
+ getDefaultUltraSettings
76439
77160
  }, Symbol.toStringTag, { value: "Module" }));
76440
77161
  const SectionBoxPanel = {
76441
77162
  Ids