@tresjs/leches 0.6.0 → 0.7.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/style.css +1 -1
- package/dist/tresleches.js +401 -1080
- package/dist/tresleches.umd.cjs +2 -6
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/is.d.ts +10 -0
- package/dist/utils/normalize.d.ts +6 -3
- package/package.json +14 -17
package/dist/tresleches.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/leches
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.7.0
|
|
4
4
|
* (c) 2023
|
|
5
5
|
* description: Tasty GUI for Vue controls 🍰
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
7
|
*/
|
|
8
|
-
import { unref as
|
|
9
|
-
import { useStorage as
|
|
10
|
-
function
|
|
11
|
-
return
|
|
8
|
+
import { unref as D, getCurrentScope as ne, onScopeDispose as oe, toRef as le, readonly as ae, customRef as se, ref as g, defineComponent as w, computed as I, reactive as H, h as re, watch as T, provide as ue, isReactive as ie, toRefs as ce, onUnmounted as fe, isRef as L, openBlock as f, createElementBlock as d, createElementVNode as u, toDisplayString as m, normalizeClass as M, withDirectives as G, vShow as q, createTextVNode as pe, normalizeStyle as ve, Fragment as E, renderList as A, createCommentVNode as J, createVNode as de, Transition as be, withCtx as Q, createBlock as _ } from "vue";
|
|
9
|
+
import { useStorage as ge, isClient as ye, useDraggable as he, useMouse as R, useFps as _e, useRafFn as me, useWindowSize as we } from "@vueuse/core";
|
|
10
|
+
function Z(t) {
|
|
11
|
+
return ne() ? (oe(t), !0) : !1;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return typeof
|
|
13
|
+
function P(t) {
|
|
14
|
+
return typeof t == "function" ? t() : D(t);
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
},
|
|
18
|
-
function
|
|
19
|
-
var
|
|
20
|
-
return
|
|
16
|
+
const O = typeof window < "u", F = () => {
|
|
17
|
+
}, X = /* @__PURE__ */ xe();
|
|
18
|
+
function xe() {
|
|
19
|
+
var t;
|
|
20
|
+
return O && ((t = window == null ? void 0 : window.navigator) == null ? void 0 : t.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
if (
|
|
24
|
-
return
|
|
25
|
-
const
|
|
26
|
-
return typeof
|
|
22
|
+
function $e(...t) {
|
|
23
|
+
if (t.length !== 1)
|
|
24
|
+
return le(...t);
|
|
25
|
+
const o = t[0];
|
|
26
|
+
return typeof o == "function" ? ae(se(() => ({ get: o, set: F }))) : g(o);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
var
|
|
30
|
-
const e =
|
|
31
|
-
return (
|
|
28
|
+
function ke(t) {
|
|
29
|
+
var o;
|
|
30
|
+
const e = P(t);
|
|
31
|
+
return (o = e == null ? void 0 : e.$el) != null ? o : e;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
function
|
|
35
|
-
let
|
|
36
|
-
if (typeof
|
|
37
|
-
return
|
|
38
|
-
Array.isArray(e) || (e = [e]), Array.isArray(
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
() => [
|
|
43
|
-
([
|
|
44
|
-
|
|
45
|
-
...e.flatMap((
|
|
33
|
+
const Ce = O ? window : void 0;
|
|
34
|
+
function Me(...t) {
|
|
35
|
+
let o, e, n, l;
|
|
36
|
+
if (typeof t[0] == "string" || Array.isArray(t[0]) ? ([e, n, l] = t, o = Ce) : [o, e, n, l] = t, !o)
|
|
37
|
+
return F;
|
|
38
|
+
Array.isArray(e) || (e = [e]), Array.isArray(n) || (n = [n]);
|
|
39
|
+
const a = [], s = () => {
|
|
40
|
+
a.forEach((c) => c()), a.length = 0;
|
|
41
|
+
}, i = (c, r, v, C) => (c.addEventListener(r, v, C), () => c.removeEventListener(r, v, C)), p = T(
|
|
42
|
+
() => [ke(o), P(l)],
|
|
43
|
+
([c, r]) => {
|
|
44
|
+
s(), c && a.push(
|
|
45
|
+
...e.flatMap((v) => n.map((C) => i(c, v, C, r)))
|
|
46
46
|
);
|
|
47
47
|
},
|
|
48
48
|
{ immediate: !0, flush: "post" }
|
|
49
|
-
),
|
|
50
|
-
|
|
49
|
+
), x = () => {
|
|
50
|
+
p(), s();
|
|
51
51
|
};
|
|
52
|
-
return
|
|
52
|
+
return Z(x), x;
|
|
53
53
|
}
|
|
54
|
-
var
|
|
55
|
-
for (var e in
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
for (var e of
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
},
|
|
62
|
-
const
|
|
54
|
+
var Se = Object.defineProperty, Ie = Object.defineProperties, Te = Object.getOwnPropertyDescriptors, U = Object.getOwnPropertySymbols, je = Object.prototype.hasOwnProperty, De = Object.prototype.propertyIsEnumerable, W = (t, o, e) => o in t ? Se(t, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[o] = e, Pe = (t, o) => {
|
|
55
|
+
for (var e in o || (o = {}))
|
|
56
|
+
je.call(o, e) && W(t, e, o[e]);
|
|
57
|
+
if (U)
|
|
58
|
+
for (var e of U(o))
|
|
59
|
+
De.call(o, e) && W(t, e, o[e]);
|
|
60
|
+
return t;
|
|
61
|
+
}, Ee = (t, o) => Ie(t, Te(o));
|
|
62
|
+
const Ae = /* @__PURE__ */ w({
|
|
63
63
|
name: "UseDraggable",
|
|
64
64
|
props: [
|
|
65
65
|
"storageKey",
|
|
@@ -76,1272 +76,593 @@ const Qt = /* @__PURE__ */ S({
|
|
|
76
76
|
"onMove",
|
|
77
77
|
"onEnd"
|
|
78
78
|
],
|
|
79
|
-
setup(
|
|
80
|
-
const e =
|
|
81
|
-
var
|
|
82
|
-
return (
|
|
83
|
-
}),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
),
|
|
88
|
-
var
|
|
89
|
-
(
|
|
90
|
-
},
|
|
91
|
-
handle:
|
|
92
|
-
initialValue:
|
|
93
|
-
onEnd:
|
|
79
|
+
setup(t, { slots: o }) {
|
|
80
|
+
const e = g(), n = I(() => {
|
|
81
|
+
var p;
|
|
82
|
+
return (p = t.handle) != null ? p : e.value;
|
|
83
|
+
}), l = t.storageKey && ge(
|
|
84
|
+
t.storageKey,
|
|
85
|
+
P(t.initialValue) || { x: 0, y: 0 },
|
|
86
|
+
ye ? t.storageType === "session" ? sessionStorage : localStorage : void 0
|
|
87
|
+
), a = l || t.initialValue || { x: 0, y: 0 }, s = (p, x) => {
|
|
88
|
+
var c;
|
|
89
|
+
(c = t.onEnd) == null || c.call(t, p, x), l && (l.value.x = p.x, l.value.y = p.y);
|
|
90
|
+
}, i = H(he(e, Ee(Pe({}, t), {
|
|
91
|
+
handle: n,
|
|
92
|
+
initialValue: a,
|
|
93
|
+
onEnd: s
|
|
94
94
|
})));
|
|
95
95
|
return () => {
|
|
96
|
-
if (
|
|
97
|
-
return
|
|
96
|
+
if (o.default)
|
|
97
|
+
return re(t.as || "div", { ref: e, style: `touch-action:none;${i.style}` }, o.default(i));
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
|
-
function
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
101
|
+
function N(t) {
|
|
102
|
+
const o = window.getComputedStyle(t);
|
|
103
|
+
if (o.overflowX === "scroll" || o.overflowY === "scroll" || o.overflowX === "auto" && t.clientWidth < t.scrollWidth || o.overflowY === "auto" && t.clientHeight < t.scrollHeight)
|
|
104
104
|
return !0;
|
|
105
105
|
{
|
|
106
|
-
const e =
|
|
107
|
-
return !e || e.tagName === "BODY" ? !1 :
|
|
106
|
+
const e = t.parentNode;
|
|
107
|
+
return !e || e.tagName === "BODY" ? !1 : N(e);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
const
|
|
112
|
-
return
|
|
110
|
+
function Le(t) {
|
|
111
|
+
const o = t || window.event, e = o.target;
|
|
112
|
+
return N(e) ? !1 : o.touches.length > 1 ? !0 : (o.preventDefault && o.preventDefault(), !1);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
const e =
|
|
116
|
-
let
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
const
|
|
120
|
-
|
|
114
|
+
function Ve(t, o = !1) {
|
|
115
|
+
const e = g(o);
|
|
116
|
+
let n = null, l;
|
|
117
|
+
T($e(t), (i) => {
|
|
118
|
+
if (i) {
|
|
119
|
+
const p = i;
|
|
120
|
+
l = p.style.overflow, e.value && (p.style.overflow = "hidden");
|
|
121
121
|
}
|
|
122
122
|
}, {
|
|
123
123
|
immediate: !0
|
|
124
124
|
});
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
!
|
|
128
|
-
|
|
125
|
+
const a = () => {
|
|
126
|
+
const i = P(t);
|
|
127
|
+
!i || e.value || (X && (n = Me(
|
|
128
|
+
i,
|
|
129
129
|
"touchmove",
|
|
130
|
-
(
|
|
131
|
-
|
|
130
|
+
(p) => {
|
|
131
|
+
Le(p);
|
|
132
132
|
},
|
|
133
133
|
{ passive: !1 }
|
|
134
|
-
)),
|
|
135
|
-
},
|
|
136
|
-
const
|
|
137
|
-
!
|
|
134
|
+
)), i.style.overflow = "hidden", e.value = !0);
|
|
135
|
+
}, s = () => {
|
|
136
|
+
const i = P(t);
|
|
137
|
+
!i || !e.value || (X && (n == null || n()), i.style.overflow = l, e.value = !1);
|
|
138
138
|
};
|
|
139
|
-
return
|
|
139
|
+
return Z(s), I({
|
|
140
140
|
get() {
|
|
141
141
|
return e.value;
|
|
142
142
|
},
|
|
143
|
-
set(
|
|
144
|
-
|
|
143
|
+
set(i) {
|
|
144
|
+
i ? a() : s();
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
let
|
|
150
|
-
const
|
|
151
|
-
return (e,
|
|
152
|
-
if (
|
|
148
|
+
function ze() {
|
|
149
|
+
let t = !1;
|
|
150
|
+
const o = g(!1);
|
|
151
|
+
return (e, n) => {
|
|
152
|
+
if (o.value = n.value, t)
|
|
153
153
|
return;
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
|
|
154
|
+
t = !0;
|
|
155
|
+
const l = Ve(e, n.value);
|
|
156
|
+
T(o, (a) => l.value = a);
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
* SPDX-License-Identifier: MIT
|
|
164
|
-
*/
|
|
165
|
-
const lt = "155";
|
|
166
|
-
function Q(o, t, e) {
|
|
167
|
-
return Math.max(t, Math.min(e, o));
|
|
168
|
-
}
|
|
169
|
-
class W {
|
|
170
|
-
constructor(t = 0, e = 0) {
|
|
171
|
-
W.prototype.isVector2 = !0, this.x = t, this.y = e;
|
|
172
|
-
}
|
|
173
|
-
get width() {
|
|
174
|
-
return this.x;
|
|
175
|
-
}
|
|
176
|
-
set width(t) {
|
|
177
|
-
this.x = t;
|
|
178
|
-
}
|
|
179
|
-
get height() {
|
|
180
|
-
return this.y;
|
|
181
|
-
}
|
|
182
|
-
set height(t) {
|
|
183
|
-
this.y = t;
|
|
184
|
-
}
|
|
185
|
-
set(t, e) {
|
|
186
|
-
return this.x = t, this.y = e, this;
|
|
187
|
-
}
|
|
188
|
-
setScalar(t) {
|
|
189
|
-
return this.x = t, this.y = t, this;
|
|
190
|
-
}
|
|
191
|
-
setX(t) {
|
|
192
|
-
return this.x = t, this;
|
|
193
|
-
}
|
|
194
|
-
setY(t) {
|
|
195
|
-
return this.y = t, this;
|
|
196
|
-
}
|
|
197
|
-
setComponent(t, e) {
|
|
198
|
-
switch (t) {
|
|
199
|
-
case 0:
|
|
200
|
-
this.x = e;
|
|
201
|
-
break;
|
|
202
|
-
case 1:
|
|
203
|
-
this.y = e;
|
|
204
|
-
break;
|
|
205
|
-
default:
|
|
206
|
-
throw new Error("index is out of range: " + t);
|
|
207
|
-
}
|
|
208
|
-
return this;
|
|
209
|
-
}
|
|
210
|
-
getComponent(t) {
|
|
211
|
-
switch (t) {
|
|
212
|
-
case 0:
|
|
213
|
-
return this.x;
|
|
214
|
-
case 1:
|
|
215
|
-
return this.y;
|
|
216
|
-
default:
|
|
217
|
-
throw new Error("index is out of range: " + t);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
clone() {
|
|
221
|
-
return new this.constructor(this.x, this.y);
|
|
222
|
-
}
|
|
223
|
-
copy(t) {
|
|
224
|
-
return this.x = t.x, this.y = t.y, this;
|
|
225
|
-
}
|
|
226
|
-
add(t) {
|
|
227
|
-
return this.x += t.x, this.y += t.y, this;
|
|
228
|
-
}
|
|
229
|
-
addScalar(t) {
|
|
230
|
-
return this.x += t, this.y += t, this;
|
|
231
|
-
}
|
|
232
|
-
addVectors(t, e) {
|
|
233
|
-
return this.x = t.x + e.x, this.y = t.y + e.y, this;
|
|
234
|
-
}
|
|
235
|
-
addScaledVector(t, e) {
|
|
236
|
-
return this.x += t.x * e, this.y += t.y * e, this;
|
|
237
|
-
}
|
|
238
|
-
sub(t) {
|
|
239
|
-
return this.x -= t.x, this.y -= t.y, this;
|
|
240
|
-
}
|
|
241
|
-
subScalar(t) {
|
|
242
|
-
return this.x -= t, this.y -= t, this;
|
|
243
|
-
}
|
|
244
|
-
subVectors(t, e) {
|
|
245
|
-
return this.x = t.x - e.x, this.y = t.y - e.y, this;
|
|
246
|
-
}
|
|
247
|
-
multiply(t) {
|
|
248
|
-
return this.x *= t.x, this.y *= t.y, this;
|
|
249
|
-
}
|
|
250
|
-
multiplyScalar(t) {
|
|
251
|
-
return this.x *= t, this.y *= t, this;
|
|
252
|
-
}
|
|
253
|
-
divide(t) {
|
|
254
|
-
return this.x /= t.x, this.y /= t.y, this;
|
|
255
|
-
}
|
|
256
|
-
divideScalar(t) {
|
|
257
|
-
return this.multiplyScalar(1 / t);
|
|
258
|
-
}
|
|
259
|
-
applyMatrix3(t) {
|
|
260
|
-
const e = this.x, s = this.y, n = t.elements;
|
|
261
|
-
return this.x = n[0] * e + n[3] * s + n[6], this.y = n[1] * e + n[4] * s + n[7], this;
|
|
262
|
-
}
|
|
263
|
-
min(t) {
|
|
264
|
-
return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this;
|
|
265
|
-
}
|
|
266
|
-
max(t) {
|
|
267
|
-
return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this;
|
|
268
|
-
}
|
|
269
|
-
clamp(t, e) {
|
|
270
|
-
return this.x = Math.max(t.x, Math.min(e.x, this.x)), this.y = Math.max(t.y, Math.min(e.y, this.y)), this;
|
|
271
|
-
}
|
|
272
|
-
clampScalar(t, e) {
|
|
273
|
-
return this.x = Math.max(t, Math.min(e, this.x)), this.y = Math.max(t, Math.min(e, this.y)), this;
|
|
274
|
-
}
|
|
275
|
-
clampLength(t, e) {
|
|
276
|
-
const s = this.length();
|
|
277
|
-
return this.divideScalar(s || 1).multiplyScalar(Math.max(t, Math.min(e, s)));
|
|
278
|
-
}
|
|
279
|
-
floor() {
|
|
280
|
-
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this;
|
|
281
|
-
}
|
|
282
|
-
ceil() {
|
|
283
|
-
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this;
|
|
284
|
-
}
|
|
285
|
-
round() {
|
|
286
|
-
return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
|
|
287
|
-
}
|
|
288
|
-
roundToZero() {
|
|
289
|
-
return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this;
|
|
290
|
-
}
|
|
291
|
-
negate() {
|
|
292
|
-
return this.x = -this.x, this.y = -this.y, this;
|
|
293
|
-
}
|
|
294
|
-
dot(t) {
|
|
295
|
-
return this.x * t.x + this.y * t.y;
|
|
296
|
-
}
|
|
297
|
-
cross(t) {
|
|
298
|
-
return this.x * t.y - this.y * t.x;
|
|
299
|
-
}
|
|
300
|
-
lengthSq() {
|
|
301
|
-
return this.x * this.x + this.y * this.y;
|
|
302
|
-
}
|
|
303
|
-
length() {
|
|
304
|
-
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
305
|
-
}
|
|
306
|
-
manhattanLength() {
|
|
307
|
-
return Math.abs(this.x) + Math.abs(this.y);
|
|
308
|
-
}
|
|
309
|
-
normalize() {
|
|
310
|
-
return this.divideScalar(this.length() || 1);
|
|
311
|
-
}
|
|
312
|
-
angle() {
|
|
313
|
-
return Math.atan2(-this.y, -this.x) + Math.PI;
|
|
314
|
-
}
|
|
315
|
-
angleTo(t) {
|
|
316
|
-
const e = Math.sqrt(this.lengthSq() * t.lengthSq());
|
|
317
|
-
if (e === 0)
|
|
318
|
-
return Math.PI / 2;
|
|
319
|
-
const s = this.dot(t) / e;
|
|
320
|
-
return Math.acos(Q(s, -1, 1));
|
|
321
|
-
}
|
|
322
|
-
distanceTo(t) {
|
|
323
|
-
return Math.sqrt(this.distanceToSquared(t));
|
|
324
|
-
}
|
|
325
|
-
distanceToSquared(t) {
|
|
326
|
-
const e = this.x - t.x, s = this.y - t.y;
|
|
327
|
-
return e * e + s * s;
|
|
328
|
-
}
|
|
329
|
-
manhattanDistanceTo(t) {
|
|
330
|
-
return Math.abs(this.x - t.x) + Math.abs(this.y - t.y);
|
|
331
|
-
}
|
|
332
|
-
setLength(t) {
|
|
333
|
-
return this.normalize().multiplyScalar(t);
|
|
334
|
-
}
|
|
335
|
-
lerp(t, e) {
|
|
336
|
-
return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this;
|
|
337
|
-
}
|
|
338
|
-
lerpVectors(t, e, s) {
|
|
339
|
-
return this.x = t.x + (e.x - t.x) * s, this.y = t.y + (e.y - t.y) * s, this;
|
|
340
|
-
}
|
|
341
|
-
equals(t) {
|
|
342
|
-
return t.x === this.x && t.y === this.y;
|
|
343
|
-
}
|
|
344
|
-
fromArray(t, e = 0) {
|
|
345
|
-
return this.x = t[e], this.y = t[e + 1], this;
|
|
346
|
-
}
|
|
347
|
-
toArray(t = [], e = 0) {
|
|
348
|
-
return t[e] = this.x, t[e + 1] = this.y, t;
|
|
349
|
-
}
|
|
350
|
-
fromBufferAttribute(t, e) {
|
|
351
|
-
return this.x = t.getX(e), this.y = t.getY(e), this;
|
|
352
|
-
}
|
|
353
|
-
rotateAround(t, e) {
|
|
354
|
-
const s = Math.cos(e), n = Math.sin(e), i = this.x - t.x, a = this.y - t.y;
|
|
355
|
-
return this.x = i * s - a * n + t.x, this.y = i * n + a * s + t.y, this;
|
|
356
|
-
}
|
|
357
|
-
random() {
|
|
358
|
-
return this.x = Math.random(), this.y = Math.random(), this;
|
|
359
|
-
}
|
|
360
|
-
*[Symbol.iterator]() {
|
|
361
|
-
yield this.x, yield this.y;
|
|
362
|
-
}
|
|
159
|
+
ze();
|
|
160
|
+
const Re = Symbol("CONTROLS_CONTEXT_KEY"), y = H({});
|
|
161
|
+
function Xe() {
|
|
162
|
+
return ue(Re, y), y;
|
|
363
163
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
let y = s[n + 0], c = s[n + 1], h = s[n + 2], r = s[n + 3];
|
|
370
|
-
const _ = i[a + 0], u = i[a + 1], x = i[a + 2], b = i[a + 3];
|
|
371
|
-
if (l === 0) {
|
|
372
|
-
t[e + 0] = y, t[e + 1] = c, t[e + 2] = h, t[e + 3] = r;
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
if (l === 1) {
|
|
376
|
-
t[e + 0] = _, t[e + 1] = u, t[e + 2] = x, t[e + 3] = b;
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
if (r !== b || y !== _ || c !== u || h !== x) {
|
|
380
|
-
let z = 1 - l;
|
|
381
|
-
const f = y * _ + c * u + h * x + r * b, M = f >= 0 ? 1 : -1, Z = 1 - f * f;
|
|
382
|
-
if (Z > Number.EPSILON) {
|
|
383
|
-
const k = Math.sqrt(Z), B = Math.atan2(k, f * M);
|
|
384
|
-
z = Math.sin(z * B) / k, l = Math.sin(l * B) / k;
|
|
385
|
-
}
|
|
386
|
-
const D = l * M;
|
|
387
|
-
if (y = y * z + _ * D, c = c * z + u * D, h = h * z + x * D, r = r * z + b * D, z === 1 - l) {
|
|
388
|
-
const k = 1 / Math.sqrt(y * y + c * c + h * h + r * r);
|
|
389
|
-
y *= k, c *= k, h *= k, r *= k;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
t[e] = y, t[e + 1] = c, t[e + 2] = h, t[e + 3] = r;
|
|
393
|
-
}
|
|
394
|
-
static multiplyQuaternionsFlat(t, e, s, n, i, a) {
|
|
395
|
-
const l = s[n], y = s[n + 1], c = s[n + 2], h = s[n + 3], r = i[a], _ = i[a + 1], u = i[a + 2], x = i[a + 3];
|
|
396
|
-
return t[e] = l * x + h * r + y * u - c * _, t[e + 1] = y * x + h * _ + c * r - l * u, t[e + 2] = c * x + h * u + l * _ - y * r, t[e + 3] = h * x - l * r - y * _ - c * u, t;
|
|
397
|
-
}
|
|
398
|
-
get x() {
|
|
399
|
-
return this._x;
|
|
400
|
-
}
|
|
401
|
-
set x(t) {
|
|
402
|
-
this._x = t, this._onChangeCallback();
|
|
403
|
-
}
|
|
404
|
-
get y() {
|
|
405
|
-
return this._y;
|
|
406
|
-
}
|
|
407
|
-
set y(t) {
|
|
408
|
-
this._y = t, this._onChangeCallback();
|
|
409
|
-
}
|
|
410
|
-
get z() {
|
|
411
|
-
return this._z;
|
|
412
|
-
}
|
|
413
|
-
set z(t) {
|
|
414
|
-
this._z = t, this._onChangeCallback();
|
|
415
|
-
}
|
|
416
|
-
get w() {
|
|
417
|
-
return this._w;
|
|
418
|
-
}
|
|
419
|
-
set w(t) {
|
|
420
|
-
this._w = t, this._onChangeCallback();
|
|
421
|
-
}
|
|
422
|
-
set(t, e, s, n) {
|
|
423
|
-
return this._x = t, this._y = e, this._z = s, this._w = n, this._onChangeCallback(), this;
|
|
424
|
-
}
|
|
425
|
-
clone() {
|
|
426
|
-
return new this.constructor(this._x, this._y, this._z, this._w);
|
|
427
|
-
}
|
|
428
|
-
copy(t) {
|
|
429
|
-
return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this._onChangeCallback(), this;
|
|
430
|
-
}
|
|
431
|
-
setFromEuler(t, e) {
|
|
432
|
-
const s = t._x, n = t._y, i = t._z, a = t._order, l = Math.cos, y = Math.sin, c = l(s / 2), h = l(n / 2), r = l(i / 2), _ = y(s / 2), u = y(n / 2), x = y(i / 2);
|
|
433
|
-
switch (a) {
|
|
434
|
-
case "XYZ":
|
|
435
|
-
this._x = _ * h * r + c * u * x, this._y = c * u * r - _ * h * x, this._z = c * h * x + _ * u * r, this._w = c * h * r - _ * u * x;
|
|
436
|
-
break;
|
|
437
|
-
case "YXZ":
|
|
438
|
-
this._x = _ * h * r + c * u * x, this._y = c * u * r - _ * h * x, this._z = c * h * x - _ * u * r, this._w = c * h * r + _ * u * x;
|
|
439
|
-
break;
|
|
440
|
-
case "ZXY":
|
|
441
|
-
this._x = _ * h * r - c * u * x, this._y = c * u * r + _ * h * x, this._z = c * h * x + _ * u * r, this._w = c * h * r - _ * u * x;
|
|
442
|
-
break;
|
|
443
|
-
case "ZYX":
|
|
444
|
-
this._x = _ * h * r - c * u * x, this._y = c * u * r + _ * h * x, this._z = c * h * x - _ * u * r, this._w = c * h * r + _ * u * x;
|
|
445
|
-
break;
|
|
446
|
-
case "YZX":
|
|
447
|
-
this._x = _ * h * r + c * u * x, this._y = c * u * r + _ * h * x, this._z = c * h * x - _ * u * r, this._w = c * h * r - _ * u * x;
|
|
448
|
-
break;
|
|
449
|
-
case "XZY":
|
|
450
|
-
this._x = _ * h * r - c * u * x, this._y = c * u * r - _ * h * x, this._z = c * h * x + _ * u * r, this._w = c * h * r + _ * u * x;
|
|
451
|
-
break;
|
|
452
|
-
default:
|
|
453
|
-
console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + a);
|
|
454
|
-
}
|
|
455
|
-
return e !== !1 && this._onChangeCallback(), this;
|
|
456
|
-
}
|
|
457
|
-
setFromAxisAngle(t, e) {
|
|
458
|
-
const s = e / 2, n = Math.sin(s);
|
|
459
|
-
return this._x = t.x * n, this._y = t.y * n, this._z = t.z * n, this._w = Math.cos(s), this._onChangeCallback(), this;
|
|
460
|
-
}
|
|
461
|
-
setFromRotationMatrix(t) {
|
|
462
|
-
const e = t.elements, s = e[0], n = e[4], i = e[8], a = e[1], l = e[5], y = e[9], c = e[2], h = e[6], r = e[10], _ = s + l + r;
|
|
463
|
-
if (_ > 0) {
|
|
464
|
-
const u = 0.5 / Math.sqrt(_ + 1);
|
|
465
|
-
this._w = 0.25 / u, this._x = (h - y) * u, this._y = (i - c) * u, this._z = (a - n) * u;
|
|
466
|
-
} else if (s > l && s > r) {
|
|
467
|
-
const u = 2 * Math.sqrt(1 + s - l - r);
|
|
468
|
-
this._w = (h - y) / u, this._x = 0.25 * u, this._y = (n + a) / u, this._z = (i + c) / u;
|
|
469
|
-
} else if (l > r) {
|
|
470
|
-
const u = 2 * Math.sqrt(1 + l - s - r);
|
|
471
|
-
this._w = (i - c) / u, this._x = (n + a) / u, this._y = 0.25 * u, this._z = (y + h) / u;
|
|
472
|
-
} else {
|
|
473
|
-
const u = 2 * Math.sqrt(1 + r - s - l);
|
|
474
|
-
this._w = (a - n) / u, this._x = (i + c) / u, this._y = (y + h) / u, this._z = 0.25 * u;
|
|
475
|
-
}
|
|
476
|
-
return this._onChangeCallback(), this;
|
|
477
|
-
}
|
|
478
|
-
setFromUnitVectors(t, e) {
|
|
479
|
-
let s = t.dot(e) + 1;
|
|
480
|
-
return s < Number.EPSILON ? (s = 0, Math.abs(t.x) > Math.abs(t.z) ? (this._x = -t.y, this._y = t.x, this._z = 0, this._w = s) : (this._x = 0, this._y = -t.z, this._z = t.y, this._w = s)) : (this._x = t.y * e.z - t.z * e.y, this._y = t.z * e.x - t.x * e.z, this._z = t.x * e.y - t.y * e.x, this._w = s), this.normalize();
|
|
481
|
-
}
|
|
482
|
-
angleTo(t) {
|
|
483
|
-
return 2 * Math.acos(Math.abs(Q(this.dot(t), -1, 1)));
|
|
484
|
-
}
|
|
485
|
-
rotateTowards(t, e) {
|
|
486
|
-
const s = this.angleTo(t);
|
|
487
|
-
if (s === 0)
|
|
488
|
-
return this;
|
|
489
|
-
const n = Math.min(1, e / s);
|
|
490
|
-
return this.slerp(t, n), this;
|
|
491
|
-
}
|
|
492
|
-
identity() {
|
|
493
|
-
return this.set(0, 0, 0, 1);
|
|
494
|
-
}
|
|
495
|
-
invert() {
|
|
496
|
-
return this.conjugate();
|
|
497
|
-
}
|
|
498
|
-
conjugate() {
|
|
499
|
-
return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this;
|
|
500
|
-
}
|
|
501
|
-
dot(t) {
|
|
502
|
-
return this._x * t._x + this._y * t._y + this._z * t._z + this._w * t._w;
|
|
503
|
-
}
|
|
504
|
-
lengthSq() {
|
|
505
|
-
return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;
|
|
506
|
-
}
|
|
507
|
-
length() {
|
|
508
|
-
return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);
|
|
509
|
-
}
|
|
510
|
-
normalize() {
|
|
511
|
-
let t = this.length();
|
|
512
|
-
return t === 0 ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (t = 1 / t, this._x = this._x * t, this._y = this._y * t, this._z = this._z * t, this._w = this._w * t), this._onChangeCallback(), this;
|
|
513
|
-
}
|
|
514
|
-
multiply(t) {
|
|
515
|
-
return this.multiplyQuaternions(this, t);
|
|
516
|
-
}
|
|
517
|
-
premultiply(t) {
|
|
518
|
-
return this.multiplyQuaternions(t, this);
|
|
519
|
-
}
|
|
520
|
-
multiplyQuaternions(t, e) {
|
|
521
|
-
const s = t._x, n = t._y, i = t._z, a = t._w, l = e._x, y = e._y, c = e._z, h = e._w;
|
|
522
|
-
return this._x = s * h + a * l + n * c - i * y, this._y = n * h + a * y + i * l - s * c, this._z = i * h + a * c + s * y - n * l, this._w = a * h - s * l - n * y - i * c, this._onChangeCallback(), this;
|
|
523
|
-
}
|
|
524
|
-
slerp(t, e) {
|
|
525
|
-
if (e === 0)
|
|
526
|
-
return this;
|
|
527
|
-
if (e === 1)
|
|
528
|
-
return this.copy(t);
|
|
529
|
-
const s = this._x, n = this._y, i = this._z, a = this._w;
|
|
530
|
-
let l = a * t._w + s * t._x + n * t._y + i * t._z;
|
|
531
|
-
if (l < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, l = -l) : this.copy(t), l >= 1)
|
|
532
|
-
return this._w = a, this._x = s, this._y = n, this._z = i, this;
|
|
533
|
-
const y = 1 - l * l;
|
|
534
|
-
if (y <= Number.EPSILON) {
|
|
535
|
-
const u = 1 - e;
|
|
536
|
-
return this._w = u * a + e * this._w, this._x = u * s + e * this._x, this._y = u * n + e * this._y, this._z = u * i + e * this._z, this.normalize(), this._onChangeCallback(), this;
|
|
537
|
-
}
|
|
538
|
-
const c = Math.sqrt(y), h = Math.atan2(c, l), r = Math.sin((1 - e) * h) / c, _ = Math.sin(e * h) / c;
|
|
539
|
-
return this._w = a * r + this._w * _, this._x = s * r + this._x * _, this._y = n * r + this._y * _, this._z = i * r + this._z * _, this._onChangeCallback(), this;
|
|
540
|
-
}
|
|
541
|
-
slerpQuaternions(t, e, s) {
|
|
542
|
-
return this.copy(t).slerp(e, s);
|
|
543
|
-
}
|
|
544
|
-
random() {
|
|
545
|
-
const t = Math.random(), e = Math.sqrt(1 - t), s = Math.sqrt(t), n = 2 * Math.PI * Math.random(), i = 2 * Math.PI * Math.random();
|
|
546
|
-
return this.set(
|
|
547
|
-
e * Math.cos(n),
|
|
548
|
-
s * Math.sin(i),
|
|
549
|
-
s * Math.cos(i),
|
|
550
|
-
e * Math.sin(n)
|
|
551
|
-
);
|
|
552
|
-
}
|
|
553
|
-
equals(t) {
|
|
554
|
-
return t._x === this._x && t._y === this._y && t._z === this._z && t._w === this._w;
|
|
555
|
-
}
|
|
556
|
-
fromArray(t, e = 0) {
|
|
557
|
-
return this._x = t[e], this._y = t[e + 1], this._z = t[e + 2], this._w = t[e + 3], this._onChangeCallback(), this;
|
|
558
|
-
}
|
|
559
|
-
toArray(t = [], e = 0) {
|
|
560
|
-
return t[e] = this._x, t[e + 1] = this._y, t[e + 2] = this._z, t[e + 3] = this._w, t;
|
|
561
|
-
}
|
|
562
|
-
fromBufferAttribute(t, e) {
|
|
563
|
-
return this._x = t.getX(e), this._y = t.getY(e), this._z = t.getZ(e), this._w = t.getW(e), this;
|
|
564
|
-
}
|
|
565
|
-
toJSON() {
|
|
566
|
-
return this.toArray();
|
|
567
|
-
}
|
|
568
|
-
_onChange(t) {
|
|
569
|
-
return this._onChangeCallback = t, this;
|
|
570
|
-
}
|
|
571
|
-
_onChangeCallback() {
|
|
572
|
-
}
|
|
573
|
-
*[Symbol.iterator]() {
|
|
574
|
-
yield this._x, yield this._y, yield this._z, yield this._w;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
class E {
|
|
578
|
-
constructor(t = 0, e = 0, s = 0) {
|
|
579
|
-
E.prototype.isVector3 = !0, this.x = t, this.y = e, this.z = s;
|
|
580
|
-
}
|
|
581
|
-
set(t, e, s) {
|
|
582
|
-
return s === void 0 && (s = this.z), this.x = t, this.y = e, this.z = s, this;
|
|
583
|
-
}
|
|
584
|
-
setScalar(t) {
|
|
585
|
-
return this.x = t, this.y = t, this.z = t, this;
|
|
586
|
-
}
|
|
587
|
-
setX(t) {
|
|
588
|
-
return this.x = t, this;
|
|
589
|
-
}
|
|
590
|
-
setY(t) {
|
|
591
|
-
return this.y = t, this;
|
|
592
|
-
}
|
|
593
|
-
setZ(t) {
|
|
594
|
-
return this.z = t, this;
|
|
595
|
-
}
|
|
596
|
-
setComponent(t, e) {
|
|
597
|
-
switch (t) {
|
|
598
|
-
case 0:
|
|
599
|
-
this.x = e;
|
|
600
|
-
break;
|
|
601
|
-
case 1:
|
|
602
|
-
this.y = e;
|
|
603
|
-
break;
|
|
604
|
-
case 2:
|
|
605
|
-
this.z = e;
|
|
606
|
-
break;
|
|
607
|
-
default:
|
|
608
|
-
throw new Error("index is out of range: " + t);
|
|
609
|
-
}
|
|
610
|
-
return this;
|
|
611
|
-
}
|
|
612
|
-
getComponent(t) {
|
|
613
|
-
switch (t) {
|
|
614
|
-
case 0:
|
|
615
|
-
return this.x;
|
|
616
|
-
case 1:
|
|
617
|
-
return this.y;
|
|
618
|
-
case 2:
|
|
619
|
-
return this.z;
|
|
620
|
-
default:
|
|
621
|
-
throw new Error("index is out of range: " + t);
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
clone() {
|
|
625
|
-
return new this.constructor(this.x, this.y, this.z);
|
|
626
|
-
}
|
|
627
|
-
copy(t) {
|
|
628
|
-
return this.x = t.x, this.y = t.y, this.z = t.z, this;
|
|
629
|
-
}
|
|
630
|
-
add(t) {
|
|
631
|
-
return this.x += t.x, this.y += t.y, this.z += t.z, this;
|
|
632
|
-
}
|
|
633
|
-
addScalar(t) {
|
|
634
|
-
return this.x += t, this.y += t, this.z += t, this;
|
|
635
|
-
}
|
|
636
|
-
addVectors(t, e) {
|
|
637
|
-
return this.x = t.x + e.x, this.y = t.y + e.y, this.z = t.z + e.z, this;
|
|
638
|
-
}
|
|
639
|
-
addScaledVector(t, e) {
|
|
640
|
-
return this.x += t.x * e, this.y += t.y * e, this.z += t.z * e, this;
|
|
641
|
-
}
|
|
642
|
-
sub(t) {
|
|
643
|
-
return this.x -= t.x, this.y -= t.y, this.z -= t.z, this;
|
|
644
|
-
}
|
|
645
|
-
subScalar(t) {
|
|
646
|
-
return this.x -= t, this.y -= t, this.z -= t, this;
|
|
647
|
-
}
|
|
648
|
-
subVectors(t, e) {
|
|
649
|
-
return this.x = t.x - e.x, this.y = t.y - e.y, this.z = t.z - e.z, this;
|
|
650
|
-
}
|
|
651
|
-
multiply(t) {
|
|
652
|
-
return this.x *= t.x, this.y *= t.y, this.z *= t.z, this;
|
|
653
|
-
}
|
|
654
|
-
multiplyScalar(t) {
|
|
655
|
-
return this.x *= t, this.y *= t, this.z *= t, this;
|
|
656
|
-
}
|
|
657
|
-
multiplyVectors(t, e) {
|
|
658
|
-
return this.x = t.x * e.x, this.y = t.y * e.y, this.z = t.z * e.z, this;
|
|
659
|
-
}
|
|
660
|
-
applyEuler(t) {
|
|
661
|
-
return this.applyQuaternion(N.setFromEuler(t));
|
|
662
|
-
}
|
|
663
|
-
applyAxisAngle(t, e) {
|
|
664
|
-
return this.applyQuaternion(N.setFromAxisAngle(t, e));
|
|
665
|
-
}
|
|
666
|
-
applyMatrix3(t) {
|
|
667
|
-
const e = this.x, s = this.y, n = this.z, i = t.elements;
|
|
668
|
-
return this.x = i[0] * e + i[3] * s + i[6] * n, this.y = i[1] * e + i[4] * s + i[7] * n, this.z = i[2] * e + i[5] * s + i[8] * n, this;
|
|
669
|
-
}
|
|
670
|
-
applyNormalMatrix(t) {
|
|
671
|
-
return this.applyMatrix3(t).normalize();
|
|
672
|
-
}
|
|
673
|
-
applyMatrix4(t) {
|
|
674
|
-
const e = this.x, s = this.y, n = this.z, i = t.elements, a = 1 / (i[3] * e + i[7] * s + i[11] * n + i[15]);
|
|
675
|
-
return this.x = (i[0] * e + i[4] * s + i[8] * n + i[12]) * a, this.y = (i[1] * e + i[5] * s + i[9] * n + i[13]) * a, this.z = (i[2] * e + i[6] * s + i[10] * n + i[14]) * a, this;
|
|
676
|
-
}
|
|
677
|
-
applyQuaternion(t) {
|
|
678
|
-
const e = this.x, s = this.y, n = this.z, i = t.x, a = t.y, l = t.z, y = t.w, c = y * e + a * n - l * s, h = y * s + l * e - i * n, r = y * n + i * s - a * e, _ = -i * e - a * s - l * n;
|
|
679
|
-
return this.x = c * y + _ * -i + h * -l - r * -a, this.y = h * y + _ * -a + r * -i - c * -l, this.z = r * y + _ * -l + c * -a - h * -i, this;
|
|
680
|
-
}
|
|
681
|
-
project(t) {
|
|
682
|
-
return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix);
|
|
683
|
-
}
|
|
684
|
-
unproject(t) {
|
|
685
|
-
return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld);
|
|
686
|
-
}
|
|
687
|
-
transformDirection(t) {
|
|
688
|
-
const e = this.x, s = this.y, n = this.z, i = t.elements;
|
|
689
|
-
return this.x = i[0] * e + i[4] * s + i[8] * n, this.y = i[1] * e + i[5] * s + i[9] * n, this.z = i[2] * e + i[6] * s + i[10] * n, this.normalize();
|
|
690
|
-
}
|
|
691
|
-
divide(t) {
|
|
692
|
-
return this.x /= t.x, this.y /= t.y, this.z /= t.z, this;
|
|
693
|
-
}
|
|
694
|
-
divideScalar(t) {
|
|
695
|
-
return this.multiplyScalar(1 / t);
|
|
696
|
-
}
|
|
697
|
-
min(t) {
|
|
698
|
-
return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this.z = Math.min(this.z, t.z), this;
|
|
699
|
-
}
|
|
700
|
-
max(t) {
|
|
701
|
-
return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this.z = Math.max(this.z, t.z), this;
|
|
702
|
-
}
|
|
703
|
-
clamp(t, e) {
|
|
704
|
-
return this.x = Math.max(t.x, Math.min(e.x, this.x)), this.y = Math.max(t.y, Math.min(e.y, this.y)), this.z = Math.max(t.z, Math.min(e.z, this.z)), this;
|
|
705
|
-
}
|
|
706
|
-
clampScalar(t, e) {
|
|
707
|
-
return this.x = Math.max(t, Math.min(e, this.x)), this.y = Math.max(t, Math.min(e, this.y)), this.z = Math.max(t, Math.min(e, this.z)), this;
|
|
708
|
-
}
|
|
709
|
-
clampLength(t, e) {
|
|
710
|
-
const s = this.length();
|
|
711
|
-
return this.divideScalar(s || 1).multiplyScalar(Math.max(t, Math.min(e, s)));
|
|
712
|
-
}
|
|
713
|
-
floor() {
|
|
714
|
-
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this;
|
|
715
|
-
}
|
|
716
|
-
ceil() {
|
|
717
|
-
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this;
|
|
718
|
-
}
|
|
719
|
-
round() {
|
|
720
|
-
return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this;
|
|
721
|
-
}
|
|
722
|
-
roundToZero() {
|
|
723
|
-
return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this;
|
|
724
|
-
}
|
|
725
|
-
negate() {
|
|
726
|
-
return this.x = -this.x, this.y = -this.y, this.z = -this.z, this;
|
|
727
|
-
}
|
|
728
|
-
dot(t) {
|
|
729
|
-
return this.x * t.x + this.y * t.y + this.z * t.z;
|
|
730
|
-
}
|
|
731
|
-
// TODO lengthSquared?
|
|
732
|
-
lengthSq() {
|
|
733
|
-
return this.x * this.x + this.y * this.y + this.z * this.z;
|
|
734
|
-
}
|
|
735
|
-
length() {
|
|
736
|
-
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
|
737
|
-
}
|
|
738
|
-
manhattanLength() {
|
|
739
|
-
return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);
|
|
740
|
-
}
|
|
741
|
-
normalize() {
|
|
742
|
-
return this.divideScalar(this.length() || 1);
|
|
743
|
-
}
|
|
744
|
-
setLength(t) {
|
|
745
|
-
return this.normalize().multiplyScalar(t);
|
|
746
|
-
}
|
|
747
|
-
lerp(t, e) {
|
|
748
|
-
return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this.z += (t.z - this.z) * e, this;
|
|
749
|
-
}
|
|
750
|
-
lerpVectors(t, e, s) {
|
|
751
|
-
return this.x = t.x + (e.x - t.x) * s, this.y = t.y + (e.y - t.y) * s, this.z = t.z + (e.z - t.z) * s, this;
|
|
752
|
-
}
|
|
753
|
-
cross(t) {
|
|
754
|
-
return this.crossVectors(this, t);
|
|
755
|
-
}
|
|
756
|
-
crossVectors(t, e) {
|
|
757
|
-
const s = t.x, n = t.y, i = t.z, a = e.x, l = e.y, y = e.z;
|
|
758
|
-
return this.x = n * y - i * l, this.y = i * a - s * y, this.z = s * l - n * a, this;
|
|
759
|
-
}
|
|
760
|
-
projectOnVector(t) {
|
|
761
|
-
const e = t.lengthSq();
|
|
762
|
-
if (e === 0)
|
|
763
|
-
return this.set(0, 0, 0);
|
|
764
|
-
const s = t.dot(this) / e;
|
|
765
|
-
return this.copy(t).multiplyScalar(s);
|
|
766
|
-
}
|
|
767
|
-
projectOnPlane(t) {
|
|
768
|
-
return X.copy(this).projectOnVector(t), this.sub(X);
|
|
769
|
-
}
|
|
770
|
-
reflect(t) {
|
|
771
|
-
return this.sub(X.copy(t).multiplyScalar(2 * this.dot(t)));
|
|
772
|
-
}
|
|
773
|
-
angleTo(t) {
|
|
774
|
-
const e = Math.sqrt(this.lengthSq() * t.lengthSq());
|
|
775
|
-
if (e === 0)
|
|
776
|
-
return Math.PI / 2;
|
|
777
|
-
const s = this.dot(t) / e;
|
|
778
|
-
return Math.acos(Q(s, -1, 1));
|
|
779
|
-
}
|
|
780
|
-
distanceTo(t) {
|
|
781
|
-
return Math.sqrt(this.distanceToSquared(t));
|
|
782
|
-
}
|
|
783
|
-
distanceToSquared(t) {
|
|
784
|
-
const e = this.x - t.x, s = this.y - t.y, n = this.z - t.z;
|
|
785
|
-
return e * e + s * s + n * n;
|
|
786
|
-
}
|
|
787
|
-
manhattanDistanceTo(t) {
|
|
788
|
-
return Math.abs(this.x - t.x) + Math.abs(this.y - t.y) + Math.abs(this.z - t.z);
|
|
789
|
-
}
|
|
790
|
-
setFromSpherical(t) {
|
|
791
|
-
return this.setFromSphericalCoords(t.radius, t.phi, t.theta);
|
|
792
|
-
}
|
|
793
|
-
setFromSphericalCoords(t, e, s) {
|
|
794
|
-
const n = Math.sin(e) * t;
|
|
795
|
-
return this.x = n * Math.sin(s), this.y = Math.cos(e) * t, this.z = n * Math.cos(s), this;
|
|
796
|
-
}
|
|
797
|
-
setFromCylindrical(t) {
|
|
798
|
-
return this.setFromCylindricalCoords(t.radius, t.theta, t.y);
|
|
799
|
-
}
|
|
800
|
-
setFromCylindricalCoords(t, e, s) {
|
|
801
|
-
return this.x = t * Math.sin(e), this.y = s, this.z = t * Math.cos(e), this;
|
|
802
|
-
}
|
|
803
|
-
setFromMatrixPosition(t) {
|
|
804
|
-
const e = t.elements;
|
|
805
|
-
return this.x = e[12], this.y = e[13], this.z = e[14], this;
|
|
806
|
-
}
|
|
807
|
-
setFromMatrixScale(t) {
|
|
808
|
-
const e = this.setFromMatrixColumn(t, 0).length(), s = this.setFromMatrixColumn(t, 1).length(), n = this.setFromMatrixColumn(t, 2).length();
|
|
809
|
-
return this.x = e, this.y = s, this.z = n, this;
|
|
810
|
-
}
|
|
811
|
-
setFromMatrixColumn(t, e) {
|
|
812
|
-
return this.fromArray(t.elements, e * 4);
|
|
813
|
-
}
|
|
814
|
-
setFromMatrix3Column(t, e) {
|
|
815
|
-
return this.fromArray(t.elements, e * 3);
|
|
816
|
-
}
|
|
817
|
-
setFromEuler(t) {
|
|
818
|
-
return this.x = t._x, this.y = t._y, this.z = t._z, this;
|
|
819
|
-
}
|
|
820
|
-
setFromColor(t) {
|
|
821
|
-
return this.x = t.r, this.y = t.g, this.z = t.b, this;
|
|
822
|
-
}
|
|
823
|
-
equals(t) {
|
|
824
|
-
return t.x === this.x && t.y === this.y && t.z === this.z;
|
|
825
|
-
}
|
|
826
|
-
fromArray(t, e = 0) {
|
|
827
|
-
return this.x = t[e], this.y = t[e + 1], this.z = t[e + 2], this;
|
|
828
|
-
}
|
|
829
|
-
toArray(t = [], e = 0) {
|
|
830
|
-
return t[e] = this.x, t[e + 1] = this.y, t[e + 2] = this.z, t;
|
|
831
|
-
}
|
|
832
|
-
fromBufferAttribute(t, e) {
|
|
833
|
-
return this.x = t.getX(e), this.y = t.getY(e), this.z = t.getZ(e), this;
|
|
834
|
-
}
|
|
835
|
-
random() {
|
|
836
|
-
return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this;
|
|
837
|
-
}
|
|
838
|
-
randomDirection() {
|
|
839
|
-
const t = (Math.random() - 0.5) * 2, e = Math.random() * Math.PI * 2, s = Math.sqrt(1 - t ** 2);
|
|
840
|
-
return this.x = s * Math.cos(e), this.y = s * Math.sin(e), this.z = t, this;
|
|
841
|
-
}
|
|
842
|
-
*[Symbol.iterator]() {
|
|
843
|
-
yield this.x, yield this.y, yield this.z;
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
const X = /* @__PURE__ */ new E(), N = /* @__PURE__ */ new Ut();
|
|
847
|
-
typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: {
|
|
848
|
-
revision: lt
|
|
849
|
-
} }));
|
|
850
|
-
typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = lt);
|
|
851
|
-
const Ft = Symbol("CONTROLS_CONTEXT_KEY"), w = tt({});
|
|
852
|
-
function Kt() {
|
|
853
|
-
return ft(Ft, w), w;
|
|
854
|
-
}
|
|
855
|
-
function R(o) {
|
|
856
|
-
return Object.entries(o).map(([t, e]) => {
|
|
857
|
-
let s = "string", n;
|
|
858
|
-
const i = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
859
|
-
return !V(e) && e.value || V(e) ? (s = typeof e.value, n = e.value) : (s = typeof e, n = e), s === "number" && (e.step || e.max || e.min) && (s = "range"), s === "string" && i.test(n) && (s = "color"), (n instanceof E || n instanceof E || n instanceof Array) && (s = "vector"), !V(e) && e.value ? {
|
|
164
|
+
function V(t) {
|
|
165
|
+
return Object.entries(t).map(([o, e]) => {
|
|
166
|
+
let n = "string", l;
|
|
167
|
+
const a = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
168
|
+
return !L(e) && e.value || L(e) ? (n = typeof e.value, l = e.value) : (n = typeof e, l = e), n === "number" && (e.step || e.max || e.min) && (n = "range"), n === "string" && a.test(l) && (n = "color"), (l.isVector3 || l instanceof Array) && (n = "vector"), !L(e) && e.value ? {
|
|
860
169
|
...e,
|
|
861
|
-
label: e.label ||
|
|
170
|
+
label: e.label || o,
|
|
862
171
|
value: e.value,
|
|
863
|
-
type:
|
|
172
|
+
type: n,
|
|
864
173
|
visible: !0
|
|
865
174
|
} : {
|
|
866
|
-
label: e.label ||
|
|
175
|
+
label: e.label || o,
|
|
867
176
|
value: e,
|
|
868
|
-
type:
|
|
177
|
+
type: n,
|
|
869
178
|
visible: !0
|
|
870
179
|
};
|
|
871
180
|
});
|
|
872
181
|
}
|
|
873
|
-
function
|
|
874
|
-
for (const
|
|
875
|
-
delete
|
|
182
|
+
function Ue() {
|
|
183
|
+
for (const t in y)
|
|
184
|
+
delete y[t];
|
|
876
185
|
}
|
|
877
|
-
function
|
|
878
|
-
const
|
|
879
|
-
if (typeof
|
|
880
|
-
|
|
186
|
+
function Bt(t, o, e) {
|
|
187
|
+
const n = g();
|
|
188
|
+
if (typeof t == "string")
|
|
189
|
+
t === "fpsgraph" ? (y[t] = {
|
|
881
190
|
label: "fpsgraph",
|
|
882
191
|
visible: !0,
|
|
883
192
|
type: "fpsgraph"
|
|
884
|
-
},
|
|
885
|
-
label:
|
|
193
|
+
}, n.value = y[t]) : (y[t] = {
|
|
194
|
+
label: t,
|
|
886
195
|
visible: !0,
|
|
887
196
|
type: "folder",
|
|
888
|
-
controls:
|
|
889
|
-
},
|
|
890
|
-
else if (typeof
|
|
891
|
-
|
|
197
|
+
controls: o ? V(o) : []
|
|
198
|
+
}, n.value = y[t]);
|
|
199
|
+
else if (typeof t == "object" && t.options)
|
|
200
|
+
y[t.label || "Dropdown"] = {
|
|
892
201
|
...e,
|
|
893
|
-
label:
|
|
202
|
+
label: t.label || "Dropdown",
|
|
894
203
|
visible: !0,
|
|
895
|
-
value:
|
|
204
|
+
value: t.value,
|
|
896
205
|
type: "select",
|
|
897
|
-
ref:
|
|
898
|
-
options:
|
|
899
|
-
},
|
|
900
|
-
else if (typeof
|
|
901
|
-
|
|
206
|
+
ref: t,
|
|
207
|
+
options: t.options
|
|
208
|
+
}, n.value = y[t.label || "Dropdown"];
|
|
209
|
+
else if (typeof t == "object" && typeof o == "string")
|
|
210
|
+
y[o] = {
|
|
902
211
|
...e,
|
|
903
|
-
label:
|
|
212
|
+
label: o,
|
|
904
213
|
visible: !0,
|
|
905
|
-
value: o
|
|
906
|
-
type: typeof o
|
|
907
|
-
ref:
|
|
908
|
-
},
|
|
909
|
-
else if (
|
|
910
|
-
const
|
|
911
|
-
for (const
|
|
912
|
-
|
|
913
|
-
|
|
214
|
+
value: t[o],
|
|
215
|
+
type: typeof t[o],
|
|
216
|
+
ref: t
|
|
217
|
+
}, n.value = y[o];
|
|
218
|
+
else if (ie(t)) {
|
|
219
|
+
const l = ce(t), a = V(l);
|
|
220
|
+
for (const s of a)
|
|
221
|
+
y[s.label] = s;
|
|
222
|
+
n.value = a;
|
|
914
223
|
} else {
|
|
915
|
-
const
|
|
916
|
-
for (const
|
|
917
|
-
|
|
918
|
-
|
|
224
|
+
const l = V(t);
|
|
225
|
+
for (const a of l)
|
|
226
|
+
y[a.label] = a;
|
|
227
|
+
n.value = l;
|
|
919
228
|
}
|
|
920
|
-
return
|
|
229
|
+
return fe(Ue), n;
|
|
921
230
|
}
|
|
922
|
-
const
|
|
231
|
+
const We = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, Be = { class: "text-gray-500 w-1/3" }, Ke = ["value", "min", "max", "step"], Ye = /* @__PURE__ */ w({
|
|
923
232
|
__name: "NumberControl",
|
|
924
233
|
props: {
|
|
925
234
|
label: {},
|
|
926
235
|
control: {}
|
|
927
236
|
},
|
|
928
237
|
emits: ["change"],
|
|
929
|
-
setup(
|
|
930
|
-
const e =
|
|
931
|
-
function
|
|
932
|
-
const { target: r } =
|
|
933
|
-
|
|
238
|
+
setup(t, { emit: o }) {
|
|
239
|
+
const e = t;
|
|
240
|
+
function n(c) {
|
|
241
|
+
const { target: r } = c;
|
|
242
|
+
o("change", r.valueAsNumber);
|
|
934
243
|
}
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
},
|
|
938
|
-
|
|
939
|
-
},
|
|
940
|
-
return
|
|
941
|
-
if (
|
|
942
|
-
const r =
|
|
943
|
-
r > 0 ?
|
|
244
|
+
const l = R(), a = g(0), s = g(!1), i = (c) => {
|
|
245
|
+
a.value = c.clientX, s.value = !0;
|
|
246
|
+
}, p = () => {
|
|
247
|
+
s.value = !1;
|
|
248
|
+
}, x = (c) => Math.floor(Math.abs(c) / 10);
|
|
249
|
+
return T(l.x, (c) => {
|
|
250
|
+
if (s.value) {
|
|
251
|
+
const r = c - a.value, v = x(r);
|
|
252
|
+
r > 0 ? o("change", e.control.value + 1 + v) : r < 0 && o("change", e.control.value - 1 + v), e.control.min !== void 0 && e.control.value < e.control.min && o("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && o("change", e.control.max), a.value = c;
|
|
944
253
|
}
|
|
945
|
-
}), (
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
value:
|
|
949
|
-
class:
|
|
254
|
+
}), (c, r) => (f(), d("div", We, [
|
|
255
|
+
u("label", Be, m(c.label), 1),
|
|
256
|
+
u("input", {
|
|
257
|
+
value: c.control.value,
|
|
258
|
+
class: M(["p-2 w-1/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans", { "cursor-ew-resize": s.value }]),
|
|
950
259
|
type: "number",
|
|
951
|
-
min:
|
|
952
|
-
max:
|
|
953
|
-
step:
|
|
954
|
-
onInput:
|
|
955
|
-
onMousedown:
|
|
956
|
-
onMouseup:
|
|
957
|
-
}, null, 42,
|
|
260
|
+
min: c.control.min,
|
|
261
|
+
max: c.control.max,
|
|
262
|
+
step: c.control.step,
|
|
263
|
+
onInput: n,
|
|
264
|
+
onMousedown: i,
|
|
265
|
+
onMouseup: p
|
|
266
|
+
}, null, 42, Ke)
|
|
958
267
|
]));
|
|
959
268
|
}
|
|
960
|
-
}),
|
|
269
|
+
}), He = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, Ge = { class: "text-gray-500 w-1/3" }, qe = ["value"], Je = /* @__PURE__ */ w({
|
|
961
270
|
__name: "TextControl",
|
|
962
271
|
props: {
|
|
963
272
|
label: {},
|
|
964
273
|
control: {}
|
|
965
274
|
},
|
|
966
275
|
emits: ["change"],
|
|
967
|
-
setup(
|
|
968
|
-
function e(
|
|
969
|
-
|
|
276
|
+
setup(t, { emit: o }) {
|
|
277
|
+
function e(n) {
|
|
278
|
+
o("change", n);
|
|
970
279
|
}
|
|
971
|
-
return (
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
value:
|
|
280
|
+
return (n, l) => (f(), d("div", He, [
|
|
281
|
+
u("label", Ge, m(n.label), 1),
|
|
282
|
+
u("input", {
|
|
283
|
+
value: n.control.value,
|
|
975
284
|
type: "string",
|
|
976
285
|
class: "p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",
|
|
977
286
|
onChange: e
|
|
978
|
-
}, null, 40,
|
|
287
|
+
}, null, 40, qe)
|
|
979
288
|
]));
|
|
980
289
|
}
|
|
981
|
-
}),
|
|
290
|
+
}), Qe = { class: "flex px-4 justify-start gap-2 items-center mb-2 min-h-32px" }, Ze = { class: "text-gray-500 w-1/3" }, Oe = ["id", "checked"], Fe = ["for"], Ne = { class: "i-ic:baseline-check text-light" }, et = /* @__PURE__ */ w({
|
|
982
291
|
__name: "BooleanControl",
|
|
983
292
|
props: {
|
|
984
293
|
label: {},
|
|
985
294
|
control: {}
|
|
986
295
|
},
|
|
987
296
|
emits: ["change"],
|
|
988
|
-
setup(
|
|
989
|
-
function e(
|
|
990
|
-
const { target:
|
|
991
|
-
|
|
297
|
+
setup(t, { emit: o }) {
|
|
298
|
+
function e(n) {
|
|
299
|
+
const { target: l } = n;
|
|
300
|
+
o("change", l.checked);
|
|
992
301
|
}
|
|
993
|
-
return (
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
id:
|
|
997
|
-
checked:
|
|
302
|
+
return (n, l) => (f(), d("div", Qe, [
|
|
303
|
+
u("label", Ze, m(n.label), 1),
|
|
304
|
+
u("input", {
|
|
305
|
+
id: n.control.label,
|
|
306
|
+
checked: n.control.value,
|
|
998
307
|
class: "hidden",
|
|
999
308
|
type: "checkbox",
|
|
1000
309
|
onInput: e
|
|
1001
|
-
}, null, 40,
|
|
1002
|
-
|
|
1003
|
-
for:
|
|
310
|
+
}, null, 40, Oe),
|
|
311
|
+
u("label", {
|
|
312
|
+
for: n.control.label,
|
|
1004
313
|
class: "inline-flex items-center cursor-pointer"
|
|
1005
314
|
}, [
|
|
1006
|
-
|
|
1007
|
-
class:
|
|
315
|
+
u("span", {
|
|
316
|
+
class: M([{ "bg-dark-500": n.control.value, "bg-gray-200": !n.control.value }, "w-4 h-4 flex justify-center items-center rounded border border-gray-300 mr-2 transition-colors duration-200"])
|
|
1008
317
|
}, [
|
|
1009
|
-
|
|
1010
|
-
[
|
|
318
|
+
G(u("i", Ne, null, 512), [
|
|
319
|
+
[q, n.control.value]
|
|
1011
320
|
])
|
|
1012
321
|
], 2)
|
|
1013
|
-
], 8,
|
|
322
|
+
], 8, Fe)
|
|
1014
323
|
]));
|
|
1015
324
|
}
|
|
1016
|
-
}),
|
|
325
|
+
}), tt = { class: "px-4 relative flex justify-between gap-4 items-center mb-2" }, nt = ["value", "min", "max", "step"], ot = ["value", "min", "max", "step"], lt = /* @__PURE__ */ w({
|
|
1017
326
|
__name: "SliderControl",
|
|
1018
327
|
props: {
|
|
1019
328
|
label: {},
|
|
1020
329
|
control: {}
|
|
1021
330
|
},
|
|
1022
331
|
emits: ["change"],
|
|
1023
|
-
setup(
|
|
1024
|
-
const e =
|
|
1025
|
-
function
|
|
1026
|
-
const { target:
|
|
1027
|
-
|
|
332
|
+
setup(t, { emit: o }) {
|
|
333
|
+
const e = t;
|
|
334
|
+
function n(r) {
|
|
335
|
+
const { target: v } = r;
|
|
336
|
+
o("change", v.valueAsNumber);
|
|
1028
337
|
}
|
|
1029
|
-
const
|
|
338
|
+
const l = I(() => ({
|
|
1030
339
|
backgroundImage: `linear-gradient(to right, #333 0% ${100 * (e.control.value - (e.control.min || 0)) / ((e.control.max || 100) - (e.control.min || 0))}%, #e2e2e2 0%)`
|
|
1031
|
-
})),
|
|
1032
|
-
|
|
1033
|
-
},
|
|
1034
|
-
|
|
1035
|
-
},
|
|
1036
|
-
return
|
|
1037
|
-
if (
|
|
1038
|
-
const
|
|
1039
|
-
|
|
340
|
+
})), a = R(), s = g(0), i = g(!1), p = (r) => {
|
|
341
|
+
s.value = r.clientX, i.value = !0;
|
|
342
|
+
}, x = () => {
|
|
343
|
+
i.value = !1;
|
|
344
|
+
}, c = (r) => Math.floor(Math.abs(r) / 10);
|
|
345
|
+
return T(a.x, (r) => {
|
|
346
|
+
if (i.value) {
|
|
347
|
+
const v = r - s.value, C = c(v);
|
|
348
|
+
v > 0 ? o("change", e.control.value + 1 + C) : v < 0 && o("change", e.control.value - 1 + C), e.control.min !== void 0 && e.control.value < e.control.min && o("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && o("change", e.control.max), s.value = r;
|
|
1040
349
|
}
|
|
1041
|
-
}), (r,
|
|
1042
|
-
|
|
1043
|
-
class:
|
|
350
|
+
}), (r, v) => (f(), d("div", tt, [
|
|
351
|
+
u("label", {
|
|
352
|
+
class: M(["text-gray-500 w-1/3", { "flex justify-between items-center": r.control.icon }])
|
|
1044
353
|
}, [
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
class:
|
|
354
|
+
pe(m(r.label) + " ", 1),
|
|
355
|
+
u("i", {
|
|
356
|
+
class: M(`i-${r.control.icon}`)
|
|
1048
357
|
}, null, 2)
|
|
1049
358
|
], 2),
|
|
1050
|
-
|
|
359
|
+
u("input", {
|
|
1051
360
|
value: r.control.value,
|
|
1052
361
|
class: "w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",
|
|
1053
|
-
style:
|
|
362
|
+
style: ve(l.value),
|
|
1054
363
|
type: "range",
|
|
1055
364
|
min: r.control.min,
|
|
1056
365
|
max: r.control.max,
|
|
1057
366
|
step: r.control.step,
|
|
1058
|
-
onInput:
|
|
1059
|
-
}, null, 44,
|
|
1060
|
-
|
|
367
|
+
onInput: n
|
|
368
|
+
}, null, 44, nt),
|
|
369
|
+
u("input", {
|
|
1061
370
|
value: r.control.value,
|
|
1062
|
-
class:
|
|
371
|
+
class: M(["p-2 w-1/4 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans", { "cursor-ew-resize": i.value }]),
|
|
1063
372
|
type: "number",
|
|
1064
373
|
min: r.control.min,
|
|
1065
374
|
max: r.control.max,
|
|
1066
375
|
step: r.control.step,
|
|
1067
|
-
onInput:
|
|
1068
|
-
onMousedown:
|
|
1069
|
-
onMouseup:
|
|
1070
|
-
}, null, 42,
|
|
376
|
+
onInput: n,
|
|
377
|
+
onMousedown: p,
|
|
378
|
+
onMouseup: x
|
|
379
|
+
}, null, 42, ot)
|
|
1071
380
|
]));
|
|
1072
381
|
}
|
|
1073
382
|
});
|
|
1074
|
-
const
|
|
1075
|
-
const e =
|
|
1076
|
-
for (const [
|
|
1077
|
-
e[
|
|
383
|
+
const at = (t, o) => {
|
|
384
|
+
const e = t.__vccOpts || t;
|
|
385
|
+
for (const [n, l] of o)
|
|
386
|
+
e[n] = l;
|
|
1078
387
|
return e;
|
|
1079
|
-
},
|
|
388
|
+
}, st = /* @__PURE__ */ at(lt, [["__scopeId", "data-v-743fd350"]]), rt = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, ut = { class: "text-gray-500 w-1/3" }, it = ["value"], ct = ["value"], ft = /* @__PURE__ */ w({
|
|
1080
389
|
__name: "ColorControl",
|
|
1081
390
|
props: {
|
|
1082
391
|
label: {},
|
|
1083
392
|
control: {}
|
|
1084
393
|
},
|
|
1085
394
|
emits: ["change"],
|
|
1086
|
-
setup(
|
|
1087
|
-
function e(
|
|
1088
|
-
const { target:
|
|
1089
|
-
|
|
395
|
+
setup(t, { emit: o }) {
|
|
396
|
+
function e(n) {
|
|
397
|
+
const { target: l } = n;
|
|
398
|
+
o("change", l.value);
|
|
1090
399
|
}
|
|
1091
|
-
return (
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
value:
|
|
400
|
+
return (n, l) => (f(), d("div", rt, [
|
|
401
|
+
u("label", ut, m(n.label), 1),
|
|
402
|
+
u("input", {
|
|
403
|
+
value: n.control.value,
|
|
1095
404
|
type: "color",
|
|
1096
405
|
onInput: e
|
|
1097
|
-
}, null, 40,
|
|
1098
|
-
|
|
1099
|
-
value:
|
|
406
|
+
}, null, 40, it),
|
|
407
|
+
u("input", {
|
|
408
|
+
value: n.control.value,
|
|
1100
409
|
class: "p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",
|
|
1101
410
|
type: "text",
|
|
1102
411
|
onInput: e
|
|
1103
|
-
}, null, 40,
|
|
412
|
+
}, null, 40, ct)
|
|
1104
413
|
]));
|
|
1105
414
|
}
|
|
1106
415
|
});
|
|
1107
|
-
function
|
|
1108
|
-
|
|
416
|
+
function pt(t) {
|
|
417
|
+
if (typeof t == "number")
|
|
418
|
+
return [t, t, t];
|
|
419
|
+
if (ee(t)) {
|
|
420
|
+
const { x: o, y: e, z: n } = t;
|
|
421
|
+
return [o, e, n];
|
|
422
|
+
}
|
|
423
|
+
return t;
|
|
424
|
+
}
|
|
425
|
+
function vt(t) {
|
|
426
|
+
return t && typeof t.x == "number" && typeof t.y == "number" && typeof t.z > "u";
|
|
427
|
+
}
|
|
428
|
+
function ee(t) {
|
|
429
|
+
return t && typeof t.x == "number" && typeof t.y == "number" && typeof t.z == "number";
|
|
1109
430
|
}
|
|
1110
|
-
const
|
|
431
|
+
const dt = { class: "flex px-4 justify-between gap-2 items-center mb-2" }, bt = { class: "text-gray-500 w-1/3" }, gt = { class: "w-2/3 flex justify-between gap-1" }, yt = {
|
|
1111
432
|
key: 0,
|
|
1112
433
|
class: "font-bold px-0.5 py-1 text-0.65rem text-gray-300"
|
|
1113
|
-
},
|
|
434
|
+
}, ht = ["value", "onInput", "onMousedown", "onMouseup"], _t = /* @__PURE__ */ w({
|
|
1114
435
|
__name: "VectorControl",
|
|
1115
436
|
props: {
|
|
1116
437
|
label: {},
|
|
1117
438
|
control: {}
|
|
1118
439
|
},
|
|
1119
440
|
emits: ["change"],
|
|
1120
|
-
setup(
|
|
1121
|
-
const e =
|
|
1122
|
-
|
|
1123
|
-
},
|
|
1124
|
-
|
|
1125
|
-
},
|
|
1126
|
-
function
|
|
1127
|
-
const { value:
|
|
1128
|
-
|
|
441
|
+
setup(t, { emit: o }) {
|
|
442
|
+
const e = t, n = R(), l = g(0), a = g(!1), s = g(0), i = (h, $) => {
|
|
443
|
+
s.value = $, l.value = h.clientX, a.value = !0;
|
|
444
|
+
}, p = (h, $) => {
|
|
445
|
+
s.value = $, a.value = !1;
|
|
446
|
+
}, x = (h) => Math.floor(Math.abs(h) / 10), c = I(() => pt(e.control.value)), r = I(() => Object.keys(e.control.value)), v = I(() => vt(e.control.value) || ee(e.control.value));
|
|
447
|
+
function C(h, $) {
|
|
448
|
+
const { value: S } = e.control, { target: b } = h;
|
|
449
|
+
s.value = $, S[v.value ? r.value[s.value] : s.value] = parseInt(b.value, 10), o("change", S);
|
|
1129
450
|
}
|
|
1130
|
-
return
|
|
1131
|
-
if (
|
|
1132
|
-
const
|
|
1133
|
-
|
|
451
|
+
return T(n.x, (h) => {
|
|
452
|
+
if (a.value) {
|
|
453
|
+
const $ = h - l.value, S = x($), { value: b } = e.control, k = v.value ? r.value[s.value] : s.value;
|
|
454
|
+
$ > 0 ? b[k] += 1 + S : $ < 0 && (b[k] -= 1 + S), e.control.min !== void 0 && b < e.control.min && (b[k] = e.control.min), e.control.max !== void 0 && b > e.control.max && (b[k] = e.control.max), o("change", b), l.value = h;
|
|
1134
455
|
}
|
|
1135
|
-
}), (
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
(
|
|
1139
|
-
key:
|
|
456
|
+
}), (h, $) => (f(), d("div", dt, [
|
|
457
|
+
u("label", bt, m(h.label), 1),
|
|
458
|
+
u("div", gt, [
|
|
459
|
+
(f(!0), d(E, null, A(c.value, (S, b) => (f(), d("div", {
|
|
460
|
+
key: h.label + b,
|
|
1140
461
|
class: "flex items-center w-1/3 bg-gray-100 rounded"
|
|
1141
462
|
}, [
|
|
1142
|
-
r.value[
|
|
1143
|
-
|
|
463
|
+
r.value[b] && v.value ? (f(), d("span", yt, m(r.value[b]), 1)) : J("", !0),
|
|
464
|
+
u("input", {
|
|
1144
465
|
type: "text",
|
|
1145
|
-
class:
|
|
1146
|
-
value:
|
|
1147
|
-
onInput: (
|
|
1148
|
-
onMousedown: (
|
|
1149
|
-
onMouseup: (
|
|
1150
|
-
}, null, 42,
|
|
466
|
+
class: M(["w-full pl-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans", { "cursor-ew-resize": a.value }]),
|
|
467
|
+
value: c.value[b].toFixed(2),
|
|
468
|
+
onInput: (k) => C(k, b),
|
|
469
|
+
onMousedown: (k) => i(k, b),
|
|
470
|
+
onMouseup: (k) => p(k, b)
|
|
471
|
+
}, null, 42, ht)
|
|
1151
472
|
]))), 128))
|
|
1152
473
|
])
|
|
1153
474
|
]));
|
|
1154
475
|
}
|
|
1155
|
-
}),
|
|
476
|
+
}), mt = { class: "mb-4" }, wt = { class: "bg-white rounded-b pt-4" }, xt = /* @__PURE__ */ w({
|
|
1156
477
|
__name: "Folder",
|
|
1157
478
|
props: {
|
|
1158
479
|
control: {}
|
|
1159
480
|
},
|
|
1160
|
-
setup(
|
|
1161
|
-
function
|
|
1162
|
-
|
|
481
|
+
setup(t) {
|
|
482
|
+
function o(l, a) {
|
|
483
|
+
a.value = l;
|
|
1163
484
|
}
|
|
1164
|
-
const e =
|
|
485
|
+
const e = g(!1), n = () => {
|
|
1165
486
|
e.value = !e.value;
|
|
1166
487
|
};
|
|
1167
|
-
return (
|
|
1168
|
-
|
|
488
|
+
return (l, a) => (f(), d("div", mt, [
|
|
489
|
+
u("button", {
|
|
1169
490
|
class: "flex items-center justify-between w-full p-4 bg-gray-100 border-none text-gray-400 font-bold text-xs focus:outline-none font-sans cursor-pointer",
|
|
1170
|
-
onClick:
|
|
491
|
+
onClick: n
|
|
1171
492
|
}, [
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
class:
|
|
493
|
+
u("span", null, m(l.control.label), 1),
|
|
494
|
+
u("i", {
|
|
495
|
+
class: M(e.value ? "i-ic:baseline-keyboard-arrow-up" : "i-ic:baseline-keyboard-arrow-down")
|
|
1175
496
|
}, null, 2)
|
|
1176
497
|
]),
|
|
1177
|
-
|
|
498
|
+
de(be, {
|
|
1178
499
|
name: "slide",
|
|
1179
500
|
"enter-active-class": " animate-fade-in animate-duration-200 animate-ease-in-out",
|
|
1180
501
|
"leave-active-class": " animate-fade-out animate-duration-200 animate-ease-in-out"
|
|
1181
502
|
}, {
|
|
1182
|
-
default:
|
|
1183
|
-
|
|
1184
|
-
(
|
|
1185
|
-
key:
|
|
1186
|
-
control:
|
|
1187
|
-
onChange: (
|
|
503
|
+
default: Q(() => [
|
|
504
|
+
G(u("div", wt, [
|
|
505
|
+
(f(!0), d(E, null, A(l.control.controls, (s) => (f(), _(te, {
|
|
506
|
+
key: s.label,
|
|
507
|
+
control: s,
|
|
508
|
+
onChange: (i) => o(i, s)
|
|
1188
509
|
}, null, 8, ["control", "onChange"]))), 128))
|
|
1189
510
|
], 512), [
|
|
1190
|
-
[
|
|
511
|
+
[q, e.value]
|
|
1191
512
|
])
|
|
1192
513
|
]),
|
|
1193
514
|
_: 1
|
|
1194
515
|
})
|
|
1195
516
|
]));
|
|
1196
517
|
}
|
|
1197
|
-
}),
|
|
518
|
+
}), $t = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, kt = { class: "text-gray-500 w-1/3" }, Ct = { class: "relative w-2/3 p-1 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans" }, Mt = { class: "absolute bottom-0.5 right-0.5 font-sans text-xs" }, St = ["points"], B = 160, z = 40, j = 2, K = 100, Y = 20, It = /* @__PURE__ */ w({
|
|
1198
519
|
__name: "FPSGraph",
|
|
1199
520
|
props: {
|
|
1200
521
|
label: {},
|
|
1201
522
|
control: {}
|
|
1202
523
|
},
|
|
1203
|
-
setup(
|
|
1204
|
-
const
|
|
1205
|
-
let
|
|
1206
|
-
return
|
|
1207
|
-
|
|
1208
|
-
(
|
|
524
|
+
setup(t) {
|
|
525
|
+
const o = _e({ every: K }), e = g(""), n = g([]), l = g(B / j);
|
|
526
|
+
let a = performance.now();
|
|
527
|
+
return me(({ timestamp: s }) => {
|
|
528
|
+
s - a >= K && (a = s, n.value.push(o.value), n.value.length > l.value && n.value.shift(), e.value = n.value.map(
|
|
529
|
+
(i, p) => `${p * j},${z + Y - j / 2 - i * (z + Y - j) / 120}`
|
|
1209
530
|
).join(" "));
|
|
1210
|
-
}), (
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
(
|
|
1215
|
-
width:
|
|
1216
|
-
height:
|
|
531
|
+
}), (s, i) => (f(), d("div", $t, [
|
|
532
|
+
u("label", kt, m(s.label), 1),
|
|
533
|
+
u("div", Ct, [
|
|
534
|
+
u("div", Mt, m(Math.round(D(o))) + " FPS", 1),
|
|
535
|
+
(f(), d("svg", {
|
|
536
|
+
width: B,
|
|
537
|
+
height: z,
|
|
1217
538
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1218
539
|
class: "bg-gray-100"
|
|
1219
540
|
}, [
|
|
1220
|
-
|
|
541
|
+
u("polyline", {
|
|
1221
542
|
points: e.value,
|
|
1222
543
|
fill: "none",
|
|
1223
544
|
stroke: "lightgray",
|
|
1224
|
-
"stroke-width":
|
|
545
|
+
"stroke-width": j,
|
|
1225
546
|
"stroke-linecap": "round",
|
|
1226
547
|
"stroke-linejoin": "round"
|
|
1227
|
-
}, null, 8,
|
|
548
|
+
}, null, 8, St)
|
|
1228
549
|
]))
|
|
1229
550
|
])
|
|
1230
551
|
]));
|
|
1231
552
|
}
|
|
1232
|
-
}),
|
|
553
|
+
}), Tt = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, jt = { class: "text-gray-500 w-1/3" }, Dt = ["value"], Pt = ["value"], Et = /* @__PURE__ */ w({
|
|
1233
554
|
__name: "SelectControl",
|
|
1234
555
|
props: {
|
|
1235
556
|
label: {},
|
|
1236
557
|
control: {}
|
|
1237
558
|
},
|
|
1238
559
|
emits: ["change"],
|
|
1239
|
-
setup(
|
|
1240
|
-
function e(
|
|
1241
|
-
|
|
560
|
+
setup(t, { emit: o }) {
|
|
561
|
+
function e(n) {
|
|
562
|
+
o("change", n.target.value);
|
|
1242
563
|
}
|
|
1243
|
-
return (
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
value:
|
|
564
|
+
return (n, l) => (f(), d("div", Tt, [
|
|
565
|
+
u("label", jt, m(n.label), 1),
|
|
566
|
+
u("select", {
|
|
567
|
+
value: n.control.value,
|
|
1247
568
|
class: "p-2 w-2/3 rounded text-left text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",
|
|
1248
569
|
onChange: e
|
|
1249
570
|
}, [
|
|
1250
|
-
(
|
|
1251
|
-
key:
|
|
1252
|
-
value:
|
|
1253
|
-
},
|
|
1254
|
-
], 40,
|
|
571
|
+
(f(!0), d(E, null, A(n.control.options, (a) => (f(), d("option", {
|
|
572
|
+
key: a.value,
|
|
573
|
+
value: a.value
|
|
574
|
+
}, m(a.text), 9, Pt))), 128))
|
|
575
|
+
], 40, Dt)
|
|
1255
576
|
]));
|
|
1256
577
|
}
|
|
1257
|
-
}),
|
|
578
|
+
}), te = /* @__PURE__ */ w({
|
|
1258
579
|
__name: "ControlInput",
|
|
1259
580
|
props: {
|
|
1260
581
|
control: {}
|
|
1261
582
|
},
|
|
1262
583
|
emits: ["change"],
|
|
1263
|
-
setup(
|
|
1264
|
-
function e(
|
|
1265
|
-
|
|
584
|
+
setup(t, { emit: o }) {
|
|
585
|
+
function e(n) {
|
|
586
|
+
o("change", n);
|
|
1266
587
|
}
|
|
1267
|
-
return (
|
|
1268
|
-
|
|
588
|
+
return (n, l) => n.control.visible ? (f(), d(E, { key: 0 }, [
|
|
589
|
+
n.control.type === "color" ? (f(), _(ft, {
|
|
1269
590
|
key: 0,
|
|
1270
|
-
label:
|
|
1271
|
-
control:
|
|
591
|
+
label: n.control.label,
|
|
592
|
+
control: n.control,
|
|
1272
593
|
onChange: e
|
|
1273
|
-
}, null, 8, ["label", "control"])) :
|
|
594
|
+
}, null, 8, ["label", "control"])) : n.control.type === "vector" ? (f(), _(_t, {
|
|
1274
595
|
key: 1,
|
|
1275
|
-
label:
|
|
1276
|
-
control:
|
|
596
|
+
label: n.control.label,
|
|
597
|
+
control: n.control,
|
|
1277
598
|
onChange: e
|
|
1278
|
-
}, null, 8, ["label", "control"])) :
|
|
599
|
+
}, null, 8, ["label", "control"])) : n.control.type === "boolean" ? (f(), _(et, {
|
|
1279
600
|
key: 2,
|
|
1280
|
-
label:
|
|
1281
|
-
control:
|
|
601
|
+
label: n.control.label,
|
|
602
|
+
control: n.control,
|
|
1282
603
|
onChange: e
|
|
1283
|
-
}, null, 8, ["label", "control"])) :
|
|
604
|
+
}, null, 8, ["label", "control"])) : n.control.type === "fpsgraph" ? (f(), _(It, {
|
|
1284
605
|
key: 3,
|
|
1285
|
-
label:
|
|
1286
|
-
control:
|
|
1287
|
-
}, null, 8, ["label", "control"])) :
|
|
606
|
+
label: n.control.label,
|
|
607
|
+
control: n.control
|
|
608
|
+
}, null, 8, ["label", "control"])) : n.control.type === "folder" ? (f(), _(xt, {
|
|
1288
609
|
key: 4,
|
|
1289
|
-
label:
|
|
1290
|
-
control:
|
|
1291
|
-
}, null, 8, ["label", "control"])) :
|
|
610
|
+
label: n.control.label,
|
|
611
|
+
control: n.control
|
|
612
|
+
}, null, 8, ["label", "control"])) : n.control.type === "number" ? (f(), _(Ye, {
|
|
1292
613
|
key: 5,
|
|
1293
|
-
label:
|
|
1294
|
-
control:
|
|
614
|
+
label: n.control.label,
|
|
615
|
+
control: n.control,
|
|
1295
616
|
onChange: e
|
|
1296
|
-
}, null, 8, ["label", "control"])) :
|
|
617
|
+
}, null, 8, ["label", "control"])) : n.control.type === "range" ? (f(), _(st, {
|
|
1297
618
|
key: 6,
|
|
1298
|
-
label:
|
|
1299
|
-
control:
|
|
619
|
+
label: n.control.label,
|
|
620
|
+
control: n.control,
|
|
1300
621
|
onChange: e
|
|
1301
|
-
}, null, 8, ["label", "control"])) :
|
|
622
|
+
}, null, 8, ["label", "control"])) : n.control.type === "select" ? (f(), _(Et, {
|
|
1302
623
|
key: 7,
|
|
1303
|
-
label:
|
|
1304
|
-
control:
|
|
624
|
+
label: n.control.label,
|
|
625
|
+
control: n.control,
|
|
1305
626
|
onChange: e
|
|
1306
|
-
}, null, 8, ["label", "control"])) : (
|
|
627
|
+
}, null, 8, ["label", "control"])) : (f(), _(Je, {
|
|
1307
628
|
key: 8,
|
|
1308
|
-
label:
|
|
1309
|
-
control:
|
|
629
|
+
label: n.control.label,
|
|
630
|
+
control: n.control,
|
|
1310
631
|
onChange: e
|
|
1311
632
|
}, null, 8, ["label", "control"]))
|
|
1312
|
-
], 64)) :
|
|
1313
|
-
}
|
|
1314
|
-
}),
|
|
1315
|
-
/* @__PURE__ */
|
|
1316
|
-
/* @__PURE__ */
|
|
1317
|
-
/* @__PURE__ */
|
|
1318
|
-
], -1),
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
],
|
|
633
|
+
], 64)) : J("", !0);
|
|
634
|
+
}
|
|
635
|
+
}), At = { class: "bg-white shadow-xl rounded border-4 border-solid border-black" }, Lt = /* @__PURE__ */ u("i", { class: "h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs" }, "🍰", -1), Vt = /* @__PURE__ */ u("div", null, [
|
|
636
|
+
/* @__PURE__ */ u("i", { class: "i-ic-baseline-drag-indicator" }),
|
|
637
|
+
/* @__PURE__ */ u("i", { class: "i-ic-baseline-drag-indicator" }),
|
|
638
|
+
/* @__PURE__ */ u("i", { class: "i-ic-baseline-drag-indicator" })
|
|
639
|
+
], -1), zt = /* @__PURE__ */ u("div", null, null, -1), Rt = [
|
|
640
|
+
Lt,
|
|
641
|
+
Vt,
|
|
642
|
+
zt
|
|
643
|
+
], Xt = 280, Kt = /* @__PURE__ */ w({
|
|
1323
644
|
__name: "TresLeches",
|
|
1324
|
-
setup(
|
|
1325
|
-
const { width:
|
|
1326
|
-
function
|
|
1327
|
-
|
|
645
|
+
setup(t) {
|
|
646
|
+
const { width: o } = we(), e = g(null), n = Xe();
|
|
647
|
+
function l(a, s) {
|
|
648
|
+
s.ref && (s.ref[s.label] = a), s.value = a;
|
|
1328
649
|
}
|
|
1329
|
-
return (
|
|
1330
|
-
"initial-value": { x:
|
|
1331
|
-
class:
|
|
650
|
+
return (a, s) => (f(), _(D(Ae), {
|
|
651
|
+
"initial-value": { x: D(o) - Xt - 20, y: 10 },
|
|
652
|
+
class: M(["absolute select-none z-24 w-280px font-sans text-xs", a.$attrs.class]),
|
|
1332
653
|
handle: e.value
|
|
1333
654
|
}, {
|
|
1334
|
-
default:
|
|
1335
|
-
|
|
1336
|
-
|
|
655
|
+
default: Q(() => [
|
|
656
|
+
u("div", At, [
|
|
657
|
+
u("header", {
|
|
1337
658
|
ref_key: "handle",
|
|
1338
659
|
ref: e,
|
|
1339
660
|
class: "relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"
|
|
1340
|
-
},
|
|
1341
|
-
(
|
|
1342
|
-
key:
|
|
1343
|
-
control:
|
|
1344
|
-
onChange: (
|
|
661
|
+
}, Rt, 512),
|
|
662
|
+
(f(!0), d(E, null, A(D(n), (i) => (f(), _(te, {
|
|
663
|
+
key: i.label,
|
|
664
|
+
control: i,
|
|
665
|
+
onChange: (p) => l(p, i)
|
|
1345
666
|
}, null, 8, ["control", "onChange"]))), 128))
|
|
1346
667
|
])
|
|
1347
668
|
]),
|
|
@@ -1350,6 +671,6 @@ const Me = { class: "flex px-4 justify-between gap-2 items-center mb-2" }, ve =
|
|
|
1350
671
|
}
|
|
1351
672
|
});
|
|
1352
673
|
export {
|
|
1353
|
-
|
|
1354
|
-
|
|
674
|
+
Kt as TresLeches,
|
|
675
|
+
Bt as useControls
|
|
1355
676
|
};
|