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.
@@ -14,9 +14,11 @@ interface ICameraAdapter {
14
14
  onSelectionChanged: ISignal;
15
15
  frameCamera: (box: THREE.Box3, duration: number) => void;
16
16
  resetCamera: (duration: number) => void;
17
- frameAll: (duration: number) => void;
18
17
  hasSelection: () => boolean;
19
18
  getSelectionBox: () => Promise<THREE.Box3>;
19
+ getSceneBox: () => Promise<THREE.Box3>;
20
+ getSectionBox: () => THREE.Box3;
21
+ isSectionBoxEnabled: () => boolean;
20
22
  }
21
23
  export declare function useCamera(adapter: ICameraAdapter): CameraRef;
22
24
  export {};
@@ -1,2 +1,3 @@
1
1
  import { UltraViewer } from "../..";
2
- export declare function useUltraCamera(viewer: UltraViewer.Viewer): import("../..").CameraRef;
2
+ import { SectionBoxRef } from "../state/sectionBoxState";
3
+ export declare function useUltraCamera(viewer: UltraViewer.Viewer, section: SectionBoxRef): import("../..").CameraRef;
@@ -1,2 +1,2 @@
1
- import { WebglViewer } from "../..";
2
- export declare function useWebglCamera(viewer: WebglViewer.Viewer): import("../..").CameraRef;
1
+ import { SectionBoxRef, WebglViewer } from "../..";
2
+ export declare function useWebglCamera(viewer: WebglViewer.Viewer, section: SectionBoxRef): import("../..").CameraRef;
@@ -76017,14 +76017,10 @@ Averrage Date/Second ${avgDataRatePS} kb
76017
76017
  frameScene.call();
76018
76018
  return;
76019
76019
  }
76020
- const box = await adapter.getSelectionBox();
76021
- if (!box) {
76022
- return;
76023
- }
76024
- adapter.frameCamera(box, 1);
76020
+ frameBox(adapter, () => adapter.getSelectionBox());
76025
76021
  });
76026
76022
  const frameScene = useAsyncFuncRef(async () => {
76027
- adapter.frameAll(1);
76023
+ frameBox(adapter, () => adapter.getSceneBox());
76028
76024
  });
76029
76025
  return {
76030
76026
  autoCamera: autoCamera2,
@@ -76033,17 +76029,30 @@ Averrage Date/Second ${avgDataRatePS} kb
76033
76029
  frameScene
76034
76030
  };
76035
76031
  }
76036
- function useWebglCamera(viewer) {
76032
+ async function frameBox(adapter, getBox) {
76033
+ const box = await getBox();
76034
+ if (!box) return;
76035
+ if (adapter.isSectionBoxEnabled()) {
76036
+ const section = adapter.getSectionBox();
76037
+ if (section) {
76038
+ box.intersect(section);
76039
+ }
76040
+ if (box.isEmpty()) {
76041
+ box.copy(section);
76042
+ }
76043
+ }
76044
+ adapter.frameCamera(box, 1);
76045
+ }
76046
+ function useWebglCamera(viewer, section) {
76037
76047
  return useCamera({
76038
76048
  onSelectionChanged: viewer.selection.onValueChanged,
76039
76049
  frameCamera: (box, duration) => viewer.camera.lerp(duration).frame(box),
76040
76050
  resetCamera: (duration) => viewer.camera.lerp(duration).reset(),
76041
- frameAll: (duration) => {
76042
- const box = viewer.renderer.getBoundingBox();
76043
- viewer.camera.lerp(duration).frame(box);
76044
- },
76045
76051
  hasSelection: () => viewer.selection.count > 0,
76046
- getSelectionBox: () => Promise.resolve(viewer.selection.getBoundingBox())
76052
+ getSelectionBox: () => Promise.resolve(viewer.selection.getBoundingBox()),
76053
+ getSectionBox: () => viewer.renderer.section.box,
76054
+ getSceneBox: () => Promise.resolve(viewer.renderer.getBoundingBox()),
76055
+ isSectionBoxEnabled: () => section.enable.get()
76047
76056
  });
76048
76057
  }
76049
76058
  function createWebglComponent(container, componentSettings = {}, viewerSettings = {}) {
@@ -76077,7 +76086,8 @@ Averrage Date/Second ${avgDataRatePS} kb
76077
76086
  var _a2;
76078
76087
  const settings2 = useSettings(props.viewer, props.settings ?? {});
76079
76088
  const modal = useModal(settings2.value.capacity.canFollowUrl);
76080
- const camera2 = useWebglCamera(props.viewer);
76089
+ const sectionBox2 = useWebglSectionBox(props.viewer);
76090
+ const camera2 = useWebglCamera(props.viewer, sectionBox2);
76081
76091
  const cursor = React2.useMemo(() => new CursorManager(props.viewer), []);
76082
76092
  const loader = React2.useRef(new ComponentLoader(props.viewer, modal));
76083
76093
  const [isolation] = React2.useState(() => new Isolation(props.viewer, camera2, settings2.value));
@@ -76092,7 +76102,6 @@ Averrage Date/Second ${avgDataRatePS} kb
76092
76102
  const viewerState = useViewerState(props.viewer);
76093
76103
  const treeRef = React2.useRef();
76094
76104
  const performanceRef = React2.useRef(null);
76095
- const sectionBox2 = useWebglSectionBox(props.viewer);
76096
76105
  const controlBar2 = useControlBar(props.viewer, camera2, modal, side, isolation, cursor, settings2.value, sectionBox2, controlBarCustom);
76097
76106
  React2.useEffect(() => {
76098
76107
  var _a3;
@@ -76556,14 +76565,16 @@ Averrage Date/Second ${avgDataRatePS} kb
76556
76565
  bar = (customization == null ? void 0 : customization(bar)) ?? bar;
76557
76566
  return bar;
76558
76567
  }
76559
- function useUltraCamera(viewer) {
76568
+ function useUltraCamera(viewer, section) {
76560
76569
  return useCamera({
76561
76570
  onSelectionChanged: viewer.selection.onValueChanged,
76562
76571
  frameCamera: (box, duration) => void viewer.camera.frameBox(box, duration),
76563
- frameAll: (duration) => viewer.camera.frameAll(duration),
76564
76572
  resetCamera: (duration) => viewer.camera.restoreSavedPosition(duration),
76565
76573
  hasSelection: () => viewer.selection.count > 0,
76566
- getSelectionBox: () => viewer.selection.getBoundingBox()
76574
+ getSelectionBox: () => viewer.selection.getBoundingBox(),
76575
+ getSceneBox: () => viewer.renderer.getBoundingBox(),
76576
+ getSectionBox: () => viewer.sectionBox.getBox(),
76577
+ isSectionBoxEnabled: () => section.enable.get()
76567
76578
  });
76568
76579
  }
76569
76580
  function createUltraComponent(container) {
@@ -76594,7 +76605,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76594
76605
  function UltraComponent(props) {
76595
76606
  const modal = useModal(true);
76596
76607
  const sectionBox2 = useUltraSectionBox(props.viewer);
76597
- const camera2 = useUltraCamera(props.viewer);
76608
+ const camera2 = useUltraCamera(props.viewer, sectionBox2);
76598
76609
  const side = useSideState(true, 400);
76599
76610
  const [_, setSelectState] = React2.useState(0);
76600
76611
  const [controlBarCustom, setControlBarCustom] = React2.useState(() => (c) => c);