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

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
@@ -76001,14 +76001,10 @@ function useCamera(adapter) {
76001
76001
  frameScene.call();
76002
76002
  return;
76003
76003
  }
76004
- const box = await adapter.getSelectionBox();
76005
- if (!box) {
76006
- return;
76007
- }
76008
- adapter.frameCamera(box, 1);
76004
+ frameBox(adapter, () => adapter.getSelectionBox());
76009
76005
  });
76010
76006
  const frameScene = useAsyncFuncRef(async () => {
76011
- adapter.frameAll(1);
76007
+ frameBox(adapter, () => adapter.getSceneBox());
76012
76008
  });
76013
76009
  return {
76014
76010
  autoCamera: autoCamera2,
@@ -76017,17 +76013,30 @@ function useCamera(adapter) {
76017
76013
  frameScene
76018
76014
  };
76019
76015
  }
76020
- function useWebglCamera(viewer) {
76016
+ async function frameBox(adapter, getBox) {
76017
+ const box = await getBox();
76018
+ if (!box) return;
76019
+ if (adapter.isSectionBoxEnabled()) {
76020
+ const section = adapter.getSectionBox();
76021
+ if (section) {
76022
+ box.intersect(section);
76023
+ }
76024
+ if (box.isEmpty()) {
76025
+ box.copy(section);
76026
+ }
76027
+ }
76028
+ adapter.frameCamera(box, 1);
76029
+ }
76030
+ function useWebglCamera(viewer, section) {
76021
76031
  return useCamera({
76022
76032
  onSelectionChanged: viewer.selection.onValueChanged,
76023
76033
  frameCamera: (box, duration) => viewer.camera.lerp(duration).frame(box),
76024
76034
  resetCamera: (duration) => viewer.camera.lerp(duration).reset(),
76025
- frameAll: (duration) => {
76026
- const box = viewer.renderer.getBoundingBox();
76027
- viewer.camera.lerp(duration).frame(box);
76028
- },
76029
76035
  hasSelection: () => viewer.selection.count > 0,
76030
- getSelectionBox: () => Promise.resolve(viewer.selection.getBoundingBox())
76036
+ getSelectionBox: () => Promise.resolve(viewer.selection.getBoundingBox()),
76037
+ getSectionBox: () => viewer.renderer.section.box,
76038
+ getSceneBox: () => Promise.resolve(viewer.renderer.getBoundingBox()),
76039
+ isSectionBoxEnabled: () => section.enable.get()
76031
76040
  });
76032
76041
  }
76033
76042
  function createWebglComponent(container, componentSettings = {}, viewerSettings = {}) {
@@ -76061,7 +76070,8 @@ function VimComponent(props) {
76061
76070
  var _a2;
76062
76071
  const settings2 = useSettings(props.viewer, props.settings ?? {});
76063
76072
  const modal = useModal(settings2.value.capacity.canFollowUrl);
76064
- const camera2 = useWebglCamera(props.viewer);
76073
+ const sectionBox2 = useWebglSectionBox(props.viewer);
76074
+ const camera2 = useWebglCamera(props.viewer, sectionBox2);
76065
76075
  const cursor = useMemo(() => new CursorManager(props.viewer), []);
76066
76076
  const loader = useRef(new ComponentLoader(props.viewer, modal));
76067
76077
  const [isolation] = useState(() => new Isolation(props.viewer, camera2, settings2.value));
@@ -76076,7 +76086,6 @@ function VimComponent(props) {
76076
76086
  const viewerState = useViewerState(props.viewer);
76077
76087
  const treeRef = useRef();
76078
76088
  const performanceRef = useRef(null);
76079
- const sectionBox2 = useWebglSectionBox(props.viewer);
76080
76089
  const controlBar2 = useControlBar(props.viewer, camera2, modal, side, isolation, cursor, settings2.value, sectionBox2, controlBarCustom);
76081
76090
  useEffect(() => {
76082
76091
  var _a3;
@@ -76540,14 +76549,16 @@ function useUltraControlBar(viewer, section, camera2, customization) {
76540
76549
  bar = (customization == null ? void 0 : customization(bar)) ?? bar;
76541
76550
  return bar;
76542
76551
  }
76543
- function useUltraCamera(viewer) {
76552
+ function useUltraCamera(viewer, section) {
76544
76553
  return useCamera({
76545
76554
  onSelectionChanged: viewer.selection.onValueChanged,
76546
76555
  frameCamera: (box, duration) => void viewer.camera.frameBox(box, duration),
76547
- frameAll: (duration) => viewer.camera.frameAll(duration),
76548
76556
  resetCamera: (duration) => viewer.camera.restoreSavedPosition(duration),
76549
76557
  hasSelection: () => viewer.selection.count > 0,
76550
- getSelectionBox: () => viewer.selection.getBoundingBox()
76558
+ getSelectionBox: () => viewer.selection.getBoundingBox(),
76559
+ getSceneBox: () => viewer.renderer.getBoundingBox(),
76560
+ getSectionBox: () => viewer.sectionBox.getBox(),
76561
+ isSectionBoxEnabled: () => section.enable.get()
76551
76562
  });
76552
76563
  }
76553
76564
  function createUltraComponent(container) {
@@ -76578,7 +76589,7 @@ function createUltraComponent(container) {
76578
76589
  function UltraComponent(props) {
76579
76590
  const modal = useModal(true);
76580
76591
  const sectionBox2 = useUltraSectionBox(props.viewer);
76581
- const camera2 = useUltraCamera(props.viewer);
76592
+ const camera2 = useUltraCamera(props.viewer, sectionBox2);
76582
76593
  const side = useSideState(true, 400);
76583
76594
  const [_, setSelectState] = useState(0);
76584
76595
  const [controlBarCustom, setControlBarCustom] = useState(() => (c) => c);