vim-web 0.3.44-dev.4 → 0.3.44-dev.40

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 (84) hide show
  1. package/README.md +2 -2
  2. package/dist/style.css +9 -8
  3. package/dist/types/core-viewers/{webgl/viewer/inputs/input.d.ts → shared/coreInputHandler.d.ts} +46 -64
  4. package/dist/types/core-viewers/{webgl/viewer/inputs → shared}/inputHandler.d.ts +5 -5
  5. package/dist/types/core-viewers/shared/keyboardHandler.d.ts +96 -0
  6. package/dist/types/core-viewers/shared/mouseHandler.d.ts +26 -0
  7. package/dist/types/core-viewers/{webgl/viewer/inputs → shared}/touchHandler.d.ts +13 -16
  8. package/dist/types/core-viewers/ultra/index.d.ts +4 -4
  9. package/dist/types/core-viewers/ultra/viewer/camera.d.ts +2 -1
  10. package/dist/types/core-viewers/ultra/viewer/color.d.ts +1 -1
  11. package/dist/types/core-viewers/ultra/viewer/colorManager.d.ts +1 -1
  12. package/dist/types/core-viewers/ultra/viewer/marshal.d.ts +2 -2
  13. package/dist/types/core-viewers/ultra/viewer/renderer.d.ts +1 -1
  14. package/dist/types/core-viewers/ultra/viewer/rpcClient.d.ts +1 -1
  15. package/dist/types/core-viewers/ultra/viewer/rpcSafeClient.d.ts +1 -1
  16. package/dist/types/core-viewers/ultra/viewer/sectionBox.d.ts +7 -2
  17. package/dist/types/core-viewers/ultra/viewer/selection.d.ts +4 -1
  18. package/dist/types/core-viewers/ultra/viewer/socketClient.d.ts +1 -1
  19. package/dist/types/core-viewers/ultra/viewer/{viewer.d.ts → ultraCoreViewer.d.ts} +4 -4
  20. package/dist/types/core-viewers/ultra/viewer/ultraInputsAdapter.d.ts +5 -0
  21. package/dist/types/core-viewers/ultra/{utils → viewer}/validation.d.ts +1 -1
  22. package/dist/types/core-viewers/ultra/viewer/vim.d.ts +2 -2
  23. package/dist/types/core-viewers/{webgl/utils → utils}/threeUtils.d.ts +1 -0
  24. package/dist/types/core-viewers/webgl/index.d.ts +2 -3
  25. package/dist/types/core-viewers/webgl/loader/materials/viewerMaterials.d.ts +1 -1
  26. package/dist/types/core-viewers/webgl/loader/progressive/vimRequest.d.ts +1 -1
  27. package/dist/types/core-viewers/webgl/viewer/camera/ICamera.d.ts +0 -4
  28. package/dist/types/core-viewers/webgl/viewer/camera/camera.d.ts +0 -11
  29. package/dist/types/core-viewers/webgl/viewer/gizmos/gizmoOrbit.d.ts +2 -2
  30. package/dist/types/core-viewers/webgl/viewer/gizmos/measure/measure.d.ts +9 -16
  31. package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBox.d.ts +4 -5
  32. package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxHandle.d.ts +2 -0
  33. package/dist/types/core-viewers/webgl/viewer/rendering/renderScene.d.ts +1 -1
  34. package/dist/types/core-viewers/webgl/viewer/rendering/renderer.d.ts +1 -1
  35. package/dist/types/core-viewers/webgl/viewer/viewer.d.ts +2 -2
  36. package/dist/types/core-viewers/webgl/viewer/webglInputsAdapter.d.ts +3 -0
  37. package/dist/types/react-viewers/bim/bimPanel.d.ts +3 -3
  38. package/dist/types/react-viewers/bim/bimTree.d.ts +2 -2
  39. package/dist/types/react-viewers/controlbar/controlBarIds.d.ts +4 -2
  40. package/dist/types/react-viewers/helpers/isolation.d.ts +2 -2
  41. package/dist/types/react-viewers/helpers/loadRequest.d.ts +1 -1
  42. package/dist/types/react-viewers/helpers/reactUtils.d.ts +40 -0
  43. package/dist/types/react-viewers/index.d.ts +4 -0
  44. package/dist/types/react-viewers/panels/axesPanel.d.ts +2 -2
  45. package/dist/types/react-viewers/panels/contextMenu.d.ts +2 -2
  46. package/dist/types/react-viewers/panels/icons.d.ts +1 -0
  47. package/dist/types/react-viewers/state/cameraState.d.ts +24 -0
  48. package/dist/types/react-viewers/state/controlBarState.d.ts +54 -6
  49. package/dist/types/react-viewers/state/sectionBoxState.d.ts +14 -15
  50. package/dist/types/react-viewers/ultra/errors/ultraErrors.d.ts +1 -1
  51. package/dist/types/react-viewers/ultra/index.d.ts +1 -0
  52. package/dist/types/react-viewers/ultra/ultraCameraState.d.ts +3 -0
  53. package/dist/types/react-viewers/ultra/ultraComponent.d.ts +2 -8
  54. package/dist/types/react-viewers/ultra/ultraComponentRef.d.ts +36 -0
  55. package/dist/types/react-viewers/ultra/ultraControlBarState.d.ts +15 -1
  56. package/dist/types/react-viewers/ultra/ultraSectionBoxState.d.ts +1 -1
  57. package/dist/types/react-viewers/urls.d.ts +1 -0
  58. package/dist/types/react-viewers/webgl/webgInputsBindings.d.ts +8 -0
  59. package/dist/types/react-viewers/webgl/webglCameraState.d.ts +2 -0
  60. package/dist/types/react-viewers/webgl/webglComponentRef.d.ts +7 -2
  61. package/dist/vim-web.iife.js +7906 -8231
  62. package/dist/vim-web.iife.js.map +1 -1
  63. package/dist/vim-web.js +7912 -8237
  64. package/dist/vim-web.js.map +1 -1
  65. package/package.json +1 -1
  66. package/dist/types/core-viewers/ultra/utils/deferredPromise.d.ts +0 -8
  67. package/dist/types/core-viewers/ultra/viewer/inputs/InputTouch.d.ts +0 -25
  68. package/dist/types/core-viewers/ultra/viewer/inputs/inputHandler.d.ts +0 -7
  69. package/dist/types/core-viewers/ultra/viewer/inputs/inputKeyboard.d.ts +0 -20
  70. package/dist/types/core-viewers/ultra/viewer/inputs/inputMouse.d.ts +0 -21
  71. package/dist/types/core-viewers/ultra/viewer/inputs/inputs.d.ts +0 -27
  72. package/dist/types/core-viewers/webgl/utils/deferredPromise.d.ts +0 -8
  73. package/dist/types/core-viewers/webgl/viewer/gizmos/measure/measureFlow.d.ts +0 -36
  74. package/dist/types/core-viewers/webgl/viewer/inputs/keyboardHandler.d.ts +0 -113
  75. package/dist/types/core-viewers/webgl/viewer/inputs/mouseHandler.d.ts +0 -66
  76. package/dist/types/react-viewers/helpers/camera.d.ts +0 -37
  77. package/dist/types/react-viewers/helpers/inputs.d.ts +0 -22
  78. /package/dist/types/core-viewers/{ultra/utils → utils}/array.d.ts +0 -0
  79. /package/dist/types/core-viewers/{ultra/utils → utils}/debounce.d.ts +0 -0
  80. /package/dist/types/core-viewers/{ultra/utils → utils}/math3d.d.ts +0 -0
  81. /package/dist/types/core-viewers/{ultra/utils → utils}/promise.d.ts +0 -0
  82. /package/dist/types/core-viewers/{webgl/utils → utils}/requestResult.d.ts +0 -0
  83. /package/dist/types/core-viewers/{ultra/utils → utils}/result.d.ts +0 -0
  84. /package/dist/types/core-viewers/{ultra/utils → utils}/url.d.ts +0 -0
