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

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.
Files changed (43) hide show
  1. package/README.md +2 -2
  2. package/dist/style.css +9 -8
  3. package/dist/types/core-viewers/ultra/index.d.ts +1 -1
  4. package/dist/types/core-viewers/ultra/viewer/camera.d.ts +2 -1
  5. package/dist/types/core-viewers/ultra/viewer/inputs/{inputKeyboard.d.ts → keyboardHandler.d.ts} +1 -1
  6. package/dist/types/core-viewers/ultra/viewer/inputs/{inputMouse.d.ts → mouseHandler.d.ts} +7 -6
  7. package/dist/types/core-viewers/ultra/viewer/inputs/{InputTouch.d.ts → touchHandler.d.ts} +1 -1
  8. package/dist/types/core-viewers/ultra/viewer/marshal.d.ts +1 -1
  9. package/dist/types/core-viewers/ultra/viewer/sectionBox.d.ts +1 -0
  10. package/dist/types/core-viewers/ultra/viewer/selection.d.ts +3 -0
  11. package/dist/types/core-viewers/ultra/viewer/vim.d.ts +1 -1
  12. package/dist/types/core-viewers/webgl/loader/materials/viewerMaterials.d.ts +1 -1
  13. package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxHandle.d.ts +2 -0
  14. package/dist/types/core-viewers/webgl/viewer/inputs/inputHandler.d.ts +1 -0
  15. package/dist/types/react-viewers/bim/bimPanel.d.ts +3 -3
  16. package/dist/types/react-viewers/bim/bimTree.d.ts +2 -2
  17. package/dist/types/react-viewers/controlbar/controlBar.d.ts +1 -0
  18. package/dist/types/react-viewers/controlbar/controlBarIds.d.ts +29 -0
  19. package/dist/types/react-viewers/helpers/{inputs.d.ts → componentInputs.d.ts} +2 -2
  20. package/dist/types/react-viewers/helpers/isolation.d.ts +2 -2
  21. package/dist/types/react-viewers/helpers/reactUtils.d.ts +39 -0
  22. package/dist/types/react-viewers/index.d.ts +4 -0
  23. package/dist/types/react-viewers/panels/axesPanel.d.ts +2 -2
  24. package/dist/types/react-viewers/panels/contextMenu.d.ts +2 -2
  25. package/dist/types/react-viewers/panels/icons.d.ts +1 -0
  26. package/dist/types/react-viewers/state/cameraState.d.ts +22 -0
  27. package/dist/types/react-viewers/state/controlBarState.d.ts +31 -33
  28. package/dist/types/react-viewers/state/sectionBoxState.d.ts +12 -14
  29. package/dist/types/react-viewers/ultra/errors/ultraErrors.d.ts +1 -1
  30. package/dist/types/react-viewers/ultra/index.d.ts +1 -0
  31. package/dist/types/react-viewers/ultra/ultraCameraState.d.ts +2 -0
  32. package/dist/types/react-viewers/ultra/ultraComponent.d.ts +1 -7
  33. package/dist/types/react-viewers/ultra/ultraComponentRef.d.ts +36 -0
  34. package/dist/types/react-viewers/ultra/ultraControlBarState.d.ts +14 -1
  35. package/dist/types/react-viewers/urls.d.ts +1 -0
  36. package/dist/types/react-viewers/webgl/webglCameraState.d.ts +2 -0
  37. package/dist/types/react-viewers/webgl/webglComponentRef.d.ts +7 -2
  38. package/dist/vim-web.iife.js +529 -396
  39. package/dist/vim-web.iife.js.map +1 -1
  40. package/dist/vim-web.js +529 -396
  41. package/dist/vim-web.js.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/types/react-viewers/helpers/camera.d.ts +0 -37
package/README.md CHANGED
@@ -11,11 +11,11 @@ https://www.npmjs.com/package/vim-web
11
11
 
12
12
  ### WebGL Viewer
