vim-web 0.3.44-dev.4 → 0.3.44-dev.41
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/README.md +2 -2
- package/dist/style.css +9 -8
- package/dist/types/core-viewers/{webgl/viewer/inputs/input.d.ts → shared/coreInputHandler.d.ts} +46 -64
- package/dist/types/core-viewers/{webgl/viewer/inputs → shared}/inputHandler.d.ts +5 -5
- package/dist/types/core-viewers/shared/keyboardHandler.d.ts +96 -0
- package/dist/types/core-viewers/shared/mouseHandler.d.ts +26 -0
- package/dist/types/core-viewers/{webgl/viewer/inputs → shared}/touchHandler.d.ts +13 -16
- package/dist/types/core-viewers/ultra/index.d.ts +4 -4
- package/dist/types/core-viewers/ultra/viewer/camera.d.ts +2 -1
- package/dist/types/core-viewers/ultra/viewer/color.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/colorManager.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/marshal.d.ts +2 -2
- package/dist/types/core-viewers/ultra/viewer/renderer.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/rpcClient.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/rpcSafeClient.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/sectionBox.d.ts +7 -2
- package/dist/types/core-viewers/ultra/viewer/selection.d.ts +4 -1
- package/dist/types/core-viewers/ultra/viewer/socketClient.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/{viewer.d.ts → ultraCoreViewer.d.ts} +4 -4
- package/dist/types/core-viewers/ultra/viewer/ultraInputsAdapter.d.ts +5 -0
- package/dist/types/core-viewers/ultra/{utils → viewer}/validation.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/vim.d.ts +2 -2
- package/dist/types/core-viewers/{webgl/utils → utils}/threeUtils.d.ts +1 -0
- package/dist/types/core-viewers/webgl/index.d.ts +2 -3
- package/dist/types/core-viewers/webgl/loader/materials/viewerMaterials.d.ts +1 -1
- package/dist/types/core-viewers/webgl/loader/progressive/vimRequest.d.ts +1 -1
- package/dist/types/core-viewers/webgl/viewer/camera/ICamera.d.ts +0 -4
- package/dist/types/core-viewers/webgl/viewer/camera/camera.d.ts +0 -11
- package/dist/types/core-viewers/webgl/viewer/gizmos/gizmoOrbit.d.ts +2 -2
- package/dist/types/core-viewers/webgl/viewer/gizmos/measure/measure.d.ts +9 -16
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBox.d.ts +4 -5
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxHandle.d.ts +2 -0
- package/dist/types/core-viewers/webgl/viewer/rendering/renderScene.d.ts +1 -1
- package/dist/types/core-viewers/webgl/viewer/rendering/renderer.d.ts +1 -1
- package/dist/types/core-viewers/webgl/viewer/viewer.d.ts +2 -2
- package/dist/types/core-viewers/webgl/viewer/webglInputsAdapter.d.ts +3 -0
- package/dist/types/react-viewers/bim/bimPanel.d.ts +3 -3
- package/dist/types/react-viewers/bim/bimTree.d.ts +2 -2
- package/dist/types/react-viewers/controlbar/controlBarIds.d.ts +4 -2
- package/dist/types/react-viewers/helpers/isolation.d.ts +2 -2
- package/dist/types/react-viewers/helpers/loadRequest.d.ts +1 -1
- package/dist/types/react-viewers/helpers/reactUtils.d.ts +40 -0
- package/dist/types/react-viewers/index.d.ts +4 -0
- package/dist/types/react-viewers/panels/axesPanel.d.ts +2 -2
- package/dist/types/react-viewers/panels/contextMenu.d.ts +2 -2
- package/dist/types/react-viewers/panels/icons.d.ts +1 -0
- package/dist/types/react-viewers/state/cameraState.d.ts +24 -0
- package/dist/types/react-viewers/state/controlBarState.d.ts +54 -6
- package/dist/types/react-viewers/state/sectionBoxState.d.ts +14 -15
- package/dist/types/react-viewers/ultra/errors/ultraErrors.d.ts +1 -1
- package/dist/types/react-viewers/ultra/index.d.ts +1 -0
- package/dist/types/react-viewers/ultra/ultraCameraState.d.ts +3 -0
- package/dist/types/react-viewers/ultra/ultraComponent.d.ts +2 -8
- package/dist/types/react-viewers/ultra/ultraComponentRef.d.ts +36 -0
- package/dist/types/react-viewers/ultra/ultraControlBarState.d.ts +15 -1
- package/dist/types/react-viewers/ultra/ultraSectionBoxState.d.ts +1 -1
- package/dist/types/react-viewers/urls.d.ts +1 -0
- package/dist/types/react-viewers/webgl/webgInputsBindings.d.ts +8 -0
- package/dist/types/react-viewers/webgl/webglCameraState.d.ts +2 -0
- package/dist/types/react-viewers/webgl/webglComponentRef.d.ts +7 -2
- package/dist/vim-web.iife.js +7906 -8231
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +7912 -8237
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
- package/dist/types/core-viewers/ultra/utils/deferredPromise.d.ts +0 -8
- package/dist/types/core-viewers/ultra/viewer/inputs/InputTouch.d.ts +0 -25
- package/dist/types/core-viewers/ultra/viewer/inputs/inputHandler.d.ts +0 -7
- package/dist/types/core-viewers/ultra/viewer/inputs/inputKeyboard.d.ts +0 -20
- package/dist/types/core-viewers/ultra/viewer/inputs/inputMouse.d.ts +0 -21
- package/dist/types/core-viewers/ultra/viewer/inputs/inputs.d.ts +0 -27
- package/dist/types/core-viewers/webgl/utils/deferredPromise.d.ts +0 -8
- package/dist/types/core-viewers/webgl/viewer/gizmos/measure/measureFlow.d.ts +0 -36
- package/dist/types/core-viewers/webgl/viewer/inputs/keyboardHandler.d.ts +0 -113
- package/dist/types/core-viewers/webgl/viewer/inputs/mouseHandler.d.ts +0 -66
- package/dist/types/react-viewers/helpers/camera.d.ts +0 -37
- package/dist/types/react-viewers/helpers/inputs.d.ts +0 -22
- /package/dist/types/core-viewers/{ultra/utils → utils}/array.d.ts +0 -0
- /package/dist/types/core-viewers/{ultra/utils → utils}/debounce.d.ts +0 -0
- /package/dist/types/core-viewers/{ultra/utils → utils}/math3d.d.ts +0 -0
- /package/dist/types/core-viewers/{ultra/utils → utils}/promise.d.ts +0 -0
- /package/dist/types/core-viewers/{webgl/utils → utils}/requestResult.d.ts +0 -0
- /package/dist/types/core-viewers/{ultra/utils → utils}/result.d.ts +0 -0
- /package/dist/types/core-viewers/{ultra/utils → utils}/url.d.ts +0 -0
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://
|
|
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://
|
|
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;
|
package/dist/types/core-viewers/{webgl/viewer/inputs/input.d.ts → shared/coreInputHandler.d.ts}
RENAMED
|
@@ -1,48 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module viw-webgl-viewer/inputs
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
import { Viewer } from '../viewer';
|
|
6
|
-
import { KeyboardHandler } from './keyboardHandler';
|
|
7
1
|
import { TouchHandler } from './touchHandler';
|
|
8
2
|
import { MouseHandler } from './mouseHandler';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import { KeyboardHandler } from './keyboardHandler';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { InputHandler } from './inputHandler';
|
|
12
6
|
export type PointerMode = 'orbit' | 'look' | 'pan' | 'zoom' | 'rect';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
7
|
+
export interface InputAdapter {
|
|
8
|
+
init: () => void;
|
|
9
|
+
toggleOrthographic: () => void;
|
|
10
|
+
resetCamera: () => void;
|
|
11
|
+
clearSelection: () => void;
|
|
12
|
+
frameCamera: () => void;
|
|
13
|
+
moveCamera: (value: THREE.Vector3) => void;
|
|
14
|
+
orbitCamera: (value: THREE.Vector2) => void;
|
|
15
|
+
rotateCamera: (value: THREE.Vector2) => void;
|
|
16
|
+
panCamera: (value: THREE.Vector2) => void;
|
|
17
|
+
keyDown: (keyCode: string) => boolean;
|
|
18
|
+
keyUp: (keyCode: string) => boolean;
|
|
19
|
+
mouseDown: (pos: THREE.Vector2, button: number) => void;
|
|
20
|
+
mouseUp: (pos: THREE.Vector2, button: number) => void;
|
|
21
|
+
mouseMove: (pos: THREE.Vector2) => void;
|
|
22
|
+
selectAtPointer: (pos: THREE.Vector2, add: boolean) => void;
|
|
23
|
+
frameAtPointer: (pos: THREE.Vector2) => void;
|
|
24
|
+
zoom: (value: number) => void;
|
|
30
25
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
onMainAction(action: InputAction): void;
|
|
38
|
-
onIdleAction(hit: InputAction): void;
|
|
39
|
-
onKeyAction(key: number): boolean;
|
|
26
|
+
interface InputSettings {
|
|
27
|
+
orbit: boolean;
|
|
28
|
+
scrollSpeed: number;
|
|
29
|
+
moveSpeed: number;
|
|
30
|
+
rotateSpeed: number;
|
|
31
|
+
orbitSpeed: number;
|
|
40
32
|
}
|
|
41
|
-
|
|
42
|
-
* Manages and registers all viewer user inputs for mouse, keyboard and touch
|
|
43
|
-
*/
|
|
44
|
-
export declare class Input {
|
|
45
|
-
private _viewer;
|
|
33
|
+
export declare class CoreInputHandler extends InputHandler {
|
|
46
34
|
/**
|
|
47
35
|
* Touch input handler
|
|
48
36
|
*/
|
|
@@ -55,10 +43,22 @@ export declare class Input {
|
|
|
55
43
|
* Keyboard input handler
|
|
56
44
|
*/
|
|
57
45
|
keyboard: KeyboardHandler;
|
|
46
|
+
scrollSpeed: number;
|
|
47
|
+
private _moveSpeed;
|
|
48
|
+
rotateSpeed: number;
|
|
49
|
+
orbitSpeed: number;
|
|
58
50
|
private _pointerActive;
|
|
59
51
|
private _pointerFallback;
|
|
60
52
|
private _pointerOverride;
|
|
61
|
-
|
|
53
|
+
private _onPointerOverrideChanged;
|
|
54
|
+
private _onPointerModeChanged;
|
|
55
|
+
private _onSettingsChanged;
|
|
56
|
+
private _adapter;
|
|
57
|
+
constructor(canvas: HTMLCanvasElement, adapter: InputAdapter, settings?: Partial<InputSettings>);
|
|
58
|
+
init(): void;
|
|
59
|
+
get moveSpeed(): number;
|
|
60
|
+
set moveSpeed(value: number);
|
|
61
|
+
get onSettingsChanged(): import("ste-signals").ISignal;
|
|
62
62
|
/**
|
|
63
63
|
* Returns the last main mode (orbit, look) that was active.
|
|
64
64
|
*/
|
|
@@ -70,18 +70,16 @@ export declare class Input {
|
|
|
70
70
|
/**
|
|
71
71
|
* A temporary pointer mode used for temporary icons.
|
|
72
72
|
*/
|
|
73
|
-
get pointerOverride(): PointerMode
|
|
73
|
+
get pointerOverride(): PointerMode;
|
|
74
74
|
set pointerOverride(value: PointerMode | undefined);
|
|
75
75
|
/**
|
|
76
76
|
* Changes pointer interaction mode. Look mode will set camera orbitMode to false.
|
|
77
77
|
*/
|
|
78
78
|
set pointerActive(value: PointerMode);
|
|
79
|
-
private _onPointerModeChanged;
|
|
80
79
|
/**
|
|
81
80
|
* Event called when pointer interaction mode changes.
|
|
82
81
|
*/
|
|
83
82
|
get onPointerModeChanged(): import("ste-signals").ISignal;
|
|
84
|
-
private _onPointerOverrideChanged;
|
|
85
83
|
/**
|
|
86
84
|
* Event called when the pointer is temporarily overriden.
|
|
87
85
|
*/
|
|
@@ -91,31 +89,13 @@ export declare class Input {
|
|
|
91
89
|
* Event called when when context menu could be displayed
|
|
92
90
|
*/
|
|
93
91
|
get onContextMenu(): import("ste-simple-events").ISimpleEvent<THREE.Vector2>;
|
|
94
|
-
private _scheme;
|
|
95
|
-
/**
|
|
96
|
-
* Get or set the current viewer input scheme, set undefined to revert to default.
|
|
97
|
-
*/
|
|
98
|
-
get scheme(): InputScheme | undefined;
|
|
99
|
-
set scheme(value: InputScheme | undefined);
|
|
100
|
-
/**
|
|
101
|
-
* Calls main action on the current input scheme
|
|
102
|
-
*/
|
|
103
|
-
MainAction(action: InputAction): void;
|
|
104
|
-
/**
|
|
105
|
-
* Calls idle action on the current input scheme
|
|
106
|
-
*/
|
|
107
|
-
IdleAction(action: InputAction | undefined): void;
|
|
108
|
-
/**
|
|
109
|
-
* Calls key action on the current input scheme
|
|
110
|
-
*/
|
|
111
|
-
KeyAction(key: number): boolean;
|
|
112
92
|
/**
|
|
113
93
|
* Calls context menu action
|
|
114
94
|
*/
|
|
115
95
|
ContextMenu(position: THREE.Vector2 | undefined): void;
|
|
116
96
|
/**
|
|
117
|
-
|
|
118
|
-
|
|
97
|
+
* Register inputs handlers for default viewer behavior
|
|
98
|
+
*/
|
|
119
99
|
registerAll(): void;
|
|
120
100
|
/**
|
|
121
101
|
* Unregisters all input handlers
|
|
@@ -125,4 +105,6 @@ export declare class Input {
|
|
|
125
105
|
* Resets all input state
|
|
126
106
|
*/
|
|
127
107
|
resetAll(): void;
|
|
108
|
+
dispose(): void;
|
|
128
109
|
}
|
|
110
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module viw-webgl-viewer/inputs
|
|
3
3
|
*/
|
|
4
|
-
import { Viewer } from '../viewer';
|
|
5
4
|
/**
|
|
5
|
+
* TODO: Use the same code for ULTRA and webgl.
|
|
6
6
|
* Base class for various input handlers.
|
|
7
7
|
* It provides convenience to register to and unregister from events.
|
|
8
8
|
*/
|
|
9
9
|
export declare class InputHandler {
|
|
10
|
-
protected
|
|
11
|
-
protected
|
|
12
|
-
constructor(
|
|
13
|
-
protected reg
|
|
10
|
+
protected _canvas: HTMLCanvasElement;
|
|
11
|
+
protected _disconnect: Function[];
|
|
12
|
+
constructor(canvas: HTMLCanvasElement);
|
|
13
|
+
protected reg<T extends Event>(element: Document | HTMLElement | Window, eventType: string, callback: (event: T) => void): void;
|
|
14
14
|
/**
|
|
15
15
|
* Register handler to related browser events
|
|
16
16
|
* Prevents double registrations
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module viw-webgl-viewer/inputs
|
|
3
|
+
*/
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { InputHandler } from './inputHandler';
|
|
6
|
+
type CallbackMode = 'replace' | 'append' | 'prepend';
|
|
7
|
+
/**
|
|
8
|
+
* KeyboardHandler
|
|
9
|
+
*
|
|
10
|
+
* A modern keyboard handler that manages keyboard events using a stateful pattern.
|
|
11
|
+
* It supports separate handlers for key down, key up, and continuous key pressed events.
|
|
12
|
+
* The handler calculates a movement vector based on currently pressed keys.
|
|
13
|
+
*/
|
|
14
|
+
export declare class KeyboardHandler extends InputHandler {
|
|
15
|
+
/**
|
|
16
|
+
* Callback invoked whenever the calculated movement vector is updated.
|
|
17
|
+
*/
|
|
18
|
+
onMove: (value: THREE.Vector3) => void;
|
|
19
|
+
onKeyUp: (code: string) => boolean;
|
|
20
|
+
onKeyDown: (code: string) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Speed multiplier applied when the Shift key is held.
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
private readonly SHIFT_MULTIPLIER;
|
|
26
|
+
/**
|
|
27
|
+
* Set of currently pressed key codes.
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
private pressedKeys;
|
|
31
|
+
/**
|
|
32
|
+
* Map of key down event handlers (invoked once on key down).
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
private keyDownHandlers;
|
|
36
|
+
/**
|
|
37
|
+
* Map of key up event handlers (invoked once on key up).
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
private keyUpHandlers;
|
|
41
|
+
/**
|
|
42
|
+
* Creates an instance of KeyboardHandler.
|
|
43
|
+
* @param canvas The HTMLCanvasElement to attach keyboard events to.
|
|
44
|
+
*/
|
|
45
|
+
constructor(canvas: HTMLCanvasElement);
|
|
46
|
+
/**
|
|
47
|
+
* Registers the necessary keyboard event listeners.
|
|
48
|
+
* @protected
|
|
49
|
+
*/
|
|
50
|
+
protected addListeners(): void;
|
|
51
|
+
private registerMovementHandlers;
|
|
52
|
+
/**
|
|
53
|
+
* Checks if a key is currently pressed.
|
|
54
|
+
* @param key The event.code of the key.
|
|
55
|
+
* @returns {boolean} True if the key is pressed, false otherwise.
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
isKeyPressed(key: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Resets the handler state by clearing all pressed keys and recalculating movement.
|
|
61
|
+
* @override
|
|
62
|
+
*/
|
|
63
|
+
reset(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Registers a handler for a key down event.
|
|
66
|
+
* @param code The event.code of the key.
|
|
67
|
+
* @param handler Callback invoked on key down.
|
|
68
|
+
*/
|
|
69
|
+
registerKeyDown(code: string, mode: CallbackMode, handler: () => void): void;
|
|
70
|
+
/**
|
|
71
|
+
* Registers a handler for a key up event.
|
|
72
|
+
* @param code The event.code of the key.
|
|
73
|
+
* @param handler Callback invoked on key up.
|
|
74
|
+
*/
|
|
75
|
+
registerKeyUp(code: string, mode: CallbackMode, handler: () => void): void;
|
|
76
|
+
private registerKey;
|
|
77
|
+
/**
|
|
78
|
+
* Internal key down event handler.
|
|
79
|
+
* @param event The KeyboardEvent object.
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
private _onKeyDown;
|
|
83
|
+
/**
|
|
84
|
+
* Internal key up event handler.
|
|
85
|
+
* @param event The KeyboardEvent object.
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
private _onKeyUp;
|
|
89
|
+
/**
|
|
90
|
+
* Calculates and applies the movement vector based on currently pressed keys.
|
|
91
|
+
* Also calls any continuous key pressed handlers for keys that are held down.
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
private applyMove;
|
|
95
|
+
}
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { InputHandler } from "./inputHandler";
|
|
2
|
+
import { Vector2 } from "../utils/math3d";
|
|
3
|
+
type DragCallback = (delta: Vector2, button: number) => void;
|
|
4
|
+
export declare class MouseHandler extends InputHandler {
|
|
5
|
+
private _lastMouseDownPosition;
|
|
6
|
+
private _capture;
|
|
7
|
+
private _dragHandler;
|
|
8
|
+
onButtonDown: (pos: Vector2, button: number) => void;
|
|
9
|
+
onButtonUp: (pos: Vector2, button: number) => void;
|
|
10
|
+
onMouseMove: (event: Vector2) => void;
|
|
11
|
+
onDrag: DragCallback;
|
|
12
|
+
onClick: (position: Vector2, ctrl: boolean) => void;
|
|
13
|
+
onDoubleClick: (position: Vector2) => void;
|
|
14
|
+
onWheel: (value: number, ctrl: boolean) => void;
|
|
15
|
+
constructor(canvas: HTMLCanvasElement);
|
|
16
|
+
protected addListeners(): void;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
private onPointerDown;
|
|
19
|
+
private onPointerUp;
|
|
20
|
+
private handleMouseClick;
|
|
21
|
+
private onPointerMove;
|
|
22
|
+
private _onDoubleClick;
|
|
23
|
+
private onMouseScroll;
|
|
24
|
+
private relativePosition;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module viw-webgl-viewer/inputs
|
|
3
3
|
*/
|
|
4
|
+
import * as THREE from 'three';
|
|
4
5
|
import { InputHandler } from './inputHandler';
|
|
5
|
-
import { Viewer } from '../viewer';
|
|
6
6
|
/**
|
|
7
7
|
* Manages user touch inputs.
|
|
8
8
|
*/
|
|
@@ -12,17 +12,12 @@ export declare class TouchHandler extends InputHandler {
|
|
|
12
12
|
private readonly TAP_MAX_MOVE_PIXEL;
|
|
13
13
|
private readonly ZOOM_SPEED;
|
|
14
14
|
private readonly MOVE_SPEED;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
orbitSpeed: number;
|
|
23
|
-
constructor(viewer: Viewer);
|
|
24
|
-
private get camera();
|
|
25
|
-
private get viewport();
|
|
15
|
+
onTap: (position: THREE.Vector2) => void;
|
|
16
|
+
onDoubleTap: (position: THREE.Vector2) => void;
|
|
17
|
+
onDrag: (delta: THREE.Vector2) => void;
|
|
18
|
+
onDoubleDrag: (delta: THREE.Vector2) => void;
|
|
19
|
+
onPinchOrSpread: (delta: number) => void;
|
|
20
|
+
constructor(canvas: HTMLCanvasElement);
|
|
26
21
|
private _touch;
|
|
27
22
|
private _touch1;
|
|
28
23
|
private _touch2;
|
|
@@ -31,15 +26,17 @@ export declare class TouchHandler extends InputHandler {
|
|
|
31
26
|
private _touchStart;
|
|
32
27
|
protected addListeners(): void;
|
|
33
28
|
reset: () => void;
|
|
34
|
-
private
|
|
29
|
+
private _onTap;
|
|
35
30
|
private onTouchStart;
|
|
36
31
|
private toRotation;
|
|
37
|
-
private onDrag;
|
|
38
|
-
private onDoubleDrag;
|
|
39
|
-
private onPinchOrSpread;
|
|
40
32
|
private onTouchMove;
|
|
41
33
|
private onTouchEnd;
|
|
42
34
|
private isSingleTouch;
|
|
43
35
|
private touchToVector;
|
|
44
36
|
private average;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the pixel size of the canvas.
|
|
39
|
+
* @returns {THREE.Vector2} The pixel size of the canvas.
|
|
40
|
+
*/
|
|
41
|
+
getCanvasSize(): THREE.Vector2;
|
|
45
42
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
export * from './viewer/
|
|
3
|
-
export * as utils from '
|
|
2
|
+
export * from './viewer/ultraCoreViewer';
|
|
3
|
+
export * as utils from '../utils/promise';
|
|
4
|
+
export * from '../utils/math3d';
|
|
4
5
|
export * from './viewer/vim';
|
|
5
|
-
export * from './viewer/vim';
|
|
6
|
-
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 '
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RpcSafeClient } from './rpcSafeClient';
|
|
2
2
|
import { ColorHandle } from './color';
|
|
3
|
-
import { RGBA32 } from '
|
|
3
|
+
import { RGBA32 } from '../../utils/math3d';
|
|
4
4
|
/**
|
|
5
5
|
* Manages the creation, caching, and deletion of color instances.
|
|
6
6
|
* Handles batched deletion of colors to optimize RPC calls.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Don't modify this file, the RPC generated code depends on its interface.
|
|
3
3
|
*/
|
|
4
|
-
import { Box3, RGB, RGBA, RGBA32, Segment, Vector2, Vector3, Matrix44 } from "
|
|
4
|
+
import { Box3, RGB, RGBA, RGBA32, Segment, Vector2, Vector3, Matrix44 } from "../../utils/math3d";
|
|
5
5
|
export type HitCheckResult = {
|
|
6
6
|
vimHandle: number;
|
|
7
7
|
nodeIndex: number;
|
|
@@ -14,7 +14,7 @@ export type VimStatus = {
|
|
|
14
14
|
};
|
|
15
15
|
export type SectionBoxState = {
|
|
16
16
|
visible: boolean;
|
|
17
|
-
|
|
17
|
+
interactive: boolean;
|
|
18
18
|
clip: boolean;
|
|
19
19
|
box: Box3;
|
|
20
20
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SocketClient } from './socketClient';
|
|
2
2
|
import { HitCheckResult, VimStatus, SectionBoxState } from './marshal';
|
|
3
|
-
import { Box3, RGBA, RGBA32, Segment, Vector2, Vector3, Matrix44 } from '
|
|
3
|
+
import { Box3, RGBA, RGBA32, Segment, Vector2, Vector3, Matrix44 } from '../../utils/math3d';
|
|
4
4
|
export type MaterialHandle = 4294967295 | 6 | 2 | 0 | 1 | 3 | 4 | 5 | 7 | 8;
|
|
5
5
|
export declare class MaterialHandles {
|
|
6
6
|
static readonly Invalid: MaterialHandle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box3, RGBA, RGBA32, Segment, Vector2, Vector3 } from "
|
|
1
|
+
import { Box3, RGBA, RGBA32, Segment, Vector2, Vector3 } from "../../utils/math3d";
|
|
2
2
|
import { HitCheckResult, SectionBoxState } from "./marshal";
|
|
3
3
|
import { MaterialHandle, RpcClient } from "./rpcClient";
|
|
4
4
|
export type VimSource = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box3 } from "
|
|
1
|
+
import { Box3 } from "../../utils/math3d";
|
|
2
2
|
import { RpcSafeClient } from "./rpcSafeClient";
|
|
3
3
|
export declare class SectionBox {
|
|
4
4
|
private _visible;
|
|
@@ -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();
|
|
@@ -22,7 +23,11 @@ export declare class SectionBox {
|
|
|
22
23
|
set interactive(value: boolean);
|
|
23
24
|
get clip(): boolean;
|
|
24
25
|
set clip(value: boolean);
|
|
26
|
+
/**
|
|
27
|
+
* Fits the given box, invalid dimensions will be reversed.
|
|
28
|
+
* @param box - The new bounding box.
|
|
29
|
+
*/
|
|
25
30
|
fitBox(box: Box3): void;
|
|
26
|
-
getBox(): Box3;
|
|
31
|
+
getBox(): Box3 | undefined;
|
|
27
32
|
dispose(): void;
|
|
28
33
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box3, Vector2, Vector3 } from "
|
|
1
|
+
import { Box3, Vector2, Vector3 } from "../../utils/math3d";
|
|
2
2
|
import { RpcSafeClient } from "./rpcSafeClient";
|
|
3
3
|
import { Vim } from "./vim";
|
|
4
4
|
import { IReadonlyVimCollection } from "./vimCollection";
|
|
@@ -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,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Protocol from './protocol';
|
|
2
2
|
import { Marshal, ReadMarshal } from './marshal';
|
|
3
3
|
import { ILogger } from './logger';
|
|
4
|
-
import { Segment } from '
|
|
4
|
+
import { Segment } from '../../utils/math3d';
|
|
5
5
|
export declare const DEFAULT_LOCAL_ULTRA_SERVER_URL = "ws://localhost:8123";
|
|
6
6
|
export type ConnectionSettings = {
|
|
7
7
|
url?: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IInputs } from './inputs/inputs';
|
|
2
1
|
import { ClientState, ConnectionSettings } from './socketClient';
|
|
3
2
|
import { IDecoder } from './decoder';
|
|
4
3
|
import { Vim } from './vim';
|
|
@@ -13,12 +12,13 @@ import { ViewerSelection } from './selection';
|
|
|
13
12
|
import { IReadonlyVimCollection } from './vimCollection';
|
|
14
13
|
import { IRenderer } from './renderer';
|
|
15
14
|
import { SectionBox } from './sectionBox';
|
|
15
|
+
import { CoreInputHandler } from '../../shared/coreInputHandler';
|
|
16
16
|
export declare const INVALID_HANDLE = 4294967295;
|
|
17
17
|
/**
|
|
18
18
|
* The main Viewer class responsible for managing VIM files,
|
|
19
19
|
* handling connections, and coordinating various components like the camera, decoder, and inputs.
|
|
20
20
|
*/
|
|
21
|
-
export declare class
|
|
21
|
+
export declare class UltraCoreViewer {
|
|
22
22
|
private readonly _decoder;
|
|
23
23
|
private readonly _socketClient;
|
|
24
24
|
private readonly _input;
|
|
@@ -41,7 +41,7 @@ export declare class Viewer {
|
|
|
41
41
|
/**
|
|
42
42
|
* The input API for handling user input events.
|
|
43
43
|
*/
|
|
44
|
-
get inputs():
|
|
44
|
+
get inputs(): CoreInputHandler;
|
|
45
45
|
get vims(): IReadonlyVimCollection;
|
|
46
46
|
/**
|
|
47
47
|
* The viewport API for managing the rendering viewport.
|
|
@@ -79,7 +79,7 @@ export declare class Viewer {
|
|
|
79
79
|
* @param logger - Optional logger for logging messages.
|
|
80
80
|
* @returns A new instance of the Viewer class.
|
|
81
81
|
*/
|
|
82
|
-
static createWithCanvas(parent: HTMLElement, logger?: ILogger):
|
|
82
|
+
static createWithCanvas(parent: HTMLElement, logger?: ILogger): UltraCoreViewer;
|
|
83
83
|
/**
|
|
84
84
|
* Constructs a new Viewer instance.
|
|
85
85
|
* @param canvas - The HTML canvas element for rendering.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CoreInputHandler } from "../../shared/coreInputHandler";
|
|
2
|
+
import { UltraCoreViewer } from "./ultraCoreViewer";
|
|
3
|
+
declare const CODE_TO_KEYCODE: Record<string, number>;
|
|
4
|
+
export default CODE_TO_KEYCODE;
|
|
5
|
+
export declare function ultraInputAdapter(viewer: UltraCoreViewer): CoreInputHandler;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box3, RGB, RGBA, Segment, Vector2, Vector3 } from '
|
|
1
|
+
import { Box3, RGB, RGBA, Segment, Vector2, Vector3 } from '../../utils/math3d';
|
|
2
2
|
export declare class Validation {
|
|
3
3
|
static isNumber(value: number): boolean;
|
|
4
4
|
static isPositiveNumber(value: number): boolean;
|
|
@@ -3,7 +3,7 @@ import { ColorManager } from './colorManager';
|
|
|
3
3
|
import { LoadRequest } from './loadRequest';
|
|
4
4
|
import { RpcSafeClient, VimSource } from './rpcSafeClient';
|
|
5
5
|
import { ILogger } from './logger';
|
|
6
|
-
import { Box3 } from '
|
|
6
|
+
import { Box3 } from '../../utils/math3d';
|
|
7
7
|
type NodeState = 'visible' | 'hidden' | 'ghosted' | 'highlighted';
|
|
8
8
|
export declare class Vim {
|
|
9
9
|
readonly source: VimSource;
|
|
@@ -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.
|