vim-web 0.3.44-dev.31 → 0.3.44-dev.32

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.
package/dist/vim-web.js CHANGED
@@ -52973,7 +52973,7 @@ class RenderScene {
52973
52973
  * @param target box in which to copy result, a new instance is created if undefined.
52974
52974
  */
52975
52975
  getBoundingBox(target = new Box3()) {
52976
- return this._boundingBox ? target.copy(this._boundingBox) : target.set(new Vector3(-1, -1, -1), new Vector3(1, 1, 1));
52976
+ return this._boundingBox ? target.copy(this._boundingBox) : void 0;
52977
52977
  }
52978
52978
  /**
52979
52979
  * Returns the bounding box of the average center of all meshes.
@@ -55601,6 +55601,34 @@ class SectionBoxGizmo {
55601
55601
  this.handles.dispose();
55602
55602
  }
55603
55603
  }
55604
+ function addBox(b1, b2) {
55605
+ const r = b1.clone();
55606
+ r.min.x += b2.min.x;
55607
+ r.min.y += b2.min.y;
55608
+ r.min.z += b2.min.z;
55609
+ r.max.x += b2.max.x;
55610
+ r.max.y += b2.max.y;
55611
+ r.max.z += b2.max.z;
55612
+ return r;
55613
+ }
55614
+ function safeBox(b1) {
55615
+ if (b1.max.x <= b1.min.x) {
55616
+ const temp = b1.min.x;
55617
+ b1.min.x = b1.max.x;
55618
+ b1.max.x = temp;
55619
+ }
55620
+ if (b1.max.y <= b1.min.y) {
55621
+ const temp = b1.min.y;
55622
+ b1.min.y = b1.max.y;
55623
+ b1.max.y = temp;
55624
+ }
55625
+ if (b1.max.z <= b1.min.z) {
55626
+ const temp = b1.min.z;
55627
+ b1.min.z = b1.max.z;
55628
+ b1.max.z = temp;
55629
+ }
55630
+ return b1;
55631
+ }
55604
55632
  let SectionBox$1 = class SectionBox {
55605
55633
  // -------------------------------------------------------------------------
55606
55634
  // Constructor
@@ -55639,9 +55667,6 @@ let SectionBox$1 = class SectionBox {
55639
55667
  this.update();
55640
55668
  };
55641
55669
  this._inputs.onBoxConfirm = (box) => this._onBoxConfirm.dispatch(box);
55642
- viewer.renderer.onBoxUpdated.subscribe(() => {
55643
- this.fitBox(viewer.renderer.getBoundingBox());
55644
- });
55645
55670
  this.clip = false;
55646
55671
  this.visible = false;
55647
55672
  this.interactive = false;
@@ -55761,6 +55786,7 @@ let SectionBox$1 = class SectionBox {
55761
55786
  */
55762
55787
  fitBox(box) {
55763
55788
  if (!box) return;
55789
+ box = safeBox(box);
55764
55790
  this._gizmos.fitBox(box);
55765
55791
  this.renderer.section.fitBox(box);
55766
55792
  this._onBoxConfirm.dispatch(this.box);
@@ -75758,16 +75784,6 @@ function computePosition(panelRef) {
75758
75784
  }
75759
75785
  return { top: 0, left: 0 };
75760
75786
  }
75761
- function addBox(b1, b2) {
75762
- const r = b1.clone();
75763
- r.min.x += b2.min.x;
75764
- r.min.y += b2.min.y;
75765
- r.min.z += b2.min.z;
75766
- r.max.x += b2.max.x;
75767
- r.max.y += b2.max.y;
75768
- r.max.z += b2.max.z;
75769
- return r;
75770
- }
75771
75787
  function useStateRef(initialValue) {
75772
75788
  const [value, setValue] = useState(initialValue);
75773
75789
  const ref = useRef(initialValue);
@@ -75893,6 +75909,7 @@ function useSectionBox(adapter) {
75893
75909
  });
75894
75910
  visible2.useOnChange((v) => adapter.setVisible(v));
75895
75911
  const section = useArgActionRef((baseBox) => {
75912
+ if (baseBox === void 0) return;
75896
75913
  boxRef.current = baseBox;
75897
75914
  const newBox = addBox(baseBox, offsetsToBox3(topOffset.get(), sideOffset.get(), bottomOffset.get()));
75898
75915
  adapter.fitBox(newBox);