vim-web 0.3.43 → 0.3.44-dev.0
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/dist/types/core-viewers/ultra/viewer/camera.d.ts +1 -13
- package/dist/types/core-viewers/ultra/viewer/marshal.d.ts +37 -24
- package/dist/types/core-viewers/ultra/viewer/rpcClient.d.ts +9 -7
- package/dist/types/core-viewers/ultra/viewer/rpcSafeClient.d.ts +8 -1
- package/dist/types/core-viewers/ultra/viewer/sectionBox.d.ts +31 -0
- package/dist/types/core-viewers/ultra/viewer/socketClient.d.ts +4 -2
- package/dist/types/core-viewers/ultra/viewer/viewer.d.ts +5 -0
- package/dist/types/core-viewers/webgl/viewer/camera/ICamera.d.ts +102 -0
- package/dist/types/core-viewers/webgl/viewer/environment/cameraLight.d.ts +1 -1
- package/dist/types/core-viewers/webgl/viewer/environment/environment.d.ts +1 -1
- package/dist/types/core-viewers/webgl/viewer/environment/skybox.d.ts +1 -1
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/SectionBoxMesh.d.ts +15 -0
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBox.d.ts +55 -21
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxGizmo.d.ts +13 -43
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxHandle.d.ts +15 -0
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxHandles.d.ts +19 -0
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxInputs.d.ts +143 -28
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxOutline.d.ts +15 -0
- package/dist/types/core-viewers/webgl/viewer/inputs/input.d.ts +4 -4
- package/dist/types/core-viewers/webgl/viewer/viewer.d.ts +1 -1
- package/dist/vim-web.iife.js +1109 -600
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +1109 -600
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
- /package/dist/types/core-viewers/webgl/viewer/inputs/{keyboard.d.ts → keyboardHandler.d.ts} +0 -0
- /package/dist/types/core-viewers/webgl/viewer/inputs/{mouse.d.ts → mouseHandler.d.ts} +0 -0
- /package/dist/types/core-viewers/webgl/viewer/inputs/{touch.d.ts → touchHandler.d.ts} +0 -0
|
@@ -1,40 +1,155 @@
|
|
|
1
1
|
/**
|
|
2
|
-
@module viw-webgl-viewer/gizmos/sectionBox
|
|
3
|
-
*/
|
|
2
|
+
* @module viw-webgl-viewer/gizmos/sectionBox
|
|
3
|
+
*/
|
|
4
4
|
import { Viewer } from '../../viewer';
|
|
5
5
|
import * as THREE from 'three';
|
|
6
|
+
import { SectionBoxHandles } from './sectionBoxHandles';
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Manages pointer interactions (mouse, touch, etc.) on a {@link SectionBoxHandles} to
|
|
9
|
+
* reshape a Three.js `Box3`. This includes detecting which handle is hovered or dragged,
|
|
10
|
+
* capturing the pointer for smooth dragging, and enforcing a minimum box size.
|
|
8
11
|
*/
|
|
9
12
|
export declare class BoxInputs {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
/** The parent Viewer controlling the scene. */
|
|
14
|
+
private _viewer;
|
|
15
|
+
/** The handles mesh group containing the draggable cones/faces. */
|
|
16
|
+
private _handles;
|
|
17
|
+
/** The main box that is being reshaped by dragging handles. */
|
|
18
|
+
private _sharedBox;
|
|
19
|
+
/** The currently hovered/dragged handle, if any. */
|
|
20
|
+
private _handle;
|
|
21
|
+
/** The origin point for dragging, updated on pointer down. */
|
|
22
|
+
private _dragOrigin;
|
|
23
|
+
/** The plane used for drag intersection (perpendicular to the camera direction). */
|
|
24
|
+
private _dragPlane;
|
|
25
|
+
/** Whether a pointer is currently down on a handle. */
|
|
26
|
+
private _mouseDown;
|
|
27
|
+
/** A reusable Raycaster for picking and plane intersection. */
|
|
28
|
+
private _raycaster;
|
|
29
|
+
/** The box state before the current drag. */
|
|
30
|
+
private _lastBox;
|
|
31
|
+
/** A collection of unregister callbacks for event listeners. */
|
|
32
|
+
private _unregisters;
|
|
33
|
+
/** The ID of the pointer that is captured, if any. */
|
|
34
|
+
private _capturedPointerId;
|
|
35
|
+
/**
|
|
36
|
+
* Called when the pointer enters or leaves a handle face.
|
|
37
|
+
* @param normal - The normal (forward) vector of the hovered handle, or a zero vector if none.
|
|
38
|
+
*/
|
|
23
39
|
onFaceEnter: ((normal: THREE.Vector3) => void) | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Called continuously as the box is reshaped by dragging.
|
|
42
|
+
* @param box - The updated box after the latest drag move.
|
|
43
|
+
*/
|
|
24
44
|
onBoxStretch: ((box: THREE.Box3) => void) | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Called when the user has finished reshaping the box (pointer up).
|
|
47
|
+
* @param box - The final box after dragging ends.
|
|
48
|
+
*/
|
|
25
49
|
onBoxConfirm: ((box: THREE.Box3) => void) | undefined;
|
|
26
|
-
|
|
27
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new BoxInputs instance for pointer-driven box resizing.
|
|
52
|
+
*
|
|
53
|
+
* @param viewer - The parent {@link Viewer} that renders the scene.
|
|
54
|
+
* @param handles - A {@link SectionBoxHandles} instance containing the draggable mesh handles.
|
|
55
|
+
* @param box - The shared bounding box (`Box3`) that will be updated by dragging.
|
|
56
|
+
*/
|
|
57
|
+
constructor(viewer: Viewer, handles: SectionBoxHandles, box: THREE.Box3);
|
|
58
|
+
/**
|
|
59
|
+
* Registers pointer event listeners on the viewer's canvas.
|
|
60
|
+
* If already registered, it does nothing.
|
|
61
|
+
*/
|
|
28
62
|
register(): void;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Unregisters any previously set pointer event listeners, releasing pointer capture
|
|
65
|
+
* and resetting drag state.
|
|
66
|
+
*/
|
|
32
67
|
unregister(): void;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Indicates if a pointer is currently captured for dragging.
|
|
70
|
+
*/
|
|
71
|
+
get pointerCaptured(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* A helper method to attach an event listener and store its unregister callback.
|
|
74
|
+
*
|
|
75
|
+
* @param handler - The DOM element or Window to attach the listener to.
|
|
76
|
+
* @param type - The pointer event type, e.g. 'pointerdown'.
|
|
77
|
+
* @param listener - The event handler function.
|
|
78
|
+
*/
|
|
79
|
+
private reg;
|
|
80
|
+
/**
|
|
81
|
+
* Called when the pointer leaves the canvas. If not dragging,
|
|
82
|
+
* invokes {@link onFaceEnter} to indicate no active handle is hovered.
|
|
83
|
+
*
|
|
84
|
+
* @param event - The pointerleave event.
|
|
85
|
+
*/
|
|
86
|
+
private onPointerLeave;
|
|
87
|
+
/**
|
|
88
|
+
* Sets pointer capture on the canvas for a specific pointer (ID).
|
|
89
|
+
*
|
|
90
|
+
* @param pointerId - The pointer ID to capture.
|
|
91
|
+
*/
|
|
92
|
+
private capturePointer;
|
|
93
|
+
/**
|
|
94
|
+
* Releases any captured pointer on the canvas, if present.
|
|
95
|
+
*/
|
|
96
|
+
private releasePointer;
|
|
97
|
+
/**
|
|
98
|
+
* Handles pointer movement events.
|
|
99
|
+
* - If dragging, calls {@link onDrag}.
|
|
100
|
+
* - Otherwise, performs a raycast to detect which handle is under the pointer.
|
|
101
|
+
*
|
|
102
|
+
* @param event - The pointermove event.
|
|
103
|
+
*/
|
|
104
|
+
private onMouseMove;
|
|
105
|
+
/**
|
|
106
|
+
* Handles pointer up events. Ends dragging and triggers {@link onBoxConfirm}.
|
|
107
|
+
*
|
|
108
|
+
* @param event - The pointerup event.
|
|
109
|
+
*/
|
|
110
|
+
private onMouseUp;
|
|
111
|
+
/**
|
|
112
|
+
* Handles pointer down events. Begins drag if a handle is hit, capturing the pointer.
|
|
113
|
+
*
|
|
114
|
+
* @param event - The pointerdown event.
|
|
115
|
+
*/
|
|
116
|
+
private onMouseDown;
|
|
117
|
+
/**
|
|
118
|
+
* Continues the drag operation. Determines the new position on the drag plane
|
|
119
|
+
* and computes how far we moved along the handle's forward axis.
|
|
120
|
+
*
|
|
121
|
+
* @param event - The pointermove event while dragging.
|
|
122
|
+
*/
|
|
123
|
+
private onDrag;
|
|
124
|
+
/**
|
|
125
|
+
* Expands or contracts the `_sharedBox` along one axis by a certain amount,
|
|
126
|
+
* ensuring the box cannot shrink below the minimum size (`MIN_BOX_SIZE`).
|
|
127
|
+
*
|
|
128
|
+
* @param axis - The axis ('x', 'y', or 'z') to stretch.
|
|
129
|
+
* @param sign - +1 if stretching the 'max' side, -1 if stretching the 'min' side.
|
|
130
|
+
* @param amount - The numeric offset along that axis to add or subtract.
|
|
131
|
+
* @returns A **new** `Box3` instance with updated min/max coordinates.
|
|
132
|
+
*/
|
|
133
|
+
private stretch;
|
|
134
|
+
/**
|
|
135
|
+
* Prepares the internal raycaster for a given 2D pointer position.
|
|
136
|
+
*
|
|
137
|
+
* @param position - The pointer position in canvas coordinates.
|
|
138
|
+
* @returns The updated raycaster pointing from the camera through this position.
|
|
139
|
+
*/
|
|
140
|
+
private getRaycaster;
|
|
141
|
+
/**
|
|
142
|
+
* Raycasts into the handle meshes from the given pointer position.
|
|
143
|
+
*
|
|
144
|
+
* @param position - The pointer position in canvas coordinates.
|
|
145
|
+
* @returns An array of intersection results, if any.
|
|
146
|
+
*/
|
|
147
|
+
private raycast;
|
|
148
|
+
/**
|
|
149
|
+
* Raycasts into the drag plane from the given pointer position.
|
|
150
|
+
*
|
|
151
|
+
* @param position - The pointer position in canvas coordinates.
|
|
152
|
+
* @returns The intersection point in 3D space, or `null` if none.
|
|
153
|
+
*/
|
|
154
|
+
private raycastPlane;
|
|
40
155
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the thin outline on the edges of the section box.
|
|
4
|
+
*/
|
|
5
|
+
export declare class SectionBoxOutline extends THREE.LineSegments {
|
|
6
|
+
constructor(color: THREE.Color);
|
|
7
|
+
/**
|
|
8
|
+
* Resize the outline to the given box.
|
|
9
|
+
*/
|
|
10
|
+
fitBox(box: THREE.Box3): void;
|
|
11
|
+
/**
|
|
12
|
+
* Disposes of all resources.
|
|
13
|
+
*/
|
|
14
|
+
dispose(): void;
|
|
15
|
+
}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { Viewer } from '../viewer';
|
|
6
|
-
import { KeyboardHandler } from './
|
|
7
|
-
import { TouchHandler } from './
|
|
8
|
-
import { MouseHandler } from './
|
|
6
|
+
import { KeyboardHandler } from './keyboardHandler';
|
|
7
|
+
import { TouchHandler } from './touchHandler';
|
|
8
|
+
import { MouseHandler } from './mouseHandler';
|
|
9
9
|
import { InputAction } from '../raycaster';
|
|
10
|
-
export { KEYS } from './
|
|
10
|
+
export { KEYS } from './keyboardHandler';
|
|
11
11
|
/** Pointers mode supported by the viewer */
|
|
12
12
|
export type PointerMode = 'orbit' | 'look' | 'pan' | 'zoom' | 'rect';
|
|
13
13
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@module viw-webgl-viewer
|
|
3
3
|
*/
|
|
4
4
|
import { ViewerSettings, PartialViewerSettings } from './settings/viewerSettings';
|
|
5
|
-
import { ICamera } from './camera/
|
|
5
|
+
import { ICamera } from './camera/ICamera';
|
|
6
6
|
import { Input } from './inputs/input';
|
|
7
7
|
import { Selection } from './selection';
|
|
8
8
|
import { Environment } from './environment/environment';
|