@@ -7,13 +7,12 @@ export * from './loader/progressive/vimRequest';
7
7
  export * from './loader/progressive/vimx';
8
8
  export * from './viewer/viewer';
9
9
  export * from './loader/geometry';
10
- export type { PointerMode, InputScheme } from './viewer/inputs/input';
11
- export { DefaultInputScheme, KEYS } from './viewer/inputs/input';
10
+ export * from '../shared/coreInputHandler';
12
11
  export * from './viewer/settings/viewerSettings';
13
12
  export * from './viewer/settings/viewerSettingsParsing';
14
13
  export * from './viewer/settings/defaultViewerSettings';
15
14
  export { RaycastResult as HitTestResult, InputAction } from './viewer/raycaster';
16
- export { type SelectableObject } from './viewer/selection';
15
+ export { type SelectableObject, Selection } from './viewer/selection';
17
16
  export * from './loader/progressive/insertableMesh';
18
17
  export * from './loader/progressive/g3dSubset';
19
18
  export * from './loader/geometry';
@@ -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);
@@ -1,6 +1,6 @@
1
1
  import { VimPartialSettings } from '../vimSettings';
2
2
  import { Vim } from '../vim';
3
- import { RequestResult } from '../../utils/requestResult';
3
+ import { RequestResult } from '../../../utils/requestResult';
4
4
  import { VimSource } from '../..';
