vim-web 0.3.44-dev.16 → 0.3.44-dev.18

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.
@@ -45835,7 +45835,7 @@ void main() {
45835
45835
  }
45836
45836
  }
45837
45837
  class ElementMapping {
45838
- constructor(instances, instanceToElement, elementIds2, instanceMeshes) {
45838
+ constructor(instances, instanceToElement, elementIds, instanceMeshes) {
45839
45839
  __publicField(this, "_instanceToElement");
45840
45840
  __publicField(this, "_instanceMeshes");
45841
45841
  __publicField(this, "_elementToInstances");
@@ -45848,17 +45848,17 @@ void main() {
45848
45848
  this._elementToInstances = ElementMapping.invertMap(
45849
45849
  this._instanceToElement
45850
45850
  );
45851
- this._elementIds = elementIds2;
45852
- this._elementIdToElements = ElementMapping.invertArray(elementIds2);
45851
+ this._elementIds = elementIds;
45852
+ this._elementIdToElements = ElementMapping.invertArray(elementIds);
45853
45853
  this._instanceMeshes = instanceMeshes;
45854
45854
  }
45855
45855
  static async fromG3d(g3d2, bim) {
45856
45856
  const instanceToElement = await bim.node.getAllElementIndex();
45857
- const elementIds2 = await bim.element.getAllId();
45857
+ const elementIds = await bim.element.getAllId();
45858
45858
  return new ElementMapping(
45859
45859
  Array.from(g3d2.instanceNodes),
45860
45860
  instanceToElement,
45861
- elementIds2,
45861
+ elementIds,
45862
45862
  g3d2.instanceMeshes
45863
45863
  );
45864
45864
  }
@@ -60812,8 +60812,8 @@ Averrage Date/Second ${avgDataRatePS} kb
60812
60812
  if (nodes === "all") {
60813
60813
  this._rpc.RPCClearMaterialOverrides(this._handle);
60814
60814
  } else {
60815
- const ids = new Array(nodes.length).fill(MaterialHandles.Invalid);
60816
- this._rpc.RPCSetMaterialOverrides(this._handle, nodes, ids);
60815
+ const ids2 = new Array(nodes.length).fill(MaterialHandles.Invalid);
60816
+ this._rpc.RPCSetMaterialOverrides(this._handle, nodes, ids2);
60817
60817
  }
60818
60818
  }
60819
60819
  updateMap(nodes, state) {
@@ -66817,6 +66817,25 @@ Averrage Date/Second ${avgDataRatePS} kb
66817
66817
  }
66818
66818
  );
66819
66819
  }
66820
+ function autoCamera({ height, width, fill: fill2 = "", className }) {
66821
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className, height, width, viewBox: "0 0 256 256", children: [
66822
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
66823
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66824
+ "path",
66825
+ {
66826
+ fill: fill2,
66827
+ d: "M 242.35934,69.720521 V 192.19034 c 0,9.46501 -7.97359,15.37204 -14.35248,10.67406 l -39.68884,-29.41993 v 8.38267 c 0,25.1595 -15.90243,45.64407 -35.51391,45.64407 H 48.520099 C 28.90861,227.51727 13.006195,206.98664 13.006195,181.80411 V 80.187338 c 0,-25.159506 15.902415,-45.644066 35.513904,-45.644066 H 152.55325 c 19.57566,0 35.51392,20.4385 35.51392,45.644066 v 8.382665 L 227.756,59.150074 c 6.33409,-4.801607 14.60334,1.162981 14.60334,10.570447 z"
66828
+ }
66829
+ ),
66830
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66831
+ "path",
66832
+ {
66833
+ fill: "white",
66834
+ d: "m 134.24221,179.28573 -6.38,-16.771 H 73.539201 l -6.38,17.135 c -2.492,6.684 -4.618,11.211 -6.38,13.581 -1.763,2.309 -4.649,3.464 -8.659,3.464 -3.403,0 -6.411,-1.246 -9.024,-3.737 -2.613,-2.492 -3.919,-5.317 -3.919,-8.477 0,-1.823 0.304,-3.706 0.911,-5.651 0.608,-1.944 1.611,-4.648 3.008,-8.112 l 34.18,-86.771005 c 0.972,-2.491 2.127,-5.469 3.463,-8.932 1.398,-3.525 2.856,-6.441 4.375,-8.75 1.58,-2.309 3.616,-4.163 6.107,-5.56 2.552005,-1.458 5.682005,-2.188 9.388009,-2.188 3.768,0 6.897,0.73 9.388,2.188 2.552,1.397 4.588,3.22 6.107,5.469 1.58,2.248 2.886,4.678 3.919,7.291 1.094,2.552 2.461,5.986 4.102,10.3 l 34.909,86.224005 c 2.734,6.562 4.101,11.332 4.101,14.31 0,3.099 -1.306,5.955 -3.919,8.568 -2.552,2.552 -5.651,3.828 -9.297,3.828 -2.126,0 -3.949,-0.395 -5.468,-1.185 -1.52,-0.729 -2.796,-1.732 -3.829,-3.008 -1.033,-1.337 -2.157,-3.342 -3.372,-6.016 -1.155,-2.734 -2.157,-5.134 -3.008,-7.2 z m -53.594009,-37.097 h 39.922009 l -20.143,-55.143005 z"
66835
+ }
66836
+ )
66837
+ ] });
66838
+ }
66820
66839
  function orbit({ height, width, fill: fill2 = "", className }) {
66821
66840
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className, height, width, viewBox: "0 0 256 256", children: [
66822
66841
  /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
@@ -67340,6 +67359,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67340
67359
  const icons = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
67341
67360
  __proto__: null,
67342
67361
  arrowLeft,
67362
+ autoCamera,
67343
67363
  camera,
67344
67364
  checkmark,
67345
67365
  close,
@@ -67486,7 +67506,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67486
67506
  );
67487
67507
  };
