@gui-chat-plugin/present3d 0.0.3 → 0.4.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/core.cjs +1 -1
- package/dist/core.js +2 -11
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -11
- package/dist/style.css +3 -1
- package/dist/toThreeJS-BE5vXH2S.cjs +4175 -0
- package/dist/toThreeJS-smhACxwN.js +16575 -0
- package/dist/vue.cjs +2 -2
- package/dist/vue.js +626 -720
- package/package.json +18 -18
- package/dist/index-B8W7aPbA.js +0 -27687
- package/dist/index-CIaq2DFf.cjs +0 -4175
package/dist/vue.js
CHANGED
|
@@ -1,714 +1,632 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
if (this._pointers[e] == t.pointerId) {
|
|
275
|
-
this._pointers.splice(e, 1);
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
_isTrackingPointer(t) {
|
|
280
|
-
for (let e = 0; e < this._pointers.length; e++)
|
|
281
|
-
if (this._pointers[e] == t.pointerId) return !0;
|
|
282
|
-
return !1;
|
|
283
|
-
}
|
|
284
|
-
_trackPointer(t) {
|
|
285
|
-
let e = this._pointerPositions[t.pointerId];
|
|
286
|
-
e === void 0 && (e = new y(), this._pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
|
|
287
|
-
}
|
|
288
|
-
_getSecondPointerPosition(t) {
|
|
289
|
-
const e = t.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
|
|
290
|
-
return this._pointerPositions[e];
|
|
291
|
-
}
|
|
292
|
-
//
|
|
293
|
-
_customWheelEvent(t) {
|
|
294
|
-
const e = t.deltaMode, s = {
|
|
295
|
-
clientX: t.clientX,
|
|
296
|
-
clientY: t.clientY,
|
|
297
|
-
deltaY: t.deltaY
|
|
298
|
-
};
|
|
299
|
-
switch (e) {
|
|
300
|
-
case 1:
|
|
301
|
-
s.deltaY *= 16;
|
|
302
|
-
break;
|
|
303
|
-
case 2:
|
|
304
|
-
s.deltaY *= 100;
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
return t.ctrlKey && !this._controlActive && (s.deltaY *= 10), s;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
function Ct(i) {
|
|
311
|
-
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(i.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(i) && (this._addPointer(i), i.pointerType === "touch" ? this._onTouchStart(i) : this._onMouseDown(i)));
|
|
1
|
+
import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, w as b, x, y as S } from "./toThreeJS-smhACxwN.js";
|
|
2
|
+
import { computed as C, createCommentVNode as ee, createElementBlock as w, createElementVNode as T, createTextVNode as E, defineComponent as D, nextTick as O, onMounted as k, onUnmounted as A, openBlock as j, ref as M, toDisplayString as N, vModelText as te, watch as P, withDirectives as ne } from "vue";
|
|
3
|
+
//#region node_modules/three/examples/jsm/controls/OrbitControls.js
|
|
4
|
+
var F = { type: "change" }, I = { type: "start" }, L = { type: "end" }, R = new m(), z = new a(), B = Math.cos(70 * u.DEG2RAD), V = new y(), H = 2 * Math.PI, U = {
|
|
5
|
+
NONE: -1,
|
|
6
|
+
ROTATE: 0,
|
|
7
|
+
DOLLY: 1,
|
|
8
|
+
PAN: 2,
|
|
9
|
+
TOUCH_ROTATE: 3,
|
|
10
|
+
TOUCH_PAN: 4,
|
|
11
|
+
TOUCH_DOLLY_PAN: 5,
|
|
12
|
+
TOUCH_DOLLY_ROTATE: 6
|
|
13
|
+
}, W = 1e-6, re = class extends n {
|
|
14
|
+
constructor(e, n = null) {
|
|
15
|
+
super(e, n), this.state = U.NONE, this.target = new y(), this.cursor = new y(), this.minDistance = 0, this.maxDistance = Infinity, this.minZoom = 0, this.maxZoom = Infinity, this.minTargetRadius = 0, this.maxTargetRadius = Infinity, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -Infinity, this.maxAzimuthAngle = Infinity, this.enableDamping = !1, this.dampingFactor = .05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = {
|
|
16
|
+
LEFT: "ArrowLeft",
|
|
17
|
+
UP: "ArrowUp",
|
|
18
|
+
RIGHT: "ArrowRight",
|
|
19
|
+
BOTTOM: "ArrowDown"
|
|
20
|
+
}, this.mouseButtons = {
|
|
21
|
+
LEFT: i.ROTATE,
|
|
22
|
+
MIDDLE: i.DOLLY,
|
|
23
|
+
RIGHT: i.PAN
|
|
24
|
+
}, this.touches = {
|
|
25
|
+
ONE: s.ROTATE,
|
|
26
|
+
TWO: s.DOLLY_PAN
|
|
27
|
+
}, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new y(), this._lastQuaternion = new o(), this._lastTargetPosition = new y(), this._quat = new o().setFromUnitVectors(e.up, new y(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new c(), this._sphericalDelta = new c(), this._scale = 1, this._panOffset = new y(), this._rotateStart = new t(), this._rotateEnd = new t(), this._rotateDelta = new t(), this._panStart = new t(), this._panEnd = new t(), this._panDelta = new t(), this._dollyStart = new t(), this._dollyEnd = new t(), this._dollyDelta = new t(), this._dollyDirection = new y(), this._mouse = new t(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = K.bind(this), this._onPointerDown = G.bind(this), this._onPointerUp = q.bind(this), this._onContextMenu = oe.bind(this), this._onMouseWheel = X.bind(this), this._onKeyDown = Z.bind(this), this._onTouchStart = ie.bind(this), this._onTouchMove = ae.bind(this), this._onMouseDown = J.bind(this), this._onMouseMove = Y.bind(this), this._interceptControlDown = se.bind(this), this._interceptControlUp = ce.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
28
|
+
}
|
|
29
|
+
connect(e) {
|
|
30
|
+
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, {
|
|
31
|
+
passive: !0,
|
|
32
|
+
capture: !0
|
|
33
|
+
}), this.domElement.style.touchAction = "none";
|
|
34
|
+
}
|
|
35
|
+
disconnect() {
|
|
36
|
+
this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointercancel", this._onPointerUp), this.domElement.removeEventListener("wheel", this._onMouseWheel), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.stopListenToKeyEvents(), this.domElement.getRootNode().removeEventListener("keydown", this._interceptControlDown, { capture: !0 }), this.domElement.style.touchAction = "auto";
|
|
37
|
+
}
|
|
38
|
+
dispose() {
|
|
39
|
+
this.disconnect();
|
|
40
|
+
}
|
|
41
|
+
getPolarAngle() {
|
|
42
|
+
return this._spherical.phi;
|
|
43
|
+
}
|
|
44
|
+
getAzimuthalAngle() {
|
|
45
|
+
return this._spherical.theta;
|
|
46
|
+
}
|
|
47
|
+
getDistance() {
|
|
48
|
+
return this.object.position.distanceTo(this.target);
|
|
49
|
+
}
|
|
50
|
+
listenToKeyEvents(e) {
|
|
51
|
+
e.addEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = e;
|
|
52
|
+
}
|
|
53
|
+
stopListenToKeyEvents() {
|
|
54
|
+
this._domElementKeyEvents !== null && (this._domElementKeyEvents.removeEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = null);
|
|
55
|
+
}
|
|
56
|
+
saveState() {
|
|
57
|
+
this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
|
|
58
|
+
}
|
|
59
|
+
reset() {
|
|
60
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(F), this.update(), this.state = U.NONE;
|
|
61
|
+
}
|
|
62
|
+
update(e = null) {
|
|
63
|
+
let t = this.object.position;
|
|
64
|
+
V.copy(t).sub(this.target), V.applyQuaternion(this._quat), this._spherical.setFromVector3(V), this.autoRotate && this.state === U.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
65
|
+
let n = this.minAzimuthAngle, r = this.maxAzimuthAngle;
|
|
66
|
+
isFinite(n) && isFinite(r) && (n < -Math.PI ? n += H : n > Math.PI && (n -= H), r < -Math.PI ? r += H : r > Math.PI && (r -= H), n <= r ? this._spherical.theta = Math.max(n, Math.min(r, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + r) / 2 ? Math.max(n, this._spherical.theta) : Math.min(r, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
|
|
67
|
+
let i = !1;
|
|
68
|
+
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera) this._spherical.radius = this._clampDistance(this._spherical.radius);
|
|
69
|
+
else {
|
|
70
|
+
let e = this._spherical.radius;
|
|
71
|
+
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), i = e != this._spherical.radius;
|
|
72
|
+
}
|
|
73
|
+
if (V.setFromSpherical(this._spherical), V.applyQuaternion(this._quatInverse), t.copy(this.target).add(V), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
|
|
74
|
+
let e = null;
|
|
75
|
+
if (this.object.isPerspectiveCamera) {
|
|
76
|
+
let t = V.length();
|
|
77
|
+
e = this._clampDistance(t * this._scale);
|
|
78
|
+
let n = t - e;
|
|
79
|
+
this.object.position.addScaledVector(this._dollyDirection, n), this.object.updateMatrixWorld(), i = !!n;
|
|
80
|
+
} else if (this.object.isOrthographicCamera) {
|
|
81
|
+
let t = new y(this._mouse.x, this._mouse.y, 0);
|
|
82
|
+
t.unproject(this.object);
|
|
83
|
+
let n = this.object.zoom;
|
|
84
|
+
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), i = n !== this.object.zoom;
|
|
85
|
+
let r = new y(this._mouse.x, this._mouse.y, 0);
|
|
86
|
+
r.unproject(this.object), this.object.position.sub(r).add(t), this.object.updateMatrixWorld(), e = V.length();
|
|
87
|
+
} else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
88
|
+
e !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position) : (R.origin.copy(this.object.position), R.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(R.direction)) < B ? this.object.lookAt(this.target) : (z.setFromNormalAndCoplanarPoint(this.object.up, this.target), R.intersectPlane(z, this.target))));
|
|
89
|
+
} else if (this.object.isOrthographicCamera) {
|
|
90
|
+
let e = this.object.zoom;
|
|
91
|
+
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), e !== this.object.zoom && (this.object.updateProjectionMatrix(), i = !0);
|
|
92
|
+
}
|
|
93
|
+
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > W || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > W || this._lastTargetPosition.distanceToSquared(this.target) > W ? (this.dispatchEvent(F), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
94
|
+
}
|
|
95
|
+
_getAutoRotationAngle(e) {
|
|
96
|
+
return e === null ? H / 60 / 60 * this.autoRotateSpeed : H / 60 * this.autoRotateSpeed * e;
|
|
97
|
+
}
|
|
98
|
+
_getZoomScale(e) {
|
|
99
|
+
let t = Math.abs(e * .01);
|
|
100
|
+
return .95 ** (this.zoomSpeed * t);
|
|
101
|
+
}
|
|
102
|
+
_rotateLeft(e) {
|
|
103
|
+
this._sphericalDelta.theta -= e;
|
|
104
|
+
}
|
|
105
|
+
_rotateUp(e) {
|
|
106
|
+
this._sphericalDelta.phi -= e;
|
|
107
|
+
}
|
|
108
|
+
_panLeft(e, t) {
|
|
109
|
+
V.setFromMatrixColumn(t, 0), V.multiplyScalar(-e), this._panOffset.add(V);
|
|
110
|
+
}
|
|
111
|
+
_panUp(e, t) {
|
|
112
|
+
this.screenSpacePanning === !0 ? V.setFromMatrixColumn(t, 1) : (V.setFromMatrixColumn(t, 0), V.crossVectors(this.object.up, V)), V.multiplyScalar(e), this._panOffset.add(V);
|
|
113
|
+
}
|
|
114
|
+
_pan(e, t) {
|
|
115
|
+
let n = this.domElement;
|
|
116
|
+
if (this.object.isPerspectiveCamera) {
|
|
117
|
+
let r = this.object.position;
|
|
118
|
+
V.copy(r).sub(this.target);
|
|
119
|
+
let i = V.length();
|
|
120
|
+
i *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * i / n.clientHeight, this.object.matrix), this._panUp(2 * t * i / n.clientHeight, this.object.matrix);
|
|
121
|
+
} else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / n.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / n.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
|
|
122
|
+
}
|
|
123
|
+
_dollyOut(e) {
|
|
124
|
+
this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
|
|
125
|
+
}
|
|
126
|
+
_dollyIn(e) {
|
|
127
|
+
this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale *= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
|
|
128
|
+
}
|
|
129
|
+
_updateZoomParameters(e, t) {
|
|
130
|
+
if (!this.zoomToCursor) return;
|
|
131
|
+
this._performCursorZoom = !0;
|
|
132
|
+
let n = this.domElement.getBoundingClientRect(), r = e - n.left, i = t - n.top, a = n.width, o = n.height;
|
|
133
|
+
this._mouse.x = r / a * 2 - 1, this._mouse.y = -(i / o) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
|
|
134
|
+
}
|
|
135
|
+
_clampDistance(e) {
|
|
136
|
+
return Math.max(this.minDistance, Math.min(this.maxDistance, e));
|
|
137
|
+
}
|
|
138
|
+
_handleMouseDownRotate(e) {
|
|
139
|
+
this._rotateStart.set(e.clientX, e.clientY);
|
|
140
|
+
}
|
|
141
|
+
_handleMouseDownDolly(e) {
|
|
142
|
+
this._updateZoomParameters(e.clientX, e.clientX), this._dollyStart.set(e.clientX, e.clientY);
|
|
143
|
+
}
|
|
144
|
+
_handleMouseDownPan(e) {
|
|
145
|
+
this._panStart.set(e.clientX, e.clientY);
|
|
146
|
+
}
|
|
147
|
+
_handleMouseMoveRotate(e) {
|
|
148
|
+
this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
149
|
+
let t = this.domElement;
|
|
150
|
+
this._rotateLeft(H * this._rotateDelta.x / t.clientHeight), this._rotateUp(H * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
|
|
151
|
+
}
|
|
152
|
+
_handleMouseMoveDolly(e) {
|
|
153
|
+
this._dollyEnd.set(e.clientX, e.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
|
|
154
|
+
}
|
|
155
|
+
_handleMouseMovePan(e) {
|
|
156
|
+
this._panEnd.set(e.clientX, e.clientY), this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd), this.update();
|
|
157
|
+
}
|
|
158
|
+
_handleMouseWheel(e) {
|
|
159
|
+
this._updateZoomParameters(e.clientX, e.clientY), e.deltaY < 0 ? this._dollyIn(this._getZoomScale(e.deltaY)) : e.deltaY > 0 && this._dollyOut(this._getZoomScale(e.deltaY)), this.update();
|
|
160
|
+
}
|
|
161
|
+
_handleKeyDown(e) {
|
|
162
|
+
let t = !1;
|
|
163
|
+
switch (e.code) {
|
|
164
|
+
case this.keys.UP:
|
|
165
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
|
|
166
|
+
break;
|
|
167
|
+
case this.keys.BOTTOM:
|
|
168
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
|
|
169
|
+
break;
|
|
170
|
+
case this.keys.LEFT:
|
|
171
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
|
|
172
|
+
break;
|
|
173
|
+
case this.keys.RIGHT:
|
|
174
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-H * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
t && (e.preventDefault(), this.update());
|
|
178
|
+
}
|
|
179
|
+
_handleTouchStartRotate(e) {
|
|
180
|
+
if (this._pointers.length === 1) this._rotateStart.set(e.pageX, e.pageY);
|
|
181
|
+
else {
|
|
182
|
+
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
183
|
+
this._rotateStart.set(n, r);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
_handleTouchStartPan(e) {
|
|
187
|
+
if (this._pointers.length === 1) this._panStart.set(e.pageX, e.pageY);
|
|
188
|
+
else {
|
|
189
|
+
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
190
|
+
this._panStart.set(n, r);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
_handleTouchStartDolly(e) {
|
|
194
|
+
let t = this._getSecondPointerPosition(e), n = e.pageX - t.x, r = e.pageY - t.y, i = Math.sqrt(n * n + r * r);
|
|
195
|
+
this._dollyStart.set(0, i);
|
|
196
|
+
}
|
|
197
|
+
_handleTouchStartDollyPan(e) {
|
|
198
|
+
this.enableZoom && this._handleTouchStartDolly(e), this.enablePan && this._handleTouchStartPan(e);
|
|
199
|
+
}
|
|
200
|
+
_handleTouchStartDollyRotate(e) {
|
|
201
|
+
this.enableZoom && this._handleTouchStartDolly(e), this.enableRotate && this._handleTouchStartRotate(e);
|
|
202
|
+
}
|
|
203
|
+
_handleTouchMoveRotate(e) {
|
|
204
|
+
if (this._pointers.length == 1) this._rotateEnd.set(e.pageX, e.pageY);
|
|
205
|
+
else {
|
|
206
|
+
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
207
|
+
this._rotateEnd.set(n, r);
|
|
208
|
+
}
|
|
209
|
+
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
210
|
+
let t = this.domElement;
|
|
211
|
+
this._rotateLeft(H * this._rotateDelta.x / t.clientHeight), this._rotateUp(H * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
|
|
212
|
+
}
|
|
213
|
+
_handleTouchMovePan(e) {
|
|
214
|
+
if (this._pointers.length === 1) this._panEnd.set(e.pageX, e.pageY);
|
|
215
|
+
else {
|
|
216
|
+
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
217
|
+
this._panEnd.set(n, r);
|
|
218
|
+
}
|
|
219
|
+
this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
|
|
220
|
+
}
|
|
221
|
+
_handleTouchMoveDolly(e) {
|
|
222
|
+
let t = this._getSecondPointerPosition(e), n = e.pageX - t.x, r = e.pageY - t.y, i = Math.sqrt(n * n + r * r);
|
|
223
|
+
this._dollyEnd.set(0, i), this._dollyDelta.set(0, (this._dollyEnd.y / this._dollyStart.y) ** +this.zoomSpeed), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
|
|
224
|
+
let a = (e.pageX + t.x) * .5, o = (e.pageY + t.y) * .5;
|
|
225
|
+
this._updateZoomParameters(a, o);
|
|
226
|
+
}
|
|
227
|
+
_handleTouchMoveDollyPan(e) {
|
|
228
|
+
this.enableZoom && this._handleTouchMoveDolly(e), this.enablePan && this._handleTouchMovePan(e);
|
|
229
|
+
}
|
|
230
|
+
_handleTouchMoveDollyRotate(e) {
|
|
231
|
+
this.enableZoom && this._handleTouchMoveDolly(e), this.enableRotate && this._handleTouchMoveRotate(e);
|
|
232
|
+
}
|
|
233
|
+
_addPointer(e) {
|
|
234
|
+
this._pointers.push(e.pointerId);
|
|
235
|
+
}
|
|
236
|
+
_removePointer(e) {
|
|
237
|
+
delete this._pointerPositions[e.pointerId];
|
|
238
|
+
for (let t = 0; t < this._pointers.length; t++) if (this._pointers[t] == e.pointerId) {
|
|
239
|
+
this._pointers.splice(t, 1);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
_isTrackingPointer(e) {
|
|
244
|
+
for (let t = 0; t < this._pointers.length; t++) if (this._pointers[t] == e.pointerId) return !0;
|
|
245
|
+
return !1;
|
|
246
|
+
}
|
|
247
|
+
_trackPointer(e) {
|
|
248
|
+
let n = this._pointerPositions[e.pointerId];
|
|
249
|
+
n === void 0 && (n = new t(), this._pointerPositions[e.pointerId] = n), n.set(e.pageX, e.pageY);
|
|
250
|
+
}
|
|
251
|
+
_getSecondPointerPosition(e) {
|
|
252
|
+
let t = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
|
|
253
|
+
return this._pointerPositions[t];
|
|
254
|
+
}
|
|
255
|
+
_customWheelEvent(e) {
|
|
256
|
+
let t = e.deltaMode, n = {
|
|
257
|
+
clientX: e.clientX,
|
|
258
|
+
clientY: e.clientY,
|
|
259
|
+
deltaY: e.deltaY
|
|
260
|
+
};
|
|
261
|
+
switch (t) {
|
|
262
|
+
case 1:
|
|
263
|
+
n.deltaY *= 16;
|
|
264
|
+
break;
|
|
265
|
+
case 2:
|
|
266
|
+
n.deltaY *= 100;
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
function G(e) {
|
|
273
|
+
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(e.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(e) && (this._addPointer(e), e.pointerType === "touch" ? this._onTouchStart(e) : this._onMouseDown(e)));
|
|
312
274
|
}
|
|
313
|
-
function
|
|
314
|
-
|
|
275
|
+
function K(e) {
|
|
276
|
+
this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
|
|
315
277
|
}
|
|
316
|
-
function
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
278
|
+
function q(e) {
|
|
279
|
+
switch (this._removePointer(e), this._pointers.length) {
|
|
280
|
+
case 0:
|
|
281
|
+
this.domElement.releasePointerCapture(e.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(L), this.state = U.NONE;
|
|
282
|
+
break;
|
|
283
|
+
case 1:
|
|
284
|
+
let t = this._pointers[0], n = this._pointerPositions[t];
|
|
285
|
+
this._onTouchStart({
|
|
286
|
+
pointerId: t,
|
|
287
|
+
pageX: n.x,
|
|
288
|
+
pageY: n.y
|
|
289
|
+
});
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
326
292
|
}
|
|
327
|
-
function
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}
|
|
368
|
-
this.state !== h.NONE && this.dispatchEvent(F);
|
|
293
|
+
function J(e) {
|
|
294
|
+
let t;
|
|
295
|
+
switch (e.button) {
|
|
296
|
+
case 0:
|
|
297
|
+
t = this.mouseButtons.LEFT;
|
|
298
|
+
break;
|
|
299
|
+
case 1:
|
|
300
|
+
t = this.mouseButtons.MIDDLE;
|
|
301
|
+
break;
|
|
302
|
+
case 2:
|
|
303
|
+
t = this.mouseButtons.RIGHT;
|
|
304
|
+
break;
|
|
305
|
+
default: t = -1;
|
|
306
|
+
}
|
|
307
|
+
switch (t) {
|
|
308
|
+
case i.DOLLY:
|
|
309
|
+
if (this.enableZoom === !1) return;
|
|
310
|
+
this._handleMouseDownDolly(e), this.state = U.DOLLY;
|
|
311
|
+
break;
|
|
312
|
+
case i.ROTATE:
|
|
313
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
314
|
+
if (this.enablePan === !1) return;
|
|
315
|
+
this._handleMouseDownPan(e), this.state = U.PAN;
|
|
316
|
+
} else {
|
|
317
|
+
if (this.enableRotate === !1) return;
|
|
318
|
+
this._handleMouseDownRotate(e), this.state = U.ROTATE;
|
|
319
|
+
}
|
|
320
|
+
break;
|
|
321
|
+
case i.PAN:
|
|
322
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
323
|
+
if (this.enableRotate === !1) return;
|
|
324
|
+
this._handleMouseDownRotate(e), this.state = U.ROTATE;
|
|
325
|
+
} else {
|
|
326
|
+
if (this.enablePan === !1) return;
|
|
327
|
+
this._handleMouseDownPan(e), this.state = U.PAN;
|
|
328
|
+
}
|
|
329
|
+
break;
|
|
330
|
+
default: this.state = U.NONE;
|
|
331
|
+
}
|
|
332
|
+
this.state !== U.NONE && this.dispatchEvent(I);
|
|
369
333
|
}
|
|
370
|
-
function
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
334
|
+
function Y(e) {
|
|
335
|
+
switch (this.state) {
|
|
336
|
+
case U.ROTATE:
|
|
337
|
+
if (this.enableRotate === !1) return;
|
|
338
|
+
this._handleMouseMoveRotate(e);
|
|
339
|
+
break;
|
|
340
|
+
case U.DOLLY:
|
|
341
|
+
if (this.enableZoom === !1) return;
|
|
342
|
+
this._handleMouseMoveDolly(e);
|
|
343
|
+
break;
|
|
344
|
+
case U.PAN:
|
|
345
|
+
if (this.enablePan === !1) return;
|
|
346
|
+
this._handleMouseMovePan(e);
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
385
349
|
}
|
|
386
|
-
function
|
|
387
|
-
|
|
350
|
+
function X(e) {
|
|
351
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== U.NONE || (e.preventDefault(), this.dispatchEvent(I), this._handleMouseWheel(this._customWheelEvent(e)), this.dispatchEvent(L));
|
|
388
352
|
}
|
|
389
|
-
function
|
|
390
|
-
|
|
353
|
+
function Z(e) {
|
|
354
|
+
this.enabled !== !1 && this._handleKeyDown(e);
|
|
391
355
|
}
|
|
392
|
-
function
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
this.state = h.NONE;
|
|
424
|
-
}
|
|
425
|
-
this.state !== h.NONE && this.dispatchEvent(F);
|
|
356
|
+
function ie(e) {
|
|
357
|
+
switch (this._trackPointer(e), this._pointers.length) {
|
|
358
|
+
case 1:
|
|
359
|
+
switch (this.touches.ONE) {
|
|
360
|
+
case s.ROTATE:
|
|
361
|
+
if (this.enableRotate === !1) return;
|
|
362
|
+
this._handleTouchStartRotate(e), this.state = U.TOUCH_ROTATE;
|
|
363
|
+
break;
|
|
364
|
+
case s.PAN:
|
|
365
|
+
if (this.enablePan === !1) return;
|
|
366
|
+
this._handleTouchStartPan(e), this.state = U.TOUCH_PAN;
|
|
367
|
+
break;
|
|
368
|
+
default: this.state = U.NONE;
|
|
369
|
+
}
|
|
370
|
+
break;
|
|
371
|
+
case 2:
|
|
372
|
+
switch (this.touches.TWO) {
|
|
373
|
+
case s.DOLLY_PAN:
|
|
374
|
+
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
375
|
+
this._handleTouchStartDollyPan(e), this.state = U.TOUCH_DOLLY_PAN;
|
|
376
|
+
break;
|
|
377
|
+
case s.DOLLY_ROTATE:
|
|
378
|
+
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
379
|
+
this._handleTouchStartDollyRotate(e), this.state = U.TOUCH_DOLLY_ROTATE;
|
|
380
|
+
break;
|
|
381
|
+
default: this.state = U.NONE;
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
384
|
+
default: this.state = U.NONE;
|
|
385
|
+
}
|
|
386
|
+
this.state !== U.NONE && this.dispatchEvent(I);
|
|
426
387
|
}
|
|
427
|
-
function
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
}
|
|
388
|
+
function ae(e) {
|
|
389
|
+
switch (this._trackPointer(e), this.state) {
|
|
390
|
+
case U.TOUCH_ROTATE:
|
|
391
|
+
if (this.enableRotate === !1) return;
|
|
392
|
+
this._handleTouchMoveRotate(e), this.update();
|
|
393
|
+
break;
|
|
394
|
+
case U.TOUCH_PAN:
|
|
395
|
+
if (this.enablePan === !1) return;
|
|
396
|
+
this._handleTouchMovePan(e), this.update();
|
|
397
|
+
break;
|
|
398
|
+
case U.TOUCH_DOLLY_PAN:
|
|
399
|
+
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
400
|
+
this._handleTouchMoveDollyPan(e), this.update();
|
|
401
|
+
break;
|
|
402
|
+
case U.TOUCH_DOLLY_ROTATE:
|
|
403
|
+
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
404
|
+
this._handleTouchMoveDollyRotate(e), this.update();
|
|
405
|
+
break;
|
|
406
|
+
default: this.state = U.NONE;
|
|
407
|
+
}
|
|
448
408
|
}
|
|
449
|
-
function
|
|
450
|
-
|
|
409
|
+
function oe(e) {
|
|
410
|
+
this.enabled !== !1 && e.preventDefault();
|
|
451
411
|
}
|
|
452
|
-
function
|
|
453
|
-
|
|
412
|
+
function se(e) {
|
|
413
|
+
e.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, {
|
|
414
|
+
passive: !0,
|
|
415
|
+
capture: !0
|
|
416
|
+
}));
|
|
454
417
|
}
|
|
455
|
-
function
|
|
456
|
-
|
|
418
|
+
function ce(e) {
|
|
419
|
+
e.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, {
|
|
420
|
+
passive: !0,
|
|
421
|
+
capture: !0
|
|
422
|
+
}));
|
|
457
423
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
() => {
|
|
665
|
-
m();
|
|
666
|
-
}
|
|
667
|
-
);
|
|
668
|
-
function S() {
|
|
669
|
-
if (s.value)
|
|
670
|
-
try {
|
|
671
|
-
o = new $(), o.background = new J(2763322);
|
|
672
|
-
const r = s.value.clientWidth || 200, P = s.value.clientHeight || 150;
|
|
673
|
-
n = new tt(50, r / P, 0.1, 1e3), n.position.set(4, 4, 8), n.lookAt(0, 0, 0), l = new et({ antialias: !0, alpha: !1 }), l.setSize(r, P), l.setPixelRatio(Math.min(window.devicePixelRatio, 2)), s.value.appendChild(l.domElement);
|
|
674
|
-
const E = new it(16777215, 0.6);
|
|
675
|
-
o.add(E);
|
|
676
|
-
const T = new st(16777215, 0.8);
|
|
677
|
-
if (T.position.set(5, 5, 5), o.add(T), !t.result.data?.script) return;
|
|
678
|
-
const D = z(t.result.data.script);
|
|
679
|
-
u = Y(D, { wireframe: !1 }), o.add(u), b();
|
|
680
|
-
} catch (r) {
|
|
681
|
-
console.error("Preview render error:", r);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
function b() {
|
|
685
|
-
p = requestAnimationFrame(b);
|
|
686
|
-
const r = Date.now() * 5e-4;
|
|
687
|
-
n.position.x = Math.cos(r) * 8, n.position.z = Math.sin(r) * 8, n.lookAt(0, 0, 0), l.render(o, n);
|
|
688
|
-
}
|
|
689
|
-
function m() {
|
|
690
|
-
if (!(!o || !t.result.data?.script))
|
|
691
|
-
try {
|
|
692
|
-
u && o.remove(u);
|
|
693
|
-
const r = z(t.result.data.script);
|
|
694
|
-
u = Y(r, { wireframe: !1 }), o.add(u);
|
|
695
|
-
} catch (r) {
|
|
696
|
-
console.error("Preview reload error:", r);
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
function g() {
|
|
700
|
-
p && cancelAnimationFrame(p), l && l.dispose();
|
|
701
|
-
}
|
|
702
|
-
return (r, P) => (K(), Z("div", Jt, [
|
|
703
|
-
_("div", {
|
|
704
|
-
ref_key: "previewViewport",
|
|
705
|
-
ref: s,
|
|
706
|
-
class: "preview-viewport"
|
|
707
|
-
}, null, 512),
|
|
708
|
-
_("div", te, C(e.value), 1)
|
|
709
|
-
]));
|
|
710
|
-
}
|
|
711
|
-
}), ie = /* @__PURE__ */ lt(ee, [["__scopeId", "data-v-75941188"]]), se = "present3D", oe = `Use the ${se} tool to create interactive 3D visualizations when the user requests:
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/vue/View.vue?vue&type=script&setup=true&lang.ts
|
|
426
|
+
var le = { class: "present3d-container" }, ue = { class: "header" }, de = { class: "controls" }, fe = { class: "material-icons" }, pe = { class: "material-icons" }, me = {
|
|
427
|
+
key: 0,
|
|
428
|
+
class: "error"
|
|
429
|
+
}, he = { class: "script-source" }, ge = ["disabled"], _e = /* @__PURE__ */ D({
|
|
430
|
+
__name: "View",
|
|
431
|
+
props: { selectedResult: {} },
|
|
432
|
+
emits: ["updateResult"],
|
|
433
|
+
setup(e, { emit: t }) {
|
|
434
|
+
let n = e, r = t, i = M(n.selectedResult.data?.script ?? ""), a = M(null), o = M(null), s = M(!1), c = M(!0), u = C(() => i.value !== n.selectedResult.data?.script), m, y, b, x, D, F, I = [], L = null, R = null;
|
|
435
|
+
k(() => {
|
|
436
|
+
z(), V(), H(), O(() => {
|
|
437
|
+
W();
|
|
438
|
+
});
|
|
439
|
+
}), A(() => {
|
|
440
|
+
X();
|
|
441
|
+
}), P(() => n.selectedResult.data?.script, () => {
|
|
442
|
+
V();
|
|
443
|
+
}), P(s, () => {
|
|
444
|
+
V();
|
|
445
|
+
}), P(c, (e) => {
|
|
446
|
+
F && (F.visible = e);
|
|
447
|
+
});
|
|
448
|
+
function z() {
|
|
449
|
+
if (!a.value) return;
|
|
450
|
+
m = new d(), m.background = new l(1710618);
|
|
451
|
+
let e = a.value.clientWidth, t = a.value.clientHeight;
|
|
452
|
+
y = new v(50, e / t, .1, 1e3), y.position.set(5, 5, 10), y.lookAt(0, 0, 0), b = new f({ antialias: !0 }), b.setSize(e, t), b.setPixelRatio(window.devicePixelRatio), a.value.appendChild(b.domElement), x = new re(y, b.domElement), x.enableDamping = !0, x.dampingFactor = .05, x.addEventListener("change", K);
|
|
453
|
+
let n = new h(16777215, .6);
|
|
454
|
+
m.add(n);
|
|
455
|
+
let r = new p(16777215, .8);
|
|
456
|
+
r.position.set(10, 10, 10), m.add(r), F = new g(20, 20, 4473924, 2236962), F.visible = c.value, m.add(F), window.addEventListener("resize", B), R = new ResizeObserver(() => {
|
|
457
|
+
B();
|
|
458
|
+
}), R.observe(a.value);
|
|
459
|
+
}
|
|
460
|
+
function B() {
|
|
461
|
+
if (!a.value) return;
|
|
462
|
+
let e = a.value.clientWidth, t = a.value.clientHeight;
|
|
463
|
+
y.aspect = e / t, y.updateProjectionMatrix(), b.setSize(e, t);
|
|
464
|
+
}
|
|
465
|
+
function V() {
|
|
466
|
+
try {
|
|
467
|
+
I.forEach((e) => m.remove(e)), I = [];
|
|
468
|
+
let e = n.selectedResult.data?.script;
|
|
469
|
+
if (!e) return;
|
|
470
|
+
let t = _(S(e), { wireframe: s.value });
|
|
471
|
+
m.add(t), I.push(t), o.value = null;
|
|
472
|
+
} catch (e) {
|
|
473
|
+
o.value = e instanceof Error ? e.message : "Unknown error", console.error("ShapeScript parse error:", e);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
function H() {
|
|
477
|
+
D = requestAnimationFrame(H), x.update(), b.render(m, y);
|
|
478
|
+
}
|
|
479
|
+
function U() {
|
|
480
|
+
y.position.set(5, 5, 10), y.lookAt(0, 0, 0), x.reset();
|
|
481
|
+
}
|
|
482
|
+
function W() {
|
|
483
|
+
if (!y || !x || !n.selectedResult?.viewState?.cameraState) return;
|
|
484
|
+
let e = n.selectedResult.viewState.cameraState;
|
|
485
|
+
e.position && y.position.set(e.position.x, e.position.y, e.position.z), e.target && x.target.set(e.target.x, e.target.y, e.target.z), y.updateProjectionMatrix(), x.update();
|
|
486
|
+
}
|
|
487
|
+
function G() {
|
|
488
|
+
return {
|
|
489
|
+
position: {
|
|
490
|
+
x: y.position.x,
|
|
491
|
+
y: y.position.y,
|
|
492
|
+
z: y.position.z
|
|
493
|
+
},
|
|
494
|
+
target: {
|
|
495
|
+
x: x.target.x,
|
|
496
|
+
y: x.target.y,
|
|
497
|
+
z: x.target.z
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
function K() {
|
|
502
|
+
L !== null && clearTimeout(L), L = window.setTimeout(() => {
|
|
503
|
+
q();
|
|
504
|
+
}, 500);
|
|
505
|
+
}
|
|
506
|
+
function q() {
|
|
507
|
+
r("updateResult", {
|
|
508
|
+
...n.selectedResult,
|
|
509
|
+
viewState: { cameraState: G() }
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
function J() {
|
|
513
|
+
s.value = !s.value;
|
|
514
|
+
}
|
|
515
|
+
function Y() {
|
|
516
|
+
c.value = !c.value;
|
|
517
|
+
}
|
|
518
|
+
function X() {
|
|
519
|
+
L !== null && clearTimeout(L), D && cancelAnimationFrame(D), b && b.dispose(), x && (x.removeEventListener("change", K), x.dispose()), R && R.disconnect(), window.removeEventListener("resize", B);
|
|
520
|
+
}
|
|
521
|
+
function Z() {}
|
|
522
|
+
function ie() {
|
|
523
|
+
try {
|
|
524
|
+
S(i.value), r("updateResult", {
|
|
525
|
+
...n.selectedResult,
|
|
526
|
+
data: { script: i.value }
|
|
527
|
+
});
|
|
528
|
+
} catch (e) {
|
|
529
|
+
o.value = e instanceof Error ? e.message : "Invalid ShapeScript", console.error("Script validation failed:", e);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return P(() => n.selectedResult.data?.script, (e) => {
|
|
533
|
+
e && (i.value = e);
|
|
534
|
+
}), P(() => n.selectedResult, () => {
|
|
535
|
+
O(() => {
|
|
536
|
+
W();
|
|
537
|
+
});
|
|
538
|
+
}), (t, n) => (j(), w("div", le, [
|
|
539
|
+
T("div", ue, [T("h1", null, N(e.selectedResult.title || "3D Visualization"), 1), T("div", de, [
|
|
540
|
+
T("button", {
|
|
541
|
+
onClick: U,
|
|
542
|
+
class: "control-btn"
|
|
543
|
+
}, [...n[1] ||= [T("span", { class: "material-icons" }, "refresh", -1), E(" Reset Camera ", -1)]]),
|
|
544
|
+
T("button", {
|
|
545
|
+
onClick: J,
|
|
546
|
+
class: "control-btn"
|
|
547
|
+
}, [T("span", fe, N(s.value ? "grid_off" : "grid_on"), 1), n[2] ||= E(" Wireframe ", -1)]),
|
|
548
|
+
T("button", {
|
|
549
|
+
onClick: Y,
|
|
550
|
+
class: "control-btn"
|
|
551
|
+
}, [T("span", pe, N(c.value ? "visibility_off" : "visibility"), 1), n[3] ||= E(" Grid ", -1)])
|
|
552
|
+
])]),
|
|
553
|
+
o.value ? (j(), w("div", me, [n[4] ||= T("strong", null, "Parse Error:", -1), E(" " + N(o.value), 1)])) : ee("", !0),
|
|
554
|
+
T("div", {
|
|
555
|
+
class: "viewport",
|
|
556
|
+
ref_key: "viewport",
|
|
557
|
+
ref: a
|
|
558
|
+
}, null, 512),
|
|
559
|
+
T("details", he, [
|
|
560
|
+
n[5] ||= T("summary", null, "Edit ShapeScript Source", -1),
|
|
561
|
+
ne(T("textarea", {
|
|
562
|
+
"onUpdate:modelValue": n[0] ||= (e) => i.value = e,
|
|
563
|
+
onInput: Z,
|
|
564
|
+
class: "script-editor",
|
|
565
|
+
spellcheck: "false"
|
|
566
|
+
}, null, 544), [[te, i.value]]),
|
|
567
|
+
T("button", {
|
|
568
|
+
onClick: ie,
|
|
569
|
+
class: "apply-btn",
|
|
570
|
+
disabled: !u.value
|
|
571
|
+
}, " Apply Changes ", 8, ge)
|
|
572
|
+
])
|
|
573
|
+
]));
|
|
574
|
+
}
|
|
575
|
+
}), Q = (e, t) => {
|
|
576
|
+
let n = e.__vccOpts || e;
|
|
577
|
+
for (let [e, r] of t) n[e] = r;
|
|
578
|
+
return n;
|
|
579
|
+
}, ve = /* @__PURE__ */ Q(_e, [["__scopeId", "data-v-daa337a0"]]), ye = { class: "preview-container" }, be = { class: "preview-title" }, xe = /* @__PURE__ */ Q(/* @__PURE__ */ D({
|
|
580
|
+
__name: "Preview",
|
|
581
|
+
props: { result: {} },
|
|
582
|
+
setup(e) {
|
|
583
|
+
let t = e, n = C(() => t.result.title || "3D Visualization"), r = M(null), i, a, o, s, c = null;
|
|
584
|
+
k(() => {
|
|
585
|
+
u();
|
|
586
|
+
}), A(() => {
|
|
587
|
+
y();
|
|
588
|
+
}), P(() => t.result.data?.script, () => {
|
|
589
|
+
g();
|
|
590
|
+
});
|
|
591
|
+
function u() {
|
|
592
|
+
if (r.value) try {
|
|
593
|
+
i = new d(), i.background = new l(2763322);
|
|
594
|
+
let e = r.value.clientWidth || 200, n = r.value.clientHeight || 150;
|
|
595
|
+
a = new v(50, e / n, .1, 1e3), a.position.set(4, 4, 8), a.lookAt(0, 0, 0), o = new f({
|
|
596
|
+
antialias: !0,
|
|
597
|
+
alpha: !1
|
|
598
|
+
}), o.setSize(e, n), o.setPixelRatio(Math.min(window.devicePixelRatio, 2)), r.value.appendChild(o.domElement);
|
|
599
|
+
let s = new h(16777215, .6);
|
|
600
|
+
i.add(s);
|
|
601
|
+
let u = new p(16777215, .8);
|
|
602
|
+
if (u.position.set(5, 5, 5), i.add(u), !t.result.data?.script) return;
|
|
603
|
+
c = _(S(t.result.data.script), { wireframe: !1 }), i.add(c), m();
|
|
604
|
+
} catch (e) {
|
|
605
|
+
console.error("Preview render error:", e);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
function m() {
|
|
609
|
+
s = requestAnimationFrame(m);
|
|
610
|
+
let e = Date.now() * 5e-4;
|
|
611
|
+
a.position.x = Math.cos(e) * 8, a.position.z = Math.sin(e) * 8, a.lookAt(0, 0, 0), o.render(i, a);
|
|
612
|
+
}
|
|
613
|
+
function g() {
|
|
614
|
+
if (!(!i || !t.result.data?.script)) try {
|
|
615
|
+
c && i.remove(c), c = _(S(t.result.data.script), { wireframe: !1 }), i.add(c);
|
|
616
|
+
} catch (e) {
|
|
617
|
+
console.error("Preview reload error:", e);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
function y() {
|
|
621
|
+
s && cancelAnimationFrame(s), o && o.dispose();
|
|
622
|
+
}
|
|
623
|
+
return (e, t) => (j(), w("div", ye, [T("div", {
|
|
624
|
+
ref_key: "previewViewport",
|
|
625
|
+
ref: r,
|
|
626
|
+
class: "preview-viewport"
|
|
627
|
+
}, null, 512), T("div", be, N(n.value), 1)]));
|
|
628
|
+
}
|
|
629
|
+
}), [["__scopeId", "data-v-75941188"]]), Se = "present3D", Ce = `Use the ${Se} tool to create interactive 3D visualizations when the user requests:
|
|
712
630
|
- 3D models or shapes
|
|
713
631
|
- Mathematical visualizations (surfaces, functions, geometric patterns)
|
|
714
632
|
- Molecular or atomic structures
|
|
@@ -789,24 +707,12 @@ Shapes: cube, sphere, cylinder, cone, torus
|
|
|
789
707
|
CSG: union, difference, intersection, xor, stencil
|
|
790
708
|
Properties: position, rotation, size, color, opacity
|
|
791
709
|
|
|
792
|
-
Keep visualizations clear, well-organized, and leverage the full power of expressions and control flow.`,
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
},
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
oe as SYSTEM_PROMPT,
|
|
802
|
-
pe as TOOL_DEFINITION,
|
|
803
|
-
se as TOOL_NAME,
|
|
804
|
-
$t as View,
|
|
805
|
-
Y as astToThreeJS,
|
|
806
|
-
he as default,
|
|
807
|
-
de as executePresent3D,
|
|
808
|
-
z as parseShapeScript,
|
|
809
|
-
ae as plugin,
|
|
810
|
-
Tt as pluginCore,
|
|
811
|
-
St as samples
|
|
812
|
-
};
|
|
710
|
+
Keep visualizations clear, well-organized, and leverage the full power of expressions and control flow.`, $ = {
|
|
711
|
+
...e,
|
|
712
|
+
viewComponent: ve,
|
|
713
|
+
previewComponent: xe,
|
|
714
|
+
samples: r,
|
|
715
|
+
systemPrompt: Ce
|
|
716
|
+
}, we = { plugin: $ };
|
|
717
|
+
//#endregion
|
|
718
|
+
export { xe as Preview, Ce as SYSTEM_PROMPT, b as TOOL_DEFINITION, Se as TOOL_NAME, ve as View, _ as astToThreeJS, we as default, x as executePresent3D, S as parseShapeScript, $ as plugin, e as pluginCore, r as samples };
|