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

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
@@ -61895,7 +61895,12 @@ class SectionBox2 {
61895
61895
  this._clip = value;
61896
61896
  this.scheduleUpdate();
61897
61897
  }
61898
+ /**
61899
+ * Fits the given box, invalid dimensions will be reversed.
61900
+ * @param box - The new bounding box.
61901
+ */
61898
61902
  fitBox(box) {
61903
+ box = safeBox(box);
61899
61904
  this._box = box;
61900
61905
  this.scheduleUpdate();
61901
61906
  }
@@ -75996,14 +76001,10 @@ function useCamera(adapter) {
75996
76001
  frameScene.call();
75997
76002
  return;
75998
76003
  }
75999
- const box = await adapter.getSelectionBox();
76000
- if (!box) {
76001
- return;
76002
- }
76003
- adapter.frameCamera(box, 1);
76004
+ frameBox(adapter, () => adapter.getSelectionBox());
76004
76005
  });
76005
76006
  const frameScene = useAsyncFuncRef(async () => {
76006
- adapter.frameAll(1);
76007
+ frameBox(adapter, () => adapter.getSceneBox());
76007
76008
  });
76008
76009
  return {
76009
76010
  autoCamera: autoCamera2,
@@ -76012,17 +76013,27 @@ function useCamera(adapter) {
76012
76013
  frameScene
76013
76014
  };
76014
76015
  }
76016
+ async function frameBox(adapter, getBox) {
76017
+ const box = await getBox();
76018
+ if (!box) return;
76019
+ const section = adapter.getSectionBox();
76020
+ if (section) {
76021
+ box.intersect(section);
76022
+ }
76023
+ if (box.isEmpty()) {
76024
+ box.copy(section);
76025
+ }
76026
+ adapter.frameCamera(box, 1);
76027
+ }
76015
76028
  function useWebglCamera(viewer) {
76016
76029
  return useCamera({
76017
76030
  onSelectionChanged: viewer.selection.onValueChanged,
76018
76031
  frameCamera: (box, duration) => viewer.camera.lerp(duration).frame(box),
76019
76032
  resetCamera: (duration) => viewer.camera.lerp(duration).reset(),
76020
- frameAll: (duration) => {
76021
- const box = viewer.renderer.getBoundingBox();
76022
- viewer.camera.lerp(duration).frame(box);
76023
- },
76024
76033
  hasSelection: () => viewer.selection.count > 0,
76025
- getSelectionBox: () => Promise.resolve(viewer.selection.getBoundingBox())
76034
+ getSelectionBox: () => Promise.resolve(viewer.selection.getBoundingBox()),
76035
+ getSectionBox: () => viewer.renderer.section.box,
76036
+ getSceneBox: () => Promise.resolve(viewer.renderer.getBoundingBox())
76026
76037
  });
76027
76038
  }
76028
76039
  function createWebglComponent(container, componentSettings = {}, viewerSettings = {}) {
@@ -76539,10 +76550,11 @@ function useUltraCamera(viewer) {
76539
76550
  return useCamera({
76540
76551
  onSelectionChanged: viewer.selection.onValueChanged,
76541
76552
  frameCamera: (box, duration) => void viewer.camera.frameBox(box, duration),
76542
- frameAll: (duration) => viewer.camera.frameAll(duration),
76543
76553
  resetCamera: (duration) => viewer.camera.restoreSavedPosition(duration),
76544
76554
  hasSelection: () => viewer.selection.count > 0,
76545
- getSelectionBox: () => viewer.selection.getBoundingBox()
76555
+ getSelectionBox: () => viewer.selection.getBoundingBox(),
76556
+ getSceneBox: () => viewer.renderer.getBoundingBox(),
76557
+ getSectionBox: () => viewer.sectionBox.getBox()
76546
76558
  });
76547
76559
  }
76548
76560
  function createUltraComponent(container) {