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

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.
@@ -6,12 +6,35 @@ import { ComponentSettings } from '../settings/settings';
6
6
  import { SideState } from '../sidePanel/sideState';
7
7
  import * as Icons from '../panels/icons';
8
8
  import { SectionBoxRef } from './sectionBoxState';
9
+ import { getMeasureState } from './measureState';
9
10
  import { ModalRef } from '../panels/modal';
10
11
  import * as ControlBar from '../controlbar/controlBar';
11
12
  /**
12
13
  * Returns a control bar section for the section box.
13
14
  */
14
15
  export declare function controlBarSectionBox(section: SectionBoxRef, hasSelection: boolean): ControlBar.IControlBarSection;
16
+ export declare function controlBarActions(camera: CameraRef, settings: ComponentSettings, isolation: Isolation, measure: ReturnType<typeof getMeasureState>): {
17
+ id: string;
18
+ enable: () => boolean;
19
+ style: string;
20
+ buttons: ({
21
+ id: string;
22
+ enabled: () => boolean;
23
+ tip: string;
24
+ action: () => void;
25
+ icon: typeof Icons.toggleIsolation;
26
+ style: typeof ControlBar.buttonDefaultStyle;
27
+ isOn?: undefined;
28
+ } | {
29
+ id: string;
30
+ enabled: () => boolean;
31
+ isOn: () => boolean;
32
+ tip: string;
33
+ action: () => void;
34
+ icon: typeof Icons.measure;
35
+ style: typeof ControlBar.buttonDefaultStyle;
36
+ })[];
37
+ };
15
38
  export declare function controlBarCamera(camera: CameraRef): {
16
39
  id: string;
17
40
  enable: () => boolean;
@@ -13,7 +13,8 @@ export interface SectionBoxRef {
13
13
  auto: StateRef<boolean>;
14
14
  sectionSelection: AsyncFuncRef<void>;
15
15
  sectionReset: AsyncFuncRef<void>;
16
- section: ArgActionRef<THREE.Box3>;
16
+ sectionBox: ArgActionRef<THREE.Box3>;
17
+ getBox: () => THREE.Box3;
17
18
  showOffsetPanel: StateRef<boolean>;
18
19
  topOffset: StateRef<string>;
19
20
  sideOffset: StateRef<string>;
@@ -2,9 +2,10 @@ import { ControlBarCustomization } from '../controlbar/controlBar';
2
2
  import { SectionBoxRef } from '../state/sectionBoxState';
3
3
  import * as Ultra from '../../core-viewers/ultra/index';
4
4
  import { CameraRef } from '../state/cameraState';
5
+ import { ControlBar, Icons } from '..';
5
6
  export { buttonDefaultStyle, buttonBlueStyle } from '../controlbar/controlBarButton';
6
7
  export { sectionDefaultStyle, sectionBlueStyle } from '../controlbar/controlBarSection';
7
- export declare function useUltraControlBar(viewer: Ultra.Viewer, section: SectionBoxRef, camera: CameraRef, customization: ControlBarCustomization | undefined): (import("../controlbar/controlBarSection").IControlBarSection | {
8
+ export declare function useUltraControlBar(viewer: Ultra.Viewer, section: SectionBoxRef, camera: CameraRef, customization: ControlBarCustomization | undefined): (ControlBar.IControlBarSection | {
8
9
  id: string;
9
10
  enable: () => boolean;
10
11
  style: string;
@@ -13,7 +14,7 @@ export declare function useUltraControlBar(viewer: Ultra.Viewer, section: Sectio
13
14
  tip: string;
14
15
  isOn: () => boolean;
15
16
  action: () => void;
16
- icon: typeof import("../panels/icons").autoCamera;
17
- style: typeof import("../controlbar/controlBarButton").buttonDefaultStyle;
17
+ icon: typeof Icons.autoCamera;
18
+ style: typeof ControlBar.buttonDefaultStyle;
18
19
  }[];
19
20
  })[];
@@ -4,11 +4,11 @@
4
4
  import * as VIM from '../../core-viewers/webgl/index';
5
5
  import { SideState } from '../sidePanel/sideState';
6
6
  import { CameraRef } from '../state/cameraState';
7
- import { Isolation } from './isolation';
7
+ import { Isolation } from '../helpers/isolation';
8
8
  /**
9
9
  * Custom viewer input scheme for the vim component
10
10
  */
11
- export declare class ComponentInputs implements VIM.InputScheme {
11
+ export declare class UltraInputs implements VIM.InputScheme {
12
12
  private _viewer;
13
13
  private _camera;
14
14
  private _default;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module viw-webgl-react
3
+ */
4
+ import * as VIM from '../../core-viewers/webgl/index';
5
+ import { SideState } from '../sidePanel/sideState';
6
+ import { CameraRef } from '../state/cameraState';
7
+ import { Isolation } from '../helpers/isolation';
8
+ /**
9
+ * Custom viewer input scheme for the vim component
10
+ */
11
+ export declare class WebglInputs implements VIM.InputScheme {
12
+ private _viewer;
13
+ private _camera;
14
+ private _default;
15
+ private _isolation;
16
+ private _sideState;
17
+ constructor(viewer: VIM.Viewer, camera: CameraRef, isolation: Isolation, sideState: SideState);
18
+ private _getSelection;
19
+ onMainAction(hit: VIM.InputAction): void;
20
+ onIdleAction(hit: VIM.InputAction): void;
21
+ onKeyAction(key: number): boolean;
22
+ }
@@ -68074,7 +68074,7 @@ Averrage Date/Second ${avgDataRatePS} kb
68074
68074
  {
68075
68075
  id: ids.buttonZoomToFit,
68076
68076
  enabled: () => isTrue(settings2.ui.zoomToFit),
68077
- tip: "Zoom to Fit",
68077
+ tip: "Frame Camera",
68078
68078
  action: () => camera2.frameSelection.call(),
68079
68079
  icon: frameSelection,
68080
68080
  isOn: () => false,
@@ -74763,7 +74763,7 @@ Averrage Date/Second ${avgDataRatePS} kb
74763
74763
  }
74764
74764
  animate();
74765
74765
  }
74766
- class ComponentInputs {
74766
+ class WebglInputs {
74767
74767
  constructor(viewer, camera2, isolation, sideState) {
74768
74768
  __publicField(this, "_viewer");
74769
74769
  __publicField(this, "_camera");
@@ -75922,14 +75922,14 @@ Averrage Date/Second ${avgDataRatePS} kb
75922
75922
  topOffset.useConfirm((v) => sanitize(v, true));
75923
75923
  sideOffset.useConfirm((v) => sanitize(v, true));
75924
75924
  bottomOffset.useConfirm((v) => sanitize(v, true));
75925
- topOffset.useOnChange((v) => section.call(boxRef.current));
75926
- sideOffset.useOnChange((v) => section.call(boxRef.current));
75927
- bottomOffset.useOnChange((v) => section.call(boxRef.current));
75925
+ topOffset.useOnChange((v) => sectionBox2.call(boxRef.current));
75926
+ sideOffset.useOnChange((v) => sectionBox2.call(boxRef.current));
75927
+ bottomOffset.useOnChange((v) => sectionBox2.call(boxRef.current));
75928
75928
  auto.useOnChange((v) => {
75929
75929
  if (v) sectionSelection.call();
75930
75930
  });
75931
75931
  visible2.useOnChange((v) => adapter.setVisible(v));
75932
- const section = useArgActionRef((baseBox) => {
75932
+ const sectionBox2 = useArgActionRef((baseBox) => {
75933
75933
  if (baseBox === void 0) return;
75934
75934
  boxRef.current = baseBox;
75935
75935
  const newBox = addBox(baseBox, offsetsToBox3(topOffset.get(), sideOffset.get(), bottomOffset.get()));
@@ -75938,14 +75938,14 @@ Averrage Date/Second ${avgDataRatePS} kb
75938
75938
  const sectionSelection = useFuncRef(async () => {
75939
75939
  try {
75940
75940
  const box = await adapter.getSelectionBox() ?? await adapter.getRendererBox();
75941
- section.call(box);
75941
+ sectionBox2.call(box);
75942
75942
  } catch (e) {
75943
75943
  console.error(e);
75944
75944
  }
75945
75945
  });
75946
75946
  const sectionReset = useFuncRef(async () => {
75947
75947
  const box = await adapter.getRendererBox();
75948
- section.call(box);
75948
+ sectionBox2.call(box);
75949
75949
  });
75950
75950
  return {
75951
75951
  enable,
@@ -75957,7 +75957,8 @@ Averrage Date/Second ${avgDataRatePS} kb
75957
75957
  bottomOffset,
75958
75958
  sectionSelection,
75959
75959
  sectionReset,
75960
- section
75960
+ sectionBox: sectionBox2,
75961
+ getBox: () => adapter.getBox()
75961
75962
  };
75962
75963
  }
75963
75964
  const sanitize = (value, strict) => {
@@ -76113,7 +76114,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76113
76114
  }
76114
76115
  cursor.register();
76115
76116
  props.viewer.viewport.canvas.tabIndex = 0;
76116
- props.viewer.inputs.scheme = new ComponentInputs(
76117
+ props.viewer.inputs.scheme = new WebglInputs(
76117
76118
  props.viewer,
76118
76119
  camera2,
76119
76120
  isolation,
@@ -76561,10 +76562,29 @@ Averrage Date/Second ${avgDataRatePS} kb
76561
76562
  function useUltraControlBar(viewer, section, camera2, customization) {
76562
76563
  const sectionSectionBox = controlBarSectionBox(section, viewer.selection.count > 0);
76563
76564
  const sectionCamera = controlBarCamera(camera2);
76564
- let bar = [sectionCamera, sectionSectionBox];
76565
+ const frame = frameSection(camera2);
76566
+ let bar = [sectionCamera, frame, sectionSectionBox];
76565
76567
  bar = (customization == null ? void 0 : customization(bar)) ?? bar;
76566
76568
  return bar;
76567
76569
  }
76570
+ function frameSection(camera2) {
76571
+ return {
76572
+ id: ids.sectionActions,
76573
+ enable: () => true,
76574
+ style: sectionDefaultStyle,
76575
+ buttons: [
76576
+ {
76577
+ id: ids.buttonZoomToFit,
76578
+ enabled: () => true,
76579
+ tip: "Frame Camera",
76580
+ action: () => camera2.frameSelection.call(),
76581
+ icon: frameSelection,
76582
+ isOn: () => false,
76583
+ style: buttonDefaultStyle
76584
+ }
76585
+ ]
76586
+ };
76587
+ }
76568
76588
  function useUltraCamera(viewer, section) {
76569
76589
  return useCamera({
76570
76590
  onSelectionChanged: viewer.selection.onValueChanged,