13
13
  - **[Small - Residence](https://vimaec.github.io/vim-web/webgl)**
14
- - **[Medium - Medical Tower](https://vimaec.github.io/vim-web/webgl?vim=https://vim.azureedge.net/samples/Medical_Tower.vim)**
14
+ - **[Medium - Medical Tower](https://vimaec.github.io/vim-web/webgl?vim=https://storage.cdn.vimaec.com/samples/Medical_Tower.vim)**
15
15
 
16
16
  ### Ultra Viewer
17
17
  - **[Small - Residence](https://vimaec.github.io/vim-web/ultra)**
18
- - **[Medium - Medical Tower](https://vimaec.github.io/vim-web/ultra?vim=https://vim.azureedge.net/samples/Medical_Tower.vim)**
18
+ - **[Medium - Medical Tower](https://vimaec.github.io/vim-web/ultra?vim=https://storage.cdn.vimaec.com/samples/Medical_Tower.vim)**
19
19
 
20
20
  Find detailed camera controls here: [Camera Controls](https://docs.vimaec.com/docs/vim-cloud/webgl-navigation-and-controls-guide).
21
21
 
package/dist/style.css CHANGED
@@ -733,6 +733,9 @@ video:where(.vim-component,.vim-component *) {
733
733
  .vc-top-1 {
734
734
  top: 0.25rem;
735
735
  }
736
+ .vc-top-10 {
737
+ top: 2.5rem;
738
+ }
736
739
  .vc-top-4 {
737
740
  top: 1rem;
738
741
  }
@@ -982,6 +985,9 @@ video:where(.vim-component,.vim-component *) {
982
985
  .vc-justify-evenly {
983
986
  justify-content: space-evenly;
984
987
  }
988
+ .vc-gap-1 {
989
+ gap: 0.25rem;
990
+ }
985
991
  .vc-gap-2 {
986
992
  gap: 0.5rem;
987
993
  }
@@ -1098,6 +1104,9 @@ video:where(.vim-component,.vim-component *) {
1098
1104
  --tw-bg-opacity: 1 !important;
1099
1105
  background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1)) !important;
1100
1106
  }
1107
+ .vc-bg-gray {
1108
+ background-color: var(--c-gray);
1109
+ }
1101
1110
  .vc-bg-gray-light {
1102
1111
  background-color: var(--c-light-gray);
1103
1112
  }
@@ -1110,9 +1119,6 @@ video:where(.vim-component,.vim-component *) {
1110
1119
  .vc-bg-gray-warm {
1111
1120
  background-color: var(--c-dark-gray-warm);
1112
1121
  }
1113
- .vc-bg-overflow {
1114
- background-color: var(--c-overflow);
1115
- }
1116
1122
  .vc-bg-primary {
1117
1123
  background-color: var(--c-primary);
1118
1124
  }
@@ -1304,11 +1310,6 @@ video:where(.vim-component,.vim-component *) {
1304
1310
  --tw-saturate: saturate(0);
1305
1311
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
1306
1312
  }
1307
- .vc-backdrop-blur {
1308
- --tw-backdrop-blur: blur(8px);
1309
- -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
1310
- backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
1311
- }
1312
1313
  .\!vc-transition-opacity {
1313
1314
  transition-property: opacity !important;
1314
1315
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
@@ -2,9 +2,9 @@ import "./style.css";
2
2
  export * from './viewer/viewer';
3
3
  export * as utils from './utils/promise';
4
4
  export * from './viewer/vim';
5
- export * from './viewer/vim';
6
5
  export * from './utils/math3d';
7
6
  export * from './viewer/color';
8
7
  export type { ILoadRequest, VimRequestErrorType } from './viewer/loadRequest';
9
8
  export type { ClientState, ConnectionSettings } from './viewer/socketClient';
10
9
  export type { VimSource } from './viewer/rpcSafeClient';
10
+ export type { SectionBoxState } from './viewer/marshal';
@@ -1,4 +1,4 @@
1
- import { Box3, Segment } from '../utils/math3d';
1
+ import { Box3, Segment, Vector3 } from '../utils/math3d';
2
2
  import { RpcSafeClient } from './rpcSafeClient';
3
3
  import { Vim } from './vim';
4
4
  /**
@@ -78,6 +78,7 @@ export declare class Camera implements ICamera {
78
78
  */
79
79
  onConnect(): void;
80
80
  onCameraPose(pose: Segment): void;
81
+ set(position: Vector3, target: Vector3, blendTime?: number): void;
81
82
  /**
82
83
  * Pauses or resumes rendering
83
84
  * @param value - True to pause rendering, false to resume
@@ -3,7 +3,7 @@ import { RpcSafeClient } from "../rpcSafeClient";
3
3
  import { ViewerSelection } from "../selection";
4
4
  import { InputHandler } from "./inputHandler";
5
5
  import { Inputs } from "./inputs";
6
- export declare class InputKeyboard extends InputHandler {
6
+ export declare class KeyboardHandler extends InputHandler {
7
7
  private readonly _rpc;
8
8
  private readonly _selection;
9
9
  private _camera;
@@ -2,20 +2,21 @@ import { InputHandler } from "./inputHandler";
2
2
  import { RpcSafeClient } from "../rpcSafeClient";
3
3
  import { ViewerSelection } from "../selection";
4
4
  import { ICamera } from "../camera";
5
- export declare class InputMouse extends InputHandler {
5
+ export declare class MouseHandler extends InputHandler {
6
6
  private readonly _rpc;
7
7
  private readonly _canvas;
8
8
  private _lastMouseDownPosition;
9
9
  private _selection;
10
10
  private _camera;
11
+ private _capture;
11
12
  constructor(canvas: HTMLCanvasElement, rpc: RpcSafeClient, selection: ViewerSelection, camera: ICamera);
12
13
  register(): void;
13
14
  dispose(): void;
14
- private handlePointerDown;
15
- private handlePointerUp;
15
+ private onPointerDown;
16
+ private onPointerUp;
16
17
  private handleMouseClick;
17
- private handlePointerMove;
18
- private handleDoubleClick;
19
- private handleMouseScroll;
18
+ private onPointerMove;
19
+ private onDoubleClick;
20
+ private onMouseScroll;
20
21
  private relativePosition;
21
22
  }
@@ -1,6 +1,6 @@
1
1
  import { InputHandler } from "./inputHandler";
2
2
  import { RpcSafeClient } from "../rpcSafeClient";
3
- export declare class InputTouch extends InputHandler {
3
+ export declare class TouchHandler extends InputHandler {
4
4
  private readonly _rpc;
5
5
  private readonly _canvas;
6
6
  private _lastTouchStartPosition;
@@ -14,7 +14,7 @@ export type VimStatus = {
14
14
  };
15
15
  export type SectionBoxState = {
16
16
  visible: boolean;
17
- interactible: boolean;
17
+ interactive: boolean;
18
18
  clip: boolean;
19
19
  box: Box3;
20
20
  };
@@ -8,6 +8,7 @@ export declare class SectionBox {
8
8
  private _rpc;
9
9
  private _interval;
10
10
  private _animationFrame;
11
+ private _pullId;
11
12
  private _onUpdate;
12
13
  get onUpdate(): import("ste-signals").ISignal;
13
14
  private get needUpdate();
@@ -9,6 +9,7 @@ export interface IViewerSelection {
9
9
  add(vim: Vim, node: number | number[]): void;
10
10
  remove(vim: Vim, node: number | number[]): void;
11
11
  clear(vim?: Vim): void;
12
+ get(): ReadonlyMap<Vim, ReadonlySet<number>>;
12
13
  }
13
14
  /**
14
15
  * Represents the result of a hit test operation.
@@ -32,6 +33,7 @@ export declare class ViewerSelection implements IViewerSelection {
32
33
  private _selectedNodes;
33
34
  private _onValueChanged;
34
35
  get onValueChanged(): import("ste-signals").ISignal;
36
+ get(): ReadonlyMap<Vim, ReadonlySet<number>>;
35
37
  /**
36
38
  * Creates a new ViewerSelection instance.
37
39
  * @param rpc - RPC client for communication with the viewer.
@@ -82,6 +84,7 @@ export declare class ViewerSelection implements IViewerSelection {
82
84
  * @param vim - Optional. If provided, only clears selections for the specified VIM.
83
85
  */
84
86
  clear(vim?: Vim): void;
87
+ private _clear;
85
88
  /**
86
89
  * Calculates the bounding box encompassing all selected nodes.
87
90
  * @returns Promise resolving to a Box3 representing the bounds of all selected nodes,
@@ -76,7 +76,7 @@ export declare class Vim {
76
76
  * @param nodes - The nodes to remove the highlight from.
77
77
  * @param fallback - The state to revert the nodes to.
78
78
  */
79
- removeHighlight(nodes: number[], fallback: NodeState): void;
79
+ removeHighlight(nodes: number[] | 'all', fallback: NodeState): void;
80
80
  /**
81
81
  * Retrieves the bounding box of the given nodes.
82
82
  * @param nodes - The nodes to get the bounding box for.
@@ -131,7 +131,7 @@ export declare class ViewerMaterials {
131
131
  get outlineAntialias(): boolean;
132
132
  set outlineAntialias(value: boolean);
133
133
  /**
134
- * Size of the blur convolution on the selection outline effect.
134
+ * Size of the blur convolution on the selection outline effect. Minimum 2.
135
135
  */
136
136
  get outlineBlur(): number;
137
137
  set outlineBlur(value: number);
@@ -8,9 +8,11 @@ export declare class SectionBoxHandle extends THREE.Mesh {
8
8
  private _color;
9
9
  private _highlightColor;
10
10
  private _materials;
11
+ private _camera;
11
12
  private _camSub;
12
13
  constructor(axes: Axis, sign: number, size: number, color?: THREE.Color);
13
14
  trackCamera(camera: ICamera): void;
15
+ update(): void;
14
16
  setPosition(position: THREE.Vector3): void;
15
17
  get forward(): THREE.Vector3;
16
18
  highlight(value: boolean): void;
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { Viewer } from '../viewer';
5
5
  /**
6
+ * TODO: Use the same code for ULTRA and webgl.
6
7
  * Base class for various input handlers.
7
8
  * It provides convenience to register to and unregister from events.
8
9
  */
@@ -5,13 +5,13 @@ import React from 'react';
5
5
  import * as VIM from '../../core-viewers/webgl/index';
6
6
  import { TreeActionRef } from './bimTree';
7
7
  import { Isolation } from '../helpers/isolation';
8
- import { ComponentCamera } from '../helpers/camera';
8
+ import { CameraRef } from '../state/cameraState';
9
9
  import { ViewerState } from '../webgl/viewerState';
10
10
  import { ComponentSettings } from '../settings/settings';
11
11
  import { BimInfoPanelRef } from './bimInfoData';
12
12
  export declare function OptionalBimPanel(props: {
13
13
  viewer: VIM.Viewer;
14
- camera: ComponentCamera;
14
+ camera: CameraRef;
15
15
  viewerState: ViewerState;
16
16
  isolation: Isolation;
17
17
  visible: boolean;
@@ -30,7 +30,7 @@ export declare function OptionalBimPanel(props: {
30
30
  */
31
31
  export declare function BimPanel(props: {
32
32
  viewer: VIM.Viewer;
33
- camera: ComponentCamera;
33
+ camera: CameraRef;
34
34
  viewerState: ViewerState;
35
35
  isolation: Isolation;
36
36
  visible: boolean;
@@ -4,7 +4,7 @@
4
4
  import React from 'react';
5
5
  import 'react-complex-tree/lib/style.css';
6
6
  import * as VIM from '../../core-viewers/webgl/index';
7
- import { ComponentCamera as CameraHelpers } from '../helpers/camera';
7
+ import { CameraRef } from '../state/cameraState';
8
8
  import { Isolation } from '../helpers/isolation';
9
9
  import { BimTreeData } from './bimTreeData';
10
10
  export type TreeActionRef = {
@@ -23,7 +23,7 @@ export type TreeActionRef = {
23
23
  export declare function BimTree(props: {
24
24
  actionRef: React.MutableRefObject<TreeActionRef>;
25
25
  viewer: VIM.Viewer;
26
- camera: CameraHelpers;
26
+ camera: CameraRef;
27
27
  objects: VIM.Object3D[];
28
28
  isolation: Isolation;
29
29
  treeData: BimTreeData;
@@ -5,6 +5,7 @@ import { IControlBarSection } from './controlBarSection';
5
5
  export * from './controlBarSection';
6
6
  export * from './controlBarButton';
7
7
  export * from './controlBarSection';
8
+ export * from './controlBarIds';
8
9
  /**
9
10
  * A map function that changes the context menu.
10
11
  */
@@ -0,0 +1,29 @@
1
+ export declare const ids: {
2
+ sectionCamera: string;
3
+ sectionInputs: string;
4
+ sectionActions: string;
5
+ sectionTools: string;
6
+ sectionSettings: string;
7
+ sectionMeasure: string;
8
+ sectionSectionBox: string;
9
+ buttonCameraAuto: string;
10
+ buttonCameraOrbit: string;
11
+ buttonCameraLook: string;
12
+ buttonCameraPan: string;
13
+ buttonCameraZoom: string;
14
+ buttonCameraZoomWindow: string;
15
+ buttonProjectInspector: string;
16
+ buttonSettings: string;
17
+ buttonHelp: string;
18
+ buttonMaximize: string;
19
+ buttonToggleIsolation: string;
20
+ buttonZoomToFit: string;
21
+ buttonSectionBox: string;
22
+ buttonMeasure: string;
23
+ buttonSectionBoxEnable: string;
24
+ buttonSectionBoxVisible: string;
25
+ buttonSectionBoxShrinkToSelection: string;
26
+ buttonSectionBoxAuto: string;
27
+ buttonSectionBoxReset: string;
28
+ buttonSectionBoxSettings: string;
29
+ };
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as VIM from '../../core-viewers/webgl/index';
5
5
  import { SideState } from '../sidePanel/sideState';
6
- import { ComponentCamera } from './camera';
6
+ import { CameraRef } from '../state/cameraState';
7
7
  import { Isolation } from './isolation';
8
8
  /**
9
9
  * Custom viewer input scheme for the vim component
@@ -14,7 +14,7 @@ export declare class ComponentInputs implements VIM.InputScheme {
14
14
  private _default;
15
15
  private _isolation;
16
16
  private _sideState;
17
- constructor(viewer: VIM.Viewer, camera: ComponentCamera, isolation: Isolation, sideState: SideState);
17
+ constructor(viewer: VIM.Viewer, camera: CameraRef, isolation: Isolation, sideState: SideState);
18
18
  private _getSelection;
19
19
  onMainAction(hit: VIM.InputAction): void;
20
20
  onIdleAction(hit: VIM.InputAction): void;
@@ -1,6 +1,6 @@
1
1
  import * as VIM from '../../core-viewers/webgl/index';
2
2
  import { ComponentSettings } from '../settings/settings';
3
- import { ComponentCamera } from './camera';
3
+ import { CameraRef } from '../state/cameraState';
4
4
  import { ISimpleEvent } from 'ste-simple-events';
5
5
  /**
6
6
  * Manages the isolation mechanic in the VIM component.
@@ -32,7 +32,7 @@ export declare class Isolation {
32
32
  * @param camera - A component that handles camera control and framing.
33
33
  * @param settings - The settings that control isolation and material usage.
34
34
  */
35
- constructor(viewer: VIM.Viewer, camera: ComponentCamera, settings: ComponentSettings);
35
+ constructor(viewer: VIM.Viewer, camera: CameraRef, settings: ComponentSettings);
36
36
  /**
37
37
  * Applies relevant settings to the isolation behavior.
38
38
  *
@@ -0,0 +1,39 @@
1
+ export interface StateRef<T> {
2
+ get(): T;
3
+ set(value: T): void;
4
+ confirm(): void;
5
+ }
6
+ export declare function useStateRef<T>(initialValue: T): {
7
+ get(): T;
8
+ set: (value: T) => void;
9
+ confirm(): void;
10
+ useOnChange(on: (value: T) => (void | (() => void))): void;
11
+ useMemo<TOut>(on: (value: T) => TOut, deps?: any[]): TOut;
12
+ useValidate(on: (value: T) => T): void;
13
+ useConfirm(on: (value: T) => T): void;
14
+ };
15
+ export interface ActionRef {
16
+ call(): void;
17
+ set(func: () => void): void;
18
+ }
19
+ export declare function useActionRef(action: () => void): ActionRef;
20
+ export interface ArgActionRef<T> {
21
+ call(arg: T): void;
22
+ set(func: (arg: T) => void): void;
23
+ }
24
+ export declare function useArgActionRef<T>(action: (arg: T) => void): ArgActionRef<T>;
25
+ export interface FuncRef<T> {
26
+ call(): T;
27
+ set(func: () => T): void;
28
+ }
29
+ export declare function useFuncRef<T>(func: () => T): FuncRef<T>;
30
+ export interface AsyncFuncRef<T> {
31
+ call(): Promise<T>;
32
+ set(func: () => Promise<T>): void;
33
+ }
34
+ export declare function useAsyncFuncRef<T>(func: () => Promise<T>): AsyncFuncRef<T>;
35
+ export interface ArgFuncRef<TArg, TResult> {
36
+ call(arg: TArg): TResult;
37
+ set(func: (arg: TArg) => TResult): void;
38
+ }
39
+ export declare function useArgFuncRef<TArg, TResult>(func: (arg: TArg) => TResult): ArgFuncRef<TArg, TResult>;
@@ -5,5 +5,9 @@ export * as ErrorStyle from './errors/errorStyle';
5
5
  export * as Errors from './errors/errors';
6
6
  export * as Urls from './urls';
7
7
  export * as Icons from './panels/icons';
8
+ export type { ActionRef, ArgActionRef, ArgFuncRef, AsyncFuncRef, FuncRef, StateRef } from './helpers/reactUtils';
8
9
  export type { MessageBoxProps } from './panels/messageBox';
9
10
  export * from './container';
11
+ export { type CameraRef } from './state/cameraState';
12
+ export { type SectionBoxRef } from './state/sectionBoxState';
13
+ export * as ControlBar from './controlbar/controlBar';
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import React from 'react';
5
5
  import * as VIM from '../../core-viewers/webgl/index';
6
- import { ComponentCamera } from '../helpers/camera';
6
+ import { CameraRef } from '../state/cameraState';
7
7
  import { SettingsState } from '../settings/settingsState';
8
8
  /**
9
9
  * Memoized version of the AxesPanelMemo.
@@ -14,7 +14,7 @@ export declare const AxesPanelMemo: React.MemoExoticComponent<typeof AxesPanel>;
14
14
  */
15
15
  declare function AxesPanel(props: {
16
16
  viewer: VIM.Viewer;
17
- camera: ComponentCamera;
17
+ camera: CameraRef;
18
18
  settings: SettingsState;
19
19
  }): import("react/jsx-runtime").JSX.Element;
20
20
  export {};
@@ -4,7 +4,7 @@
4
4
  import React from 'react';
5
5
  import { WebglViewer } from '../..';
6
6
  import { Isolation } from '../helpers/isolation';
7
- import { ComponentCamera } from '../helpers/camera';
7
+ import { CameraRef } from '../state/cameraState';
8
8
  import { TreeActionRef } from '../bim/bimTree';
9
9
  import { ModalRef } from './modal';
10
10
  type ClickCallback = React.MouseEvent<HTMLDivElement, MouseEvent>;
@@ -65,7 +65,7 @@ export declare const VimContextMenuMemo: React.MemoExoticComponent<typeof VimCon
65
65
  */
66
66
  export declare function VimContextMenu(props: {
67
67
  viewer: WebglViewer.Viewer;
68
- camera: ComponentCamera;
68
+ camera: CameraRef;
69
69
  modal: ModalRef;
70
70
  isolation: Isolation;
71
71
  selection: WebglViewer.Object3D[];
@@ -27,6 +27,7 @@ export declare function arrowLeft({ height, width, fill, className }: IconOption
27
27
  export declare function fullArrowLeft({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
28
28
  export declare function visible({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
29
29
  export declare function hidden({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
30
+ export declare function autoCamera({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
30
31
  export declare function orbit({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
31
32
  export declare function look({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
32
33
  export declare function perspective({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module viw-webgl-react
3
+ */
4
+ import { THREE } from '../../index';
5
+ import { ActionRef, AsyncFuncRef, StateRef } from '../helpers/reactUtils';
6
+ import { ISignal } from 'ste-signals';
7
+ export interface CameraRef {
8
+ autoCamera: StateRef<boolean>;
9
+ reset: ActionRef;
10
+ frameSelection: AsyncFuncRef<void>;
11
+ frameScene: AsyncFuncRef<void>;
12
+ }
13
+ interface ICameraAdapter {
14
+ onSelectionChanged: ISignal;
15
+ frameCamera: (box: THREE.Box3, duration: number) => void;
16
+ resetCamera: (duration: number) => void;
17
+ frameAll: (duration: number) => void;
18
+ hasSelection: () => boolean;
19
+ getSelectionBox: () => Promise<THREE.Box3>;
20
+ }
21
+ export declare function useCamera(adapter: ICameraAdapter): CameraRef;
22
+ export {};
@@ -1,5 +1,5 @@
1
1
  import * as VIM from '../../core-viewers/webgl/index';
2
- import { ComponentCamera } from '../helpers/camera';
2
+ import { CameraRef } from './cameraState';
3
3
  import { CursorManager } from '../helpers/cursor';
4
4
  import { Isolation } from '../helpers/isolation';
5
5
  import { ComponentSettings } from '../settings/settings';
@@ -8,41 +8,27 @@ import * as Icons from '../panels/icons';
8
8
  import { SectionBoxRef } from './sectionBoxState';
9
9
  import { ModalRef } from '../panels/modal';
10
10
  import * as ControlBar from '../controlbar/controlBar';
11
- export declare const elementIds: {
12
- sectionCamera: string;
13
- sectionActions: string;
14
- sectionTools: string;
15
- sectionSettings: string;
16
- sectionMeasure: string;
17
- sectionSectionBox: string;
18
- buttonCameraOrbit: string;
19
- buttonCameraLook: string;
20
- buttonCameraPan: string;
21
- buttonCameraZoom: string;
22
- buttonCameraZoomWindow: string;
23
- buttonProjectInspector: string;
24
- buttonSettings: string;
25
- buttonHelp: string;
26
- buttonMaximize: string;
27
- buttonToggleIsolation: string;
28
- buttonZoomToFit: string;
29
- buttonSectionBox: string;
30
- buttonMeasure: string;
31
- buttonSectionBoxEnable: string;
32
- buttonSectionBoxVisible: string;
33
- buttonSectionBoxShrinkToSelection: string;
34
- buttonSectionBoxAuto: string;
35
- buttonSectionBoxClip: string;
36
- buttonSectionBoxSettings: string;
37
- };
38
11
  /**
39
12
  * Returns a control bar section for the section box.
40
13
  */
41
14
  export declare function controlBarSectionBox(section: SectionBoxRef, hasSelection: boolean): ControlBar.IControlBarSection;
15
+ export declare function controlBarCamera(camera: CameraRef): {
16
+ id: string;
17
+ enable: () => boolean;
18
+ style: string;
19
+ buttons: {
20
+ id: string;
21
+ tip: string;
22
+ isOn: () => boolean;
23
+ action: () => void;
24
+ icon: typeof Icons.autoCamera;
25
+ style: typeof ControlBar.buttonDefaultStyle;
26
+ }[];
27
+ };
42
28
  /**
43
29
  * Combines all control bar sections into one control bar.
44
30
  */
45
- export declare function useControlBar(viewer: VIM.Viewer, camera: ComponentCamera, modal: ModalRef, side: SideState, isolation: Isolation, cursor: CursorManager, settings: ComponentSettings, section: SectionBoxRef, customization: ControlBar.ControlBarCustomization | undefined): (ControlBar.IControlBarSection | {
31
+ export declare function useControlBar(viewer: VIM.Viewer, camera: CameraRef, modal: ModalRef, side: SideState, isolation: Isolation, cursor: CursorManager, settings: ComponentSettings, section: SectionBoxRef, customization: ControlBar.ControlBarCustomization | undefined): (ControlBar.IControlBarSection | {
46
32
  id: string;
47
33
  enable: () => boolean;
48
34
  style: string;
@@ -51,16 +37,28 @@ export declare function useControlBar(viewer: VIM.Viewer, camera: ComponentCamer
51
37
  enabled: () => boolean;
52
38
  tip: string;
53
39
  action: () => void;
54
- icon: typeof Icons.frameSelection;
55
- isOn: () => boolean;
40
+ icon: typeof Icons.toggleIsolation;
56
41
  style: typeof ControlBar.buttonDefaultStyle;
42
+ isOn?: undefined;
57
43
  } | {
58
44
  id: string;
59
45
  enabled: () => boolean;
46
+ isOn: () => boolean;
60
47
  tip: string;
61
48
  action: () => void;
62
- icon: typeof Icons.toggleIsolation;
49
+ icon: typeof Icons.measure;
63
50
  style: typeof ControlBar.buttonDefaultStyle;
64
- isOn?: undefined;
65
51
  })[];
52
+ } | {
53
+ id: string;
54
+ enable: () => boolean;
55
+ style: string;
56
+ buttons: {
57
+ id: string;
58
+ tip: string;
59
+ isOn: () => boolean;
60
+ action: () => void;
61
+ icon: typeof Icons.autoCamera;
62
+ style: typeof ControlBar.buttonDefaultStyle;
63
+ }[];
66
64
  })[];
@@ -1,5 +1,6 @@
1
1
  import * as THREE from 'three';
2
2
  import { ISignal } from 'ste-signals';
3
+ import { ArgActionRef, AsyncFuncRef, StateRef } from '../helpers/reactUtils';
3
4
  export type Offsets = {
4
5
  topOffset: string;
5
6
  sideOffset: string;
@@ -7,27 +8,24 @@ export type Offsets = {
7
8
  };
8
9
  export type OffsetField = keyof Offsets;
9
10
  export interface SectionBoxRef {
10
- getEnable: () => boolean;
11
- setEnable: (enable: boolean) => void;
12
- getVisible: () => boolean;
13
- setVisible: React.Dispatch<React.SetStateAction<boolean>>;
14
- getAuto: () => boolean;
15
- setAuto: (auto: boolean) => void;
16
- sectionSelection: () => void;
17
- sectionReset: () => void;
18
- getOffsetVisible: () => boolean;
19
- setOffsetsVisible: React.Dispatch<React.SetStateAction<boolean>>;
20
- getText: (field: OffsetField) => string;
21
- setText: (field: OffsetField, value: string) => void;
22
- validate: (field: OffsetField) => void;
11
+ enable: StateRef<boolean>;
12
+ visible: StateRef<boolean>;
13
+ auto: StateRef<boolean>;
14
+ sectionSelection: AsyncFuncRef<void>;
15
+ sectionReset: AsyncFuncRef<void>;
16
+ section: ArgActionRef<THREE.Box3>;
17
+ showOffsetPanel: StateRef<boolean>;
18
+ topOffset: StateRef<string>;
19
+ sideOffset: StateRef<string>;
20
+ bottomOffset: StateRef<string>;
23
21
  }
24
22
  export interface SectionBoxAdapter {
23
+ setClip: (b: boolean) => void;
25
24
  setVisible: (visible: boolean) => void;
26
25
  getBox: () => THREE.Box3;
27
26
  fitBox: (box: THREE.Box3) => void;
28
27
  getSelectionBox: () => Promise<THREE.Box3 | undefined>;
29
28
  getRendererBox: () => Promise<THREE.Box3>;
30
29
  onSelectionChanged: ISignal;
31
- onSceneChanged: ISignal;
32
30
  }
33
31
  export declare function useSectionBox(adapter: SectionBoxAdapter): SectionBoxRef;
@@ -1,3 +1,3 @@
1
1
  import * as Ultra from '../../../core-viewers/ultra';
2
2
  export declare function getErrorMessage(state: Ultra.ClientState): import("../..").MessageBoxProps;
3
- export declare function getRequestErrorMessage(source: Ultra.VimSource, error: Ultra.VimRequestErrorType): import("../..").MessageBoxProps;
3
+ export declare function getRequestErrorMessage(serverUrl: string, source: Ultra.VimSource, error: Ultra.VimRequestErrorType): import("../..").MessageBoxProps;
@@ -1 +1,2 @@
1
1
  export * from './ultraComponent';
2
+ export * from './ultraComponentRef';
@@ -0,0 +1,2 @@
1
+ import { UltraViewer } from "../..";
2
+ export declare function useUltraCamera(viewer: UltraViewer.Viewer): import("../..").CameraRef;
@@ -1,12 +1,6 @@
1
1
  import * as Ultra from '../../core-viewers/ultra/index';
2
2
  import { Container } from '../container';
3
- import { ModalRef } from '../panels/modal';
4
- export type UltraComponentRef = {
5
- viewer: Ultra.Viewer;
6
- modal: ModalRef;
7
- dispose: () => void;
8
- load(url: Ultra.VimSource): Ultra.ILoadRequest;
9
- };
3
+ import { UltraComponentRef } from './ultraComponentRef';
10
4
  /**
11
5
  * Creates a UI container along with a VIM.Viewer and its associated React component.
12
6
  * @param container An optional container object. If none is provided, a container will be created.