67488
67508
  const onHomeBtn = () => {
67489
- props.camera.reset();
67509
+ props.camera.reset.call();
67490
67510
  };
67491
67511
  const btnStyle2 = "vim-axes-button vc-flex vc-items-center vc-justify-center vc-text-gray-medium vc-transition-all hover:vc-text-primary-royal";
67492
67512
  const btnIsolation = /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -67577,15 +67597,17 @@ Averrage Date/Second ${avgDataRatePS} kb
67577
67597
  if (section.enable !== void 0 && !section.enable()) return null;
67578
67598
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `vim-control-bar-section ${section.style ?? sectionDefaultStyle}`, children: section.buttons.map((b) => createButton(b)) }, section.id);
67579
67599
  }
67580
- const elementIds = {
67600
+ const ids = {
67581
67601
  // Sections
67582
67602
  sectionCamera: "controlBar.sectionCamera",
67603
+ sectionInputs: "controlBar.sectionInputs",
67583
67604
  sectionActions: "controlBar.sectionActions",
67584
67605
  sectionTools: "controlBar.sectionTools",
67585
67606
  sectionSettings: "controlBar.sectionSettings",
67586
67607
  sectionMeasure: "controlBar.sectionMeasure",
67587
67608
  sectionSectionBox: "controlBar.sectionSectionBox",
67588
67609
  // Camera buttons
67610
+ buttonCameraAuto: "controlBar.camera.auto",
67589
67611
  buttonCameraOrbit: "controlBar.camera.orbit",
67590
67612
  buttonCameraLook: "controlBarcamera.look",
67591
67613
  buttonCameraPan: "controlBar.camera.pan",
@@ -67607,7 +67629,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67607
67629
  buttonSectionBoxVisible: "controlBar.sectionBox.visible",
67608
67630
  buttonSectionBoxShrinkToSelection: "controlBar.sectionBox.shrinkToSelection",
67609
67631
  buttonSectionBoxAuto: "controlBar.sectionBox.auto",
67610
- buttonSectionBoxClip: "controlBar.sectionBox.clip",
67632
+ buttonSectionBoxReset: "controlBar.sectionBox.reset",
67611
67633
  buttonSectionBoxSettings: "controlBar.sectionBox.settings"
67612
67634
  };
67613
67635
  function ControlBar(props) {
@@ -67639,7 +67661,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67639
67661
  buttonExpandStyle,
67640
67662
  createButton,
67641
67663
  createSection: createSection$1,
67642
- elementIds,
67664
+ ids,
67643
67665
  sectionBlueStyle,
67644
67666
  sectionDefaultStyle,
67645
67667
  sectionNoPadStyle
@@ -67827,12 +67849,12 @@ Averrage Date/Second ${avgDataRatePS} kb
67827
67849
  }
67828
67850
  function controlBarSectionBox(section, hasSelection) {
67829
67851
  return {
67830
- id: elementIds.sectionSectionBox,
67852
+ id: ids.sectionSectionBox,
67831
67853
  style: section.enable.get() ? sectionNoPadStyle : sectionDefaultStyle,
67832
67854
  //enable: () => section.getEnable(),
67833
67855
  buttons: [
67834
67856
  {
67835
- id: elementIds.buttonSectionBoxEnable,
67857
+ id: ids.buttonSectionBoxEnable,
67836
67858
  tip: "Enable Section Box",
67837
67859
  isOn: () => section.enable.get(),
67838
67860
  style: (on) => buttonExpandStyle(on),
@@ -67840,7 +67862,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67840
67862
  icon: sectionBox
67841
67863
  },
67842
67864
  {
67843
- id: elementIds.buttonSectionBoxShrinkToSelection,
67865
+ id: ids.buttonSectionBoxShrinkToSelection,
67844
67866
  tip: "Fit Section",
67845
67867
  enabled: () => section.enable.get(),
67846
67868
  isOn: () => hasSelection,
@@ -67849,7 +67871,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67849
67871
  icon: sectionBoxShrink
67850
67872
  },
67851
67873
  {
67852
- id: elementIds.buttonSectionBoxClip,
67874
+ id: ids.buttonSectionBoxReset,
67853
67875
  tip: "Reset Section",
67854
67876
  enabled: () => section.enable.get(),
67855
67877
  style: (on) => buttonDefaultStyle(on),
@@ -67857,7 +67879,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67857
67879
  icon: sectionBoxReset
67858
67880
  },
67859
67881
  {
67860
- id: elementIds.buttonSectionBoxVisible,
67882
+ id: ids.buttonSectionBoxVisible,
67861
67883
  tip: "Show Section Box",
67862
67884
  enabled: () => section.enable.get(),
67863
67885
  isOn: () => section.visible.get(),
@@ -67866,7 +67888,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67866
67888
  icon: visible
67867
67889
  },
67868
67890
  {
67869
- id: elementIds.buttonSectionBoxAuto,
67891
+ id: ids.buttonSectionBoxAuto,
67870
67892
  tip: "Auto Section",
67871
67893
  enabled: () => section.enable.get(),
67872
67894
  isOn: () => section.auto.get(),
@@ -67875,7 +67897,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67875
67897
  icon: sectionBoxAuto
67876
67898
  },
67877
67899
  {
67878
- id: elementIds.buttonSectionBoxSettings,
67900
+ id: ids.buttonSectionBoxSettings,
67879
67901
  tip: "Section Settings",
67880
67902
  enabled: () => section.enable.get(),
67881
67903
  isOn: () => section.showOffsetPanel.get(),
@@ -67889,12 +67911,12 @@ Averrage Date/Second ${avgDataRatePS} kb
67889
67911
  function controlBarPointer(viewer, camera2, settings2, section) {
67890
67912
  const pointer = getPointerState(viewer);
67891
67913
  return {
67892
- id: elementIds.sectionCamera,
67914
+ id: ids.sectionInputs,
67893
67915
  enable: () => anyUiCursorButton(settings2),
67894
67916
  style: sectionDefaultStyle,
67895
67917
  buttons: [
67896
67918
  {
67897
- id: elementIds.buttonCameraOrbit,
67919
+ id: ids.buttonCameraOrbit,
67898
67920
  enabled: () => isTrue(settings2.ui.orbit),
67899
67921
  tip: "Orbit",
67900
67922
  action: () => pointer.onButton("orbit"),
@@ -67903,7 +67925,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67903
67925
  style: buttonDefaultStyle
67904
67926
  },
67905
67927
  {
67906
- id: elementIds.buttonCameraLook,
67928
+ id: ids.buttonCameraLook,
67907
67929
  enabled: () => isTrue(settings2.ui.lookAround),
67908
67930
  tip: "Look Around",
67909
67931
  action: () => pointer.onButton("look"),
@@ -67912,7 +67934,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67912
67934
  style: buttonDefaultStyle
67913
67935
  },
67914
67936
  {
67915
- id: elementIds.buttonCameraPan,
67937
+ id: ids.buttonCameraPan,
67916
67938
  enabled: () => isTrue(settings2.ui.pan),
67917
67939
  tip: "Pan",
67918
67940
  action: () => pointer.onButton("pan"),
@@ -67921,7 +67943,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67921
67943
  style: buttonDefaultStyle
67922
67944
  },
67923
67945
  {
67924
- id: elementIds.buttonCameraZoom,
67946
+ id: ids.buttonCameraZoom,
67925
67947
  enabled: () => isTrue(settings2.ui.zoom),
67926
67948
  tip: "Zoom",
67927
67949
  action: () => pointer.onButton("zoom"),
@@ -67930,7 +67952,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67930
67952
  style: buttonDefaultStyle
67931
67953
  },
67932
67954
  {
67933
- id: elementIds.buttonCameraZoomWindow,
67955
+ id: ids.buttonCameraZoomWindow,
67934
67956
  enabled: () => isTrue(settings2.ui.zoomWindow),
67935
67957
  tip: "Zoom Window",
67936
67958
  action: () => {
@@ -67945,21 +67967,21 @@ Averrage Date/Second ${avgDataRatePS} kb
67945
67967
  }
67946
67968
  function controlBarActions(camera2, settings2, isolation, measure$1) {
67947
67969
  return {
67948
- id: elementIds.sectionActions,
67970
+ id: ids.sectionActions,
67949
67971
  enable: () => true,
67950
67972
  style: sectionDefaultStyle,
67951
67973
  buttons: [
67952
67974
  {
67953
- id: elementIds.buttonZoomToFit,
67975
+ id: ids.buttonZoomToFit,
67954
67976
  enabled: () => isTrue(settings2.ui.zoomToFit),
67955
67977
  tip: "Zoom to Fit",
67956
- action: () => camera2.frameContext(),
67978
+ action: () => camera2.frameSelection.call(),
67957
67979
  icon: frameSelection,
67958
67980
  isOn: () => false,
67959
67981
  style: buttonDefaultStyle
67960
67982
  },
67961
67983
  {
67962
- id: elementIds.buttonToggleIsolation,
67984
+ id: ids.buttonToggleIsolation,
67963
67985
  enabled: () => isTrue(settings2.ui.toggleIsolation),
67964
67986
  tip: "Toggle Isolation",
67965
67987
  action: () => isolation.toggle("controlBar"),
@@ -67967,7 +67989,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67967
67989
  style: buttonDefaultStyle
67968
67990
  },
67969
67991
  {
67970
- id: elementIds.buttonMeasure,
67992
+ id: ids.buttonMeasure,
67971
67993
  enabled: () => isTrue(settings2.ui.measuringMode),
67972
67994
  isOn: () => measure$1.active,
67973
67995
  tip: "Measuring Mode",
@@ -67981,12 +68003,12 @@ Averrage Date/Second ${avgDataRatePS} kb
67981
68003
  function controlBarSettings(modal, side, settings$1) {
67982
68004
  const fullScreen = getFullScreenState();
67983
68005
  return {
67984
- id: elementIds.sectionSettings,
68006
+ id: ids.sectionSettings,
67985
68007
  enable: () => anyUiSettingButton(settings$1),
67986
68008
  style: sectionDefaultStyle,
67987
68009
  buttons: [
67988
68010
  {
67989
- id: elementIds.buttonProjectInspector,
68011
+ id: ids.buttonProjectInspector,
67990
68012
  enabled: () => isTrue(settings$1.ui.projectInspector) && (isTrue(settings$1.ui.bimTreePanel) || isTrue(settings$1.ui.bimInfoPanel)),
67991
68013
  tip: "Project Inspector",
67992
68014
  action: () => side.toggleContent("bim"),
@@ -67994,7 +68016,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67994
68016
  style: buttonDefaultStyle
67995
68017
  },
67996
68018
  {
67997
- id: elementIds.buttonSettings,
68019
+ id: ids.buttonSettings,
67998
68020
  enabled: () => isTrue(settings$1.ui.settings),
67999
68021
  tip: "Settings",
68000
68022
  action: () => side.toggleContent("settings"),
@@ -68002,7 +68024,7 @@ Averrage Date/Second ${avgDataRatePS} kb
68002
68024
  style: buttonDefaultStyle
68003
68025
  },
68004
68026
  {
68005
- id: elementIds.buttonHelp,
68027
+ id: ids.buttonHelp,
68006
68028
  enabled: () => isTrue(settings$1.ui.help),
68007
68029
  tip: "Help",
68008
68030
  action: () => modal.help(true),
@@ -68010,7 +68032,7 @@ Averrage Date/Second ${avgDataRatePS} kb
68010
68032
  style: buttonDefaultStyle
68011
68033
  },
68012
68034
  {
68013
- id: elementIds.buttonMaximize,
68035
+ id: ids.buttonMaximize,
68014
68036
  enabled: () => isTrue(settings$1.ui.maximise) && settings$1.capacity.canGoFullScreen,
68015
68037
  tip: fullScreen.get() ? "Minimize" : "Fullscreen",
68016
68038
  action: () => fullScreen.toggle(),
@@ -68020,15 +68042,34 @@ Averrage Date/Second ${avgDataRatePS} kb
68020
68042
  ]
68021
68043
  };
68022
68044
  }
68045
+ function controlBarCamera(camera2) {
68046
+ return {
68047
+ id: ids.sectionCamera,
68048
+ enable: () => true,
68049
+ style: sectionDefaultStyle,
68050
+ buttons: [
68051
+ {
68052
+ id: ids.buttonCameraAuto,
68053
+ tip: "Auto Camera",
68054
+ isOn: () => camera2.autoCamera.get(),
68055
+ action: () => camera2.autoCamera.set(!camera2.autoCamera.get()),
68056
+ icon: autoCamera,
68057
+ style: buttonDefaultStyle
68058
+ }
68059
+ ]
68060
+ };
68061
+ }
68023
68062
  function useControlBar(viewer, camera2, modal, side, isolation, cursor, settings2, section, customization) {
68024
68063
  const measure2 = getMeasureState(viewer, cursor);
68025
68064
  const pointerSection = controlBarPointer(viewer, camera2, settings2);
68026
68065
  const actionSection = controlBarActions(camera2, settings2, isolation, measure2);
68027
68066
  const sectionBoxSection = controlBarSectionBox(section, viewer.selection.count > 0);
68028
68067
  const settingsSection = controlBarSettings(modal, side, settings2);
68068
+ const cameraSection = controlBarCamera(camera2);
68029
68069
  let controlBarSections = [
68030
68070
  pointerSection,
68031
68071
  actionSection,
68072
+ cameraSection,
68032
68073
  sectionBoxSection,
68033
68074
  // Optional section
68034
68075
  settingsSection
@@ -72054,11 +72095,11 @@ Averrage Date/Second ${avgDataRatePS} kb
72054
72095
  e.stopPropagation();
72055
72096
  };
72056
72097
  const onCameraResetBtn = (e) => {
72057
- camera2.reset();
72098
+ camera2.reset.call();
72058
72099
  e.stopPropagation();
72059
72100
  };
72060
72101
  const onCameraFrameBtn = (e) => {
72061
- camera2.frameContext();
72102
+ camera2.frameSelection.call();
72062
72103
  e.stopPropagation();
72063
72104
  };
72064
72105
  const onSelectionIsolateBtn = (e) => {
@@ -72390,7 +72431,7 @@ Averrage Date/Second ${avgDataRatePS} kb
72390
72431
  createInteractiveElementProps: (item, treeId, actions, renderFlags) => ({
72391
72432
  onKeyUp: (e) => {
72392
72433
  if (e.key === "f") {
72393
- props.camera.frameContext();
72434
+ props.camera.frameSelection.call();
72394
72435
  }
72395
72436
  if (e.key === "Escape") {
72396
72437
  props.viewer.selection.clear();
@@ -72433,7 +72474,7 @@ Averrage Date/Second ${avgDataRatePS} kb
72433
72474
  },
72434
72475
  onPrimaryAction: (item, _) => {
72435
72476
  if (doubleClick.isDoubleClick(item.index)) {
72436
- props.camera.frameSelection();
72477
+ props.camera.frameSelection.call();
72437
72478
  }
72438
72479
  },
72439
72480
  onFocusItem: (item) => {
@@ -74724,7 +74765,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74724
74765
  return true;
74725
74766
  }
74726
74767
  case KEYS.KEY_F: {
74727
- this._camera.frameContext();
74768
+ this._camera.frameSelection.call();
74728
74769
  return true;
74729
74770
  }
74730
74771
  case KEYS.KEY_I: {
@@ -74918,7 +74959,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74918
74959
  if (!this._settings.isolation.enable) return;
74919
74960
  this._isolation = objects ?? [];
74920
74961
  this._apply(source);
74921
- this._camera.frameVisibleObjects();
74962
+ this._camera.frameVisibleObjects.call();
74922
74963
  }
74923
74964
  /**
74924
74965
  * Toggles isolation by using the current selection.
@@ -74933,7 +74974,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74933
74974
  if (!this._settings.isolation.enable) return;
74934
74975
  this._isolation = [...this._viewer.selection.objects].filter((o) => o.type === "Object3D");
74935
74976
  this._apply(source);
74936
- this._camera.frameVisibleObjects();
74977
+ this._camera.frameVisibleObjects.call();
74937
74978
  this._viewer.selection.clear();
74938
74979
  }
74939
74980
  /**
@@ -75033,74 +75074,139 @@ Averrage Date/Second ${avgDataRatePS} kb
75033
75074
  return objects;
75034
75075
  }
75035
75076
  }
75036
- class ComponentCamera {
75037
- constructor(viewer) {
75038
- __publicField(this, "_viewer");
75039
- this._viewer = viewer;
75040
- }
75041
- /**
75042
- * Resets the camera to its initial position.
75043
- */
75044
- reset() {
75045
- this._viewer.camera.lerp(1).reset();
75046
- }
75047
- /**
75048
- * Frames selected elements if there is an active selection; otherwise, frames all visible objects.
75049
- * @param duration Optional duration of the camera movement animation (default: 1).
75050
- */
75051
- frameContext(duration = 1) {
75052
- if (this._viewer.selection.count > 0) {
75053
- this.frameSelection(duration);
75054
- } else {
75055
- this.frameVisibleObjects(void 0, duration);
75077
+ function useStateRef(initialValue) {
75078
+ const [value, setValue] = React2.useState(initialValue);
75079
+ const ref = React2.useRef(initialValue);
75080
+ const event = React2.useRef(new distExports.SimpleEventDispatcher());
75081
+ const validate = React2.useRef((value2) => value2);
75082
+ const confirm = React2.useRef((value2) => value2);
75083
+ const set2 = (value2) => {
75084
+ const finalValue = validate.current(value2) ?? value2;
75085
+ if (finalValue === void 0) return;
75086
+ if (finalValue === ref.current) return;
75087
+ ref.current = finalValue;
75088
+ setValue(finalValue);
75089
+ event.current.dispatch(finalValue);
75090
+ };
75091
+ return {
75092
+ get() {
75093
+ return ref.current;
75094
+ },
75095
+ set: set2,
75096
+ confirm() {
75097
+ set2(confirm.current(ref.current));
75098
+ },
75099
+ useOnChange(on) {
75100
+ React2.useEffect(() => {
75101
+ return event.current.subscribe(on);
75102
+ }, []);
75103
+ },
75104
+ useMemo(on, deps) {
75105
+ return React2.useMemo(() => on(value), [...deps || [], value]);
75106
+ },
75107
+ useValidate(on) {
75108
+ React2.useEffect(() => {
75109
+ validate.current = on;
75110
+ }, []);
75111
+ },
75112
+ useConfirm(on) {
75113
+ React2.useEffect(() => {
75114
+ confirm.current = on;
75115
+ }, []);
75056
75116
  }
75057
- }
75058
- /**
75059
- * Frames selected elements if there is an active selection; otherwise, does nothing.
75060
- * @param duration Optional duration of the camera movement animation (default: 1).
75061
- */
75062
- frameSelection(duration = 1) {
75063
- if (this._viewer.selection.count === 0) return;
75064
- const box = this._viewer.selection.getBoundingBox();
75065
- if (box && this._viewer.gizmos.sectionBox.box.intersectsBox(box)) {
75066
- const movement = duration === 0 ? this._viewer.camera.snap() : this._viewer.camera.lerp(duration);
75067
- movement.frame(box);
75117
+ };
75118
+ }
75119
+ function useActionRef(action) {
75120
+ const ref = React2.useRef(action);
75121
+ return {
75122
+ call() {
75123
+ ref == null ? void 0 : ref.current();
75124
+ },
75125
+ set(func) {
75126
+ ref.current = func;
75068
75127
  }
75069
- }
75070
- /**
75071
- * Frames all visible objects in the scene.
75072
- * @param source Optional VIM to specify the source of objects to frame.
75073
- * @param duration Duration of the camera movement animation (default: 1).
75074
- */
75075
- frameVisibleObjects(source, duration = 1) {
75076
- const movement = duration === 0 ? this._viewer.camera.snap() : this._viewer.camera.lerp(duration);
75077
- const box = this.getVisibleBoundingBox(source);
75078
- movement.frame(box);
75079
- }
75080
- /**
75081
- * Returns the bounding box of all visible objects.
75082
- * @param source Optional VIM to specify the source of visible objects.
75083
- * @returns The bounding box of all visible objects.
75084
- */
75085
- getVisibleBoundingBox(source) {
75086
- let box;
75087
- const vimBoxUnion = (vim) => {
75088
- for (const obj of vim.getObjects()) {
75089
- if (!obj.visible) continue;
75090
- const b = obj.getBoundingBox();
75091
- if (!b) continue;
75092
- box = box ? box.union(b) : b == null ? void 0 : b.clone();
75093
- }
75094
- };
75095
- if (source) {
75096
- vimBoxUnion(source);
75097
- } else {
75098
- for (const vim of this._viewer.vims) {
75099
- vimBoxUnion(vim);
75128
+ };
75129
+ }
75130
+ function useArgActionRef(action) {
75131
+ const ref = React2.useRef(action);
75132
+ return {
75133
+ call(arg) {
75134
+ ref == null ? void 0 : ref.current(arg);
75135
+ },
75136
+ set(func) {
75137
+ ref.current = func;
75138
+ }
75139
+ };
75140
+ }
75141
+ function useFuncRef(func) {
75142
+ const ref = React2.useRef(func);
75143
+ return {
75144
+ call() {
75145
+ return ref == null ? void 0 : ref.current();
75146
+ },
75147
+ set(func2) {
75148
+ ref.current = func2;
75149
+ }
75150
+ };
75151
+ }
75152
+ function useCamera(viewer) {
75153
+ const autoCamera2 = useStateRef(false);
75154
+ autoCamera2.useOnChange((v) => {
75155
+ if (v) {
75156
+ frameSelection2.call();
75157
+ }
75158
+ });
75159
+ React2.useEffect(() => {
75160
+ viewer.selection.onValueChanged.sub(() => {
75161
+ if (autoCamera2.get()) {
75162
+ frameSelection2.call();
75100
75163
  }
75164
+ });
75165
+ }, []);
75166
+ const reset = useActionRef(() => viewer.camera.lerp(1).reset());
75167
+ const frameSelection2 = useActionRef(() => {
75168
+ if (viewer.selection.count === 0) {
75169
+ frameVisibleObjects.call();
75170
+ return;
75171
+ }
75172
+ const box = viewer.selection.getBoundingBox();
75173
+ if (!box) {
75174
+ return;
75175
+ }
75176
+ box.intersect(viewer.gizmos.sectionBox.box);
75177
+ if (box.isEmpty()) {
75178
+ return;
75179
+ }
75180
+ viewer.camera.lerp(1).frame(box);
75181
+ });
75182
+ const frameVisibleObjects = useActionRef(() => {
75183
+ const movement = viewer.camera.lerp(1);
75184
+ const box = getVisibleBoundingBox(viewer);
75185
+ movement.frame(box);
75186
+ });
75187
+ return {
75188
+ autoCamera: autoCamera2,
75189
+ reset,
75190
+ frameSelection: frameSelection2,
75191
+ frameVisibleObjects
75192
+ };
75193
+ }
75194
+ function getVisibleBoundingBox(viewer, source) {
75195
+ let box;
75196
+ const vimBoxUnion = (vim) => {
75197
+ for (const obj of vim.getObjects()) {
75198
+ if (!obj.visible) continue;
75199
+ const b = obj.getBoundingBox();
75200
+ if (!b) continue;
75201
+ box = box ? box.union(b) : b == null ? void 0 : b.clone();
75202
+ }
75203
+ };
75204
+ {
75205
+ for (const vim of viewer.vims) {
75206
+ vimBoxUnion(vim);
75101
75207
  }
75102
- return box;
75103
75208
  }
75209
+ return box;
75104
75210
  }
75105
75211
  function createContainer(element) {
75106
75212
  let root = element;
@@ -75813,70 +75919,6 @@ Averrage Date/Second ${avgDataRatePS} kb
75813
75919
  r.max.z += b2.max.z;
75814
75920
  return r;
75815
75921
  }
75816
- function useStateRef(initialValue) {
75817
- const [value, setValue] = React2.useState(initialValue);
75818
- const ref = React2.useRef(initialValue);
75819
- const event = React2.useRef(new distExports.SimpleEventDispatcher());
75820
- const validate = React2.useRef((value2) => value2);
75821
- const confirm = React2.useRef((value2) => value2);
75822
- const set2 = (value2) => {
75823
- const finalValue = validate.current(value2) ?? value2;
75824
- if (finalValue === void 0) return;
75825
- if (finalValue === ref.current) return;
75826
- ref.current = finalValue;
75827
- setValue(finalValue);
75828
- event.current.dispatch(finalValue);
75829
- };
75830
- return {
75831
- get() {
75832
- return ref.current;
75833
- },
75834
- set: set2,
75835
- confirm() {
75836
- set2(confirm.current(ref.current));
75837
- },
75838
- useOnChange(on) {
75839
- React2.useEffect(() => {
75840
- return event.current.subscribe(on);
75841
- }, []);
75842
- },
75843
- useMemo(on, deps) {
75844
- return React2.useMemo(() => on(value), [...deps || [], value]);
75845
- },
75846
- useValidate(on) {
75847
- React2.useEffect(() => {
75848
- validate.current = on;
75849
- }, []);
75850
- },
75851
- useConfirm(on) {
75852
- React2.useEffect(() => {
75853
- confirm.current = on;
75854
- }, []);
75855
- }
75856
- };
75857
- }
75858
- function useArgActionRef(action) {
75859
- const ref = React2.useRef(action);
75860
- return {
75861
- call(arg) {
75862
- ref == null ? void 0 : ref.current(arg);
75863
- },
75864
- set(func) {
75865
- ref.current = func;
75866
- }
75867
- };
75868
- }
75869
- function useFuncRef(func) {
75870
- const ref = React2.useRef(func);
75871
- return {
75872
- call() {
75873
- return ref == null ? void 0 : ref.current();
75874
- },
75875
- set(func2) {
75876
- ref.current = func2;
75877
- }
75878
- };
75879
- }
75880
75922
  function useSectionBox(adapter) {
75881
75923
  const enable = useStateRef(false);
75882
75924
  const visible2 = useStateRef(false);
@@ -76009,7 +76051,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76009
76051
  var _a2;
76010
76052
  const settings2 = useSettings(props.viewer, props.settings ?? {});
76011
76053
  const modal = useModal(settings2.value.capacity.canFollowUrl);
76012
- const camera2 = React2.useMemo(() => new ComponentCamera(props.viewer), []);
76054
+ const camera2 = useCamera(props.viewer);
76013
76055
  const cursor = React2.useMemo(() => new CursorManager(props.viewer), []);
76014
76056
  const loader = React2.useRef(new ComponentLoader(props.viewer, modal));
76015
76057
  const [isolation] = React2.useState(() => new Isolation(props.viewer, camera2, settings2.value));
@@ -76510,15 +76552,26 @@ Averrage Date/Second ${avgDataRatePS} kb
76510
76552
  function UltraComponent(props) {
76511
76553
  const modal = useModal(true);
76512
76554
  const sectionBox2 = useUltraSectionBox(props.viewer);
76513
- const controlBar2 = useUltraControlBar(props.viewer, sectionBox2, (_2) => _2);
76514
76555
  const side = useSideState(true, 400);
76515
76556
  const [_, setSelectState] = React2.useState(0);
76557
+ const [controlBarCustom, setControlBarCustom] = React2.useState(() => (c) => c);
76558
+ const controlBar2 = useUltraControlBar(props.viewer, sectionBox2, (_2) => _2);
76516
76559
  React2.useEffect(() => {
76517
76560
  props.viewer.onStateChanged.subscribe((state) => updateModal(modal, state));
76518
76561
  props.viewer.selection.onValueChanged.subscribe(() => {
76519
76562
  setSelectState((i2) => (i2 + 1) % 2);
76520
76563
  });
76521
- props.onMount(createComponentRef(props.viewer, modal, sectionBox2));
76564
+ props.onMount({
76565
+ viewer: props.viewer,
76566
+ modal,
76567
+ sectionBox: sectionBox2,
76568
+ dispose: () => {
76569
+ },
76570
+ controlBar: {
76571
+ customize: (v) => setControlBarCustom(() => v)
76572
+ },
76573
+ load: patchLoad(props.viewer, modal)
76574
+ });
76522
76575
  }, []);
76523
76576
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
76524
76577
  /* @__PURE__ */ jsxRuntimeExports.jsx(RestOfScreen, { side, content: () => {
@@ -76528,18 +76581,28 @@ Averrage Date/Second ${avgDataRatePS} kb
76528
76581
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76529
76582
  ControlBar,
76530
76583
  {
76531
- content: controlBar2,
76584
+ content: controlBarCustom(controlBar2),
76532
76585
  show: true
76533
76586
  }
76534
76587
  ),
76535
76588
  /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { state: sectionBox2 })
76536
76589
  ] });
76537
76590
  } }),
76538
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { state: modal })
76591
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { state: modal }),
76592
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76593
+ ReactTooltip,
76594
+ {
76595
+ multiline: true,
76596
+ arrowColor: "transparent",
76597
+ type: "light",
76598
+ className: "!vc-max-w-xs !vc-border !vc-border-solid !vc-border-gray-medium !vc-bg-white !vc-text-xs !vc-text-gray-darkest !vc-opacity-100 !vc-shadow-[2px_6px_15px_rgba(0,0,0,0.3)] !vc-transition-opacity",
76599
+ delayShow: 200
76600
+ }
76601
+ )
76539
76602
  ] });
76540
76603
  }
76541
- function createComponentRef(viewer, modal, sectionBox2) {
76542
- function load(source) {
76604
+ function patchLoad(viewer, modal) {
76605
+ return function load(source) {
76543
76606
  const request2 = viewer.loadVim(source);
76544
76607
  void updateProgress(request2, modal);
76545
76608
  void request2.getResult().then(
@@ -76554,18 +76617,11 @@ Averrage Date/Second ${avgDataRatePS} kb
76554
76617
  }
76555
76618
  );
76556
76619
  return request2;
76557
- }
76558
- return {
76559
- viewer,
76560
- modal,
76561
- sectionBox: sectionBox2,
76562
- dispose: () => {
76563
- },
76564
- load
76565
76620
  };
76566
76621
  }
76567
76622
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
76568
76623
  __proto__: null,
76624
+ ControlBar: controlBar,
76569
76625
  UltraComponent,
76570
76626
  createUltraComponent
76571
76627
  }, Symbol.toStringTag, { value: "Module" }));