5
5
  import { IProgressLogs } from 'vim-format';
6
6
  export type RequestSource = {
@@ -71,10 +71,6 @@ export interface ICamera {
71
71
  */
72
72
  get forward(): THREE.Vector3;
73
73
  get isLerping(): boolean;
74
- /**
75
- * The camera speed factor.
76
- */
77
- speed: number;
78
74
  /**
79
75
  * The current or target velocity of the camera.
80
76
  */
@@ -79,10 +79,6 @@ export interface ICamera {
79
79
  */
80
80
  get forward(): THREE.Vector3;
81
81
  get isLerping(): boolean;
82
- /**
83
- * The camera speed factor.
84
- */
85
- speed: number;
86
82
  /**
87
83
  * The current or target velocity of the camera.
88
84
  */
@@ -120,7 +116,6 @@ export declare class Camera implements ICamera {
120
116
  private _movement;
121
117
  private _inputVelocity;
122
118
  private _velocity;
123
- private _speed;
124
119
  private _orthographic;
125
120
  private _target;
126
121
  private _lastPosition;
@@ -169,7 +164,6 @@ export declare class Camera implements ICamera {
169
164
  get defaultForward(): THREE.Vector3;
170
165
  set defaultForward(value: THREE.Vector3);
171
166
  private _velocityBlendFactor;
172
- private _moveSpeed;
173
167
  constructor(scene: RenderScene, viewport: Viewport, settings: ViewerSettings);
174
168
  /**
175
169
  * Interface for instantaneously moving the camera.
@@ -210,11 +204,6 @@ export declare class Camera implements ICamera {
210
204
  * The forward direction of the camera.
211
205
  */
212
206
  get forward(): THREE.Vector3;
213
- /**
214
- * The camera speed factor.
215
- */
216
- get speed(): number;
217
- set speed(value: number);
218
207
  /**
219
208
  * The current or target velocity of the camera.
220
209
  */
@@ -5,7 +5,7 @@ import * as THREE from 'three';
5
5
  import { Renderer } from '../rendering/renderer';
6
6
  import { Camera } from '../camera/camera';
7
7
  import { ViewerSettings } from '../settings/viewerSettings';
8
- import { Input } from '../inputs/input';
8
+ import { CoreInputHandler } from '../../../shared/coreInputHandler';
9
9
  /**
10
10
  * Manages the camera target gizmo
11
11
  */
@@ -27,7 +27,7 @@ export declare class GizmoOrbit {
27
27
  private _timeout;
28
28
  private _active;
29
29
  private _animation;
30
- constructor(renderer: Renderer, camera: Camera, input: Input, settings: ViewerSettings);
30
+ constructor(renderer: Renderer, camera: Camera, input: CoreInputHandler, settings: ViewerSettings);
31
31
  private connect;
32
32
  private onUpdate;
33
33
  /**
@@ -2,9 +2,8 @@
2
2
  * @module viw-webgl-viewer/gizmos/measure
3
3
  */
4
4
  import * as THREE from 'three';
5
- import { InputAction } from '../../raycaster';
5
+ import { RaycastResult } from '../../raycaster';
6
6
  import { Viewer } from '../../viewer';
7
- import { MeasureStage } from './measureFlow';
8
7
  /**
9
8
  * Interacts with the measure tool.
10
9
  */
@@ -31,7 +30,7 @@ export interface IMeasure {
31
30
  * Promise is resolved if flow is succesfully completed, rejected otherwise.
32
31
  * Do not override viewer.onMouseClick while this flow is active.
33
32
  */
34
- start(onProgress?: () => void): Promise<void>;
33
+ start(): Promise<void>;
35
34
  /**
36
35
  * Aborts the current measure flow, fails the related promise.
37
36
  */
@@ -41,6 +40,7 @@ export interface IMeasure {
41
40
  */
42
41
  clear(): void;
43
42
  }
43
+ export type MeasureStage = 'ready' | 'active' | 'done' | 'failed';
44
44
  /**
45
45
  * Manages measure flow and gizmos
46
46
  */
@@ -50,8 +50,9 @@ export declare class Measure implements IMeasure {
50
50
  private _startPos;
51
51
  private _endPos;
52
52
  private _measurement;
53
- private _flow;
54
- private _previousScheme;
53
+ private _previousOnClick;
54
+ private _promise;
55
+ private _stage;
55
56
  /**
56
57
  * Start point of the current measure or undefined if no active measure.
57
58
  */
@@ -75,23 +76,15 @@ export declare class Measure implements IMeasure {
75
76
  * Promise is resolved if flow is succesfully completed, rejected otherwise.
76
77
  * Do not override viewer.onMouseClick while this flow is active.
77
78
  */
78
- start(onProgress?: () => void): Promise<void>;
79
+ start(): Promise<void>;
79
80
  /**
80
81
  * Should be private.
81
82
  */
82
- onFirstClick(action: InputAction): void;
83
+ onFirstClick(hit: RaycastResult): void;
83
84
  /**
84
85
  * Should be private.
85
86
  */
86
- onMouseMove(): void;
87
- /**
88
- * Should be private.
89
- */
90
- onMouseIdle(action: InputAction): void;
91
- /**
92
- * Should be private.
93
- */
94
- onSecondClick(action: InputAction): boolean;
87
+ onSecondClick(hit: RaycastResult): boolean;
95
88
  /**
96
89
  * Aborts the current measure flow, fails the related promise.
97
90
  */
@@ -57,11 +57,10 @@ export declare class SectionBox {
57
57
  */
58
58
  constructor(viewer: Viewer);
59
59
  /**
60
- * The shared bounding box that defines the section region.
61
- *
62
- * To programmatically update the box, see {@link fitBox}.
60
+ * Returns a copy of the current section box.
61
+ * To programmatically update the box, see {@link setBox}.
63
62
  */
64
- get box(): THREE.Box3;
63
+ getBox(): THREE.Box3;
65
64
  /**
66
65
  * Determines whether the section gizmo applies clipping planes to the model.
67
66
  *
@@ -88,7 +87,7 @@ export declare class SectionBox {
88
87
  * @param box - The bounding box to match (required).
89
88
  * @param padding - The scalar amount by which to expand the bounding box. Default is `1`.
90
89
  */
91
- fitBox(box: THREE.Box3): void;
90
+ setBox(box: THREE.Box3): void;
92
91
  /**
93
92
  * Updates the section box to match the current size of `this.section.box`.
94
93
  *
@@ -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;
@@ -28,7 +28,7 @@ export declare class RenderScene {
28
28
  * Returns the bounding box encompasing all rendererd objects.
29
29
  * @param target box in which to copy result, a new instance is created if undefined.
30
30
  */
31
- getBoundingBox(target?: THREE.Box3): THREE.Box3;
31
+ getBoundingBox(target?: THREE.Box3): THREE.Box3 | undefined;
32
32
  /**
33
33
  * Returns the bounding box of the average center of all meshes.
34
34
  * Less precise but is more stable against outliers.
@@ -83,7 +83,7 @@ export declare class Renderer implements IRenderer {
83
83
  * @param target - Box in which to copy the result. A new instance is created if undefined.
84
84
  * @returns The bounding box encompassing all rendered objects.
85
85
  */
86
- getBoundingBox(target?: THREE.Box3): THREE.Box3;
86
+ getBoundingBox(target?: THREE.Box3): THREE.Box3 | undefined;
87
87
  /**
88
88
  * Updates the global rendering bounding box.
89
89
  * @param box - The new bounding box.
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import { ViewerSettings, PartialViewerSettings } from './settings/viewerSettings';
5
5
  import { ICamera } from './camera/ICamera';
6
- import { Input } from './inputs/input';
7
6
  import { Selection } from './selection';
8
7
  import { Environment } from './environment/environment';
9
8
  import { Raycaster } from './raycaster';
@@ -13,6 +12,7 @@ import { Renderer } from './rendering/renderer';
13
12
  import { ISignal } from 'ste-signals';
14
13
  import { ViewerMaterials } from '../loader/materials/viewerMaterials';
15
14
  import { Vim } from '../loader/vim';
15
+ import { CoreInputHandler } from '../../shared/coreInputHandler';
16
16
  /**
17
17
  * Viewer and loader for vim files.
18
18
  */
@@ -36,7 +36,7 @@ export declare class Viewer {
36
36
  /**
37
37
  * The interface for manipulating default viewer inputs.
38
38
  */
39
- readonly inputs: Input;
39
+ readonly inputs: CoreInputHandler;
40
40
  /**
41
41
  * The interface for performing raycasting into the scene to find objects.
42
42
  */
@@ -0,0 +1,3 @@
1
+ import { CoreInputHandler } from "../../shared/coreInputHandler";
2
+ import { Viewer } from "./viewer";
3
+ export declare function webglInputAdapter(viewer: Viewer): CoreInputHandler;
@@ -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;
@@ -1,10 +1,12 @@
1
- export declare const elementIds: {
1
+ export declare const ids: {
2
2
  sectionCamera: string;
3
+ sectionInputs: string;
3
4
  sectionActions: string;
4
5
  sectionTools: string;
5
6
  sectionSettings: string;
6
7
  sectionMeasure: string;
7
8
  sectionSectionBox: string;
9
+ buttonCameraAuto: string;
8
10
  buttonCameraOrbit: string;
9
11
  buttonCameraLook: string;
10
12
  buttonCameraPan: string;
@@ -22,6 +24,6 @@ export declare const elementIds: {
22
24
  buttonSectionBoxVisible: string;
23
25
  buttonSectionBoxShrinkToSelection: string;
24
26
  buttonSectionBoxAuto: string;
25
- buttonSectionBoxClip: string;
27
+ buttonSectionBoxReset: string;
26
28
  buttonSectionBoxSettings: string;
27
29
  };
@@ -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
  *
@@ -23,7 +23,7 @@ export declare class LoadRequest {
23
23
  private onError;
24
24
  private end;
25
25
  getProgress(): AsyncGenerator<VIM.IProgressLogs, void, void>;
26
- getResult(): Promise<import("../../core-viewers/webgl/utils/requestResult").RequestResult<VIM.Vim>>;
26
+ getResult(): Promise<import("../../core-viewers/utils/requestResult").RequestResult<VIM.Vim>>;
27
27
  abort(): void;
28
28
  }
29
29
  export {};
@@ -0,0 +1,40 @@
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
+ get(): () => void;
18
+ set(func: () => void): void;
19
+ }
20
+ export declare function useActionRef(action: () => void): ActionRef;
21
+ export interface ArgActionRef<T> {
22
+ call(arg: T): void;
23
+ set(func: (arg: T) => void): void;
24
+ }
25
+ export declare function useArgActionRef<T>(action: (arg: T) => void): ArgActionRef<T>;
26
+ export interface FuncRef<T> {
27
+ call(): T;
28
+ set(func: () => T): void;
29
+ }
30
+ export declare function useFuncRef<T>(func: () => T): FuncRef<T>;
31
+ export interface AsyncFuncRef<T> {
32
+ call(): Promise<T>;
33
+ set(func: () => Promise<T>): void;
34
+ }
35
+ export declare function useAsyncFuncRef<T>(func: () => Promise<T>): AsyncFuncRef<T>;
36
+ export interface ArgFuncRef<TArg, TResult> {
37
+ call(arg: TArg): TResult;
38
+ set(func: (arg: TArg) => TResult): void;
39
+ }
40
+ 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,24 @@
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
+ hasSelection: () => boolean;
18
+ getSelectionBox: () => Promise<THREE.Box3>;
19
+ getSceneBox: () => Promise<THREE.Box3>;
20
+ getSectionBox: () => THREE.Box3;
21
+ isSectionBoxEnabled: () => boolean;
22
+ }
23
+ export declare function useCamera(adapter: ICameraAdapter): CameraRef;
24
+ export {};
@@ -1,21 +1,57 @@
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';
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
+ };
38
+ export declare function controlBarCamera(camera: CameraRef): {
39
+ id: string;
40
+ enable: () => boolean;
41
+ style: string;
42
+ buttons: {
43
+ id: string;
44
+ tip: string;
45
+ isOn: () => boolean;
46
+ action: () => void;
47
+ icon: typeof Icons.autoCamera;
48
+ style: typeof ControlBar.buttonDefaultStyle;
49
+ }[];
50
+ };
15
51
  /**
16
52
  * Combines all control bar sections into one control bar.
17
53
  */
18
- 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 | {
54
+ 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 | {
19
55
  id: string;
20
56
  enable: () => boolean;
21
57
  style: string;
@@ -24,16 +60,28 @@ export declare function useControlBar(viewer: VIM.Viewer, camera: ComponentCamer
24
60
  enabled: () => boolean;
25
61
  tip: string;
26
62
  action: () => void;
27
- icon: typeof Icons.frameSelection;
28
- isOn: () => boolean;
63
+ icon: typeof Icons.toggleIsolation;
29
64
  style: typeof ControlBar.buttonDefaultStyle;
65
+ isOn?: undefined;
30
66
  } | {
31
67
  id: string;
32
68
  enabled: () => boolean;
69
+ isOn: () => boolean;
33
70
  tip: string;
34
71
  action: () => void;
35
- icon: typeof Icons.toggleIsolation;
72
+ icon: typeof Icons.measure;
36
73
  style: typeof ControlBar.buttonDefaultStyle;
37
- isOn?: undefined;
38
74
  })[];
75
+ } | {
76
+ id: string;
77
+ enable: () => boolean;
78
+ style: string;
79
+ buttons: {
80
+ id: string;
81
+ tip: string;
82
+ isOn: () => boolean;
83
+ action: () => void;
84
+ icon: typeof Icons.autoCamera;
85
+ style: typeof ControlBar.buttonDefaultStyle;
86
+ }[];
39
87
  })[];
@@ -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,25 @@ 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
+ sectionBox: ArgActionRef<THREE.Box3>;
17
+ getBox: () => THREE.Box3;
18
+ showOffsetPanel: StateRef<boolean>;
19
+ topOffset: StateRef<string>;
20
+ sideOffset: StateRef<string>;
21
+ bottomOffset: StateRef<string>;
23
22
  }
24
23
  export interface SectionBoxAdapter {
24
+ setClip: (b: boolean) => void;
25
25
  setVisible: (visible: boolean) => void;
26
26
  getBox: () => THREE.Box3;
27
- fitBox: (box: THREE.Box3) => void;
27
+ setBox: (box: THREE.Box3) => void;
28
28
  getSelectionBox: () => Promise<THREE.Box3 | undefined>;
29
29
  getRendererBox: () => Promise<THREE.Box3>;
30
30
  onSelectionChanged: ISignal;
31
- onSceneChanged: ISignal;
32
31
  }
33
32
  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,3 @@
1
+ import { UltraViewer } from "../..";
2
+ import { SectionBoxRef } from "../state/sectionBoxState";
3
+ export declare function useUltraCamera(viewer: UltraViewer.UltraCoreViewer, section: SectionBoxRef): import("../..").CameraRef;