gl-draw 0.10.37 → 0.10.38

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.
@@ -0,0 +1,257 @@
1
+ import {
2
+ Camera,
3
+ Controls,
4
+ Mesh,
5
+ Object3D,
6
+ Quaternion,
7
+ Raycaster,
8
+ Vector3,
9
+ } from 'three';
10
+
11
+ type TransformControlsMode = 'translate' | 'rotate' | 'scale';
12
+
13
+ export interface TransformControlsEventMap {
14
+ /**
15
+ * Fires if any type of change (object or property change) is performed. Property changes are separate events you
16
+ * can add event listeners to. The event type is "propertyname-changed".
17
+ */
18
+ change: {};
19
+
20
+ /**
21
+ * Fires if a pointer (mouse/touch) becomes active.
22
+ */
23
+ mouseDown: {mode: TransformControlsMode};
24
+
25
+ /**
26
+ * Fires if a pointer (mouse/touch) is no longer active.
27
+ */
28
+ mouseUp: {mode: TransformControlsMode};
29
+
30
+ /**
31
+ * Fires if the controlled 3D object is changed.
32
+ */
33
+ objectChange: {};
34
+
35
+ 'camera-changed': {value: unknown};
36
+ 'object-changed': {value: unknown};
37
+ 'enabled-changed': {value: unknown};
38
+ 'axis-changed': {value: unknown};
39
+ 'mode-changed': {value: unknown};
40
+ 'translationSnap-changed': {value: unknown};
41
+ 'rotationSnap-changed': {value: unknown};
42
+ 'scaleSnap-changed': {value: unknown};
43
+ 'space-changed': {value: unknown};
44
+ 'size-changed': {value: unknown};
45
+ 'dragging-changed': {value: unknown};
46
+ 'showX-changed': {value: unknown};
47
+ 'showY-changed': {value: unknown};
48
+ 'showZ-changed': {value: unknown};
49
+ 'worldPosition-changed': {value: unknown};
50
+ 'worldPositionStart-changed': {value: unknown};
51
+ 'worldQuaternion-changed': {value: unknown};
52
+ 'worldQuaternionStart-changed': {value: unknown};
53
+ 'cameraPosition-changed': {value: unknown};
54
+ 'cameraQuaternion-changed': {value: unknown};
55
+ 'pointStart-changed': {value: unknown};
56
+ 'pointEnd-changed': {value: unknown};
57
+ 'rotationAxis-changed': {value: unknown};
58
+ 'rotationAngle-changed': {value: unknown};
59
+ 'eye-changed': {value: unknown};
60
+ }
61
+
62
+ /**
63
+ * This class can be used to transform objects in 3D space by adapting a similar interaction model of DCC tools like
64
+ * Blender. Unlike other controls, it is not intended to transform the scene's camera.
65
+ *
66
+ * TransformControls expects that its attached 3D object is part of the scene graph.
67
+ */
68
+ declare class TransformControls extends Controls<TransformControlsEventMap> {
69
+ /**
70
+ * The camera of the rendered scene.
71
+ */
72
+ camera: Camera;
73
+
74
+ /**
75
+ * The current transformation axis.
76
+ */
77
+ axis: 'X' | 'Y' | 'Z' | 'E' | 'XY' | 'YZ' | 'XZ' | 'XYZ' | 'XYZE' | null;
78
+
79
+ /**
80
+ * The current transformation mode. Possible values are "translate", "rotate" and "scale". Default is `translate`.
81
+ */
82
+ mode: TransformControlsMode;
83
+
84
+ /**
85
+ * By default, 3D objects are continuously translated. If you set this property to a numeric value (world units),
86
+ * you can define in which steps the 3D object should be translated. Default is `null`.
87
+ */
88
+ translationSnap: number | null;
89
+
90
+ /**
91
+ * By default, 3D objects are continuously rotated. If you set this property to a numeric value (radians), you can
92
+ * define in which steps the 3D object should be rotated. Default is `null`.
93
+ */
94
+ rotationSnap: number | null;
95
+
96
+ /**
97
+ * Defines in which coordinate space transformations should be performed. Possible values are "world" and "local".
98
+ * Default is `world`.
99
+ */
100
+ space: 'world' | 'local';
101
+
102
+ /**
103
+ * The size of the helper UI (axes/planes). Default is *1*.
104
+ */
105
+ size: number;
106
+
107
+ /**
108
+ * Whether or not dragging is currently performed. Read-only property.
109
+ */
110
+ dragging: boolean;
111
+
112
+ /**
113
+ * Whether or not the x-axis helper should be visible. Default is `true`.
114
+ */
115
+ showX: boolean;
116
+
117
+ /**
118
+ * Whether or not the y-axis helper should be visible. Default is `true`.
119
+ */
120
+ showY: boolean;
121
+
122
+ /**
123
+ * Whether or not the z-axis helper should be visible. Default is `true`.
124
+ */
125
+ showZ: boolean;
126
+
127
+ /**
128
+ * Creates a new instance of TransformControls.
129
+ * @param camera The camera of the rendered scene.
130
+ * @param domElement The HTML element used for event listeners. (optional)
131
+ */
132
+ constructor(camera: Camera, domElement?: HTMLElement);
133
+
134
+ /**
135
+ * Returns the visual representation of the controls. Add the helper to your scene to visually transform the
136
+ * attached 3D object.
137
+ */
138
+ getHelper(): TransformControlsRoot;
139
+
140
+ pointerHover(pointer: PointerEvent | null): void;
141
+ pointerDown(pointer: PointerEvent | null): void;
142
+ pointerMove(pointer: PointerEvent | null): void;
143
+ pointerUp(pointer: PointerEvent | null): void;
144
+
145
+ /**
146
+ * Sets the 3D object that should be transformed and ensures the controls UI is visible.
147
+ * @param object The 3D object that should be transformed.
148
+ */
149
+ attach(object: Object3D): this;
150
+
151
+ /**
152
+ * Removes the current 3D object from the controls and makes the helper UI invisible.
153
+ */
154
+ detach(): this;
155
+
156
+ /**
157
+ * Resets the object's position, rotation and scale to when the current transform began.
158
+ */
159
+ reset(): void;
160
+
161
+ /**
162
+ * Returns the {@link Raycaster} object that is used for user interaction. This object is shared between all
163
+ * instances of TransformControls. If you set the [.layers]{@link Object3D.layers} property of the
164
+ * TransformControls, you will also want to set the [.layers]{@link Raycaster.layers} property on the
165
+ * {@link Raycaster} with a matching value, or else the TransformControls won't work as expected.
166
+ */
167
+ getRaycaster(): Raycaster;
168
+
169
+ /**
170
+ * Returns the transformation mode.
171
+ */
172
+ getMode(): TransformControlsMode;
173
+
174
+ /**
175
+ * Sets the transformation mode.
176
+ * @param mode The transformation mode.
177
+ */
178
+ setMode(mode: TransformControlsMode): void;
179
+
180
+ /**
181
+ * Sets the translation snap.
182
+ * @param translationSnap The translation snap.
183
+ */
184
+ setTranslationSnap(translationSnap: number | null): void;
185
+
186
+ /**
187
+ * Sets the rotation snap.
188
+ * @param rotationSnap The rotation snap.
189
+ */
190
+ setRotationSnap(rotationSnap: number | null): void;
191
+
192
+ /**
193
+ * Sets the scale snap.
194
+ * @param scaleSnap The scale snap.
195
+ */
196
+ setScaleSnap(scaleSnap: number | null): void;
197
+
198
+ /**
199
+ * Sets the size of the helper UI.
200
+ * @param size The size of the helper UI.
201
+ */
202
+ setSize(size: number): void;
203
+
204
+ /**
205
+ * Sets the coordinate space in which transformations are applied.
206
+ * @param space The coordinate space in which transformations are applied.
207
+ */
208
+ setSpace(space: 'world' | 'local'): void;
209
+ }
210
+
211
+ declare class TransformControlsRoot extends Object3D {
212
+ readonly isTransformControlsRoot: true;
213
+
214
+ controls: TransformControls;
215
+
216
+ constructor(controls: TransformControls);
217
+ }
218
+
219
+ declare class TransformControlsGizmo extends Object3D {
220
+ isTransformControlsGizmo: true;
221
+
222
+ gizmo: {
223
+ translate: Object3D;
224
+ rotate: Object3D;
225
+ scale: Object3D;
226
+ };
227
+ helper: {
228
+ translate: Object3D;
229
+ rotate: Object3D;
230
+ scale: Object3D;
231
+ };
232
+ picker: {
233
+ translate: Object3D;
234
+ rotate: Object3D;
235
+ scale: Object3D;
236
+ };
237
+
238
+ constructor();
239
+ }
240
+
241
+ declare class TransformControlsPlane extends Mesh {
242
+ readonly isTransformControlsPlane: true;
243
+
244
+ constructor();
245
+
246
+ mode: TransformControlsMode;
247
+
248
+ axis: 'X' | 'Y' | 'Z' | 'XY' | 'YZ' | 'XZ' | 'XYZ' | 'E';
249
+
250
+ space: 'local' | 'world';
251
+
252
+ eye: Vector3;
253
+ worldPosition: Vector3;
254
+ worldQuaternion: Quaternion;
255
+ }
256
+
257
+ export {TransformControls, TransformControlsGizmo, TransformControlsPlane};
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
2
+ import { TransformControls } from './TransformControls';
3
3
  import { EventEmitter } from 'events';
4
4
  interface Options {
5
5
  renderer: THREE.WebGLRenderer;