@tonybfox/threejs-tools 1.0.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/README.md +321 -0
- package/dist/asset-loader/index.cjs +376 -0
- package/dist/asset-loader/index.cjs.map +1 -0
- package/dist/asset-loader/index.d.mts +101 -0
- package/dist/asset-loader/index.d.ts +101 -0
- package/dist/asset-loader/index.mjs +7 -0
- package/dist/asset-loader/index.mjs.map +1 -0
- package/dist/camera/index.cjs +313 -0
- package/dist/camera/index.cjs.map +1 -0
- package/dist/camera/index.d.mts +82 -0
- package/dist/camera/index.d.ts +82 -0
- package/dist/camera/index.mjs +7 -0
- package/dist/camera/index.mjs.map +1 -0
- package/dist/chunk-5DP6WDB3.mjs +1161 -0
- package/dist/chunk-5DP6WDB3.mjs.map +1 -0
- package/dist/chunk-BJKSICFA.mjs +1579 -0
- package/dist/chunk-BJKSICFA.mjs.map +1 -0
- package/dist/chunk-BYRZCHE7.mjs +277 -0
- package/dist/chunk-BYRZCHE7.mjs.map +1 -0
- package/dist/chunk-EIROAPF7.mjs +387 -0
- package/dist/chunk-EIROAPF7.mjs.map +1 -0
- package/dist/chunk-EQDOX34V.mjs +164 -0
- package/dist/chunk-EQDOX34V.mjs.map +1 -0
- package/dist/chunk-IIAZ2WJJ.mjs +405 -0
- package/dist/chunk-IIAZ2WJJ.mjs.map +1 -0
- package/dist/chunk-L4VIIJZD.mjs +340 -0
- package/dist/chunk-L4VIIJZD.mjs.map +1 -0
- package/dist/chunk-P35QJCOG.mjs +339 -0
- package/dist/chunk-P35QJCOG.mjs.map +1 -0
- package/dist/chunk-R64RVBRM.mjs +394 -0
- package/dist/chunk-R64RVBRM.mjs.map +1 -0
- package/dist/compass/index.cjs +375 -0
- package/dist/compass/index.cjs.map +1 -0
- package/dist/compass/index.d.mts +58 -0
- package/dist/compass/index.d.ts +58 -0
- package/dist/compass/index.mjs +7 -0
- package/dist/compass/index.mjs.map +1 -0
- package/dist/grid/index.cjs +200 -0
- package/dist/grid/index.cjs.map +1 -0
- package/dist/grid/index.d.mts +43 -0
- package/dist/grid/index.d.ts +43 -0
- package/dist/grid/index.mjs +7 -0
- package/dist/grid/index.mjs.map +1 -0
- package/dist/index.cjs +5049 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.mjs +47 -0
- package/dist/index.mjs.map +1 -0
- package/dist/measurements/index.cjs +1198 -0
- package/dist/measurements/index.cjs.map +1 -0
- package/dist/measurements/index.d.mts +449 -0
- package/dist/measurements/index.d.ts +449 -0
- package/dist/measurements/index.mjs +9 -0
- package/dist/measurements/index.mjs.map +1 -0
- package/dist/sunlight/index.cjs +441 -0
- package/dist/sunlight/index.cjs.map +1 -0
- package/dist/sunlight/index.d.mts +92 -0
- package/dist/sunlight/index.d.ts +92 -0
- package/dist/sunlight/index.mjs +7 -0
- package/dist/sunlight/index.mjs.map +1 -0
- package/dist/terrain/index.cjs +423 -0
- package/dist/terrain/index.cjs.map +1 -0
- package/dist/terrain/index.d.mts +219 -0
- package/dist/terrain/index.d.ts +219 -0
- package/dist/terrain/index.mjs +7 -0
- package/dist/terrain/index.mjs.map +1 -0
- package/dist/transform-controls/index.cjs +1587 -0
- package/dist/transform-controls/index.cjs.map +1 -0
- package/dist/transform-controls/index.d.mts +162 -0
- package/dist/transform-controls/index.d.ts +162 -0
- package/dist/transform-controls/index.mjs +13 -0
- package/dist/transform-controls/index.mjs.map +1 -0
- package/dist/view-helper/index.cjs +430 -0
- package/dist/view-helper/index.cjs.map +1 -0
- package/dist/view-helper/index.d.mts +75 -0
- package/dist/view-helper/index.d.ts +75 -0
- package/dist/view-helper/index.mjs +7 -0
- package/dist/view-helper/index.mjs.map +1 -0
- package/package.json +124 -0
|
@@ -0,0 +1,1587 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/transform-controls/src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
TransformControls: () => TransformControls,
|
|
24
|
+
TransformControlsGizmo: () => TransformControlsGizmo,
|
|
25
|
+
TransformControlsPlane: () => TransformControlsPlane,
|
|
26
|
+
calculateBoundingBoxCenter: () => calculateBoundingBoxCenter
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(src_exports);
|
|
29
|
+
|
|
30
|
+
// packages/transform-controls/src/TransformControls.ts
|
|
31
|
+
var import_three = require("three");
|
|
32
|
+
var import_CSS2DRenderer = require("three/examples/jsm/renderers/CSS2DRenderer.js");
|
|
33
|
+
var _raycaster = new import_three.Raycaster();
|
|
34
|
+
var _tempVector = new import_three.Vector3();
|
|
35
|
+
var _tempVector2 = new import_three.Vector3();
|
|
36
|
+
var _tempQuaternion = new import_three.Quaternion();
|
|
37
|
+
var _unit = {
|
|
38
|
+
X: new import_three.Vector3(1, 0, 0),
|
|
39
|
+
Y: new import_three.Vector3(0, 1, 0),
|
|
40
|
+
Z: new import_three.Vector3(0, 0, 1)
|
|
41
|
+
};
|
|
42
|
+
var _changeEvent = { type: "change" };
|
|
43
|
+
var _mouseDownEvent = { type: "mouseDown", mode: null };
|
|
44
|
+
var _mouseUpEvent = { type: "mouseUp", mode: null };
|
|
45
|
+
var _objectChangeEvent = { type: "objectChange" };
|
|
46
|
+
var TransformControls = class extends import_three.Controls {
|
|
47
|
+
/**
|
|
48
|
+
* Constructs a new controls instance.
|
|
49
|
+
*
|
|
50
|
+
* @param {Camera} camera - The camera of the rendered scene.
|
|
51
|
+
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
52
|
+
*/
|
|
53
|
+
constructor(camera, domElement = null) {
|
|
54
|
+
super(void 0, domElement);
|
|
55
|
+
const root = new TransformControlsRoot(this);
|
|
56
|
+
this._root = root;
|
|
57
|
+
const gizmo = new TransformControlsGizmo();
|
|
58
|
+
this._gizmo = gizmo;
|
|
59
|
+
root.add(gizmo);
|
|
60
|
+
const plane = new TransformControlsPlane();
|
|
61
|
+
this._plane = plane;
|
|
62
|
+
root.add(plane);
|
|
63
|
+
const scope = this;
|
|
64
|
+
this._overlay = document.createElement("div");
|
|
65
|
+
this._overlay.classList.add("absolute");
|
|
66
|
+
this._overlay.classList.add("bottom-2");
|
|
67
|
+
this._overlay.classList.add("left-80");
|
|
68
|
+
this._overlay.classList.add("z-50");
|
|
69
|
+
this._overlay.classList.add("bg-gray-700");
|
|
70
|
+
this._overlay.classList.add("bg-opacity-70");
|
|
71
|
+
this._overlay.classList.add("text-white");
|
|
72
|
+
this._overlay.classList.add("p-2");
|
|
73
|
+
this._overlay.classList.add("rounded-md");
|
|
74
|
+
this._overlay.classList.add("border");
|
|
75
|
+
this._overlay.classList.add("border-gray-500");
|
|
76
|
+
this._overlay.classList.add("hidden");
|
|
77
|
+
if (domElement) {
|
|
78
|
+
domElement.appendChild(this._overlay);
|
|
79
|
+
}
|
|
80
|
+
const labelDiv = document.createElement("div");
|
|
81
|
+
labelDiv.className = "distance-label";
|
|
82
|
+
labelDiv.style.padding = "4px 8px";
|
|
83
|
+
labelDiv.style.background = "rgba(0, 0, 0, 0.8)";
|
|
84
|
+
labelDiv.style.border = "1px solid rgba(255, 255, 255, 0.3)";
|
|
85
|
+
labelDiv.style.borderRadius = "4px";
|
|
86
|
+
labelDiv.style.color = "#fff";
|
|
87
|
+
labelDiv.style.fontSize = "12px";
|
|
88
|
+
labelDiv.style.fontFamily = "monospace";
|
|
89
|
+
labelDiv.style.whiteSpace = "nowrap";
|
|
90
|
+
labelDiv.style.pointerEvents = "none";
|
|
91
|
+
labelDiv.style.userSelect = "none";
|
|
92
|
+
labelDiv.textContent = "0.00";
|
|
93
|
+
this._distanceLabel = new import_CSS2DRenderer.CSS2DObject(labelDiv);
|
|
94
|
+
this._distanceLabel.visible = false;
|
|
95
|
+
root.add(this._distanceLabel);
|
|
96
|
+
const angleLabelDiv = document.createElement("div");
|
|
97
|
+
angleLabelDiv.className = "rotation-angle-label";
|
|
98
|
+
angleLabelDiv.style.padding = "4px 8px";
|
|
99
|
+
angleLabelDiv.style.background = "rgba(0, 0, 0, 0.8)";
|
|
100
|
+
angleLabelDiv.style.border = "1px solid rgba(255, 255, 255, 0.3)";
|
|
101
|
+
angleLabelDiv.style.borderRadius = "4px";
|
|
102
|
+
angleLabelDiv.style.color = "#fff";
|
|
103
|
+
angleLabelDiv.style.fontSize = "12px";
|
|
104
|
+
angleLabelDiv.style.fontFamily = "monospace";
|
|
105
|
+
angleLabelDiv.style.whiteSpace = "nowrap";
|
|
106
|
+
angleLabelDiv.style.pointerEvents = "none";
|
|
107
|
+
angleLabelDiv.style.userSelect = "none";
|
|
108
|
+
angleLabelDiv.textContent = "0\xB0";
|
|
109
|
+
this._rotationAngleLabel = new import_CSS2DRenderer.CSS2DObject(angleLabelDiv);
|
|
110
|
+
this._rotationAngleLabel.visible = false;
|
|
111
|
+
root.add(this._rotationAngleLabel);
|
|
112
|
+
this._rotationArc = null;
|
|
113
|
+
function defineProperty(propName, defaultValue) {
|
|
114
|
+
let propValue = defaultValue;
|
|
115
|
+
Object.defineProperty(scope, propName, {
|
|
116
|
+
get: function() {
|
|
117
|
+
return propValue !== void 0 ? propValue : defaultValue;
|
|
118
|
+
},
|
|
119
|
+
set: function(value) {
|
|
120
|
+
if (propValue !== value) {
|
|
121
|
+
propValue = value;
|
|
122
|
+
plane[propName] = value;
|
|
123
|
+
gizmo[propName] = value;
|
|
124
|
+
scope.dispatchEvent({
|
|
125
|
+
type: propName + "-changed",
|
|
126
|
+
value
|
|
127
|
+
});
|
|
128
|
+
scope.dispatchEvent(_changeEvent);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
scope[propName] = defaultValue;
|
|
133
|
+
plane[propName] = defaultValue;
|
|
134
|
+
gizmo[propName] = defaultValue;
|
|
135
|
+
}
|
|
136
|
+
defineProperty("camera", camera);
|
|
137
|
+
defineProperty("object", void 0);
|
|
138
|
+
defineProperty("enabled", true);
|
|
139
|
+
defineProperty("axis", null);
|
|
140
|
+
defineProperty("mode", "all");
|
|
141
|
+
defineProperty("translationSnap", null);
|
|
142
|
+
defineProperty("rotationSnap", null);
|
|
143
|
+
defineProperty("scaleSnap", null);
|
|
144
|
+
defineProperty("space", "world");
|
|
145
|
+
defineProperty("size", 0.75);
|
|
146
|
+
defineProperty("dragging", false);
|
|
147
|
+
defineProperty("activeMode", "translate");
|
|
148
|
+
defineProperty("showX", true);
|
|
149
|
+
defineProperty("showY", true);
|
|
150
|
+
defineProperty("showZ", true);
|
|
151
|
+
defineProperty("minX", -Infinity);
|
|
152
|
+
defineProperty("maxX", Infinity);
|
|
153
|
+
defineProperty("minY", -Infinity);
|
|
154
|
+
defineProperty("maxY", Infinity);
|
|
155
|
+
defineProperty("minZ", -Infinity);
|
|
156
|
+
defineProperty("maxZ", Infinity);
|
|
157
|
+
defineProperty("minRotation", -2 * Math.PI);
|
|
158
|
+
defineProperty("maxRotation", 2 * Math.PI);
|
|
159
|
+
const worldPosition = new import_three.Vector3();
|
|
160
|
+
const worldPositionStart = new import_three.Vector3();
|
|
161
|
+
const worldQuaternion = new import_three.Quaternion();
|
|
162
|
+
const worldQuaternionStart = new import_three.Quaternion();
|
|
163
|
+
const cameraPosition = new import_three.Vector3();
|
|
164
|
+
const cameraQuaternion = new import_three.Quaternion();
|
|
165
|
+
const pointStart = new import_three.Vector3();
|
|
166
|
+
const pointEnd = new import_three.Vector3();
|
|
167
|
+
const rotationAxis = new import_three.Vector3();
|
|
168
|
+
const rotationAngle = 0;
|
|
169
|
+
const eye = new import_three.Vector3();
|
|
170
|
+
defineProperty("worldPosition", worldPosition);
|
|
171
|
+
defineProperty("worldPositionStart", worldPositionStart);
|
|
172
|
+
defineProperty("worldQuaternion", worldQuaternion);
|
|
173
|
+
defineProperty("worldQuaternionStart", worldQuaternionStart);
|
|
174
|
+
defineProperty("cameraPosition", cameraPosition);
|
|
175
|
+
defineProperty("cameraQuaternion", cameraQuaternion);
|
|
176
|
+
defineProperty("pointStart", pointStart);
|
|
177
|
+
defineProperty("pointEnd", pointEnd);
|
|
178
|
+
defineProperty("rotationAxis", rotationAxis);
|
|
179
|
+
defineProperty("rotationAngle", rotationAngle);
|
|
180
|
+
defineProperty("eye", eye);
|
|
181
|
+
this._offset = new import_three.Vector3();
|
|
182
|
+
this._startNorm = new import_three.Vector3();
|
|
183
|
+
this._endNorm = new import_three.Vector3();
|
|
184
|
+
this._cameraScale = new import_three.Vector3();
|
|
185
|
+
this._parentPosition = new import_three.Vector3();
|
|
186
|
+
this._parentQuaternion = new import_three.Quaternion();
|
|
187
|
+
this._parentQuaternionInv = new import_three.Quaternion();
|
|
188
|
+
this._parentScale = new import_three.Vector3();
|
|
189
|
+
this._worldScaleStart = new import_three.Vector3();
|
|
190
|
+
this._worldQuaternionInv = new import_three.Quaternion();
|
|
191
|
+
this._worldScale = new import_three.Vector3();
|
|
192
|
+
this._tempPosition = new import_three.Vector3();
|
|
193
|
+
this._positionStart = new import_three.Vector3();
|
|
194
|
+
this._quaternionStart = new import_three.Quaternion();
|
|
195
|
+
this._scaleStart = new import_three.Vector3();
|
|
196
|
+
this._getPointer = getPointer.bind(this);
|
|
197
|
+
this._onPointerDown = onPointerDown.bind(this);
|
|
198
|
+
this._onPointerHover = onPointerHover.bind(this);
|
|
199
|
+
this._onPointerMove = onPointerMove.bind(this);
|
|
200
|
+
this._onPointerUp = onPointerUp.bind(this);
|
|
201
|
+
if (domElement !== null) {
|
|
202
|
+
this.connect(domElement);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
connect(element) {
|
|
206
|
+
super.connect(element);
|
|
207
|
+
if (this.domElement?.parentNode) {
|
|
208
|
+
this.domElement.parentNode.appendChild(this._overlay);
|
|
209
|
+
}
|
|
210
|
+
this.domElement?.addEventListener("pointerdown", this._onPointerDown);
|
|
211
|
+
this.domElement?.addEventListener("pointermove", this._onPointerHover);
|
|
212
|
+
this.domElement?.addEventListener("pointerup", this._onPointerUp);
|
|
213
|
+
if (this.domElement) {
|
|
214
|
+
this.domElement.style.touchAction = "none";
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
disconnect() {
|
|
218
|
+
if (this._overlay.parentNode) {
|
|
219
|
+
this._overlay.parentNode.removeChild(this._overlay);
|
|
220
|
+
}
|
|
221
|
+
this.domElement?.removeEventListener("pointerdown", this._onPointerDown);
|
|
222
|
+
this.domElement?.removeEventListener("pointermove", this._onPointerHover);
|
|
223
|
+
this.domElement?.removeEventListener("pointermove", this._onPointerMove);
|
|
224
|
+
this.domElement?.removeEventListener("pointerup", this._onPointerUp);
|
|
225
|
+
if (this.domElement) {
|
|
226
|
+
this.domElement.style.touchAction = "auto";
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Returns the visual representation of the controls. Add the helper to your scene to
|
|
231
|
+
* visually transform the attached 3D object.
|
|
232
|
+
*
|
|
233
|
+
* @return {TransformControlsRoot} The helper.
|
|
234
|
+
*/
|
|
235
|
+
getHelper() {
|
|
236
|
+
return this._root;
|
|
237
|
+
}
|
|
238
|
+
pointerHover(pointer) {
|
|
239
|
+
if (this.object === void 0 || this.dragging === true) return;
|
|
240
|
+
if (pointer !== null) _raycaster.setFromCamera(pointer, this.camera);
|
|
241
|
+
let intersect = null;
|
|
242
|
+
if (this.mode === "all") {
|
|
243
|
+
intersect = intersectObjectWithRay(
|
|
244
|
+
this._gizmo.picker["scale"],
|
|
245
|
+
_raycaster
|
|
246
|
+
);
|
|
247
|
+
if (!intersect) {
|
|
248
|
+
intersect = intersectObjectWithRay(
|
|
249
|
+
this._gizmo.picker["rotate"],
|
|
250
|
+
_raycaster
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
if (!intersect) {
|
|
254
|
+
intersect = intersectObjectWithRay(
|
|
255
|
+
this._gizmo.picker["translate"],
|
|
256
|
+
_raycaster
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
intersect = intersectObjectWithRay(
|
|
261
|
+
this._gizmo.picker[this.mode],
|
|
262
|
+
_raycaster
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
if (intersect) {
|
|
266
|
+
this.axis = intersect.object.name;
|
|
267
|
+
} else {
|
|
268
|
+
this.axis = null;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
pointerDown(pointer) {
|
|
272
|
+
if (this.object === void 0 || this.dragging === true || pointer != null && pointer.button !== 0)
|
|
273
|
+
return;
|
|
274
|
+
if (this.axis !== null) {
|
|
275
|
+
if (pointer !== null) _raycaster.setFromCamera(pointer, this.camera);
|
|
276
|
+
if (this.mode === "all") {
|
|
277
|
+
let intersect = intersectObjectWithRay(
|
|
278
|
+
this._gizmo.picker["scale"],
|
|
279
|
+
_raycaster
|
|
280
|
+
);
|
|
281
|
+
if (intersect && intersect.object.name === this.axis) {
|
|
282
|
+
this.activeMode = "scale";
|
|
283
|
+
} else {
|
|
284
|
+
intersect = intersectObjectWithRay(
|
|
285
|
+
this._gizmo.picker["rotate"],
|
|
286
|
+
_raycaster
|
|
287
|
+
);
|
|
288
|
+
if (intersect && intersect.object.name === this.axis) {
|
|
289
|
+
this.activeMode = "rotate";
|
|
290
|
+
} else {
|
|
291
|
+
this.activeMode = "translate";
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
} else {
|
|
295
|
+
this.activeMode = this.mode;
|
|
296
|
+
}
|
|
297
|
+
const planeIntersect = intersectObjectWithRay(
|
|
298
|
+
this._plane,
|
|
299
|
+
_raycaster,
|
|
300
|
+
true
|
|
301
|
+
);
|
|
302
|
+
if (planeIntersect) {
|
|
303
|
+
this.object.updateMatrixWorld();
|
|
304
|
+
this.object.parent.updateMatrixWorld();
|
|
305
|
+
this._positionStart.copy(this.object.position);
|
|
306
|
+
this._quaternionStart.copy(this.object.quaternion);
|
|
307
|
+
this._scaleStart.copy(this.object.scale);
|
|
308
|
+
const boundingBoxCenter = calculateBoundingBoxCenter(this.object);
|
|
309
|
+
this.worldPositionStart.copy(boundingBoxCenter);
|
|
310
|
+
this.object.matrixWorld.decompose(
|
|
311
|
+
this._tempPosition,
|
|
312
|
+
// Use temporary variable for position
|
|
313
|
+
this.worldQuaternionStart,
|
|
314
|
+
this._worldScaleStart
|
|
315
|
+
);
|
|
316
|
+
this.pointStart.copy(planeIntersect.point).sub(this.worldPositionStart);
|
|
317
|
+
}
|
|
318
|
+
this.dragging = true;
|
|
319
|
+
_mouseDownEvent.mode = this.mode === "all" ? this.activeMode : this.mode;
|
|
320
|
+
this.dispatchEvent(_mouseDownEvent);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
pointerMove(pointer) {
|
|
324
|
+
const axis = this.axis;
|
|
325
|
+
const mode = this.mode === "all" ? this.activeMode : this.mode;
|
|
326
|
+
const object = this.object;
|
|
327
|
+
let space = this.space;
|
|
328
|
+
if (mode === "scale") {
|
|
329
|
+
space = "local";
|
|
330
|
+
} else if (axis === "E" || axis === "XYZE" || axis === "XYZ") {
|
|
331
|
+
space = "world";
|
|
332
|
+
}
|
|
333
|
+
if (object === void 0 || axis === null || this.dragging === false || pointer !== null && pointer.button !== -1) {
|
|
334
|
+
this._updateDistanceOverlay();
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
if (pointer !== null) _raycaster.setFromCamera(pointer, this.camera);
|
|
338
|
+
const planeIntersect = intersectObjectWithRay(this._plane, _raycaster, true);
|
|
339
|
+
if (!planeIntersect) return;
|
|
340
|
+
this.pointEnd.copy(planeIntersect.point).sub(this.worldPositionStart);
|
|
341
|
+
if (mode === "translate") {
|
|
342
|
+
this._offset.copy(this.pointEnd).sub(this.pointStart);
|
|
343
|
+
if (space === "local" && axis !== "XYZ") {
|
|
344
|
+
this._offset.applyQuaternion(this._worldQuaternionInv);
|
|
345
|
+
}
|
|
346
|
+
if (axis.indexOf("X") === -1) this._offset.x = 0;
|
|
347
|
+
if (axis.indexOf("Y") === -1) this._offset.y = 0;
|
|
348
|
+
if (axis.indexOf("Z") === -1) this._offset.z = 0;
|
|
349
|
+
if (space === "local" && axis !== "XYZ") {
|
|
350
|
+
this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale);
|
|
351
|
+
} else {
|
|
352
|
+
this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale);
|
|
353
|
+
}
|
|
354
|
+
object.position.copy(this._offset).add(this._positionStart);
|
|
355
|
+
if (this.translationSnap) {
|
|
356
|
+
if (space === "local") {
|
|
357
|
+
object.position.applyQuaternion(
|
|
358
|
+
_tempQuaternion.copy(this._quaternionStart).invert()
|
|
359
|
+
);
|
|
360
|
+
if (axis.search("X") !== -1) {
|
|
361
|
+
object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;
|
|
362
|
+
}
|
|
363
|
+
if (axis.search("Y") !== -1) {
|
|
364
|
+
object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;
|
|
365
|
+
}
|
|
366
|
+
if (axis.search("Z") !== -1) {
|
|
367
|
+
object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;
|
|
368
|
+
}
|
|
369
|
+
object.position.applyQuaternion(this._quaternionStart);
|
|
370
|
+
}
|
|
371
|
+
if (space === "world") {
|
|
372
|
+
if (object.parent) {
|
|
373
|
+
object.position.add(
|
|
374
|
+
_tempVector.setFromMatrixPosition(object.parent.matrixWorld)
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
if (axis.search("X") !== -1) {
|
|
378
|
+
object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;
|
|
379
|
+
}
|
|
380
|
+
if (axis.search("Y") !== -1) {
|
|
381
|
+
object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;
|
|
382
|
+
}
|
|
383
|
+
if (axis.search("Z") !== -1) {
|
|
384
|
+
object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;
|
|
385
|
+
}
|
|
386
|
+
if (object.parent) {
|
|
387
|
+
object.position.sub(
|
|
388
|
+
_tempVector.setFromMatrixPosition(object.parent.matrixWorld)
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
object.position.x = Math.max(
|
|
394
|
+
this.minX,
|
|
395
|
+
Math.min(this.maxX, object.position.x)
|
|
396
|
+
);
|
|
397
|
+
object.position.y = Math.max(
|
|
398
|
+
this.minY,
|
|
399
|
+
Math.min(this.maxY, object.position.y)
|
|
400
|
+
);
|
|
401
|
+
object.position.z = Math.max(
|
|
402
|
+
this.minZ,
|
|
403
|
+
Math.min(this.maxZ, object.position.z)
|
|
404
|
+
);
|
|
405
|
+
} else if (mode === "scale") {
|
|
406
|
+
if (axis.search("XYZ") !== -1) {
|
|
407
|
+
let d = this.pointEnd.length() / this.pointStart.length();
|
|
408
|
+
if (this.pointEnd.dot(this.pointStart) < 0) d *= -1;
|
|
409
|
+
_tempVector2.set(d, d, d);
|
|
410
|
+
} else {
|
|
411
|
+
_tempVector.copy(this.pointStart);
|
|
412
|
+
_tempVector2.copy(this.pointEnd);
|
|
413
|
+
_tempVector.applyQuaternion(this._worldQuaternionInv);
|
|
414
|
+
_tempVector2.applyQuaternion(this._worldQuaternionInv);
|
|
415
|
+
_tempVector2.divide(_tempVector);
|
|
416
|
+
if (axis.search("X") === -1) {
|
|
417
|
+
_tempVector2.x = 1;
|
|
418
|
+
}
|
|
419
|
+
if (axis.search("Y") === -1) {
|
|
420
|
+
_tempVector2.y = 1;
|
|
421
|
+
}
|
|
422
|
+
if (axis.search("Z") === -1) {
|
|
423
|
+
_tempVector2.z = 1;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
object.scale.copy(this._scaleStart).multiply(_tempVector2);
|
|
427
|
+
if (this.scaleSnap) {
|
|
428
|
+
if (axis.search("X") !== -1) {
|
|
429
|
+
object.scale.x = Math.round(object.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
|
430
|
+
}
|
|
431
|
+
if (axis.search("Y") !== -1) {
|
|
432
|
+
object.scale.y = Math.round(object.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
|
433
|
+
}
|
|
434
|
+
if (axis.search("Z") !== -1) {
|
|
435
|
+
object.scale.z = Math.round(object.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
} else if (mode === "rotate") {
|
|
439
|
+
this._offset.copy(this.pointEnd).sub(this.pointStart);
|
|
440
|
+
const ROTATION_SPEED = 20 / this.worldPosition.distanceTo(
|
|
441
|
+
_tempVector.setFromMatrixPosition(this.camera.matrixWorld)
|
|
442
|
+
);
|
|
443
|
+
let _inPlaneRotation = false;
|
|
444
|
+
if (axis === "XYZE") {
|
|
445
|
+
this.rotationAxis.copy(this._offset).cross(this.eye).normalize();
|
|
446
|
+
this.rotationAngle = this._offset.dot(
|
|
447
|
+
_tempVector.copy(this.rotationAxis).cross(this.eye)
|
|
448
|
+
) * ROTATION_SPEED;
|
|
449
|
+
} else if (axis === "X" || axis === "Y" || axis === "Z") {
|
|
450
|
+
this.rotationAxis.copy(_unit[axis]);
|
|
451
|
+
_tempVector.copy(_unit[axis]);
|
|
452
|
+
if (space === "local") {
|
|
453
|
+
_tempVector.applyQuaternion(this.worldQuaternion);
|
|
454
|
+
}
|
|
455
|
+
_tempVector.cross(this.eye);
|
|
456
|
+
if (_tempVector.length() === 0) {
|
|
457
|
+
_inPlaneRotation = true;
|
|
458
|
+
} else {
|
|
459
|
+
this.rotationAngle = this._offset.dot(_tempVector.normalize()) * ROTATION_SPEED;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
if (axis === "E" || _inPlaneRotation) {
|
|
463
|
+
this.rotationAxis.copy(this.eye);
|
|
464
|
+
this.rotationAngle = this.pointEnd.angleTo(this.pointStart);
|
|
465
|
+
this._startNorm.copy(this.pointStart).normalize();
|
|
466
|
+
this._endNorm.copy(this.pointEnd).normalize();
|
|
467
|
+
this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1;
|
|
468
|
+
}
|
|
469
|
+
if (this.rotationSnap)
|
|
470
|
+
this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap;
|
|
471
|
+
this.rotationAngle = Math.max(
|
|
472
|
+
this.minRotation,
|
|
473
|
+
Math.min(this.maxRotation, this.rotationAngle)
|
|
474
|
+
);
|
|
475
|
+
if (space === "local" && axis !== "E" && axis !== "XYZE") {
|
|
476
|
+
object.quaternion.copy(this._quaternionStart);
|
|
477
|
+
object.quaternion.multiply(
|
|
478
|
+
_tempQuaternion.setFromAxisAngle(
|
|
479
|
+
this.rotationAxis,
|
|
480
|
+
this.rotationAngle
|
|
481
|
+
)
|
|
482
|
+
).normalize();
|
|
483
|
+
} else {
|
|
484
|
+
this.rotationAxis.applyQuaternion(this._parentQuaternionInv);
|
|
485
|
+
object.quaternion.copy(
|
|
486
|
+
_tempQuaternion.setFromAxisAngle(
|
|
487
|
+
this.rotationAxis,
|
|
488
|
+
this.rotationAngle
|
|
489
|
+
)
|
|
490
|
+
);
|
|
491
|
+
object.quaternion.multiply(this._quaternionStart).normalize();
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
this.dispatchEvent(_changeEvent);
|
|
495
|
+
this.dispatchEvent(_objectChangeEvent);
|
|
496
|
+
this._updateDistanceOverlay();
|
|
497
|
+
}
|
|
498
|
+
pointerUp(pointer) {
|
|
499
|
+
if (pointer !== null && pointer.button !== 0) return;
|
|
500
|
+
if (this.dragging && this.axis !== null) {
|
|
501
|
+
_mouseUpEvent.mode = this.mode;
|
|
502
|
+
this.dispatchEvent(_mouseUpEvent);
|
|
503
|
+
}
|
|
504
|
+
this.dragging = false;
|
|
505
|
+
this.axis = null;
|
|
506
|
+
this._updateDistanceOverlay();
|
|
507
|
+
}
|
|
508
|
+
dispose() {
|
|
509
|
+
this.disconnect();
|
|
510
|
+
this._root.dispose();
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Sets the 3D object that should be transformed and ensures the controls UI is visible.
|
|
514
|
+
*
|
|
515
|
+
* @param {Object3D} object - The 3D object that should be transformed.
|
|
516
|
+
* @return {TransformControls} A reference to this controls.
|
|
517
|
+
*/
|
|
518
|
+
attach(object) {
|
|
519
|
+
this.object = object;
|
|
520
|
+
this._root.visible = true;
|
|
521
|
+
return this;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Removes the current 3D object from the controls and makes the helper UI invisible.
|
|
525
|
+
*
|
|
526
|
+
* @return {TransformControls} A reference to this controls.
|
|
527
|
+
*/
|
|
528
|
+
detach() {
|
|
529
|
+
this.object = void 0;
|
|
530
|
+
this.axis = null;
|
|
531
|
+
this._root.visible = false;
|
|
532
|
+
return this;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Resets the object's position, rotation and scale to when the current transform began.
|
|
536
|
+
*/
|
|
537
|
+
reset() {
|
|
538
|
+
if (!this.enabled) return;
|
|
539
|
+
if (this.dragging) {
|
|
540
|
+
this.object.position.copy(this._positionStart);
|
|
541
|
+
this.object.quaternion.copy(this._quaternionStart);
|
|
542
|
+
this.object.scale.copy(this._scaleStart);
|
|
543
|
+
this.dispatchEvent(_changeEvent);
|
|
544
|
+
this.dispatchEvent(_objectChangeEvent);
|
|
545
|
+
this.pointStart.copy(this.pointEnd);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Returns the raycaster that is used for user interaction. This object is shared between all
|
|
550
|
+
* instances of `TransformControls`.
|
|
551
|
+
*
|
|
552
|
+
* @returns {Raycaster} The internal raycaster.
|
|
553
|
+
*/
|
|
554
|
+
getRaycaster() {
|
|
555
|
+
return _raycaster;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Returns the transformation mode.
|
|
559
|
+
*
|
|
560
|
+
* @returns {'translate'|'rotate'|'scale'} The transformation mode.
|
|
561
|
+
*/
|
|
562
|
+
getMode() {
|
|
563
|
+
return this.mode;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Sets the given transformation mode.
|
|
567
|
+
*
|
|
568
|
+
* @param {'translate'|'rotate'|'scale'|'all'} mode - The transformation mode to set.
|
|
569
|
+
*/
|
|
570
|
+
setMode(mode) {
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Sets the translation snap.
|
|
574
|
+
*
|
|
575
|
+
* @param {?number} translationSnap - The translation snap to set.
|
|
576
|
+
*/
|
|
577
|
+
setTranslationSnap(translationSnap) {
|
|
578
|
+
this.translationSnap = translationSnap;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Sets the rotation snap.
|
|
582
|
+
*
|
|
583
|
+
* @param {?number} rotationSnap - The rotation snap to set.
|
|
584
|
+
*/
|
|
585
|
+
setRotationSnap(rotationSnap) {
|
|
586
|
+
this.rotationSnap = rotationSnap;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Sets the minimum rotation angle limit (in radians).
|
|
590
|
+
*
|
|
591
|
+
* @param {number} minRotation - The minimum rotation angle to set (in radians).
|
|
592
|
+
*/
|
|
593
|
+
setMinRotation(minRotation) {
|
|
594
|
+
this.minRotation = minRotation;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Sets the maximum rotation angle limit (in radians).
|
|
598
|
+
*
|
|
599
|
+
* @param {number} maxRotation - The maximum rotation angle to set (in radians).
|
|
600
|
+
*/
|
|
601
|
+
setMaxRotation(maxRotation) {
|
|
602
|
+
this.maxRotation = maxRotation;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Sets the scale snap.
|
|
606
|
+
*
|
|
607
|
+
* @param {?number} scaleSnap - The scale snap to set.
|
|
608
|
+
*/
|
|
609
|
+
setScaleSnap(scaleSnap) {
|
|
610
|
+
this.scaleSnap = scaleSnap;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Sets the size of the helper UI.
|
|
614
|
+
*
|
|
615
|
+
* @param {number} size - The size to set.
|
|
616
|
+
*/
|
|
617
|
+
setSize(size) {
|
|
618
|
+
this.size = size;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Sets the coordinate space in which transformations are applied.
|
|
622
|
+
*
|
|
623
|
+
* @param {'world'|'local'} space - The space to set.
|
|
624
|
+
*/
|
|
625
|
+
setSpace(space) {
|
|
626
|
+
this.space = space;
|
|
627
|
+
}
|
|
628
|
+
_updateDistanceOverlay() {
|
|
629
|
+
if (!this.object || !this.dragging) {
|
|
630
|
+
this._overlay.classList.add("hidden");
|
|
631
|
+
this._distanceLabel.visible = false;
|
|
632
|
+
this._rotationAngleLabel.visible = false;
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
if (this.mode === "translate" || this.mode === "all" && this.activeMode === "translate") {
|
|
636
|
+
const xDistance = this.object.position.x - this._positionStart.x;
|
|
637
|
+
const yDistance = this.object.position.y - this._positionStart.y;
|
|
638
|
+
const zDistance = this.object.position.z - this._positionStart.z;
|
|
639
|
+
const totalDistance = Math.sqrt(
|
|
640
|
+
xDistance * xDistance + yDistance * yDistance + zDistance * zDistance
|
|
641
|
+
);
|
|
642
|
+
const midPoint = new import_three.Vector3(
|
|
643
|
+
(this._positionStart.x + this.object.position.x) / 2,
|
|
644
|
+
(this._positionStart.y + this.object.position.y) / 2,
|
|
645
|
+
(this._positionStart.z + this.object.position.z) / 2
|
|
646
|
+
);
|
|
647
|
+
this._distanceLabel.position.copy(midPoint);
|
|
648
|
+
this._distanceLabel.visible = true;
|
|
649
|
+
this._rotationAngleLabel.visible = false;
|
|
650
|
+
this._distanceLabel.element.textContent = `${totalDistance.toFixed(3)}`;
|
|
651
|
+
this._overlay.textContent = `X: ${xDistance.toFixed(2)} Y: ${yDistance.toFixed(2)} Z: ${zDistance.toFixed(2)}`;
|
|
652
|
+
} else if (this.mode === "rotate" || this.mode === "all" && this.activeMode === "rotate") {
|
|
653
|
+
this._distanceLabel.visible = false;
|
|
654
|
+
const angleDegrees = this.rotationAngle * 180 / Math.PI;
|
|
655
|
+
const labelRadius = 0.55;
|
|
656
|
+
const labelAngle = this.rotationAngle / 2;
|
|
657
|
+
const labelPos = new import_three.Vector3();
|
|
658
|
+
if (this.axis === "X" || this.axis === "Y" || this.axis === "Z") {
|
|
659
|
+
const axisvec = _unit[this.axis];
|
|
660
|
+
const perpVector = new import_three.Vector3();
|
|
661
|
+
if (Math.abs(axisvec.dot(this.pointStart.clone().normalize())) > 0.99) {
|
|
662
|
+
perpVector.copy(this.eye).cross(axisvec).normalize();
|
|
663
|
+
} else {
|
|
664
|
+
perpVector.copy(this.pointStart).normalize();
|
|
665
|
+
}
|
|
666
|
+
const rotQuat = new import_three.Quaternion().setFromAxisAngle(axisvec, labelAngle);
|
|
667
|
+
perpVector.applyQuaternion(rotQuat);
|
|
668
|
+
if (this.space === "local") {
|
|
669
|
+
perpVector.applyQuaternion(this.worldQuaternion);
|
|
670
|
+
}
|
|
671
|
+
perpVector.multiplyScalar(labelRadius);
|
|
672
|
+
labelPos.copy(this.worldPosition).add(perpVector);
|
|
673
|
+
} else {
|
|
674
|
+
labelPos.copy(this.worldPosition);
|
|
675
|
+
const offsetDir = this.pointStart.clone().normalize();
|
|
676
|
+
if (this.space === "local") {
|
|
677
|
+
offsetDir.applyQuaternion(this.worldQuaternion);
|
|
678
|
+
}
|
|
679
|
+
offsetDir.multiplyScalar(labelRadius);
|
|
680
|
+
labelPos.add(offsetDir);
|
|
681
|
+
}
|
|
682
|
+
this._rotationAngleLabel.position.copy(labelPos);
|
|
683
|
+
this._rotationAngleLabel.visible = true;
|
|
684
|
+
this._rotationAngleLabel.element.textContent = `${Math.abs(angleDegrees).toFixed(1)}\xB0`;
|
|
685
|
+
this._overlay.textContent = `X: ${(this.object.rotation.x * (180 / Math.PI)).toFixed(2)}\xB0 Y: ${(this.object.rotation.y * (180 / Math.PI)).toFixed(2)}\xB0 Z: ${(this.object.rotation.z * (180 / Math.PI)).toFixed(2)}\xB0`;
|
|
686
|
+
} else if (this.mode === "scale") {
|
|
687
|
+
this._distanceLabel.visible = false;
|
|
688
|
+
this._rotationAngleLabel.visible = false;
|
|
689
|
+
this._overlay.textContent = `X: ${this.object.scale.x.toFixed(2)} Y: ${this.object.scale.y.toFixed(2)} Z: ${this.object.scale.z.toFixed(2)}`;
|
|
690
|
+
}
|
|
691
|
+
this._overlay.classList.remove("hidden");
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
function getPointer(event) {
|
|
695
|
+
if (this.domElement.ownerDocument.pointerLockElement) {
|
|
696
|
+
return {
|
|
697
|
+
x: 0,
|
|
698
|
+
y: 0,
|
|
699
|
+
button: event.button
|
|
700
|
+
};
|
|
701
|
+
} else {
|
|
702
|
+
const rect = this.domElement.getBoundingClientRect();
|
|
703
|
+
return {
|
|
704
|
+
x: (event.clientX - rect.left) / rect.width * 2 - 1,
|
|
705
|
+
y: -(event.clientY - rect.top) / rect.height * 2 + 1,
|
|
706
|
+
button: event.button
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
function onPointerHover(event) {
|
|
711
|
+
if (!this.enabled) return;
|
|
712
|
+
switch (event.pointerType) {
|
|
713
|
+
case "mouse":
|
|
714
|
+
case "pen":
|
|
715
|
+
this.pointerHover(this._getPointer(event));
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
function onPointerDown(event) {
|
|
720
|
+
if (!this.enabled) return;
|
|
721
|
+
if (!document.pointerLockElement) {
|
|
722
|
+
this.domElement.setPointerCapture(event.pointerId);
|
|
723
|
+
}
|
|
724
|
+
this.domElement.addEventListener("pointermove", this._onPointerMove);
|
|
725
|
+
this.pointerHover(this._getPointer(event));
|
|
726
|
+
this.pointerDown(this._getPointer(event));
|
|
727
|
+
}
|
|
728
|
+
function onPointerMove(event) {
|
|
729
|
+
if (!this.enabled) return;
|
|
730
|
+
this.pointerMove(this._getPointer(event));
|
|
731
|
+
}
|
|
732
|
+
function onPointerUp(event) {
|
|
733
|
+
if (!this.enabled) return;
|
|
734
|
+
this.domElement.releasePointerCapture(event.pointerId);
|
|
735
|
+
this.domElement.removeEventListener("pointermove", this._onPointerMove);
|
|
736
|
+
this.pointerUp(this._getPointer(event));
|
|
737
|
+
}
|
|
738
|
+
function intersectObjectWithRay(object, raycaster, includeInvisible) {
|
|
739
|
+
const allIntersections = raycaster.intersectObject(object, true);
|
|
740
|
+
for (let i = 0; i < allIntersections.length; i++) {
|
|
741
|
+
if (allIntersections[i].object.visible || includeInvisible) {
|
|
742
|
+
return allIntersections[i];
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
return false;
|
|
746
|
+
}
|
|
747
|
+
var _tempEuler = new import_three.Euler();
|
|
748
|
+
var _alignVector = new import_three.Vector3(0, 1, 0);
|
|
749
|
+
var _zeroVector = new import_three.Vector3(0, 0, 0);
|
|
750
|
+
var _lookAtMatrix = new import_three.Matrix4();
|
|
751
|
+
var _tempQuaternion2 = new import_three.Quaternion();
|
|
752
|
+
var _identityQuaternion = new import_three.Quaternion();
|
|
753
|
+
var _dirVector = new import_three.Vector3();
|
|
754
|
+
var _tempMatrix = new import_three.Matrix4();
|
|
755
|
+
var _unitX = new import_three.Vector3(1, 0, 0);
|
|
756
|
+
var _unitY = new import_three.Vector3(0, 1, 0);
|
|
757
|
+
var _unitZ = new import_three.Vector3(0, 0, 1);
|
|
758
|
+
var _v1 = new import_three.Vector3();
|
|
759
|
+
var _v2 = new import_three.Vector3();
|
|
760
|
+
var _v3 = new import_three.Vector3();
|
|
761
|
+
function calculateBoundingBoxCenter(object) {
|
|
762
|
+
const box = new import_three.Box3();
|
|
763
|
+
object.traverse((child) => {
|
|
764
|
+
if (child.isMesh && child.geometry) {
|
|
765
|
+
child.geometry.computeBoundingBox();
|
|
766
|
+
box.expandByObject(child);
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
if (box.isEmpty()) {
|
|
770
|
+
return object.getWorldPosition(new import_three.Vector3());
|
|
771
|
+
}
|
|
772
|
+
const center = new import_three.Vector3();
|
|
773
|
+
box.getCenter(center);
|
|
774
|
+
return center;
|
|
775
|
+
}
|
|
776
|
+
var TransformControlsRoot = class extends import_three.Object3D {
|
|
777
|
+
constructor(controls) {
|
|
778
|
+
super();
|
|
779
|
+
this.isTransformControlsRoot = true;
|
|
780
|
+
this.controls = controls;
|
|
781
|
+
this.visible = false;
|
|
782
|
+
}
|
|
783
|
+
// updateMatrixWorld updates key transformation variables
|
|
784
|
+
updateMatrixWorld(force) {
|
|
785
|
+
const controls = this.controls;
|
|
786
|
+
if (controls.object !== void 0) {
|
|
787
|
+
controls.object.updateMatrixWorld();
|
|
788
|
+
if (controls.object.parent === null) {
|
|
789
|
+
console.error(
|
|
790
|
+
"TransformControls: The attached 3D object must be a part of the scene graph."
|
|
791
|
+
);
|
|
792
|
+
} else {
|
|
793
|
+
controls.object.parent.matrixWorld.decompose(
|
|
794
|
+
controls._parentPosition,
|
|
795
|
+
controls._parentQuaternion,
|
|
796
|
+
controls._parentScale
|
|
797
|
+
);
|
|
798
|
+
}
|
|
799
|
+
const boundingBoxCenter = calculateBoundingBoxCenter(controls.object);
|
|
800
|
+
controls.worldPosition.copy(boundingBoxCenter);
|
|
801
|
+
controls.object.matrixWorld.decompose(
|
|
802
|
+
controls._tempPosition,
|
|
803
|
+
// Use temporary variable for position
|
|
804
|
+
controls.worldQuaternion,
|
|
805
|
+
controls._worldScale
|
|
806
|
+
);
|
|
807
|
+
controls._parentQuaternionInv.copy(controls._parentQuaternion).invert();
|
|
808
|
+
controls._worldQuaternionInv.copy(controls.worldQuaternion).invert();
|
|
809
|
+
}
|
|
810
|
+
controls.camera.updateMatrixWorld();
|
|
811
|
+
controls.camera.matrixWorld.decompose(
|
|
812
|
+
controls.cameraPosition,
|
|
813
|
+
controls.cameraQuaternion,
|
|
814
|
+
controls._cameraScale
|
|
815
|
+
);
|
|
816
|
+
if (controls.camera.isOrthographicCamera) {
|
|
817
|
+
controls.eye.copy(controls.cameraPosition).sub(controls.worldPosition).normalize();
|
|
818
|
+
} else {
|
|
819
|
+
controls.eye.copy(controls.cameraPosition).sub(controls.worldPosition).normalize();
|
|
820
|
+
}
|
|
821
|
+
super.updateMatrixWorld(force);
|
|
822
|
+
}
|
|
823
|
+
dispose() {
|
|
824
|
+
this.traverse(function(child) {
|
|
825
|
+
if (child.geometry) child.geometry.dispose();
|
|
826
|
+
if (child.material) child.material.dispose();
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
var TransformControlsGizmo = class extends import_three.Object3D {
|
|
831
|
+
constructor() {
|
|
832
|
+
super();
|
|
833
|
+
this.isTransformControlsGizmo = true;
|
|
834
|
+
this.type = "TransformControlsGizmo";
|
|
835
|
+
const gizmoMaterial = new import_three.MeshBasicMaterial({
|
|
836
|
+
depthTest: false,
|
|
837
|
+
depthWrite: false,
|
|
838
|
+
fog: false,
|
|
839
|
+
toneMapped: false,
|
|
840
|
+
transparent: true
|
|
841
|
+
});
|
|
842
|
+
const gizmoLineMaterial = new import_three.LineBasicMaterial({
|
|
843
|
+
depthTest: false,
|
|
844
|
+
depthWrite: false,
|
|
845
|
+
fog: false,
|
|
846
|
+
toneMapped: false,
|
|
847
|
+
transparent: true
|
|
848
|
+
});
|
|
849
|
+
const matInvisible = gizmoMaterial.clone();
|
|
850
|
+
matInvisible.opacity = 0.15;
|
|
851
|
+
const matHelper = gizmoLineMaterial.clone();
|
|
852
|
+
matHelper.opacity = 0.5;
|
|
853
|
+
const matRed = gizmoMaterial.clone();
|
|
854
|
+
matRed.color.setHex(15549272);
|
|
855
|
+
const matGreen = gizmoMaterial.clone();
|
|
856
|
+
matGreen.color.setHex(8571929);
|
|
857
|
+
const matBlue = gizmoMaterial.clone();
|
|
858
|
+
matBlue.color.setHex(3245547);
|
|
859
|
+
const matRedTransparent = gizmoMaterial.clone();
|
|
860
|
+
matRedTransparent.color.setHex(15549272);
|
|
861
|
+
matRedTransparent.opacity = 0.5;
|
|
862
|
+
const matGreenTransparent = gizmoMaterial.clone();
|
|
863
|
+
matGreenTransparent.color.setHex(8571929);
|
|
864
|
+
matGreenTransparent.opacity = 0.5;
|
|
865
|
+
const matBlueTransparent = gizmoMaterial.clone();
|
|
866
|
+
matBlueTransparent.color.setHex(3245547);
|
|
867
|
+
matBlueTransparent.opacity = 0.5;
|
|
868
|
+
const matWhiteTransparent = gizmoMaterial.clone();
|
|
869
|
+
matWhiteTransparent.opacity = 0.25;
|
|
870
|
+
const matYellowTransparent = gizmoMaterial.clone();
|
|
871
|
+
matYellowTransparent.color.setHex(16776960);
|
|
872
|
+
matYellowTransparent.opacity = 0.25;
|
|
873
|
+
const matYellow = gizmoMaterial.clone();
|
|
874
|
+
matYellow.color.setHex(16776960);
|
|
875
|
+
const matGray = gizmoMaterial.clone();
|
|
876
|
+
matGray.color.setHex(7895160);
|
|
877
|
+
const arrowGeometry = new import_three.CylinderGeometry(0, 0.04, 0.1, 12);
|
|
878
|
+
arrowGeometry.translate(0, 0.05, 0);
|
|
879
|
+
const scaleHandleGeometry = new import_three.BoxGeometry(0.08, 0.08, 0.08);
|
|
880
|
+
scaleHandleGeometry.translate(0, 0.04, 0);
|
|
881
|
+
const lineGeometry = new import_three.BufferGeometry();
|
|
882
|
+
lineGeometry.setAttribute(
|
|
883
|
+
"position",
|
|
884
|
+
new import_three.Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3)
|
|
885
|
+
);
|
|
886
|
+
const lineGeometry2 = new import_three.CylinderGeometry(0.02, 0.02, 0.5, 3);
|
|
887
|
+
lineGeometry2.translate(0, 0.25, 0);
|
|
888
|
+
function CircleGeometry(radius, arc) {
|
|
889
|
+
const geometry = new import_three.TorusGeometry(radius, 0.02, 3, 64, arc * Math.PI * 2);
|
|
890
|
+
geometry.rotateY(Math.PI / 2);
|
|
891
|
+
geometry.rotateX(Math.PI / 2);
|
|
892
|
+
return geometry;
|
|
893
|
+
}
|
|
894
|
+
function TranslateHelperGeometry() {
|
|
895
|
+
const geometry = new import_three.BufferGeometry();
|
|
896
|
+
geometry.setAttribute(
|
|
897
|
+
"position",
|
|
898
|
+
new import_three.Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3)
|
|
899
|
+
);
|
|
900
|
+
return geometry;
|
|
901
|
+
}
|
|
902
|
+
const gizmoTranslate = {
|
|
903
|
+
X: [
|
|
904
|
+
[new import_three.Mesh(arrowGeometry, matRed), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
905
|
+
[new import_three.Mesh(lineGeometry2, matRed), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
906
|
+
],
|
|
907
|
+
Y: [
|
|
908
|
+
[new import_three.Mesh(arrowGeometry, matGreen), [0, 0.5, 0]],
|
|
909
|
+
[new import_three.Mesh(lineGeometry2, matGreen)]
|
|
910
|
+
],
|
|
911
|
+
Z: [
|
|
912
|
+
[new import_three.Mesh(arrowGeometry, matBlue), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
913
|
+
[new import_three.Mesh(lineGeometry2, matBlue), null, [Math.PI / 2, 0, 0]]
|
|
914
|
+
]
|
|
915
|
+
};
|
|
916
|
+
const pickerTranslate = {
|
|
917
|
+
X: [
|
|
918
|
+
[
|
|
919
|
+
new import_three.Mesh(new import_three.CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
|
|
920
|
+
[0.3, 0, 0],
|
|
921
|
+
[0, 0, -Math.PI / 2]
|
|
922
|
+
],
|
|
923
|
+
[
|
|
924
|
+
new import_three.Mesh(new import_three.CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
|
|
925
|
+
[-0.3, 0, 0],
|
|
926
|
+
[0, 0, Math.PI / 2]
|
|
927
|
+
]
|
|
928
|
+
],
|
|
929
|
+
Y: [
|
|
930
|
+
[
|
|
931
|
+
new import_three.Mesh(new import_three.CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
|
|
932
|
+
[0, 0.3, 0]
|
|
933
|
+
],
|
|
934
|
+
[
|
|
935
|
+
new import_three.Mesh(new import_three.CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
|
|
936
|
+
[0, -0.3, 0],
|
|
937
|
+
[0, 0, Math.PI]
|
|
938
|
+
]
|
|
939
|
+
],
|
|
940
|
+
Z: [
|
|
941
|
+
[
|
|
942
|
+
new import_three.Mesh(new import_three.CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
|
|
943
|
+
[0, 0, 0.3],
|
|
944
|
+
[Math.PI / 2, 0, 0]
|
|
945
|
+
],
|
|
946
|
+
[
|
|
947
|
+
new import_three.Mesh(new import_three.CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
|
|
948
|
+
[0, 0, -0.3],
|
|
949
|
+
[-Math.PI / 2, 0, 0]
|
|
950
|
+
]
|
|
951
|
+
]
|
|
952
|
+
};
|
|
953
|
+
const helperTranslate = {
|
|
954
|
+
START: [
|
|
955
|
+
[
|
|
956
|
+
new import_three.Mesh(new import_three.OctahedronGeometry(0.01, 2), matHelper),
|
|
957
|
+
null,
|
|
958
|
+
null,
|
|
959
|
+
null,
|
|
960
|
+
"helper"
|
|
961
|
+
]
|
|
962
|
+
],
|
|
963
|
+
END: [
|
|
964
|
+
[
|
|
965
|
+
new import_three.Mesh(new import_three.OctahedronGeometry(0.01, 2), matHelper),
|
|
966
|
+
null,
|
|
967
|
+
null,
|
|
968
|
+
null,
|
|
969
|
+
"helper"
|
|
970
|
+
]
|
|
971
|
+
],
|
|
972
|
+
DELTA: [
|
|
973
|
+
[
|
|
974
|
+
new import_three.Line(TranslateHelperGeometry(), matHelper),
|
|
975
|
+
null,
|
|
976
|
+
null,
|
|
977
|
+
null,
|
|
978
|
+
"helper"
|
|
979
|
+
]
|
|
980
|
+
]
|
|
981
|
+
};
|
|
982
|
+
const gizmoRotate = {
|
|
983
|
+
X: [[new import_three.Mesh(CircleGeometry(0.45, 0.25), matRed)]],
|
|
984
|
+
Y: [
|
|
985
|
+
[
|
|
986
|
+
new import_three.Mesh(CircleGeometry(0.45, 0.25), matGreen),
|
|
987
|
+
null,
|
|
988
|
+
[0, 0, -Math.PI / 2]
|
|
989
|
+
]
|
|
990
|
+
],
|
|
991
|
+
Z: [
|
|
992
|
+
[
|
|
993
|
+
new import_three.Mesh(CircleGeometry(0.45, 0.25), matBlue),
|
|
994
|
+
null,
|
|
995
|
+
[0, Math.PI / 2, 0]
|
|
996
|
+
]
|
|
997
|
+
]
|
|
998
|
+
};
|
|
999
|
+
const helperRotate = {
|
|
1000
|
+
AXIS: [],
|
|
1001
|
+
START: [
|
|
1002
|
+
[new import_three.Line(lineGeometry.clone(), matHelper), null, null, null, "helper"]
|
|
1003
|
+
],
|
|
1004
|
+
END: [
|
|
1005
|
+
[new import_three.Line(lineGeometry.clone(), matHelper), null, null, null, "helper"]
|
|
1006
|
+
],
|
|
1007
|
+
ARC: [
|
|
1008
|
+
[new import_three.Line(new import_three.BufferGeometry(), matHelper), null, null, null, "helper"]
|
|
1009
|
+
]
|
|
1010
|
+
};
|
|
1011
|
+
const pickerRotate = {
|
|
1012
|
+
X: [[new import_three.Mesh(CircleGeometry(0.45, 0.25), matRed)]],
|
|
1013
|
+
Y: [
|
|
1014
|
+
[
|
|
1015
|
+
new import_three.Mesh(CircleGeometry(0.45, 0.25), matGreen),
|
|
1016
|
+
null,
|
|
1017
|
+
[0, 0, -Math.PI / 2]
|
|
1018
|
+
]
|
|
1019
|
+
],
|
|
1020
|
+
Z: [
|
|
1021
|
+
[
|
|
1022
|
+
new import_three.Mesh(CircleGeometry(0.45, 0.25), matBlue),
|
|
1023
|
+
null,
|
|
1024
|
+
[0, Math.PI / 2, 0]
|
|
1025
|
+
]
|
|
1026
|
+
]
|
|
1027
|
+
};
|
|
1028
|
+
const gizmoScale = {
|
|
1029
|
+
X: [
|
|
1030
|
+
[
|
|
1031
|
+
new import_three.Mesh(scaleHandleGeometry, matRed),
|
|
1032
|
+
[0.7, 0, 0],
|
|
1033
|
+
[0, 0, -Math.PI / 2]
|
|
1034
|
+
]
|
|
1035
|
+
],
|
|
1036
|
+
Y: [[new import_three.Mesh(scaleHandleGeometry, matGreen), [0, 0.7, 0]]],
|
|
1037
|
+
Z: [
|
|
1038
|
+
[
|
|
1039
|
+
new import_three.Mesh(scaleHandleGeometry, matBlue),
|
|
1040
|
+
[0, 0, 0.7],
|
|
1041
|
+
[Math.PI / 2, 0, 0]
|
|
1042
|
+
]
|
|
1043
|
+
]
|
|
1044
|
+
};
|
|
1045
|
+
const pickerScale = {
|
|
1046
|
+
X: [
|
|
1047
|
+
[
|
|
1048
|
+
new import_three.Mesh(new import_three.BoxGeometry(0.2, 0.2, 0.2), matInvisible),
|
|
1049
|
+
[0.7, 0, 0],
|
|
1050
|
+
[0, 0, -Math.PI / 2]
|
|
1051
|
+
]
|
|
1052
|
+
],
|
|
1053
|
+
Y: [
|
|
1054
|
+
[new import_three.Mesh(new import_three.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 0.7, 0]]
|
|
1055
|
+
],
|
|
1056
|
+
Z: [
|
|
1057
|
+
[
|
|
1058
|
+
new import_three.Mesh(new import_three.BoxGeometry(0.2, 0.2, 0.2), matInvisible),
|
|
1059
|
+
[0, 0, 0.7],
|
|
1060
|
+
[Math.PI / 2, 0, 0]
|
|
1061
|
+
]
|
|
1062
|
+
]
|
|
1063
|
+
};
|
|
1064
|
+
const helperScale = {
|
|
1065
|
+
X: [],
|
|
1066
|
+
Y: [],
|
|
1067
|
+
Z: []
|
|
1068
|
+
};
|
|
1069
|
+
function setupGizmo(gizmoMap) {
|
|
1070
|
+
const gizmo = new import_three.Object3D();
|
|
1071
|
+
for (const name in gizmoMap) {
|
|
1072
|
+
for (let i = gizmoMap[name].length; i--; ) {
|
|
1073
|
+
const object = gizmoMap[name][i][0].clone();
|
|
1074
|
+
object.userData.type = "gizmo";
|
|
1075
|
+
const position = gizmoMap[name][i][1];
|
|
1076
|
+
const rotation = gizmoMap[name][i][2];
|
|
1077
|
+
const scale = gizmoMap[name][i][3];
|
|
1078
|
+
const tag = gizmoMap[name][i][4];
|
|
1079
|
+
object.name = name;
|
|
1080
|
+
object.tag = tag;
|
|
1081
|
+
if (position) {
|
|
1082
|
+
object.position.set(position[0], position[1], position[2]);
|
|
1083
|
+
}
|
|
1084
|
+
if (rotation) {
|
|
1085
|
+
object.rotation.set(rotation[0], rotation[1], rotation[2]);
|
|
1086
|
+
}
|
|
1087
|
+
if (scale) {
|
|
1088
|
+
object.scale.set(scale[0], scale[1], scale[2]);
|
|
1089
|
+
}
|
|
1090
|
+
object.updateMatrix();
|
|
1091
|
+
const tempGeometry = object.geometry.clone();
|
|
1092
|
+
tempGeometry.applyMatrix4(object.matrix);
|
|
1093
|
+
object.geometry = tempGeometry;
|
|
1094
|
+
object.renderOrder = Infinity;
|
|
1095
|
+
object.position.set(0, 0, 0);
|
|
1096
|
+
object.rotation.set(0, 0, 0);
|
|
1097
|
+
object.scale.set(1, 1, 1);
|
|
1098
|
+
gizmo.add(object);
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
return gizmo;
|
|
1102
|
+
}
|
|
1103
|
+
this.gizmo = {};
|
|
1104
|
+
this.picker = {};
|
|
1105
|
+
this.helper = {};
|
|
1106
|
+
this.add(this.gizmo["translate"] = setupGizmo(gizmoTranslate));
|
|
1107
|
+
this.add(this.gizmo["rotate"] = setupGizmo(gizmoRotate));
|
|
1108
|
+
this.add(this.gizmo["scale"] = setupGizmo(gizmoScale));
|
|
1109
|
+
this.add(this.picker["translate"] = setupGizmo(pickerTranslate));
|
|
1110
|
+
this.add(this.picker["rotate"] = setupGizmo(pickerRotate));
|
|
1111
|
+
this.add(this.picker["scale"] = setupGizmo(pickerScale));
|
|
1112
|
+
this.add(this.helper["translate"] = setupGizmo(helperTranslate));
|
|
1113
|
+
this.add(this.helper["rotate"] = setupGizmo(helperRotate));
|
|
1114
|
+
this.add(this.helper["scale"] = setupGizmo(helperScale));
|
|
1115
|
+
this.picker["translate"].visible = false;
|
|
1116
|
+
this.picker["rotate"].visible = false;
|
|
1117
|
+
this.picker["scale"].visible = false;
|
|
1118
|
+
}
|
|
1119
|
+
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
1120
|
+
updateMatrixWorld(force) {
|
|
1121
|
+
const space = this.mode === "scale" ? "local" : this.space;
|
|
1122
|
+
const quaternion = space === "local" ? this.worldQuaternion : _identityQuaternion;
|
|
1123
|
+
if (this.mode === "all") {
|
|
1124
|
+
this.gizmo["translate"].visible = true;
|
|
1125
|
+
this.gizmo["rotate"].visible = true;
|
|
1126
|
+
this.gizmo["scale"].visible = true;
|
|
1127
|
+
this.helper["translate"].visible = true;
|
|
1128
|
+
this.helper["rotate"].visible = true;
|
|
1129
|
+
this.helper["scale"].visible = false;
|
|
1130
|
+
} else {
|
|
1131
|
+
this.gizmo["translate"].visible = this.mode === "translate";
|
|
1132
|
+
this.gizmo["rotate"].visible = this.mode === "rotate";
|
|
1133
|
+
this.gizmo["scale"].visible = this.mode === "scale";
|
|
1134
|
+
this.helper["translate"].visible = this.mode === "translate";
|
|
1135
|
+
this.helper["rotate"].visible = this.mode === "rotate";
|
|
1136
|
+
this.helper["scale"].visible = this.mode === "scale";
|
|
1137
|
+
}
|
|
1138
|
+
let handles = [];
|
|
1139
|
+
if (this.mode === "all") {
|
|
1140
|
+
handles = handles.concat(this.picker["translate"].children);
|
|
1141
|
+
handles = handles.concat(this.picker["rotate"].children);
|
|
1142
|
+
handles = handles.concat(this.picker["scale"].children);
|
|
1143
|
+
handles = handles.concat(this.gizmo["translate"].children);
|
|
1144
|
+
handles = handles.concat(this.gizmo["rotate"].children);
|
|
1145
|
+
handles = handles.concat(this.gizmo["scale"].children);
|
|
1146
|
+
handles = handles.concat(this.helper["translate"].children);
|
|
1147
|
+
handles = handles.concat(this.helper["rotate"].children);
|
|
1148
|
+
} else {
|
|
1149
|
+
handles = handles.concat(this.picker[this.mode].children);
|
|
1150
|
+
handles = handles.concat(this.gizmo[this.mode].children);
|
|
1151
|
+
handles = handles.concat(this.helper[this.mode].children);
|
|
1152
|
+
}
|
|
1153
|
+
for (let i = 0; i < handles.length; i++) {
|
|
1154
|
+
const handle = handles[i];
|
|
1155
|
+
handle.visible = true;
|
|
1156
|
+
handle.rotation.set(0, 0, 0);
|
|
1157
|
+
handle.position.copy(this.worldPosition);
|
|
1158
|
+
let factor;
|
|
1159
|
+
if (this.camera.isOrthographicCamera) {
|
|
1160
|
+
factor = (this.camera.top - this.camera.bottom) / this.camera.zoom;
|
|
1161
|
+
} else {
|
|
1162
|
+
factor = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(
|
|
1163
|
+
1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom,
|
|
1164
|
+
7
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
handle.scale.set(1, 1, 1).multiplyScalar(factor * this.size / 4);
|
|
1168
|
+
if (handle.tag === "helper") {
|
|
1169
|
+
handle.visible = false;
|
|
1170
|
+
if (handle.name === "AXIS") {
|
|
1171
|
+
handle.visible = !!this.axis;
|
|
1172
|
+
if (this.axis === "X") {
|
|
1173
|
+
_tempQuaternion.setFromEuler(_tempEuler.set(0, 0, 0));
|
|
1174
|
+
handle.quaternion.copy(quaternion).multiply(_tempQuaternion);
|
|
1175
|
+
if (Math.abs(
|
|
1176
|
+
_alignVector.copy(_unitX).applyQuaternion(quaternion).dot(this.eye)
|
|
1177
|
+
) > 0.9) {
|
|
1178
|
+
handle.visible = false;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
if (this.axis === "Y") {
|
|
1182
|
+
_tempQuaternion.setFromEuler(_tempEuler.set(0, 0, Math.PI / 2));
|
|
1183
|
+
handle.quaternion.copy(quaternion).multiply(_tempQuaternion);
|
|
1184
|
+
if (Math.abs(
|
|
1185
|
+
_alignVector.copy(_unitY).applyQuaternion(quaternion).dot(this.eye)
|
|
1186
|
+
) > 0.9) {
|
|
1187
|
+
handle.visible = false;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
if (this.axis === "Z") {
|
|
1191
|
+
_tempQuaternion.setFromEuler(_tempEuler.set(0, Math.PI / 2, 0));
|
|
1192
|
+
handle.quaternion.copy(quaternion).multiply(_tempQuaternion);
|
|
1193
|
+
if (Math.abs(
|
|
1194
|
+
_alignVector.copy(_unitZ).applyQuaternion(quaternion).dot(this.eye)
|
|
1195
|
+
) > 0.9) {
|
|
1196
|
+
handle.visible = false;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
if (this.axis === "XYZE") {
|
|
1200
|
+
_tempQuaternion.setFromEuler(_tempEuler.set(0, Math.PI / 2, 0));
|
|
1201
|
+
_alignVector.copy(this.rotationAxis);
|
|
1202
|
+
handle.quaternion.setFromRotationMatrix(
|
|
1203
|
+
_lookAtMatrix.lookAt(_zeroVector, _alignVector, _unitY)
|
|
1204
|
+
);
|
|
1205
|
+
handle.quaternion.multiply(_tempQuaternion);
|
|
1206
|
+
handle.visible = this.dragging;
|
|
1207
|
+
}
|
|
1208
|
+
if (this.axis === "E") {
|
|
1209
|
+
handle.visible = false;
|
|
1210
|
+
}
|
|
1211
|
+
} else if (handle.name === "START") {
|
|
1212
|
+
if (this.mode === "rotate" || this.mode === "all") {
|
|
1213
|
+
handle.position.copy(this.worldPosition);
|
|
1214
|
+
const isRotating = this.mode === "rotate" || this.mode === "all" && this.activeMode === "rotate";
|
|
1215
|
+
handle.visible = this.dragging && isRotating;
|
|
1216
|
+
if (handle.visible) {
|
|
1217
|
+
const rotSpace = this.space;
|
|
1218
|
+
if (rotSpace === "local") {
|
|
1219
|
+
handle.quaternion.copy(this.worldQuaternionStart);
|
|
1220
|
+
} else {
|
|
1221
|
+
handle.quaternion.copy(_identityQuaternion);
|
|
1222
|
+
}
|
|
1223
|
+
let rotAxis = new import_three.Vector3();
|
|
1224
|
+
if (this.axis === "X" || this.axis === "Y" || this.axis === "Z") {
|
|
1225
|
+
rotAxis.copy(_unit[this.axis]);
|
|
1226
|
+
} else if (this.axis === "E" || this.axis === "XYZE") {
|
|
1227
|
+
rotAxis.copy(this.rotationAxis);
|
|
1228
|
+
if (rotSpace === "local") {
|
|
1229
|
+
rotAxis.applyQuaternion(
|
|
1230
|
+
this.worldQuaternionStart.clone().invert()
|
|
1231
|
+
);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
let startPoint = this.pointStart.clone();
|
|
1235
|
+
if (rotSpace === "local") {
|
|
1236
|
+
startPoint.applyQuaternion(
|
|
1237
|
+
this.worldQuaternionStart.clone().invert()
|
|
1238
|
+
);
|
|
1239
|
+
}
|
|
1240
|
+
const dotProduct = startPoint.dot(rotAxis);
|
|
1241
|
+
startPoint.sub(rotAxis.clone().multiplyScalar(dotProduct));
|
|
1242
|
+
startPoint.normalize();
|
|
1243
|
+
startPoint.multiplyScalar(0.45);
|
|
1244
|
+
const startLineGeometry = new import_three.BufferGeometry();
|
|
1245
|
+
startLineGeometry.setAttribute(
|
|
1246
|
+
"position",
|
|
1247
|
+
new import_three.Float32BufferAttribute(
|
|
1248
|
+
[0, 0, 0, startPoint.x, startPoint.y, startPoint.z],
|
|
1249
|
+
3
|
|
1250
|
+
)
|
|
1251
|
+
);
|
|
1252
|
+
handle.geometry.dispose();
|
|
1253
|
+
handle.geometry = startLineGeometry;
|
|
1254
|
+
}
|
|
1255
|
+
} else {
|
|
1256
|
+
handle.position.copy(this.worldPositionStart);
|
|
1257
|
+
handle.visible = this.dragging && this.mode === "translate";
|
|
1258
|
+
}
|
|
1259
|
+
} else if (handle.name === "ARC") {
|
|
1260
|
+
const isRotating = this.mode === "rotate" || this.mode === "all" && this.activeMode === "rotate";
|
|
1261
|
+
handle.visible = this.dragging && isRotating;
|
|
1262
|
+
if (handle.visible && this.rotationAngle !== 0) {
|
|
1263
|
+
handle.position.copy(this.worldPosition);
|
|
1264
|
+
const rotSpace = this.space;
|
|
1265
|
+
if (rotSpace === "local") {
|
|
1266
|
+
handle.quaternion.copy(this.worldQuaternionStart);
|
|
1267
|
+
} else {
|
|
1268
|
+
handle.quaternion.copy(_identityQuaternion);
|
|
1269
|
+
}
|
|
1270
|
+
const arcRadius = 0.45;
|
|
1271
|
+
const segments = Math.max(
|
|
1272
|
+
8,
|
|
1273
|
+
Math.floor(Math.abs(this.rotationAngle) * 50)
|
|
1274
|
+
);
|
|
1275
|
+
const arcPoints = [];
|
|
1276
|
+
let rotAxis = new import_three.Vector3();
|
|
1277
|
+
if (this.axis === "X" || this.axis === "Y" || this.axis === "Z") {
|
|
1278
|
+
rotAxis.copy(_unit[this.axis]);
|
|
1279
|
+
if (rotSpace !== "local") {
|
|
1280
|
+
}
|
|
1281
|
+
} else if (this.axis === "E" || this.axis === "XYZE") {
|
|
1282
|
+
rotAxis.copy(this.rotationAxis);
|
|
1283
|
+
if (rotSpace === "local") {
|
|
1284
|
+
rotAxis.applyQuaternion(
|
|
1285
|
+
this.worldQuaternionStart.clone().invert()
|
|
1286
|
+
);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
let startDir = this.pointStart.clone();
|
|
1290
|
+
if (rotSpace === "local") {
|
|
1291
|
+
startDir.applyQuaternion(
|
|
1292
|
+
this.worldQuaternionStart.clone().invert()
|
|
1293
|
+
);
|
|
1294
|
+
}
|
|
1295
|
+
const dotProduct = startDir.dot(rotAxis);
|
|
1296
|
+
startDir.sub(rotAxis.clone().multiplyScalar(dotProduct));
|
|
1297
|
+
startDir.normalize();
|
|
1298
|
+
for (let j = 0; j <= segments; j++) {
|
|
1299
|
+
const angle = this.rotationAngle * j / segments;
|
|
1300
|
+
const point = startDir.clone();
|
|
1301
|
+
const arcQuat = new import_three.Quaternion().setFromAxisAngle(rotAxis, angle);
|
|
1302
|
+
point.applyQuaternion(arcQuat);
|
|
1303
|
+
point.multiplyScalar(arcRadius);
|
|
1304
|
+
arcPoints.push(point.x, point.y, point.z);
|
|
1305
|
+
}
|
|
1306
|
+
const arcGeometry = new import_three.BufferGeometry();
|
|
1307
|
+
arcGeometry.setAttribute(
|
|
1308
|
+
"position",
|
|
1309
|
+
new import_three.Float32BufferAttribute(arcPoints, 3)
|
|
1310
|
+
);
|
|
1311
|
+
handle.geometry.dispose();
|
|
1312
|
+
handle.geometry = arcGeometry;
|
|
1313
|
+
}
|
|
1314
|
+
} else if (handle.name === "END") {
|
|
1315
|
+
if (this.mode === "rotate" || this.mode === "all") {
|
|
1316
|
+
handle.position.copy(this.worldPosition);
|
|
1317
|
+
const isRotating = this.mode === "rotate" || this.mode === "all" && this.activeMode === "rotate";
|
|
1318
|
+
handle.visible = this.dragging && isRotating;
|
|
1319
|
+
if (handle.visible) {
|
|
1320
|
+
const rotSpace = this.space;
|
|
1321
|
+
if (rotSpace === "local") {
|
|
1322
|
+
handle.quaternion.copy(this.worldQuaternionStart);
|
|
1323
|
+
} else {
|
|
1324
|
+
handle.quaternion.copy(_identityQuaternion);
|
|
1325
|
+
}
|
|
1326
|
+
const endLineGeometry = new import_three.BufferGeometry();
|
|
1327
|
+
let rotAxis = new import_three.Vector3();
|
|
1328
|
+
if (this.axis === "X" || this.axis === "Y" || this.axis === "Z") {
|
|
1329
|
+
rotAxis.copy(_unit[this.axis]);
|
|
1330
|
+
} else if (this.axis === "E" || this.axis === "XYZE") {
|
|
1331
|
+
rotAxis.copy(this.rotationAxis);
|
|
1332
|
+
if (rotSpace === "local") {
|
|
1333
|
+
rotAxis.applyQuaternion(
|
|
1334
|
+
this.worldQuaternionStart.clone().invert()
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
let startDir = this.pointStart.clone();
|
|
1339
|
+
if (rotSpace === "local") {
|
|
1340
|
+
startDir.applyQuaternion(
|
|
1341
|
+
this.worldQuaternionStart.clone().invert()
|
|
1342
|
+
);
|
|
1343
|
+
}
|
|
1344
|
+
const dotProduct = startDir.dot(rotAxis);
|
|
1345
|
+
startDir.sub(rotAxis.clone().multiplyScalar(dotProduct));
|
|
1346
|
+
startDir.normalize();
|
|
1347
|
+
const endPoint = startDir.clone();
|
|
1348
|
+
const arcQuat = new import_three.Quaternion().setFromAxisAngle(
|
|
1349
|
+
rotAxis,
|
|
1350
|
+
this.rotationAngle
|
|
1351
|
+
);
|
|
1352
|
+
endPoint.applyQuaternion(arcQuat);
|
|
1353
|
+
endPoint.multiplyScalar(0.45);
|
|
1354
|
+
endLineGeometry.setAttribute(
|
|
1355
|
+
"position",
|
|
1356
|
+
new import_three.Float32BufferAttribute(
|
|
1357
|
+
[0, 0, 0, endPoint.x, endPoint.y, endPoint.z],
|
|
1358
|
+
3
|
|
1359
|
+
)
|
|
1360
|
+
);
|
|
1361
|
+
handle.geometry.dispose();
|
|
1362
|
+
handle.geometry = endLineGeometry;
|
|
1363
|
+
}
|
|
1364
|
+
} else {
|
|
1365
|
+
handle.position.copy(this.worldPosition);
|
|
1366
|
+
handle.visible = false;
|
|
1367
|
+
}
|
|
1368
|
+
} else if (handle.name === "DELTA") {
|
|
1369
|
+
handle.position.copy(this.worldPositionStart);
|
|
1370
|
+
handle.quaternion.copy(this.worldQuaternionStart);
|
|
1371
|
+
_tempVector.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1);
|
|
1372
|
+
_tempVector.applyQuaternion(
|
|
1373
|
+
this.worldQuaternionStart.clone().invert()
|
|
1374
|
+
);
|
|
1375
|
+
handle.scale.copy(_tempVector);
|
|
1376
|
+
handle.visible = this.dragging;
|
|
1377
|
+
} else {
|
|
1378
|
+
handle.quaternion.copy(quaternion);
|
|
1379
|
+
if (this.dragging) {
|
|
1380
|
+
handle.position.copy(this.worldPositionStart);
|
|
1381
|
+
} else {
|
|
1382
|
+
handle.position.copy(this.worldPosition);
|
|
1383
|
+
}
|
|
1384
|
+
if (this.axis) {
|
|
1385
|
+
handle.visible = this.axis.search(handle.name) !== -1;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
continue;
|
|
1389
|
+
}
|
|
1390
|
+
handle.quaternion.copy(quaternion);
|
|
1391
|
+
if (this.mode === "translate" || this.mode === "scale") {
|
|
1392
|
+
const AXIS_HIDE_THRESHOLD = 0.99;
|
|
1393
|
+
const PLANE_HIDE_THRESHOLD = 0.2;
|
|
1394
|
+
if (handle.name === "X") {
|
|
1395
|
+
if (Math.abs(
|
|
1396
|
+
_alignVector.copy(_unitX).applyQuaternion(quaternion).dot(this.eye)
|
|
1397
|
+
) > AXIS_HIDE_THRESHOLD) {
|
|
1398
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
1399
|
+
handle.visible = false;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
if (handle.name === "Y") {
|
|
1403
|
+
if (Math.abs(
|
|
1404
|
+
_alignVector.copy(_unitY).applyQuaternion(quaternion).dot(this.eye)
|
|
1405
|
+
) > AXIS_HIDE_THRESHOLD) {
|
|
1406
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
1407
|
+
handle.visible = false;
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
if (handle.name === "Z") {
|
|
1411
|
+
if (Math.abs(
|
|
1412
|
+
_alignVector.copy(_unitZ).applyQuaternion(quaternion).dot(this.eye)
|
|
1413
|
+
) > AXIS_HIDE_THRESHOLD) {
|
|
1414
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
1415
|
+
handle.visible = false;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
if (handle.name === "XY") {
|
|
1419
|
+
if (Math.abs(
|
|
1420
|
+
_alignVector.copy(_unitZ).applyQuaternion(quaternion).dot(this.eye)
|
|
1421
|
+
) < PLANE_HIDE_THRESHOLD) {
|
|
1422
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
1423
|
+
handle.visible = false;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
if (handle.name === "YZ") {
|
|
1427
|
+
if (Math.abs(
|
|
1428
|
+
_alignVector.copy(_unitX).applyQuaternion(quaternion).dot(this.eye)
|
|
1429
|
+
) < PLANE_HIDE_THRESHOLD) {
|
|
1430
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
1431
|
+
handle.visible = false;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
if (handle.name === "XZ") {
|
|
1435
|
+
if (Math.abs(
|
|
1436
|
+
_alignVector.copy(_unitY).applyQuaternion(quaternion).dot(this.eye)
|
|
1437
|
+
) < PLANE_HIDE_THRESHOLD) {
|
|
1438
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
1439
|
+
handle.visible = false;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
} else if (this.mode === "rotate") {
|
|
1443
|
+
_tempQuaternion2.copy(quaternion);
|
|
1444
|
+
_alignVector.copy(this.eye).applyQuaternion(_tempQuaternion.copy(quaternion).invert());
|
|
1445
|
+
if (handle.name.search("E") !== -1) {
|
|
1446
|
+
handle.quaternion.setFromRotationMatrix(
|
|
1447
|
+
_lookAtMatrix.lookAt(this.eye, _zeroVector, _unitY)
|
|
1448
|
+
);
|
|
1449
|
+
}
|
|
1450
|
+
if (handle.name === "X") {
|
|
1451
|
+
_tempQuaternion.setFromAxisAngle(
|
|
1452
|
+
_unitX,
|
|
1453
|
+
Math.atan2(-_alignVector.y, _alignVector.z)
|
|
1454
|
+
);
|
|
1455
|
+
_tempQuaternion.multiplyQuaternions(_tempQuaternion2, _tempQuaternion);
|
|
1456
|
+
handle.quaternion.copy(_tempQuaternion);
|
|
1457
|
+
}
|
|
1458
|
+
if (handle.name === "Y") {
|
|
1459
|
+
_tempQuaternion.setFromAxisAngle(
|
|
1460
|
+
_unitY,
|
|
1461
|
+
Math.atan2(_alignVector.x, _alignVector.z)
|
|
1462
|
+
);
|
|
1463
|
+
_tempQuaternion.multiplyQuaternions(_tempQuaternion2, _tempQuaternion);
|
|
1464
|
+
handle.quaternion.copy(_tempQuaternion);
|
|
1465
|
+
}
|
|
1466
|
+
if (handle.name === "Z") {
|
|
1467
|
+
_tempQuaternion.setFromAxisAngle(
|
|
1468
|
+
_unitZ,
|
|
1469
|
+
Math.atan2(_alignVector.y, _alignVector.x)
|
|
1470
|
+
);
|
|
1471
|
+
_tempQuaternion.multiplyQuaternions(_tempQuaternion2, _tempQuaternion);
|
|
1472
|
+
handle.quaternion.copy(_tempQuaternion);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
handle.visible = handle.visible && (handle.name.indexOf("X") === -1 || this.showX);
|
|
1476
|
+
handle.visible = handle.visible && (handle.name.indexOf("Y") === -1 || this.showY);
|
|
1477
|
+
handle.visible = handle.visible && (handle.name.indexOf("Z") === -1 || this.showZ);
|
|
1478
|
+
handle.visible = handle.visible && (handle.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ);
|
|
1479
|
+
handle.material._color = handle.material._color || handle.material.color.clone();
|
|
1480
|
+
handle.material._opacity = handle.material._opacity || handle.material.opacity;
|
|
1481
|
+
handle.material.color.copy(handle.material._color);
|
|
1482
|
+
handle.material.opacity = handle.material._opacity;
|
|
1483
|
+
if (this.dragging) {
|
|
1484
|
+
handle.material.opacity = 0.2;
|
|
1485
|
+
}
|
|
1486
|
+
if (this.enabled && this.axis) {
|
|
1487
|
+
if (handle.name === this.axis) {
|
|
1488
|
+
handle.material.color.setHex(16776960);
|
|
1489
|
+
if (!this.dragging) {
|
|
1490
|
+
handle.material.opacity = 1;
|
|
1491
|
+
}
|
|
1492
|
+
} else if (this.axis.split("").some(function(a) {
|
|
1493
|
+
return handle.name === a;
|
|
1494
|
+
})) {
|
|
1495
|
+
handle.material.color.setHex(16776960);
|
|
1496
|
+
if (!this.dragging) {
|
|
1497
|
+
handle.material.opacity = 1;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
super.updateMatrixWorld(force);
|
|
1503
|
+
}
|
|
1504
|
+
};
|
|
1505
|
+
var TransformControlsPlane = class extends import_three.Mesh {
|
|
1506
|
+
constructor() {
|
|
1507
|
+
super(
|
|
1508
|
+
new import_three.PlaneGeometry(1e5, 1e5, 2, 2),
|
|
1509
|
+
new import_three.MeshBasicMaterial({
|
|
1510
|
+
visible: false,
|
|
1511
|
+
wireframe: true,
|
|
1512
|
+
side: import_three.DoubleSide,
|
|
1513
|
+
transparent: true,
|
|
1514
|
+
opacity: 0.1,
|
|
1515
|
+
toneMapped: false
|
|
1516
|
+
})
|
|
1517
|
+
);
|
|
1518
|
+
this.isTransformControlsPlane = true;
|
|
1519
|
+
this.type = "TransformControlsPlane";
|
|
1520
|
+
}
|
|
1521
|
+
updateMatrixWorld(force) {
|
|
1522
|
+
let space = this.space;
|
|
1523
|
+
this.position.copy(this.worldPosition);
|
|
1524
|
+
if (this.mode === "scale") space = "local";
|
|
1525
|
+
_v1.copy(_unitX).applyQuaternion(
|
|
1526
|
+
space === "local" ? this.worldQuaternion : _identityQuaternion
|
|
1527
|
+
);
|
|
1528
|
+
_v2.copy(_unitY).applyQuaternion(
|
|
1529
|
+
space === "local" ? this.worldQuaternion : _identityQuaternion
|
|
1530
|
+
);
|
|
1531
|
+
_v3.copy(_unitZ).applyQuaternion(
|
|
1532
|
+
space === "local" ? this.worldQuaternion : _identityQuaternion
|
|
1533
|
+
);
|
|
1534
|
+
_alignVector.copy(_v2);
|
|
1535
|
+
switch (this.mode) {
|
|
1536
|
+
case "translate":
|
|
1537
|
+
case "scale":
|
|
1538
|
+
switch (this.axis) {
|
|
1539
|
+
case "X":
|
|
1540
|
+
_alignVector.copy(this.eye).cross(_v1);
|
|
1541
|
+
_dirVector.copy(_v1).cross(_alignVector);
|
|
1542
|
+
break;
|
|
1543
|
+
case "Y":
|
|
1544
|
+
_alignVector.copy(this.eye).cross(_v2);
|
|
1545
|
+
_dirVector.copy(_v2).cross(_alignVector);
|
|
1546
|
+
break;
|
|
1547
|
+
case "Z":
|
|
1548
|
+
_alignVector.copy(this.eye).cross(_v3);
|
|
1549
|
+
_dirVector.copy(_v3).cross(_alignVector);
|
|
1550
|
+
break;
|
|
1551
|
+
case "XY":
|
|
1552
|
+
_dirVector.copy(_v3);
|
|
1553
|
+
break;
|
|
1554
|
+
case "YZ":
|
|
1555
|
+
_dirVector.copy(_v1);
|
|
1556
|
+
break;
|
|
1557
|
+
case "XZ":
|
|
1558
|
+
_alignVector.copy(_v3);
|
|
1559
|
+
_dirVector.copy(_v2);
|
|
1560
|
+
break;
|
|
1561
|
+
case "XYZ":
|
|
1562
|
+
case "E":
|
|
1563
|
+
_dirVector.set(0, 0, 0);
|
|
1564
|
+
break;
|
|
1565
|
+
}
|
|
1566
|
+
break;
|
|
1567
|
+
case "rotate":
|
|
1568
|
+
default:
|
|
1569
|
+
_dirVector.set(0, 0, 0);
|
|
1570
|
+
}
|
|
1571
|
+
if (_dirVector.length() === 0) {
|
|
1572
|
+
this.quaternion.copy(this.cameraQuaternion);
|
|
1573
|
+
} else {
|
|
1574
|
+
_tempMatrix.lookAt(_tempVector.set(0, 0, 0), _dirVector, _alignVector);
|
|
1575
|
+
this.quaternion.setFromRotationMatrix(_tempMatrix);
|
|
1576
|
+
}
|
|
1577
|
+
super.updateMatrixWorld(force);
|
|
1578
|
+
}
|
|
1579
|
+
};
|
|
1580
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1581
|
+
0 && (module.exports = {
|
|
1582
|
+
TransformControls,
|
|
1583
|
+
TransformControlsGizmo,
|
|
1584
|
+
TransformControlsPlane,
|
|
1585
|
+
calculateBoundingBoxCenter
|
|
1586
|
+
});
|
|
1587
|
+
//# sourceMappingURL=index.cjs.map
|