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

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.
@@ -23,6 +23,10 @@ export declare class SectionBox {
23
23
  set interactive(value: boolean);
24
24
  get clip(): boolean;
25
25
  set clip(value: boolean);
26
+ /**
27
+ * Fits the given box, invalid dimensions will be reversed.
28
+ * @param box - The new bounding box.
29
+ */
26
30
  fitBox(box: Box3): void;
27
31
  getBox(): Box3;
28
32
  dispose(): void;
@@ -1,3 +1,4 @@
1
1
  import * as THREE from 'three';
2
2
  export declare function addBox(b1: THREE.Box3, b2: THREE.Box3): THREE.Box3;
3
3
  export declare function subBox(b1: THREE.Box3, b2: THREE.Box3): THREE.Box3;
4
+ export declare function safeBox(b1: THREE.Box3): THREE.Box3;
@@ -28,7 +28,7 @@ export declare class RenderScene {
28
28
  * Returns the bounding box encompasing all rendererd objects.
29
29
  * @param target box in which to copy result, a new instance is created if undefined.
30
30
  */
31
- getBoundingBox(target?: THREE.Box3): THREE.Box3;
31
+ getBoundingBox(target?: THREE.Box3): THREE.Box3 | undefined;
32
32
  /**
33
33
  * Returns the bounding box of the average center of all meshes.
34
34
  * Less precise but is more stable against outliers.
@@ -83,7 +83,7 @@ export declare class Renderer implements IRenderer {
83
83
  * @param target - Box in which to copy the result. A new instance is created if undefined.
84
84
  * @returns The bounding box encompassing all rendered objects.
85
85
  */
86
- getBoundingBox(target?: THREE.Box3): THREE.Box3;
86
+ getBoundingBox(target?: THREE.Box3): THREE.Box3 | undefined;
87
87
  /**
88
88
  * Updates the global rendering bounding box.
89
89
  * @param box - The new bounding box.
@@ -52989,7 +52989,7 @@ void main() {
52989
52989
  * @param target box in which to copy result, a new instance is created if undefined.
52990
52990
  */
52991
52991
  getBoundingBox(target = new Box3()) {
52992
- return this._boundingBox ? target.copy(this._boundingBox) : target.set(new Vector3(-1, -1, -1), new Vector3(1, 1, 1));
52992
+ return this._boundingBox ? target.copy(this._boundingBox) : void 0;
52993
52993
  }
52994
52994
  /**
52995
52995
  * Returns the bounding box of the average center of all meshes.
@@ -55617,6 +55617,34 @@ void main() {
55617
55617
  this.handles.dispose();
55618
55618
  }
55619
55619
  }
55620
+ function addBox(b1, b2) {
55621
+ const r = b1.clone();
55622
+ r.min.x += b2.min.x;
55623
+ r.min.y += b2.min.y;
55624
+ r.min.z += b2.min.z;
55625
+ r.max.x += b2.max.x;
55626
+ r.max.y += b2.max.y;
55627
+ r.max.z += b2.max.z;
55628
+ return r;
55629
+ }
55630
+ function safeBox(b1) {
55631
+ if (b1.max.x <= b1.min.x) {
55632
+ const temp = b1.min.x;
55633
+ b1.min.x = b1.max.x;
55634
+ b1.max.x = temp;
55635
+ }
55636
+ if (b1.max.y <= b1.min.y) {
55637
+ const temp = b1.min.y;
55638
+ b1.min.y = b1.max.y;
55639
+ b1.max.y = temp;
55640
+ }
55641
+ if (b1.max.z <= b1.min.z) {
55642
+ const temp = b1.min.z;
55643
+ b1.min.z = b1.max.z;
55644
+ b1.max.z = temp;
55645
+ }
55646
+ return b1;
55647
+ }
55620
55648
  let SectionBox$1 = class SectionBox {
55621
55649
  // -------------------------------------------------------------------------
55622
55650
  // Constructor
@@ -55655,9 +55683,6 @@ void main() {
55655
55683
  this.update();
55656
55684
  };
55657
55685
  this._inputs.onBoxConfirm = (box) => this._onBoxConfirm.dispatch(box);
55658
- viewer.renderer.onBoxUpdated.subscribe(() => {
55659
- this.fitBox(viewer.renderer.getBoundingBox());
55660
- });
55661
55686
  this.clip = false;
55662
55687
  this.visible = false;
55663
55688
  this.interactive = false;
@@ -55777,6 +55802,7 @@ void main() {
55777
55802
  */
55778
55803
  fitBox(box) {
55779
55804
  if (!box) return;
55805
+ box = safeBox(box);
55780
55806
  this._gizmos.fitBox(box);
55781
55807
  this.renderer.section.fitBox(box);
55782
55808
  this._onBoxConfirm.dispatch(this.box);
@@ -61885,7 +61911,12 @@ Averrage Date/Second ${avgDataRatePS} kb
61885
61911
  this._clip = value;
61886
61912
  this.scheduleUpdate();
61887
61913
  }
61914
+ /**
61915
+ * Fits the given box, invalid dimensions will be reversed.
61916
+ * @param box - The new bounding box.
61917
+ */
61888
61918
  fitBox(box) {
61919
+ box = safeBox(box);
61889
61920
  this._box = box;
61890
61921
  this.scheduleUpdate();
61891
61922
  }
@@ -75774,16 +75805,6 @@ Averrage Date/Second ${avgDataRatePS} kb
75774
75805
  }
75775
75806
  return { top: 0, left: 0 };
75776
75807
  }
75777
- function addBox(b1, b2) {
75778
- const r = b1.clone();
75779
- r.min.x += b2.min.x;
75780
- r.min.y += b2.min.y;
75781
- r.min.z += b2.min.z;
75782
- r.max.x += b2.max.x;
75783
- r.max.y += b2.max.y;
75784
- r.max.z += b2.max.z;
75785
- return r;
75786
- }
75787
75808
  function useStateRef(initialValue) {
75788
75809
  const [value, setValue] = React2.useState(initialValue);
75789
75810
  const ref = React2.useRef(initialValue);
@@ -75909,6 +75930,7 @@ Averrage Date/Second ${avgDataRatePS} kb
75909
75930
  });
75910
75931
  visible2.useOnChange((v) => adapter.setVisible(v));
75911
75932
  const section = useArgActionRef((baseBox) => {
75933
+ if (baseBox === void 0) return;
75912
75934
  boxRef.current = baseBox;
75913
75935
  const newBox = addBox(baseBox, offsetsToBox3(topOffset.get(), sideOffset.get(), bottomOffset.get()));
75914
75936
  adapter.fitBox(newBox);