@planara/core 1.4.9 → 1.6.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/editor-renderer.d.ts +28 -12
- package/dist/core/editor-renderer.d.ts.map +1 -1
- package/dist/core/preview-renderer.d.ts +2 -1
- package/dist/core/preview-renderer.d.ts.map +1 -1
- package/dist/core/renderer.d.ts +40 -3
- package/dist/core/renderer.d.ts.map +1 -1
- package/dist/events/editor-events.d.ts +18 -0
- package/dist/events/editor-events.d.ts.map +1 -0
- package/dist/events/event-bus.d.ts +17 -0
- package/dist/events/event-bus.d.ts.map +1 -0
- package/dist/events/event-topics.d.ts +12 -0
- package/dist/events/event-topics.d.ts.map +1 -0
- package/dist/extensions/mesh-extension.d.ts +12 -0
- package/dist/extensions/mesh-extension.d.ts.map +1 -0
- package/dist/extensions/orbit-extension.d.ts +5 -2
- package/dist/extensions/orbit-extension.d.ts.map +1 -1
- package/dist/handlers/display/wireframe-handler.d.ts +37 -0
- package/dist/handlers/display/wireframe-handler.d.ts.map +1 -0
- package/dist/handlers/select/mesh-select-handler.d.ts +25 -0
- package/dist/handlers/select/mesh-select-handler.d.ts.map +1 -0
- package/dist/hub/app-hub.d.ts +7 -0
- package/dist/hub/app-hub.d.ts.map +1 -0
- package/dist/hub/editor-hub.d.ts +21 -0
- package/dist/hub/editor-hub.d.ts.map +1 -0
- package/dist/index.cjs.js +52 -7
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +2065 -113
- package/dist/index.full.d.ts +315 -0
- package/dist/index.public.d.ts +260 -0
- package/dist/index.umd.js +52 -7
- package/dist/interfaces/api/mesh-api.d.ts +39 -0
- package/dist/interfaces/api/mesh-api.d.ts.map +1 -0
- package/dist/interfaces/api/renderer-api.d.ts +27 -0
- package/dist/interfaces/api/renderer-api.d.ts.map +1 -0
- package/dist/interfaces/handler/display-handler.d.ts +13 -0
- package/dist/interfaces/handler/display-handler.d.ts.map +1 -0
- package/dist/interfaces/handler/handler.d.ts +23 -0
- package/dist/interfaces/handler/handler.d.ts.map +1 -0
- package/dist/interfaces/handler/select-handler.d.ts +13 -0
- package/dist/interfaces/handler/select-handler.d.ts.map +1 -0
- package/dist/interfaces/manager/display-manager.d.ts +8 -0
- package/dist/interfaces/manager/display-manager.d.ts.map +1 -0
- package/dist/interfaces/manager/manager.d.ts +16 -0
- package/dist/interfaces/manager/manager.d.ts.map +1 -0
- package/dist/interfaces/manager/select-manager.d.ts +8 -0
- package/dist/interfaces/manager/select-manager.d.ts.map +1 -0
- package/dist/ioc/container.d.ts +5 -0
- package/dist/ioc/container.d.ts.map +1 -0
- package/dist/loaders/obj-loader.d.ts +8 -7
- package/dist/loaders/obj-loader.d.ts.map +1 -1
- package/dist/managers/display/display-manager.d.ts +19 -0
- package/dist/managers/display/display-manager.d.ts.map +1 -0
- package/dist/managers/select/select-manager.d.ts +19 -0
- package/dist/managers/select/select-manager.d.ts.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/camera/camera-position.d.ts +10 -0
- package/dist/types/camera/camera-position.d.ts.map +1 -0
- package/dist/types/event/select-event-type.d.ts +6 -0
- package/dist/types/event/select-event-type.d.ts.map +1 -0
- package/dist/utils/program-settings.d.ts +4 -3
- package/dist/utils/program-settings.d.ts.map +1 -1
- package/dist/utils/renderer-api.d.ts +21 -0
- package/dist/utils/renderer-api.d.ts.map +1 -0
- package/package.json +17 -4
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,824 @@
|
|
|
1
|
-
import { Program as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Program as Et, Mesh as Ct, Renderer as St, Transform as xt, Camera as It, Geometry as Lt, Orbit as it, GridHelper as Tt, AxesHelper as At, Raycast as kt, Vec2 as jt, Vec3 as Dt, NormalProgram as Ht, WireMesh as Nt } from "ogl";
|
|
2
|
+
var Ye = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Qe = {};
|
|
3
|
+
/*! *****************************************************************************
|
|
4
|
+
Copyright (C) Microsoft. All rights reserved.
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
6
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
7
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
10
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
11
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
12
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
13
|
+
|
|
14
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
15
|
+
and limitations under the License.
|
|
16
|
+
***************************************************************************** */
|
|
17
|
+
var Xe;
|
|
18
|
+
function Ft() {
|
|
19
|
+
if (Xe) return Qe;
|
|
20
|
+
Xe = 1;
|
|
21
|
+
var e;
|
|
22
|
+
return (function(t) {
|
|
23
|
+
(function(r) {
|
|
24
|
+
var s = typeof globalThis == "object" ? globalThis : typeof Ye == "object" ? Ye : typeof self == "object" ? self : typeof this == "object" ? this : R(), o = n(t);
|
|
25
|
+
typeof s.Reflect < "u" && (o = n(s.Reflect, o)), r(o, s), typeof s.Reflect > "u" && (s.Reflect = t);
|
|
26
|
+
function n(_, S) {
|
|
27
|
+
return function(j, B) {
|
|
28
|
+
Object.defineProperty(_, j, { configurable: !0, writable: !0, value: B }), S && S(j, B);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function l() {
|
|
32
|
+
try {
|
|
33
|
+
return Function("return this;")();
|
|
34
|
+
} catch {
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function w() {
|
|
38
|
+
try {
|
|
39
|
+
return (0, eval)("(function() { return this; })()");
|
|
40
|
+
} catch {
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function R() {
|
|
44
|
+
return l() || w();
|
|
45
|
+
}
|
|
46
|
+
})(function(r, s) {
|
|
47
|
+
var o = Object.prototype.hasOwnProperty, n = typeof Symbol == "function", l = n && typeof Symbol.toPrimitive < "u" ? Symbol.toPrimitive : "@@toPrimitive", w = n && typeof Symbol.iterator < "u" ? Symbol.iterator : "@@iterator", R = typeof Object.create == "function", _ = { __proto__: [] } instanceof Array, S = !R && !_, j = {
|
|
48
|
+
// create an object in dictionary mode (a.k.a. "slow" mode in v8)
|
|
49
|
+
create: R ? function() {
|
|
50
|
+
return me(/* @__PURE__ */ Object.create(null));
|
|
51
|
+
} : _ ? function() {
|
|
52
|
+
return me({ __proto__: null });
|
|
53
|
+
} : function() {
|
|
54
|
+
return me({});
|
|
55
|
+
},
|
|
56
|
+
has: S ? function(i, a) {
|
|
57
|
+
return o.call(i, a);
|
|
58
|
+
} : function(i, a) {
|
|
59
|
+
return a in i;
|
|
60
|
+
},
|
|
61
|
+
get: S ? function(i, a) {
|
|
62
|
+
return o.call(i, a) ? i[a] : void 0;
|
|
63
|
+
} : function(i, a) {
|
|
64
|
+
return i[a];
|
|
65
|
+
}
|
|
66
|
+
}, B = Object.getPrototypeOf(Function), G = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : Mt(), Z = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : bt(), K = typeof WeakMap == "function" ? WeakMap : Ot(), V = n ? Symbol.for("@reflect-metadata:registry") : void 0, J = mt(), re = gt(J);
|
|
67
|
+
function ne(i, a, u, h) {
|
|
68
|
+
if (b(u)) {
|
|
69
|
+
if (!Be(i))
|
|
70
|
+
throw new TypeError();
|
|
71
|
+
if (!Ge(a))
|
|
72
|
+
throw new TypeError();
|
|
73
|
+
return ie(i, a);
|
|
74
|
+
} else {
|
|
75
|
+
if (!Be(i))
|
|
76
|
+
throw new TypeError();
|
|
77
|
+
if (!A(a))
|
|
78
|
+
throw new TypeError();
|
|
79
|
+
if (!A(h) && !b(h) && !Y(h))
|
|
80
|
+
throw new TypeError();
|
|
81
|
+
return Y(h) && (h = void 0), u = $(u), ve(i, a, u, h);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
r("decorate", ne);
|
|
85
|
+
function c(i, a) {
|
|
86
|
+
function u(h, M) {
|
|
87
|
+
if (!A(h))
|
|
88
|
+
throw new TypeError();
|
|
89
|
+
if (!b(M) && !yt(M))
|
|
90
|
+
throw new TypeError();
|
|
91
|
+
He(i, a, h, M);
|
|
92
|
+
}
|
|
93
|
+
return u;
|
|
94
|
+
}
|
|
95
|
+
r("metadata", c);
|
|
96
|
+
function f(i, a, u, h) {
|
|
97
|
+
if (!A(u))
|
|
98
|
+
throw new TypeError();
|
|
99
|
+
return b(h) || (h = $(h)), He(i, a, u, h);
|
|
100
|
+
}
|
|
101
|
+
r("defineMetadata", f);
|
|
102
|
+
function d(i, a, u) {
|
|
103
|
+
if (!A(a))
|
|
104
|
+
throw new TypeError();
|
|
105
|
+
return b(u) || (u = $(u)), ke(i, a, u);
|
|
106
|
+
}
|
|
107
|
+
r("hasMetadata", d);
|
|
108
|
+
function g(i, a, u) {
|
|
109
|
+
if (!A(a))
|
|
110
|
+
throw new TypeError();
|
|
111
|
+
return b(u) || (u = $(u)), pe(i, a, u);
|
|
112
|
+
}
|
|
113
|
+
r("hasOwnMetadata", g);
|
|
114
|
+
function O(i, a, u) {
|
|
115
|
+
if (!A(a))
|
|
116
|
+
throw new TypeError();
|
|
117
|
+
return b(u) || (u = $(u)), je(i, a, u);
|
|
118
|
+
}
|
|
119
|
+
r("getMetadata", O);
|
|
120
|
+
function x(i, a, u) {
|
|
121
|
+
if (!A(a))
|
|
122
|
+
throw new TypeError();
|
|
123
|
+
return b(u) || (u = $(u)), De(i, a, u);
|
|
124
|
+
}
|
|
125
|
+
r("getOwnMetadata", x);
|
|
126
|
+
function P(i, a) {
|
|
127
|
+
if (!A(i))
|
|
128
|
+
throw new TypeError();
|
|
129
|
+
return b(a) || (a = $(a)), Ne(i, a);
|
|
130
|
+
}
|
|
131
|
+
r("getMetadataKeys", P);
|
|
132
|
+
function H(i, a) {
|
|
133
|
+
if (!A(i))
|
|
134
|
+
throw new TypeError();
|
|
135
|
+
return b(a) || (a = $(a)), Fe(i, a);
|
|
136
|
+
}
|
|
137
|
+
r("getOwnMetadataKeys", H);
|
|
138
|
+
function U(i, a, u) {
|
|
139
|
+
if (!A(a))
|
|
140
|
+
throw new TypeError();
|
|
141
|
+
if (b(u) || (u = $(u)), !A(a))
|
|
142
|
+
throw new TypeError();
|
|
143
|
+
b(u) || (u = $(u));
|
|
144
|
+
var h = ee(
|
|
145
|
+
a,
|
|
146
|
+
u,
|
|
147
|
+
/*Create*/
|
|
148
|
+
!1
|
|
149
|
+
);
|
|
150
|
+
return b(h) ? !1 : h.OrdinaryDeleteMetadata(i, a, u);
|
|
151
|
+
}
|
|
152
|
+
r("deleteMetadata", U);
|
|
153
|
+
function ie(i, a) {
|
|
154
|
+
for (var u = i.length - 1; u >= 0; --u) {
|
|
155
|
+
var h = i[u], M = h(a);
|
|
156
|
+
if (!b(M) && !Y(M)) {
|
|
157
|
+
if (!Ge(M))
|
|
158
|
+
throw new TypeError();
|
|
159
|
+
a = M;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return a;
|
|
163
|
+
}
|
|
164
|
+
function ve(i, a, u, h) {
|
|
165
|
+
for (var M = i.length - 1; M >= 0; --M) {
|
|
166
|
+
var L = i[M], k = L(a, u, h);
|
|
167
|
+
if (!b(k) && !Y(k)) {
|
|
168
|
+
if (!A(k))
|
|
169
|
+
throw new TypeError();
|
|
170
|
+
h = k;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return h;
|
|
174
|
+
}
|
|
175
|
+
function ke(i, a, u) {
|
|
176
|
+
var h = pe(i, a, u);
|
|
177
|
+
if (h)
|
|
178
|
+
return !0;
|
|
179
|
+
var M = _e(a);
|
|
180
|
+
return Y(M) ? !1 : ke(i, M, u);
|
|
181
|
+
}
|
|
182
|
+
function pe(i, a, u) {
|
|
183
|
+
var h = ee(
|
|
184
|
+
a,
|
|
185
|
+
u,
|
|
186
|
+
/*Create*/
|
|
187
|
+
!1
|
|
188
|
+
);
|
|
189
|
+
return b(h) ? !1 : We(h.OrdinaryHasOwnMetadata(i, a, u));
|
|
190
|
+
}
|
|
191
|
+
function je(i, a, u) {
|
|
192
|
+
var h = pe(i, a, u);
|
|
193
|
+
if (h)
|
|
194
|
+
return De(i, a, u);
|
|
195
|
+
var M = _e(a);
|
|
196
|
+
if (!Y(M))
|
|
197
|
+
return je(i, M, u);
|
|
198
|
+
}
|
|
199
|
+
function De(i, a, u) {
|
|
200
|
+
var h = ee(
|
|
201
|
+
a,
|
|
202
|
+
u,
|
|
203
|
+
/*Create*/
|
|
204
|
+
!1
|
|
205
|
+
);
|
|
206
|
+
if (!b(h))
|
|
207
|
+
return h.OrdinaryGetOwnMetadata(i, a, u);
|
|
208
|
+
}
|
|
209
|
+
function He(i, a, u, h) {
|
|
210
|
+
var M = ee(
|
|
211
|
+
u,
|
|
212
|
+
h,
|
|
213
|
+
/*Create*/
|
|
214
|
+
!0
|
|
215
|
+
);
|
|
216
|
+
M.OrdinaryDefineOwnMetadata(i, a, u, h);
|
|
217
|
+
}
|
|
218
|
+
function Ne(i, a) {
|
|
219
|
+
var u = Fe(i, a), h = _e(i);
|
|
220
|
+
if (h === null)
|
|
221
|
+
return u;
|
|
222
|
+
var M = Ne(h, a);
|
|
223
|
+
if (M.length <= 0)
|
|
224
|
+
return u;
|
|
225
|
+
if (u.length <= 0)
|
|
226
|
+
return M;
|
|
227
|
+
for (var L = new Z(), k = [], E = 0, v = u; E < v.length; E++) {
|
|
228
|
+
var p = v[E], y = L.has(p);
|
|
229
|
+
y || (L.add(p), k.push(p));
|
|
230
|
+
}
|
|
231
|
+
for (var m = 0, C = M; m < C.length; m++) {
|
|
232
|
+
var p = C[m], y = L.has(p);
|
|
233
|
+
y || (L.add(p), k.push(p));
|
|
234
|
+
}
|
|
235
|
+
return k;
|
|
236
|
+
}
|
|
237
|
+
function Fe(i, a) {
|
|
238
|
+
var u = ee(
|
|
239
|
+
i,
|
|
240
|
+
a,
|
|
241
|
+
/*create*/
|
|
242
|
+
!1
|
|
243
|
+
);
|
|
244
|
+
return u ? u.OrdinaryOwnMetadataKeys(i, a) : [];
|
|
245
|
+
}
|
|
246
|
+
function $e(i) {
|
|
247
|
+
if (i === null)
|
|
248
|
+
return 1;
|
|
249
|
+
switch (typeof i) {
|
|
250
|
+
case "undefined":
|
|
251
|
+
return 0;
|
|
252
|
+
case "boolean":
|
|
253
|
+
return 2;
|
|
254
|
+
case "string":
|
|
255
|
+
return 3;
|
|
256
|
+
case "symbol":
|
|
257
|
+
return 4;
|
|
258
|
+
case "number":
|
|
259
|
+
return 5;
|
|
260
|
+
case "object":
|
|
261
|
+
return i === null ? 1 : 6;
|
|
262
|
+
default:
|
|
263
|
+
return 6;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function b(i) {
|
|
267
|
+
return i === void 0;
|
|
268
|
+
}
|
|
269
|
+
function Y(i) {
|
|
270
|
+
return i === null;
|
|
271
|
+
}
|
|
272
|
+
function ht(i) {
|
|
273
|
+
return typeof i == "symbol";
|
|
274
|
+
}
|
|
275
|
+
function A(i) {
|
|
276
|
+
return typeof i == "object" ? i !== null : typeof i == "function";
|
|
277
|
+
}
|
|
278
|
+
function dt(i, a) {
|
|
279
|
+
switch ($e(i)) {
|
|
280
|
+
case 0:
|
|
281
|
+
return i;
|
|
282
|
+
case 1:
|
|
283
|
+
return i;
|
|
284
|
+
case 2:
|
|
285
|
+
return i;
|
|
286
|
+
case 3:
|
|
287
|
+
return i;
|
|
288
|
+
case 4:
|
|
289
|
+
return i;
|
|
290
|
+
case 5:
|
|
291
|
+
return i;
|
|
292
|
+
}
|
|
293
|
+
var u = "string", h = Ve(i, l);
|
|
294
|
+
if (h !== void 0) {
|
|
295
|
+
var M = h.call(i, u);
|
|
296
|
+
if (A(M))
|
|
297
|
+
throw new TypeError();
|
|
298
|
+
return M;
|
|
299
|
+
}
|
|
300
|
+
return vt(i);
|
|
301
|
+
}
|
|
302
|
+
function vt(i, a) {
|
|
303
|
+
var u, h, M;
|
|
304
|
+
{
|
|
305
|
+
var L = i.toString;
|
|
306
|
+
if (se(L)) {
|
|
307
|
+
var h = L.call(i);
|
|
308
|
+
if (!A(h))
|
|
309
|
+
return h;
|
|
310
|
+
}
|
|
311
|
+
var u = i.valueOf;
|
|
312
|
+
if (se(u)) {
|
|
313
|
+
var h = u.call(i);
|
|
314
|
+
if (!A(h))
|
|
315
|
+
return h;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
throw new TypeError();
|
|
319
|
+
}
|
|
320
|
+
function We(i) {
|
|
321
|
+
return !!i;
|
|
322
|
+
}
|
|
323
|
+
function pt(i) {
|
|
324
|
+
return "" + i;
|
|
325
|
+
}
|
|
326
|
+
function $(i) {
|
|
327
|
+
var a = dt(i);
|
|
328
|
+
return ht(a) ? a : pt(a);
|
|
329
|
+
}
|
|
330
|
+
function Be(i) {
|
|
331
|
+
return Array.isArray ? Array.isArray(i) : i instanceof Object ? i instanceof Array : Object.prototype.toString.call(i) === "[object Array]";
|
|
332
|
+
}
|
|
333
|
+
function se(i) {
|
|
334
|
+
return typeof i == "function";
|
|
335
|
+
}
|
|
336
|
+
function Ge(i) {
|
|
337
|
+
return typeof i == "function";
|
|
338
|
+
}
|
|
339
|
+
function yt(i) {
|
|
340
|
+
switch ($e(i)) {
|
|
341
|
+
case 3:
|
|
342
|
+
return !0;
|
|
343
|
+
case 4:
|
|
344
|
+
return !0;
|
|
345
|
+
default:
|
|
346
|
+
return !1;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function ye(i, a) {
|
|
350
|
+
return i === a || i !== i && a !== a;
|
|
351
|
+
}
|
|
352
|
+
function Ve(i, a) {
|
|
353
|
+
var u = i[a];
|
|
354
|
+
if (u != null) {
|
|
355
|
+
if (!se(u))
|
|
356
|
+
throw new TypeError();
|
|
357
|
+
return u;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function ze(i) {
|
|
361
|
+
var a = Ve(i, w);
|
|
362
|
+
if (!se(a))
|
|
363
|
+
throw new TypeError();
|
|
364
|
+
var u = a.call(i);
|
|
365
|
+
if (!A(u))
|
|
366
|
+
throw new TypeError();
|
|
367
|
+
return u;
|
|
368
|
+
}
|
|
369
|
+
function Ue(i) {
|
|
370
|
+
return i.value;
|
|
371
|
+
}
|
|
372
|
+
function qe(i) {
|
|
373
|
+
var a = i.next();
|
|
374
|
+
return a.done ? !1 : a;
|
|
375
|
+
}
|
|
376
|
+
function Ze(i) {
|
|
377
|
+
var a = i.return;
|
|
378
|
+
a && a.call(i);
|
|
379
|
+
}
|
|
380
|
+
function _e(i) {
|
|
381
|
+
var a = Object.getPrototypeOf(i);
|
|
382
|
+
if (typeof i != "function" || i === B || a !== B)
|
|
383
|
+
return a;
|
|
384
|
+
var u = i.prototype, h = u && Object.getPrototypeOf(u);
|
|
385
|
+
if (h == null || h === Object.prototype)
|
|
386
|
+
return a;
|
|
387
|
+
var M = h.constructor;
|
|
388
|
+
return typeof M != "function" || M === i ? a : M;
|
|
389
|
+
}
|
|
390
|
+
function _t() {
|
|
391
|
+
var i;
|
|
392
|
+
!b(V) && typeof s.Reflect < "u" && !(V in s.Reflect) && typeof s.Reflect.defineMetadata == "function" && (i = wt(s.Reflect));
|
|
393
|
+
var a, u, h, M = new K(), L = {
|
|
394
|
+
registerProvider: k,
|
|
395
|
+
getProvider: v,
|
|
396
|
+
setProvider: y
|
|
397
|
+
};
|
|
398
|
+
return L;
|
|
399
|
+
function k(m) {
|
|
400
|
+
if (!Object.isExtensible(L))
|
|
401
|
+
throw new Error("Cannot add provider to a frozen registry.");
|
|
402
|
+
switch (!0) {
|
|
403
|
+
case i === m:
|
|
404
|
+
break;
|
|
405
|
+
case b(a):
|
|
406
|
+
a = m;
|
|
407
|
+
break;
|
|
408
|
+
case a === m:
|
|
409
|
+
break;
|
|
410
|
+
case b(u):
|
|
411
|
+
u = m;
|
|
412
|
+
break;
|
|
413
|
+
case u === m:
|
|
414
|
+
break;
|
|
415
|
+
default:
|
|
416
|
+
h === void 0 && (h = new Z()), h.add(m);
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function E(m, C) {
|
|
421
|
+
if (!b(a)) {
|
|
422
|
+
if (a.isProviderFor(m, C))
|
|
423
|
+
return a;
|
|
424
|
+
if (!b(u)) {
|
|
425
|
+
if (u.isProviderFor(m, C))
|
|
426
|
+
return a;
|
|
427
|
+
if (!b(h))
|
|
428
|
+
for (var I = ze(h); ; ) {
|
|
429
|
+
var T = qe(I);
|
|
430
|
+
if (!T)
|
|
431
|
+
return;
|
|
432
|
+
var N = Ue(T);
|
|
433
|
+
if (N.isProviderFor(m, C))
|
|
434
|
+
return Ze(I), N;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (!b(i) && i.isProviderFor(m, C))
|
|
439
|
+
return i;
|
|
440
|
+
}
|
|
441
|
+
function v(m, C) {
|
|
442
|
+
var I = M.get(m), T;
|
|
443
|
+
return b(I) || (T = I.get(C)), b(T) && (T = E(m, C), b(T) || (b(I) && (I = new G(), M.set(m, I)), I.set(C, T))), T;
|
|
444
|
+
}
|
|
445
|
+
function p(m) {
|
|
446
|
+
if (b(m))
|
|
447
|
+
throw new TypeError();
|
|
448
|
+
return a === m || u === m || !b(h) && h.has(m);
|
|
449
|
+
}
|
|
450
|
+
function y(m, C, I) {
|
|
451
|
+
if (!p(I))
|
|
452
|
+
throw new Error("Metadata provider not registered.");
|
|
453
|
+
var T = v(m, C);
|
|
454
|
+
if (T !== I) {
|
|
455
|
+
if (!b(T))
|
|
456
|
+
return !1;
|
|
457
|
+
var N = M.get(m);
|
|
458
|
+
b(N) && (N = new G(), M.set(m, N)), N.set(C, I);
|
|
459
|
+
}
|
|
460
|
+
return !0;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
function mt() {
|
|
464
|
+
var i;
|
|
465
|
+
return !b(V) && A(s.Reflect) && Object.isExtensible(s.Reflect) && (i = s.Reflect[V]), b(i) && (i = _t()), !b(V) && A(s.Reflect) && Object.isExtensible(s.Reflect) && Object.defineProperty(s.Reflect, V, {
|
|
466
|
+
enumerable: !1,
|
|
467
|
+
configurable: !1,
|
|
468
|
+
writable: !1,
|
|
469
|
+
value: i
|
|
470
|
+
}), i;
|
|
471
|
+
}
|
|
472
|
+
function gt(i) {
|
|
473
|
+
var a = new K(), u = {
|
|
474
|
+
isProviderFor: function(p, y) {
|
|
475
|
+
var m = a.get(p);
|
|
476
|
+
return b(m) ? !1 : m.has(y);
|
|
477
|
+
},
|
|
478
|
+
OrdinaryDefineOwnMetadata: k,
|
|
479
|
+
OrdinaryHasOwnMetadata: M,
|
|
480
|
+
OrdinaryGetOwnMetadata: L,
|
|
481
|
+
OrdinaryOwnMetadataKeys: E,
|
|
482
|
+
OrdinaryDeleteMetadata: v
|
|
483
|
+
};
|
|
484
|
+
return J.registerProvider(u), u;
|
|
485
|
+
function h(p, y, m) {
|
|
486
|
+
var C = a.get(p), I = !1;
|
|
487
|
+
if (b(C)) {
|
|
488
|
+
if (!m)
|
|
489
|
+
return;
|
|
490
|
+
C = new G(), a.set(p, C), I = !0;
|
|
491
|
+
}
|
|
492
|
+
var T = C.get(y);
|
|
493
|
+
if (b(T)) {
|
|
494
|
+
if (!m)
|
|
495
|
+
return;
|
|
496
|
+
if (T = new G(), C.set(y, T), !i.setProvider(p, y, u))
|
|
497
|
+
throw C.delete(y), I && a.delete(p), new Error("Wrong provider for target.");
|
|
498
|
+
}
|
|
499
|
+
return T;
|
|
500
|
+
}
|
|
501
|
+
function M(p, y, m) {
|
|
502
|
+
var C = h(
|
|
503
|
+
y,
|
|
504
|
+
m,
|
|
505
|
+
/*Create*/
|
|
506
|
+
!1
|
|
507
|
+
);
|
|
508
|
+
return b(C) ? !1 : We(C.has(p));
|
|
509
|
+
}
|
|
510
|
+
function L(p, y, m) {
|
|
511
|
+
var C = h(
|
|
512
|
+
y,
|
|
513
|
+
m,
|
|
514
|
+
/*Create*/
|
|
515
|
+
!1
|
|
516
|
+
);
|
|
517
|
+
if (!b(C))
|
|
518
|
+
return C.get(p);
|
|
519
|
+
}
|
|
520
|
+
function k(p, y, m, C) {
|
|
521
|
+
var I = h(
|
|
522
|
+
m,
|
|
523
|
+
C,
|
|
524
|
+
/*Create*/
|
|
525
|
+
!0
|
|
526
|
+
);
|
|
527
|
+
I.set(p, y);
|
|
528
|
+
}
|
|
529
|
+
function E(p, y) {
|
|
530
|
+
var m = [], C = h(
|
|
531
|
+
p,
|
|
532
|
+
y,
|
|
533
|
+
/*Create*/
|
|
534
|
+
!1
|
|
535
|
+
);
|
|
536
|
+
if (b(C))
|
|
537
|
+
return m;
|
|
538
|
+
for (var I = C.keys(), T = ze(I), N = 0; ; ) {
|
|
539
|
+
var Je = qe(T);
|
|
540
|
+
if (!Je)
|
|
541
|
+
return m.length = N, m;
|
|
542
|
+
var Rt = Ue(Je);
|
|
543
|
+
try {
|
|
544
|
+
m[N] = Rt;
|
|
545
|
+
} catch (Pt) {
|
|
546
|
+
try {
|
|
547
|
+
Ze(T);
|
|
548
|
+
} finally {
|
|
549
|
+
throw Pt;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
N++;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
function v(p, y, m) {
|
|
556
|
+
var C = h(
|
|
557
|
+
y,
|
|
558
|
+
m,
|
|
559
|
+
/*Create*/
|
|
560
|
+
!1
|
|
561
|
+
);
|
|
562
|
+
if (b(C) || !C.delete(p))
|
|
563
|
+
return !1;
|
|
564
|
+
if (C.size === 0) {
|
|
565
|
+
var I = a.get(y);
|
|
566
|
+
b(I) || (I.delete(m), I.size === 0 && a.delete(I));
|
|
567
|
+
}
|
|
568
|
+
return !0;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
function wt(i) {
|
|
572
|
+
var a = i.defineMetadata, u = i.hasOwnMetadata, h = i.getOwnMetadata, M = i.getOwnMetadataKeys, L = i.deleteMetadata, k = new K(), E = {
|
|
573
|
+
isProviderFor: function(v, p) {
|
|
574
|
+
var y = k.get(v);
|
|
575
|
+
return !b(y) && y.has(p) ? !0 : M(v, p).length ? (b(y) && (y = new Z(), k.set(v, y)), y.add(p), !0) : !1;
|
|
576
|
+
},
|
|
577
|
+
OrdinaryDefineOwnMetadata: a,
|
|
578
|
+
OrdinaryHasOwnMetadata: u,
|
|
579
|
+
OrdinaryGetOwnMetadata: h,
|
|
580
|
+
OrdinaryOwnMetadataKeys: M,
|
|
581
|
+
OrdinaryDeleteMetadata: L
|
|
582
|
+
};
|
|
583
|
+
return E;
|
|
584
|
+
}
|
|
585
|
+
function ee(i, a, u) {
|
|
586
|
+
var h = J.getProvider(i, a);
|
|
587
|
+
if (!b(h))
|
|
588
|
+
return h;
|
|
589
|
+
if (u) {
|
|
590
|
+
if (J.setProvider(i, a, re))
|
|
591
|
+
return re;
|
|
592
|
+
throw new Error("Illegal state.");
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
function Mt() {
|
|
596
|
+
var i = {}, a = [], u = (
|
|
597
|
+
/** @class */
|
|
598
|
+
(function() {
|
|
599
|
+
function E(v, p, y) {
|
|
600
|
+
this._index = 0, this._keys = v, this._values = p, this._selector = y;
|
|
601
|
+
}
|
|
602
|
+
return E.prototype["@@iterator"] = function() {
|
|
603
|
+
return this;
|
|
604
|
+
}, E.prototype[w] = function() {
|
|
605
|
+
return this;
|
|
606
|
+
}, E.prototype.next = function() {
|
|
607
|
+
var v = this._index;
|
|
608
|
+
if (v >= 0 && v < this._keys.length) {
|
|
609
|
+
var p = this._selector(this._keys[v], this._values[v]);
|
|
610
|
+
return v + 1 >= this._keys.length ? (this._index = -1, this._keys = a, this._values = a) : this._index++, { value: p, done: !1 };
|
|
611
|
+
}
|
|
612
|
+
return { value: void 0, done: !0 };
|
|
613
|
+
}, E.prototype.throw = function(v) {
|
|
614
|
+
throw this._index >= 0 && (this._index = -1, this._keys = a, this._values = a), v;
|
|
615
|
+
}, E.prototype.return = function(v) {
|
|
616
|
+
return this._index >= 0 && (this._index = -1, this._keys = a, this._values = a), { value: v, done: !0 };
|
|
617
|
+
}, E;
|
|
618
|
+
})()
|
|
619
|
+
), h = (
|
|
620
|
+
/** @class */
|
|
621
|
+
(function() {
|
|
622
|
+
function E() {
|
|
623
|
+
this._keys = [], this._values = [], this._cacheKey = i, this._cacheIndex = -2;
|
|
624
|
+
}
|
|
625
|
+
return Object.defineProperty(E.prototype, "size", {
|
|
626
|
+
get: function() {
|
|
627
|
+
return this._keys.length;
|
|
628
|
+
},
|
|
629
|
+
enumerable: !0,
|
|
630
|
+
configurable: !0
|
|
631
|
+
}), E.prototype.has = function(v) {
|
|
632
|
+
return this._find(
|
|
633
|
+
v,
|
|
634
|
+
/*insert*/
|
|
635
|
+
!1
|
|
636
|
+
) >= 0;
|
|
637
|
+
}, E.prototype.get = function(v) {
|
|
638
|
+
var p = this._find(
|
|
639
|
+
v,
|
|
640
|
+
/*insert*/
|
|
641
|
+
!1
|
|
642
|
+
);
|
|
643
|
+
return p >= 0 ? this._values[p] : void 0;
|
|
644
|
+
}, E.prototype.set = function(v, p) {
|
|
645
|
+
var y = this._find(
|
|
646
|
+
v,
|
|
647
|
+
/*insert*/
|
|
648
|
+
!0
|
|
649
|
+
);
|
|
650
|
+
return this._values[y] = p, this;
|
|
651
|
+
}, E.prototype.delete = function(v) {
|
|
652
|
+
var p = this._find(
|
|
653
|
+
v,
|
|
654
|
+
/*insert*/
|
|
655
|
+
!1
|
|
656
|
+
);
|
|
657
|
+
if (p >= 0) {
|
|
658
|
+
for (var y = this._keys.length, m = p + 1; m < y; m++)
|
|
659
|
+
this._keys[m - 1] = this._keys[m], this._values[m - 1] = this._values[m];
|
|
660
|
+
return this._keys.length--, this._values.length--, ye(v, this._cacheKey) && (this._cacheKey = i, this._cacheIndex = -2), !0;
|
|
661
|
+
}
|
|
662
|
+
return !1;
|
|
663
|
+
}, E.prototype.clear = function() {
|
|
664
|
+
this._keys.length = 0, this._values.length = 0, this._cacheKey = i, this._cacheIndex = -2;
|
|
665
|
+
}, E.prototype.keys = function() {
|
|
666
|
+
return new u(this._keys, this._values, M);
|
|
667
|
+
}, E.prototype.values = function() {
|
|
668
|
+
return new u(this._keys, this._values, L);
|
|
669
|
+
}, E.prototype.entries = function() {
|
|
670
|
+
return new u(this._keys, this._values, k);
|
|
671
|
+
}, E.prototype["@@iterator"] = function() {
|
|
672
|
+
return this.entries();
|
|
673
|
+
}, E.prototype[w] = function() {
|
|
674
|
+
return this.entries();
|
|
675
|
+
}, E.prototype._find = function(v, p) {
|
|
676
|
+
if (!ye(this._cacheKey, v)) {
|
|
677
|
+
this._cacheIndex = -1;
|
|
678
|
+
for (var y = 0; y < this._keys.length; y++)
|
|
679
|
+
if (ye(this._keys[y], v)) {
|
|
680
|
+
this._cacheIndex = y;
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
return this._cacheIndex < 0 && p && (this._cacheIndex = this._keys.length, this._keys.push(v), this._values.push(void 0)), this._cacheIndex;
|
|
685
|
+
}, E;
|
|
686
|
+
})()
|
|
687
|
+
);
|
|
688
|
+
return h;
|
|
689
|
+
function M(E, v) {
|
|
690
|
+
return E;
|
|
691
|
+
}
|
|
692
|
+
function L(E, v) {
|
|
693
|
+
return v;
|
|
694
|
+
}
|
|
695
|
+
function k(E, v) {
|
|
696
|
+
return [E, v];
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
function bt() {
|
|
700
|
+
var i = (
|
|
701
|
+
/** @class */
|
|
702
|
+
(function() {
|
|
703
|
+
function a() {
|
|
704
|
+
this._map = new G();
|
|
705
|
+
}
|
|
706
|
+
return Object.defineProperty(a.prototype, "size", {
|
|
707
|
+
get: function() {
|
|
708
|
+
return this._map.size;
|
|
709
|
+
},
|
|
710
|
+
enumerable: !0,
|
|
711
|
+
configurable: !0
|
|
712
|
+
}), a.prototype.has = function(u) {
|
|
713
|
+
return this._map.has(u);
|
|
714
|
+
}, a.prototype.add = function(u) {
|
|
715
|
+
return this._map.set(u, u), this;
|
|
716
|
+
}, a.prototype.delete = function(u) {
|
|
717
|
+
return this._map.delete(u);
|
|
718
|
+
}, a.prototype.clear = function() {
|
|
719
|
+
this._map.clear();
|
|
720
|
+
}, a.prototype.keys = function() {
|
|
721
|
+
return this._map.keys();
|
|
722
|
+
}, a.prototype.values = function() {
|
|
723
|
+
return this._map.keys();
|
|
724
|
+
}, a.prototype.entries = function() {
|
|
725
|
+
return this._map.entries();
|
|
726
|
+
}, a.prototype["@@iterator"] = function() {
|
|
727
|
+
return this.keys();
|
|
728
|
+
}, a.prototype[w] = function() {
|
|
729
|
+
return this.keys();
|
|
730
|
+
}, a;
|
|
731
|
+
})()
|
|
732
|
+
);
|
|
733
|
+
return i;
|
|
734
|
+
}
|
|
735
|
+
function Ot() {
|
|
736
|
+
var i = 16, a = j.create(), u = h();
|
|
737
|
+
return (
|
|
738
|
+
/** @class */
|
|
739
|
+
(function() {
|
|
740
|
+
function v() {
|
|
741
|
+
this._key = h();
|
|
742
|
+
}
|
|
743
|
+
return v.prototype.has = function(p) {
|
|
744
|
+
var y = M(
|
|
745
|
+
p,
|
|
746
|
+
/*create*/
|
|
747
|
+
!1
|
|
748
|
+
);
|
|
749
|
+
return y !== void 0 ? j.has(y, this._key) : !1;
|
|
750
|
+
}, v.prototype.get = function(p) {
|
|
751
|
+
var y = M(
|
|
752
|
+
p,
|
|
753
|
+
/*create*/
|
|
754
|
+
!1
|
|
755
|
+
);
|
|
756
|
+
return y !== void 0 ? j.get(y, this._key) : void 0;
|
|
757
|
+
}, v.prototype.set = function(p, y) {
|
|
758
|
+
var m = M(
|
|
759
|
+
p,
|
|
760
|
+
/*create*/
|
|
761
|
+
!0
|
|
762
|
+
);
|
|
763
|
+
return m[this._key] = y, this;
|
|
764
|
+
}, v.prototype.delete = function(p) {
|
|
765
|
+
var y = M(
|
|
766
|
+
p,
|
|
767
|
+
/*create*/
|
|
768
|
+
!1
|
|
769
|
+
);
|
|
770
|
+
return y !== void 0 ? delete y[this._key] : !1;
|
|
771
|
+
}, v.prototype.clear = function() {
|
|
772
|
+
this._key = h();
|
|
773
|
+
}, v;
|
|
774
|
+
})()
|
|
775
|
+
);
|
|
776
|
+
function h() {
|
|
777
|
+
var v;
|
|
778
|
+
do
|
|
779
|
+
v = "@@WeakMap@@" + E();
|
|
780
|
+
while (j.has(a, v));
|
|
781
|
+
return a[v] = !0, v;
|
|
782
|
+
}
|
|
783
|
+
function M(v, p) {
|
|
784
|
+
if (!o.call(v, u)) {
|
|
785
|
+
if (!p)
|
|
786
|
+
return;
|
|
787
|
+
Object.defineProperty(v, u, { value: j.create() });
|
|
788
|
+
}
|
|
789
|
+
return v[u];
|
|
790
|
+
}
|
|
791
|
+
function L(v, p) {
|
|
792
|
+
for (var y = 0; y < p; ++y)
|
|
793
|
+
v[y] = Math.random() * 255 | 0;
|
|
794
|
+
return v;
|
|
795
|
+
}
|
|
796
|
+
function k(v) {
|
|
797
|
+
if (typeof Uint8Array == "function") {
|
|
798
|
+
var p = new Uint8Array(v);
|
|
799
|
+
return typeof crypto < "u" ? crypto.getRandomValues(p) : typeof msCrypto < "u" ? msCrypto.getRandomValues(p) : L(p, v), p;
|
|
800
|
+
}
|
|
801
|
+
return L(new Array(v), v);
|
|
802
|
+
}
|
|
803
|
+
function E() {
|
|
804
|
+
var v = k(i);
|
|
805
|
+
v[6] = v[6] & 79 | 64, v[8] = v[8] & 191 | 128;
|
|
806
|
+
for (var p = "", y = 0; y < i; ++y) {
|
|
807
|
+
var m = v[y];
|
|
808
|
+
(y === 4 || y === 6 || y === 8) && (p += "-"), m < 16 && (p += "0"), p += m.toString(16).toLowerCase();
|
|
809
|
+
}
|
|
810
|
+
return p;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
function me(i) {
|
|
814
|
+
return i.__ = void 0, delete i.__, i;
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
})(e || (e = {})), Qe;
|
|
818
|
+
}
|
|
819
|
+
Ft();
|
|
820
|
+
function $t(e) {
|
|
821
|
+
const t = (
|
|
4
822
|
/* glsl */
|
|
5
823
|
`
|
|
6
824
|
attribute vec3 position;
|
|
@@ -17,34 +835,58 @@ function M(s) {
|
|
|
17
835
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
18
836
|
}
|
|
19
837
|
`
|
|
20
|
-
),
|
|
838
|
+
), r = (
|
|
21
839
|
/* glsl */
|
|
22
840
|
`
|
|
23
841
|
precision highp float;
|
|
24
842
|
|
|
25
843
|
uniform float uHit;
|
|
844
|
+
uniform float uSelected;
|
|
26
845
|
|
|
27
846
|
varying vec3 vNormal;
|
|
28
847
|
|
|
29
848
|
void main() {
|
|
30
849
|
vec3 normal = normalize(vNormal);
|
|
31
850
|
float lighting = dot(normal, normalize(vec3(-0.3, 0.8, 0.6)));
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
851
|
+
|
|
852
|
+
// Базовый цвет меша
|
|
853
|
+
vec3 baseColor = vec3(0.2, 0.8, 1.0);
|
|
854
|
+
|
|
855
|
+
// Цвет при наведении (hover)
|
|
856
|
+
vec3 hoverColor = vec3(1.0, 1.0, 0.1);
|
|
857
|
+
|
|
858
|
+
// Цвет при клике (selected)
|
|
859
|
+
vec3 selectedColor = vec3(1.0, 0.3, 0.3);
|
|
860
|
+
|
|
861
|
+
// Применяем логику подсветки:
|
|
862
|
+
// приоритет: выделение > hover > обычный цвет
|
|
863
|
+
vec3 color = mix(baseColor, hoverColor, uHit);
|
|
864
|
+
color = mix(color, selectedColor, uSelected);
|
|
865
|
+
|
|
866
|
+
// Немного света для объема
|
|
867
|
+
color += lighting * 0.1;
|
|
868
|
+
|
|
869
|
+
gl_FragColor = vec4(color, 1.0);
|
|
35
870
|
}
|
|
36
871
|
`
|
|
37
872
|
);
|
|
38
|
-
return new
|
|
39
|
-
vertex:
|
|
40
|
-
fragment:
|
|
873
|
+
return new Et(e, {
|
|
874
|
+
vertex: t,
|
|
875
|
+
fragment: r,
|
|
41
876
|
cullFace: !1,
|
|
42
877
|
uniforms: {
|
|
43
|
-
uHit: { value: 0 }
|
|
878
|
+
uHit: { value: 0 },
|
|
879
|
+
uSelected: { value: 0 }
|
|
44
880
|
}
|
|
45
881
|
});
|
|
46
882
|
}
|
|
47
|
-
class
|
|
883
|
+
class Wt extends Ct {
|
|
884
|
+
isHit;
|
|
885
|
+
constructor(t, r) {
|
|
886
|
+
super(t, r), this.isHit = !1;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
class st {
|
|
48
890
|
/** Экземпляр рендерера OGL */
|
|
49
891
|
gl;
|
|
50
892
|
/** Корневой объект сцены */
|
|
@@ -61,8 +903,8 @@ class u {
|
|
|
61
903
|
* Конструктор рендерера
|
|
62
904
|
* @param canvas - HTMLCanvasElement для рендеринга
|
|
63
905
|
*/
|
|
64
|
-
constructor(
|
|
65
|
-
this.canvas =
|
|
906
|
+
constructor(t) {
|
|
907
|
+
this.canvas = t, this.gl = new St({ canvas: t, dpr: 2 }), this.gl.setSize(t.clientWidth, t.clientHeight), this.gl.gl.clearColor(0.1, 0.1, 0.1, 1), this.scene = new xt(), this.camera = new It(this.gl.gl, { fov: 45 }), this.camera.position.set(1, 1, 7), this.camera.lookAt([0, 0, 0]), this.program = $t(this.gl.gl), this.meshes = [];
|
|
66
908
|
}
|
|
67
909
|
/**
|
|
68
910
|
* Обновляет размер рендерера и камеры при изменении размеров canvas.
|
|
@@ -89,111 +931,980 @@ class u {
|
|
|
89
931
|
}
|
|
90
932
|
/**
|
|
91
933
|
* Публичный метод для добавления фигуры.
|
|
92
|
-
* @param figure Данные фигуры: position, normal, uv
|
|
934
|
+
* @param figure - Данные фигуры: position, normal, uv
|
|
93
935
|
*/
|
|
94
|
-
addFigure(
|
|
95
|
-
const
|
|
96
|
-
position: { size: 3, data: new Float32Array(
|
|
97
|
-
normal: { size: 3, data: new Float32Array(
|
|
98
|
-
uv: { size: 2, data: new Float32Array(
|
|
99
|
-
}),
|
|
100
|
-
geometry:
|
|
936
|
+
addFigure(t) {
|
|
937
|
+
const r = new Lt(this.gl.gl, {
|
|
938
|
+
position: { size: 3, data: new Float32Array(t.position) },
|
|
939
|
+
normal: { size: 3, data: new Float32Array(t.normal ?? []) },
|
|
940
|
+
uv: { size: 2, data: new Float32Array(t.uv ?? []) }
|
|
941
|
+
}), s = new Wt(this.gl.gl, {
|
|
942
|
+
geometry: r,
|
|
101
943
|
program: this.program
|
|
102
944
|
});
|
|
103
|
-
return
|
|
945
|
+
return s.setParent(this.scene), this.meshes.push(s), s;
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Добавляет фигуру в сцену и сохраняет его во внутреннем массиве.
|
|
949
|
+
*
|
|
950
|
+
* @param mesh - Фигура для добавления в сцену.
|
|
951
|
+
* @internal
|
|
952
|
+
*/
|
|
953
|
+
addMesh(t) {
|
|
954
|
+
this.scene.addChild(t);
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Возвращает WebGL контекст рендерера.
|
|
958
|
+
*
|
|
959
|
+
* @returns Контекст WebGL (OGLRenderingContext) текущей сцены.
|
|
960
|
+
* @internal
|
|
961
|
+
*/
|
|
962
|
+
getContext() {
|
|
963
|
+
return this.gl.gl;
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Убирает фигуру со сцены
|
|
967
|
+
*
|
|
968
|
+
* @param mesh - Фигура для удаления со сцены.
|
|
969
|
+
* @internal
|
|
970
|
+
*/
|
|
971
|
+
removeMesh(t) {
|
|
972
|
+
this.scene.removeChild(t);
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Возвращает список всех фигур, находящихся в сцене.
|
|
976
|
+
*
|
|
977
|
+
* @returns Массив текущих фигур.
|
|
978
|
+
* @internal
|
|
979
|
+
*/
|
|
980
|
+
getMeshes() {
|
|
981
|
+
return this.meshes;
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Возвращает настройку для рендеринга.
|
|
985
|
+
*
|
|
986
|
+
* @returns Program для настройки рендеринга моделей.
|
|
987
|
+
* @internal
|
|
988
|
+
*/
|
|
989
|
+
getProgram() {
|
|
990
|
+
return this.program;
|
|
104
991
|
}
|
|
105
992
|
/** Деструктор */
|
|
106
993
|
destroy() {
|
|
107
994
|
this.meshes && (this.meshes.length = 0, this.meshes = []), this.scene = null, this.camera = null, this.program = null, this.gl = null, this.canvas = null;
|
|
108
995
|
}
|
|
109
996
|
}
|
|
110
|
-
class
|
|
997
|
+
class Bt extends it {
|
|
111
998
|
/** Используется ли Orbit-controls */
|
|
112
999
|
isInteracting = !1;
|
|
113
|
-
|
|
114
|
-
constructor(
|
|
115
|
-
super(
|
|
1000
|
+
_element;
|
|
1001
|
+
constructor(t, r = {}) {
|
|
1002
|
+
super(t, r), this._element = r.element || document, this._element.addEventListener("mousedown", () => this.isInteracting = !0), this._element.addEventListener("mouseup", () => this.isInteracting = !1), this._element.addEventListener("touchstart", () => this.isInteracting = !0), this._element.addEventListener("touchend", () => this.isInteracting = !1);
|
|
116
1003
|
}
|
|
117
1004
|
/** Очистка новых обработчиков событий */
|
|
118
1005
|
destroy() {
|
|
119
|
-
this.
|
|
1006
|
+
this._element.removeEventListener("mousedown", () => this.isInteracting = !0), this._element.removeEventListener("mouseup", () => this.isInteracting = !1), this._element.removeEventListener("touchstart", () => this.isInteracting = !0), this._element.removeEventListener("touchend", () => this.isInteracting = !1);
|
|
120
1007
|
}
|
|
121
1008
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
1009
|
+
var we;
|
|
1010
|
+
(function(e) {
|
|
1011
|
+
e[e.Transient = 0] = "Transient", e[e.Singleton = 1] = "Singleton", e[e.ResolutionScoped = 2] = "ResolutionScoped", e[e.ContainerScoped = 3] = "ContainerScoped";
|
|
1012
|
+
})(we || (we = {}));
|
|
1013
|
+
const D = we;
|
|
1014
|
+
/*! *****************************************************************************
|
|
1015
|
+
Copyright (c) Microsoft Corporation.
|
|
1016
|
+
|
|
1017
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
1018
|
+
purpose with or without fee is hereby granted.
|
|
1019
|
+
|
|
1020
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1021
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1022
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1023
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1024
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1025
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1026
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
1027
|
+
***************************************************************************** */
|
|
1028
|
+
var Me = function(e, t) {
|
|
1029
|
+
return Me = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
|
|
1030
|
+
r.__proto__ = s;
|
|
1031
|
+
} || function(r, s) {
|
|
1032
|
+
for (var o in s) s.hasOwnProperty(o) && (r[o] = s[o]);
|
|
1033
|
+
}, Me(e, t);
|
|
1034
|
+
};
|
|
1035
|
+
function Te(e, t) {
|
|
1036
|
+
Me(e, t);
|
|
1037
|
+
function r() {
|
|
1038
|
+
this.constructor = e;
|
|
1039
|
+
}
|
|
1040
|
+
e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
|
|
1041
|
+
}
|
|
1042
|
+
function Gt(e, t, r, s) {
|
|
1043
|
+
function o(n) {
|
|
1044
|
+
return n instanceof r ? n : new r(function(l) {
|
|
1045
|
+
l(n);
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
return new (r || (r = Promise))(function(n, l) {
|
|
1049
|
+
function w(S) {
|
|
1050
|
+
try {
|
|
1051
|
+
_(s.next(S));
|
|
1052
|
+
} catch (j) {
|
|
1053
|
+
l(j);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
function R(S) {
|
|
1057
|
+
try {
|
|
1058
|
+
_(s.throw(S));
|
|
1059
|
+
} catch (j) {
|
|
1060
|
+
l(j);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
function _(S) {
|
|
1064
|
+
S.done ? n(S.value) : o(S.value).then(w, R);
|
|
1065
|
+
}
|
|
1066
|
+
_((s = s.apply(e, [])).next());
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
function Vt(e, t) {
|
|
1070
|
+
var r = { label: 0, sent: function() {
|
|
1071
|
+
if (n[0] & 1) throw n[1];
|
|
1072
|
+
return n[1];
|
|
1073
|
+
}, trys: [], ops: [] }, s, o, n, l;
|
|
1074
|
+
return l = { next: w(0), throw: w(1), return: w(2) }, typeof Symbol == "function" && (l[Symbol.iterator] = function() {
|
|
1075
|
+
return this;
|
|
1076
|
+
}), l;
|
|
1077
|
+
function w(_) {
|
|
1078
|
+
return function(S) {
|
|
1079
|
+
return R([_, S]);
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
function R(_) {
|
|
1083
|
+
if (s) throw new TypeError("Generator is already executing.");
|
|
1084
|
+
for (; r; ) try {
|
|
1085
|
+
if (s = 1, o && (n = _[0] & 2 ? o.return : _[0] ? o.throw || ((n = o.return) && n.call(o), 0) : o.next) && !(n = n.call(o, _[1])).done) return n;
|
|
1086
|
+
switch (o = 0, n && (_ = [_[0] & 2, n.value]), _[0]) {
|
|
1087
|
+
case 0:
|
|
1088
|
+
case 1:
|
|
1089
|
+
n = _;
|
|
1090
|
+
break;
|
|
1091
|
+
case 4:
|
|
1092
|
+
return r.label++, { value: _[1], done: !1 };
|
|
1093
|
+
case 5:
|
|
1094
|
+
r.label++, o = _[1], _ = [0];
|
|
1095
|
+
continue;
|
|
1096
|
+
case 7:
|
|
1097
|
+
_ = r.ops.pop(), r.trys.pop();
|
|
1098
|
+
continue;
|
|
1099
|
+
default:
|
|
1100
|
+
if (n = r.trys, !(n = n.length > 0 && n[n.length - 1]) && (_[0] === 6 || _[0] === 2)) {
|
|
1101
|
+
r = 0;
|
|
1102
|
+
continue;
|
|
1103
|
+
}
|
|
1104
|
+
if (_[0] === 3 && (!n || _[1] > n[0] && _[1] < n[3])) {
|
|
1105
|
+
r.label = _[1];
|
|
1106
|
+
break;
|
|
1107
|
+
}
|
|
1108
|
+
if (_[0] === 6 && r.label < n[1]) {
|
|
1109
|
+
r.label = n[1], n = _;
|
|
1110
|
+
break;
|
|
1111
|
+
}
|
|
1112
|
+
if (n && r.label < n[2]) {
|
|
1113
|
+
r.label = n[2], r.ops.push(_);
|
|
1114
|
+
break;
|
|
1115
|
+
}
|
|
1116
|
+
n[2] && r.ops.pop(), r.trys.pop();
|
|
1117
|
+
continue;
|
|
1118
|
+
}
|
|
1119
|
+
_ = t.call(e, r);
|
|
1120
|
+
} catch (S) {
|
|
1121
|
+
_ = [6, S], o = 0;
|
|
1122
|
+
} finally {
|
|
1123
|
+
s = n = 0;
|
|
1124
|
+
}
|
|
1125
|
+
if (_[0] & 5) throw _[1];
|
|
1126
|
+
return { value: _[0] ? _[1] : void 0, done: !0 };
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
function oe(e) {
|
|
1130
|
+
var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t], s = 0;
|
|
1131
|
+
if (r) return r.call(e);
|
|
1132
|
+
if (e && typeof e.length == "number") return {
|
|
1133
|
+
next: function() {
|
|
1134
|
+
return e && s >= e.length && (e = void 0), { value: e && e[s++], done: !e };
|
|
1135
|
+
}
|
|
1136
|
+
};
|
|
1137
|
+
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
1138
|
+
}
|
|
1139
|
+
function ce(e, t) {
|
|
1140
|
+
var r = typeof Symbol == "function" && e[Symbol.iterator];
|
|
1141
|
+
if (!r) return e;
|
|
1142
|
+
var s = r.call(e), o, n = [], l;
|
|
1143
|
+
try {
|
|
1144
|
+
for (; (t === void 0 || t-- > 0) && !(o = s.next()).done; ) n.push(o.value);
|
|
1145
|
+
} catch (w) {
|
|
1146
|
+
l = { error: w };
|
|
1147
|
+
} finally {
|
|
1148
|
+
try {
|
|
1149
|
+
o && !o.done && (r = s.return) && r.call(s);
|
|
1150
|
+
} finally {
|
|
1151
|
+
if (l) throw l.error;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
return n;
|
|
1155
|
+
}
|
|
1156
|
+
function q() {
|
|
1157
|
+
for (var e = [], t = 0; t < arguments.length; t++)
|
|
1158
|
+
e = e.concat(ce(arguments[t]));
|
|
1159
|
+
return e;
|
|
1160
|
+
}
|
|
1161
|
+
var be = "injectionTokens";
|
|
1162
|
+
function zt(e) {
|
|
1163
|
+
var t = Reflect.getMetadata("design:paramtypes", e) || [], r = Reflect.getOwnMetadata(be, e) || {};
|
|
1164
|
+
return Object.keys(r).forEach(function(s) {
|
|
1165
|
+
t[+s] = r[s];
|
|
1166
|
+
}), t;
|
|
1167
|
+
}
|
|
1168
|
+
function ot(e, t) {
|
|
1169
|
+
return function(r, s, o) {
|
|
1170
|
+
var n = Reflect.getOwnMetadata(be, r) || {};
|
|
1171
|
+
n[o] = e, Reflect.defineMetadata(be, n, r);
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
function at(e) {
|
|
1175
|
+
return !!e.useClass;
|
|
1176
|
+
}
|
|
1177
|
+
function Oe(e) {
|
|
1178
|
+
return !!e.useFactory;
|
|
1179
|
+
}
|
|
1180
|
+
var ut = (function() {
|
|
1181
|
+
function e(t) {
|
|
1182
|
+
this.wrap = t, this.reflectMethods = [
|
|
1183
|
+
"get",
|
|
1184
|
+
"getPrototypeOf",
|
|
1185
|
+
"setPrototypeOf",
|
|
1186
|
+
"getOwnPropertyDescriptor",
|
|
1187
|
+
"defineProperty",
|
|
1188
|
+
"has",
|
|
1189
|
+
"set",
|
|
1190
|
+
"deleteProperty",
|
|
1191
|
+
"apply",
|
|
1192
|
+
"construct",
|
|
1193
|
+
"ownKeys"
|
|
1194
|
+
];
|
|
1195
|
+
}
|
|
1196
|
+
return e.prototype.createProxy = function(t) {
|
|
1197
|
+
var r = this, s = {}, o = !1, n, l = function() {
|
|
1198
|
+
return o || (n = t(r.wrap()), o = !0), n;
|
|
1199
|
+
};
|
|
1200
|
+
return new Proxy(s, this.createHandler(l));
|
|
1201
|
+
}, e.prototype.createHandler = function(t) {
|
|
1202
|
+
var r = {}, s = function(o) {
|
|
1203
|
+
r[o] = function() {
|
|
1204
|
+
for (var n = [], l = 0; l < arguments.length; l++)
|
|
1205
|
+
n[l] = arguments[l];
|
|
1206
|
+
n[0] = t();
|
|
1207
|
+
var w = Reflect[o];
|
|
1208
|
+
return w.apply(void 0, q(n));
|
|
1209
|
+
};
|
|
1210
|
+
};
|
|
1211
|
+
return this.reflectMethods.forEach(s), r;
|
|
1212
|
+
}, e;
|
|
1213
|
+
})();
|
|
1214
|
+
function Q(e) {
|
|
1215
|
+
return typeof e == "string" || typeof e == "symbol";
|
|
1216
|
+
}
|
|
1217
|
+
function Ut(e) {
|
|
1218
|
+
return typeof e == "object" && "token" in e && "multiple" in e;
|
|
1219
|
+
}
|
|
1220
|
+
function Ke(e) {
|
|
1221
|
+
return typeof e == "object" && "token" in e && "transform" in e;
|
|
1222
|
+
}
|
|
1223
|
+
function qt(e) {
|
|
1224
|
+
return typeof e == "function" || e instanceof ut;
|
|
1225
|
+
}
|
|
1226
|
+
function le(e) {
|
|
1227
|
+
return !!e.useToken;
|
|
1228
|
+
}
|
|
1229
|
+
function fe(e) {
|
|
1230
|
+
return e.useValue != null;
|
|
1231
|
+
}
|
|
1232
|
+
function Zt(e) {
|
|
1233
|
+
return at(e) || fe(e) || le(e) || Oe(e);
|
|
1234
|
+
}
|
|
1235
|
+
var Ae = (function() {
|
|
1236
|
+
function e() {
|
|
1237
|
+
this._registryMap = /* @__PURE__ */ new Map();
|
|
1238
|
+
}
|
|
1239
|
+
return e.prototype.entries = function() {
|
|
1240
|
+
return this._registryMap.entries();
|
|
1241
|
+
}, e.prototype.getAll = function(t) {
|
|
1242
|
+
return this.ensure(t), this._registryMap.get(t);
|
|
1243
|
+
}, e.prototype.get = function(t) {
|
|
1244
|
+
this.ensure(t);
|
|
1245
|
+
var r = this._registryMap.get(t);
|
|
1246
|
+
return r[r.length - 1] || null;
|
|
1247
|
+
}, e.prototype.set = function(t, r) {
|
|
1248
|
+
this.ensure(t), this._registryMap.get(t).push(r);
|
|
1249
|
+
}, e.prototype.setAll = function(t, r) {
|
|
1250
|
+
this._registryMap.set(t, r);
|
|
1251
|
+
}, e.prototype.has = function(t) {
|
|
1252
|
+
return this.ensure(t), this._registryMap.get(t).length > 0;
|
|
1253
|
+
}, e.prototype.clear = function() {
|
|
1254
|
+
this._registryMap.clear();
|
|
1255
|
+
}, e.prototype.ensure = function(t) {
|
|
1256
|
+
this._registryMap.has(t) || this._registryMap.set(t, []);
|
|
1257
|
+
}, e;
|
|
1258
|
+
})(), Jt = (function(e) {
|
|
1259
|
+
Te(t, e);
|
|
1260
|
+
function t() {
|
|
1261
|
+
return e !== null && e.apply(this, arguments) || this;
|
|
1262
|
+
}
|
|
1263
|
+
return t;
|
|
1264
|
+
})(Ae), ae = /* @__PURE__ */ (function() {
|
|
1265
|
+
function e() {
|
|
1266
|
+
this.scopedResolutions = /* @__PURE__ */ new Map();
|
|
1267
|
+
}
|
|
1268
|
+
return e;
|
|
1269
|
+
})();
|
|
1270
|
+
function Yt(e, t) {
|
|
1271
|
+
if (e === null)
|
|
1272
|
+
return "at position #" + t;
|
|
1273
|
+
var r = e.split(",")[t].trim();
|
|
1274
|
+
return '"' + r + '" at position #' + t;
|
|
1275
|
+
}
|
|
1276
|
+
function Qt(e, t, r) {
|
|
1277
|
+
return r === void 0 && (r = " "), q([e], t.message.split(`
|
|
1278
|
+
`).map(function(s) {
|
|
1279
|
+
return r + s;
|
|
1280
|
+
})).join(`
|
|
1281
|
+
`);
|
|
1282
|
+
}
|
|
1283
|
+
function Xt(e, t, r) {
|
|
1284
|
+
var s = ce(e.toString().match(/constructor\(([\w, ]+)\)/) || [], 2), o = s[1], n = o === void 0 ? null : o, l = Yt(n, t);
|
|
1285
|
+
return Qt("Cannot inject the dependency " + l + ' of "' + e.name + '" constructor. Reason:', r);
|
|
1286
|
+
}
|
|
1287
|
+
function Kt(e) {
|
|
1288
|
+
if (typeof e.dispose != "function")
|
|
1289
|
+
return !1;
|
|
1290
|
+
var t = e.dispose;
|
|
1291
|
+
return !(t.length > 0);
|
|
1292
|
+
}
|
|
1293
|
+
var er = (function(e) {
|
|
1294
|
+
Te(t, e);
|
|
1295
|
+
function t() {
|
|
1296
|
+
return e !== null && e.apply(this, arguments) || this;
|
|
1297
|
+
}
|
|
1298
|
+
return t;
|
|
1299
|
+
})(Ae), tr = (function(e) {
|
|
1300
|
+
Te(t, e);
|
|
1301
|
+
function t() {
|
|
1302
|
+
return e !== null && e.apply(this, arguments) || this;
|
|
1303
|
+
}
|
|
1304
|
+
return t;
|
|
1305
|
+
})(Ae), rr = /* @__PURE__ */ (function() {
|
|
1306
|
+
function e() {
|
|
1307
|
+
this.preResolution = new er(), this.postResolution = new tr();
|
|
1308
|
+
}
|
|
1309
|
+
return e;
|
|
1310
|
+
})(), lt = /* @__PURE__ */ new Map(), nr = (function() {
|
|
1311
|
+
function e(t) {
|
|
1312
|
+
this.parent = t, this._registry = new Jt(), this.interceptors = new rr(), this.disposed = !1, this.disposables = /* @__PURE__ */ new Set();
|
|
1313
|
+
}
|
|
1314
|
+
return e.prototype.register = function(t, r, s) {
|
|
1315
|
+
s === void 0 && (s = { lifecycle: D.Transient }), this.ensureNotDisposed();
|
|
1316
|
+
var o;
|
|
1317
|
+
if (Zt(r) ? o = r : o = { useClass: r }, le(o))
|
|
1318
|
+
for (var n = [t], l = o; l != null; ) {
|
|
1319
|
+
var w = l.useToken;
|
|
1320
|
+
if (n.includes(w))
|
|
1321
|
+
throw new Error("Token registration cycle detected! " + q(n, [w]).join(" -> "));
|
|
1322
|
+
n.push(w);
|
|
1323
|
+
var R = this._registry.get(w);
|
|
1324
|
+
R && le(R.provider) ? l = R.provider : l = null;
|
|
1325
|
+
}
|
|
1326
|
+
if ((s.lifecycle === D.Singleton || s.lifecycle == D.ContainerScoped || s.lifecycle == D.ResolutionScoped) && (fe(o) || Oe(o)))
|
|
1327
|
+
throw new Error('Cannot use lifecycle "' + D[s.lifecycle] + '" with ValueProviders or FactoryProviders');
|
|
1328
|
+
return this._registry.set(t, { provider: o, options: s }), this;
|
|
1329
|
+
}, e.prototype.registerType = function(t, r) {
|
|
1330
|
+
return this.ensureNotDisposed(), Q(r) ? this.register(t, {
|
|
1331
|
+
useToken: r
|
|
1332
|
+
}) : this.register(t, {
|
|
1333
|
+
useClass: r
|
|
1334
|
+
});
|
|
1335
|
+
}, e.prototype.registerInstance = function(t, r) {
|
|
1336
|
+
return this.ensureNotDisposed(), this.register(t, {
|
|
1337
|
+
useValue: r
|
|
1338
|
+
});
|
|
1339
|
+
}, e.prototype.registerSingleton = function(t, r) {
|
|
1340
|
+
if (this.ensureNotDisposed(), Q(t)) {
|
|
1341
|
+
if (Q(r))
|
|
1342
|
+
return this.register(t, {
|
|
1343
|
+
useToken: r
|
|
1344
|
+
}, { lifecycle: D.Singleton });
|
|
1345
|
+
if (r)
|
|
1346
|
+
return this.register(t, {
|
|
1347
|
+
useClass: r
|
|
1348
|
+
}, { lifecycle: D.Singleton });
|
|
1349
|
+
throw new Error('Cannot register a type name as a singleton without a "to" token');
|
|
1350
|
+
}
|
|
1351
|
+
var s = t;
|
|
1352
|
+
return r && !Q(r) && (s = r), this.register(t, {
|
|
1353
|
+
useClass: s
|
|
1354
|
+
}, { lifecycle: D.Singleton });
|
|
1355
|
+
}, e.prototype.resolve = function(t, r, s) {
|
|
1356
|
+
r === void 0 && (r = new ae()), s === void 0 && (s = !1), this.ensureNotDisposed();
|
|
1357
|
+
var o = this.getRegistration(t);
|
|
1358
|
+
if (!o && Q(t)) {
|
|
1359
|
+
if (s)
|
|
1360
|
+
return;
|
|
1361
|
+
throw new Error('Attempted to resolve unregistered dependency token: "' + t.toString() + '"');
|
|
1362
|
+
}
|
|
1363
|
+
if (this.executePreResolutionInterceptor(t, "Single"), o) {
|
|
1364
|
+
var n = this.resolveRegistration(o, r);
|
|
1365
|
+
return this.executePostResolutionInterceptor(t, n, "Single"), n;
|
|
1366
|
+
}
|
|
1367
|
+
if (qt(t)) {
|
|
1368
|
+
var n = this.construct(t, r);
|
|
1369
|
+
return this.executePostResolutionInterceptor(t, n, "Single"), n;
|
|
1370
|
+
}
|
|
1371
|
+
throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.");
|
|
1372
|
+
}, e.prototype.executePreResolutionInterceptor = function(t, r) {
|
|
1373
|
+
var s, o;
|
|
1374
|
+
if (this.interceptors.preResolution.has(t)) {
|
|
1375
|
+
var n = [];
|
|
1376
|
+
try {
|
|
1377
|
+
for (var l = oe(this.interceptors.preResolution.getAll(t)), w = l.next(); !w.done; w = l.next()) {
|
|
1378
|
+
var R = w.value;
|
|
1379
|
+
R.options.frequency != "Once" && n.push(R), R.callback(t, r);
|
|
1380
|
+
}
|
|
1381
|
+
} catch (_) {
|
|
1382
|
+
s = { error: _ };
|
|
1383
|
+
} finally {
|
|
1384
|
+
try {
|
|
1385
|
+
w && !w.done && (o = l.return) && o.call(l);
|
|
1386
|
+
} finally {
|
|
1387
|
+
if (s) throw s.error;
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
this.interceptors.preResolution.setAll(t, n);
|
|
1391
|
+
}
|
|
1392
|
+
}, e.prototype.executePostResolutionInterceptor = function(t, r, s) {
|
|
1393
|
+
var o, n;
|
|
1394
|
+
if (this.interceptors.postResolution.has(t)) {
|
|
1395
|
+
var l = [];
|
|
1396
|
+
try {
|
|
1397
|
+
for (var w = oe(this.interceptors.postResolution.getAll(t)), R = w.next(); !R.done; R = w.next()) {
|
|
1398
|
+
var _ = R.value;
|
|
1399
|
+
_.options.frequency != "Once" && l.push(_), _.callback(t, r, s);
|
|
1400
|
+
}
|
|
1401
|
+
} catch (S) {
|
|
1402
|
+
o = { error: S };
|
|
1403
|
+
} finally {
|
|
1404
|
+
try {
|
|
1405
|
+
R && !R.done && (n = w.return) && n.call(w);
|
|
1406
|
+
} finally {
|
|
1407
|
+
if (o) throw o.error;
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
this.interceptors.postResolution.setAll(t, l);
|
|
1411
|
+
}
|
|
1412
|
+
}, e.prototype.resolveRegistration = function(t, r) {
|
|
1413
|
+
if (this.ensureNotDisposed(), t.options.lifecycle === D.ResolutionScoped && r.scopedResolutions.has(t))
|
|
1414
|
+
return r.scopedResolutions.get(t);
|
|
1415
|
+
var s = t.options.lifecycle === D.Singleton, o = t.options.lifecycle === D.ContainerScoped, n = s || o, l;
|
|
1416
|
+
return fe(t.provider) ? l = t.provider.useValue : le(t.provider) ? l = n ? t.instance || (t.instance = this.resolve(t.provider.useToken, r)) : this.resolve(t.provider.useToken, r) : at(t.provider) ? l = n ? t.instance || (t.instance = this.construct(t.provider.useClass, r)) : this.construct(t.provider.useClass, r) : Oe(t.provider) ? l = t.provider.useFactory(this) : l = this.construct(t.provider, r), t.options.lifecycle === D.ResolutionScoped && r.scopedResolutions.set(t, l), l;
|
|
1417
|
+
}, e.prototype.resolveAll = function(t, r, s) {
|
|
1418
|
+
var o = this;
|
|
1419
|
+
r === void 0 && (r = new ae()), s === void 0 && (s = !1), this.ensureNotDisposed();
|
|
1420
|
+
var n = this.getAllRegistrations(t);
|
|
1421
|
+
if (!n && Q(t)) {
|
|
1422
|
+
if (s)
|
|
1423
|
+
return [];
|
|
1424
|
+
throw new Error('Attempted to resolve unregistered dependency token: "' + t.toString() + '"');
|
|
1425
|
+
}
|
|
1426
|
+
if (this.executePreResolutionInterceptor(t, "All"), n) {
|
|
1427
|
+
var l = n.map(function(R) {
|
|
1428
|
+
return o.resolveRegistration(R, r);
|
|
1429
|
+
});
|
|
1430
|
+
return this.executePostResolutionInterceptor(t, l, "All"), l;
|
|
1431
|
+
}
|
|
1432
|
+
var w = [this.construct(t, r)];
|
|
1433
|
+
return this.executePostResolutionInterceptor(t, w, "All"), w;
|
|
1434
|
+
}, e.prototype.isRegistered = function(t, r) {
|
|
1435
|
+
return r === void 0 && (r = !1), this.ensureNotDisposed(), this._registry.has(t) || r && (this.parent || !1) && this.parent.isRegistered(t, !0);
|
|
1436
|
+
}, e.prototype.reset = function() {
|
|
1437
|
+
this.ensureNotDisposed(), this._registry.clear(), this.interceptors.preResolution.clear(), this.interceptors.postResolution.clear();
|
|
1438
|
+
}, e.prototype.clearInstances = function() {
|
|
1439
|
+
var t, r;
|
|
1440
|
+
this.ensureNotDisposed();
|
|
1441
|
+
try {
|
|
1442
|
+
for (var s = oe(this._registry.entries()), o = s.next(); !o.done; o = s.next()) {
|
|
1443
|
+
var n = ce(o.value, 2), l = n[0], w = n[1];
|
|
1444
|
+
this._registry.setAll(l, w.filter(function(R) {
|
|
1445
|
+
return !fe(R.provider);
|
|
1446
|
+
}).map(function(R) {
|
|
1447
|
+
return R.instance = void 0, R;
|
|
1448
|
+
}));
|
|
1449
|
+
}
|
|
1450
|
+
} catch (R) {
|
|
1451
|
+
t = { error: R };
|
|
1452
|
+
} finally {
|
|
1453
|
+
try {
|
|
1454
|
+
o && !o.done && (r = s.return) && r.call(s);
|
|
1455
|
+
} finally {
|
|
1456
|
+
if (t) throw t.error;
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
}, e.prototype.createChildContainer = function() {
|
|
1460
|
+
var t, r;
|
|
1461
|
+
this.ensureNotDisposed();
|
|
1462
|
+
var s = new e(this);
|
|
1463
|
+
try {
|
|
1464
|
+
for (var o = oe(this._registry.entries()), n = o.next(); !n.done; n = o.next()) {
|
|
1465
|
+
var l = ce(n.value, 2), w = l[0], R = l[1];
|
|
1466
|
+
R.some(function(_) {
|
|
1467
|
+
var S = _.options;
|
|
1468
|
+
return S.lifecycle === D.ContainerScoped;
|
|
1469
|
+
}) && s._registry.setAll(w, R.map(function(_) {
|
|
1470
|
+
return _.options.lifecycle === D.ContainerScoped ? {
|
|
1471
|
+
provider: _.provider,
|
|
1472
|
+
options: _.options
|
|
1473
|
+
} : _;
|
|
1474
|
+
}));
|
|
1475
|
+
}
|
|
1476
|
+
} catch (_) {
|
|
1477
|
+
t = { error: _ };
|
|
1478
|
+
} finally {
|
|
1479
|
+
try {
|
|
1480
|
+
n && !n.done && (r = o.return) && r.call(o);
|
|
1481
|
+
} finally {
|
|
1482
|
+
if (t) throw t.error;
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
return s;
|
|
1486
|
+
}, e.prototype.beforeResolution = function(t, r, s) {
|
|
1487
|
+
s === void 0 && (s = { frequency: "Always" }), this.interceptors.preResolution.set(t, {
|
|
1488
|
+
callback: r,
|
|
1489
|
+
options: s
|
|
1490
|
+
});
|
|
1491
|
+
}, e.prototype.afterResolution = function(t, r, s) {
|
|
1492
|
+
s === void 0 && (s = { frequency: "Always" }), this.interceptors.postResolution.set(t, {
|
|
1493
|
+
callback: r,
|
|
1494
|
+
options: s
|
|
1495
|
+
});
|
|
1496
|
+
}, e.prototype.dispose = function() {
|
|
1497
|
+
return Gt(this, void 0, void 0, function() {
|
|
1498
|
+
var t;
|
|
1499
|
+
return Vt(this, function(r) {
|
|
1500
|
+
switch (r.label) {
|
|
1501
|
+
case 0:
|
|
1502
|
+
return this.disposed = !0, t = [], this.disposables.forEach(function(s) {
|
|
1503
|
+
var o = s.dispose();
|
|
1504
|
+
o && t.push(o);
|
|
1505
|
+
}), [4, Promise.all(t)];
|
|
1506
|
+
case 1:
|
|
1507
|
+
return r.sent(), [2];
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
});
|
|
1511
|
+
}, e.prototype.getRegistration = function(t) {
|
|
1512
|
+
return this.isRegistered(t) ? this._registry.get(t) : this.parent ? this.parent.getRegistration(t) : null;
|
|
1513
|
+
}, e.prototype.getAllRegistrations = function(t) {
|
|
1514
|
+
return this.isRegistered(t) ? this._registry.getAll(t) : this.parent ? this.parent.getAllRegistrations(t) : null;
|
|
1515
|
+
}, e.prototype.construct = function(t, r) {
|
|
1516
|
+
var s = this;
|
|
1517
|
+
if (t instanceof ut)
|
|
1518
|
+
return t.createProxy(function(n) {
|
|
1519
|
+
return s.resolve(n, r);
|
|
1520
|
+
});
|
|
1521
|
+
var o = (function() {
|
|
1522
|
+
var n = lt.get(t);
|
|
1523
|
+
if (!n || n.length === 0) {
|
|
1524
|
+
if (t.length === 0)
|
|
1525
|
+
return new t();
|
|
1526
|
+
throw new Error('TypeInfo not known for "' + t.name + '"');
|
|
1527
|
+
}
|
|
1528
|
+
var l = n.map(s.resolveParams(r, t));
|
|
1529
|
+
return new (t.bind.apply(t, q([void 0], l)))();
|
|
1530
|
+
})();
|
|
1531
|
+
return Kt(o) && this.disposables.add(o), o;
|
|
1532
|
+
}, e.prototype.resolveParams = function(t, r) {
|
|
1533
|
+
var s = this;
|
|
1534
|
+
return function(o, n) {
|
|
1535
|
+
var l, w, R;
|
|
1536
|
+
try {
|
|
1537
|
+
return Ut(o) ? Ke(o) ? o.multiple ? (l = s.resolve(o.transform)).transform.apply(l, q([s.resolveAll(o.token, new ae(), o.isOptional)], o.transformArgs)) : (w = s.resolve(o.transform)).transform.apply(w, q([s.resolve(o.token, t, o.isOptional)], o.transformArgs)) : o.multiple ? s.resolveAll(o.token, new ae(), o.isOptional) : s.resolve(o.token, t, o.isOptional) : Ke(o) ? (R = s.resolve(o.transform, t)).transform.apply(R, q([s.resolve(o.token, t)], o.transformArgs)) : s.resolve(o, t);
|
|
1538
|
+
} catch (_) {
|
|
1539
|
+
throw new Error(Xt(r, n, _));
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
}, e.prototype.ensureNotDisposed = function() {
|
|
1543
|
+
if (this.disposed)
|
|
1544
|
+
throw new Error("This container has been disposed, you cannot interact with a disposed container");
|
|
1545
|
+
}, e;
|
|
1546
|
+
})(), ir = new nr();
|
|
1547
|
+
function W(e, t) {
|
|
1548
|
+
var r = {
|
|
1549
|
+
token: e,
|
|
1550
|
+
multiple: !1,
|
|
1551
|
+
isOptional: t
|
|
1552
|
+
};
|
|
1553
|
+
return ot(r);
|
|
1554
|
+
}
|
|
1555
|
+
function z(e) {
|
|
1556
|
+
return function(t) {
|
|
1557
|
+
lt.set(t, zt(t));
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
function ft(e, t) {
|
|
1561
|
+
var r = {
|
|
1562
|
+
token: e,
|
|
1563
|
+
multiple: !0,
|
|
1564
|
+
isOptional: t
|
|
1565
|
+
};
|
|
1566
|
+
return ot(r);
|
|
1567
|
+
}
|
|
1568
|
+
if (typeof Reflect > "u" || !Reflect.getMetadata)
|
|
1569
|
+
throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);
|
|
1570
|
+
var ue = { exports: {} }, et;
|
|
1571
|
+
function sr() {
|
|
1572
|
+
if (et) return ue.exports;
|
|
1573
|
+
et = 1;
|
|
1574
|
+
var e = typeof Reflect == "object" ? Reflect : null, t = e && typeof e.apply == "function" ? e.apply : function(f, d, g) {
|
|
1575
|
+
return Function.prototype.apply.call(f, d, g);
|
|
1576
|
+
}, r;
|
|
1577
|
+
e && typeof e.ownKeys == "function" ? r = e.ownKeys : Object.getOwnPropertySymbols ? r = function(f) {
|
|
1578
|
+
return Object.getOwnPropertyNames(f).concat(Object.getOwnPropertySymbols(f));
|
|
1579
|
+
} : r = function(f) {
|
|
1580
|
+
return Object.getOwnPropertyNames(f);
|
|
1581
|
+
};
|
|
1582
|
+
function s(c) {
|
|
1583
|
+
console && console.warn && console.warn(c);
|
|
1584
|
+
}
|
|
1585
|
+
var o = Number.isNaN || function(f) {
|
|
1586
|
+
return f !== f;
|
|
1587
|
+
};
|
|
1588
|
+
function n() {
|
|
1589
|
+
n.init.call(this);
|
|
1590
|
+
}
|
|
1591
|
+
ue.exports = n, ue.exports.once = J, n.EventEmitter = n, n.prototype._events = void 0, n.prototype._eventsCount = 0, n.prototype._maxListeners = void 0;
|
|
1592
|
+
var l = 10;
|
|
1593
|
+
function w(c) {
|
|
1594
|
+
if (typeof c != "function")
|
|
1595
|
+
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof c);
|
|
1596
|
+
}
|
|
1597
|
+
Object.defineProperty(n, "defaultMaxListeners", {
|
|
1598
|
+
enumerable: !0,
|
|
1599
|
+
get: function() {
|
|
1600
|
+
return l;
|
|
1601
|
+
},
|
|
1602
|
+
set: function(c) {
|
|
1603
|
+
if (typeof c != "number" || c < 0 || o(c))
|
|
1604
|
+
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + c + ".");
|
|
1605
|
+
l = c;
|
|
1606
|
+
}
|
|
1607
|
+
}), n.init = function() {
|
|
1608
|
+
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
1609
|
+
}, n.prototype.setMaxListeners = function(f) {
|
|
1610
|
+
if (typeof f != "number" || f < 0 || o(f))
|
|
1611
|
+
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + f + ".");
|
|
1612
|
+
return this._maxListeners = f, this;
|
|
1613
|
+
};
|
|
1614
|
+
function R(c) {
|
|
1615
|
+
return c._maxListeners === void 0 ? n.defaultMaxListeners : c._maxListeners;
|
|
1616
|
+
}
|
|
1617
|
+
n.prototype.getMaxListeners = function() {
|
|
1618
|
+
return R(this);
|
|
1619
|
+
}, n.prototype.emit = function(f) {
|
|
1620
|
+
for (var d = [], g = 1; g < arguments.length; g++) d.push(arguments[g]);
|
|
1621
|
+
var O = f === "error", x = this._events;
|
|
1622
|
+
if (x !== void 0)
|
|
1623
|
+
O = O && x.error === void 0;
|
|
1624
|
+
else if (!O)
|
|
1625
|
+
return !1;
|
|
1626
|
+
if (O) {
|
|
1627
|
+
var P;
|
|
1628
|
+
if (d.length > 0 && (P = d[0]), P instanceof Error)
|
|
1629
|
+
throw P;
|
|
1630
|
+
var H = new Error("Unhandled error." + (P ? " (" + P.message + ")" : ""));
|
|
1631
|
+
throw H.context = P, H;
|
|
1632
|
+
}
|
|
1633
|
+
var U = x[f];
|
|
1634
|
+
if (U === void 0)
|
|
1635
|
+
return !1;
|
|
1636
|
+
if (typeof U == "function")
|
|
1637
|
+
t(U, this, d);
|
|
1638
|
+
else
|
|
1639
|
+
for (var ie = U.length, ve = Z(U, ie), g = 0; g < ie; ++g)
|
|
1640
|
+
t(ve[g], this, d);
|
|
1641
|
+
return !0;
|
|
1642
|
+
};
|
|
1643
|
+
function _(c, f, d, g) {
|
|
1644
|
+
var O, x, P;
|
|
1645
|
+
if (w(d), x = c._events, x === void 0 ? (x = c._events = /* @__PURE__ */ Object.create(null), c._eventsCount = 0) : (x.newListener !== void 0 && (c.emit(
|
|
1646
|
+
"newListener",
|
|
1647
|
+
f,
|
|
1648
|
+
d.listener ? d.listener : d
|
|
1649
|
+
), x = c._events), P = x[f]), P === void 0)
|
|
1650
|
+
P = x[f] = d, ++c._eventsCount;
|
|
1651
|
+
else if (typeof P == "function" ? P = x[f] = g ? [d, P] : [P, d] : g ? P.unshift(d) : P.push(d), O = R(c), O > 0 && P.length > O && !P.warned) {
|
|
1652
|
+
P.warned = !0;
|
|
1653
|
+
var H = new Error("Possible EventEmitter memory leak detected. " + P.length + " " + String(f) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
1654
|
+
H.name = "MaxListenersExceededWarning", H.emitter = c, H.type = f, H.count = P.length, s(H);
|
|
1655
|
+
}
|
|
1656
|
+
return c;
|
|
1657
|
+
}
|
|
1658
|
+
n.prototype.addListener = function(f, d) {
|
|
1659
|
+
return _(this, f, d, !1);
|
|
1660
|
+
}, n.prototype.on = n.prototype.addListener, n.prototype.prependListener = function(f, d) {
|
|
1661
|
+
return _(this, f, d, !0);
|
|
1662
|
+
};
|
|
1663
|
+
function S() {
|
|
1664
|
+
if (!this.fired)
|
|
1665
|
+
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
1666
|
+
}
|
|
1667
|
+
function j(c, f, d) {
|
|
1668
|
+
var g = { fired: !1, wrapFn: void 0, target: c, type: f, listener: d }, O = S.bind(g);
|
|
1669
|
+
return O.listener = d, g.wrapFn = O, O;
|
|
1670
|
+
}
|
|
1671
|
+
n.prototype.once = function(f, d) {
|
|
1672
|
+
return w(d), this.on(f, j(this, f, d)), this;
|
|
1673
|
+
}, n.prototype.prependOnceListener = function(f, d) {
|
|
1674
|
+
return w(d), this.prependListener(f, j(this, f, d)), this;
|
|
1675
|
+
}, n.prototype.removeListener = function(f, d) {
|
|
1676
|
+
var g, O, x, P, H;
|
|
1677
|
+
if (w(d), O = this._events, O === void 0)
|
|
1678
|
+
return this;
|
|
1679
|
+
if (g = O[f], g === void 0)
|
|
1680
|
+
return this;
|
|
1681
|
+
if (g === d || g.listener === d)
|
|
1682
|
+
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete O[f], O.removeListener && this.emit("removeListener", f, g.listener || d));
|
|
1683
|
+
else if (typeof g != "function") {
|
|
1684
|
+
for (x = -1, P = g.length - 1; P >= 0; P--)
|
|
1685
|
+
if (g[P] === d || g[P].listener === d) {
|
|
1686
|
+
H = g[P].listener, x = P;
|
|
1687
|
+
break;
|
|
1688
|
+
}
|
|
1689
|
+
if (x < 0)
|
|
1690
|
+
return this;
|
|
1691
|
+
x === 0 ? g.shift() : K(g, x), g.length === 1 && (O[f] = g[0]), O.removeListener !== void 0 && this.emit("removeListener", f, H || d);
|
|
1692
|
+
}
|
|
1693
|
+
return this;
|
|
1694
|
+
}, n.prototype.off = n.prototype.removeListener, n.prototype.removeAllListeners = function(f) {
|
|
1695
|
+
var d, g, O;
|
|
1696
|
+
if (g = this._events, g === void 0)
|
|
1697
|
+
return this;
|
|
1698
|
+
if (g.removeListener === void 0)
|
|
1699
|
+
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : g[f] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete g[f]), this;
|
|
1700
|
+
if (arguments.length === 0) {
|
|
1701
|
+
var x = Object.keys(g), P;
|
|
1702
|
+
for (O = 0; O < x.length; ++O)
|
|
1703
|
+
P = x[O], P !== "removeListener" && this.removeAllListeners(P);
|
|
1704
|
+
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
|
|
1705
|
+
}
|
|
1706
|
+
if (d = g[f], typeof d == "function")
|
|
1707
|
+
this.removeListener(f, d);
|
|
1708
|
+
else if (d !== void 0)
|
|
1709
|
+
for (O = d.length - 1; O >= 0; O--)
|
|
1710
|
+
this.removeListener(f, d[O]);
|
|
1711
|
+
return this;
|
|
1712
|
+
};
|
|
1713
|
+
function B(c, f, d) {
|
|
1714
|
+
var g = c._events;
|
|
1715
|
+
if (g === void 0)
|
|
1716
|
+
return [];
|
|
1717
|
+
var O = g[f];
|
|
1718
|
+
return O === void 0 ? [] : typeof O == "function" ? d ? [O.listener || O] : [O] : d ? V(O) : Z(O, O.length);
|
|
1719
|
+
}
|
|
1720
|
+
n.prototype.listeners = function(f) {
|
|
1721
|
+
return B(this, f, !0);
|
|
1722
|
+
}, n.prototype.rawListeners = function(f) {
|
|
1723
|
+
return B(this, f, !1);
|
|
1724
|
+
}, n.listenerCount = function(c, f) {
|
|
1725
|
+
return typeof c.listenerCount == "function" ? c.listenerCount(f) : G.call(c, f);
|
|
1726
|
+
}, n.prototype.listenerCount = G;
|
|
1727
|
+
function G(c) {
|
|
1728
|
+
var f = this._events;
|
|
1729
|
+
if (f !== void 0) {
|
|
1730
|
+
var d = f[c];
|
|
1731
|
+
if (typeof d == "function")
|
|
1732
|
+
return 1;
|
|
1733
|
+
if (d !== void 0)
|
|
1734
|
+
return d.length;
|
|
1735
|
+
}
|
|
1736
|
+
return 0;
|
|
1737
|
+
}
|
|
1738
|
+
n.prototype.eventNames = function() {
|
|
1739
|
+
return this._eventsCount > 0 ? r(this._events) : [];
|
|
1740
|
+
};
|
|
1741
|
+
function Z(c, f) {
|
|
1742
|
+
for (var d = new Array(f), g = 0; g < f; ++g)
|
|
1743
|
+
d[g] = c[g];
|
|
1744
|
+
return d;
|
|
1745
|
+
}
|
|
1746
|
+
function K(c, f) {
|
|
1747
|
+
for (; f + 1 < c.length; f++)
|
|
1748
|
+
c[f] = c[f + 1];
|
|
1749
|
+
c.pop();
|
|
1750
|
+
}
|
|
1751
|
+
function V(c) {
|
|
1752
|
+
for (var f = new Array(c.length), d = 0; d < f.length; ++d)
|
|
1753
|
+
f[d] = c[d].listener || c[d];
|
|
1754
|
+
return f;
|
|
1755
|
+
}
|
|
1756
|
+
function J(c, f) {
|
|
1757
|
+
return new Promise(function(d, g) {
|
|
1758
|
+
function O(P) {
|
|
1759
|
+
c.removeListener(f, x), g(P);
|
|
1760
|
+
}
|
|
1761
|
+
function x() {
|
|
1762
|
+
typeof c.removeListener == "function" && c.removeListener("error", O), d([].slice.call(arguments));
|
|
1763
|
+
}
|
|
1764
|
+
ne(c, f, x, { once: !0 }), f !== "error" && re(c, O, { once: !0 });
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
function re(c, f, d) {
|
|
1768
|
+
typeof c.on == "function" && ne(c, "error", f, d);
|
|
1769
|
+
}
|
|
1770
|
+
function ne(c, f, d, g) {
|
|
1771
|
+
if (typeof c.on == "function")
|
|
1772
|
+
g.once ? c.once(f, d) : c.on(f, d);
|
|
1773
|
+
else if (typeof c.addEventListener == "function")
|
|
1774
|
+
c.addEventListener(f, function O(x) {
|
|
1775
|
+
g.once && c.removeEventListener(f, O), d(x);
|
|
1776
|
+
});
|
|
1777
|
+
else
|
|
1778
|
+
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof c);
|
|
1779
|
+
}
|
|
1780
|
+
return ue.exports;
|
|
1781
|
+
}
|
|
1782
|
+
var or = sr(), ar = Object.getOwnPropertyDescriptor, ur = (e, t, r, s) => {
|
|
1783
|
+
for (var o = s > 1 ? void 0 : s ? ar(t, r) : t, n = e.length - 1, l; n >= 0; n--)
|
|
1784
|
+
(l = e[n]) && (o = l(o) || o);
|
|
1785
|
+
return o;
|
|
1786
|
+
};
|
|
1787
|
+
let Re = class {
|
|
1788
|
+
_emitter;
|
|
1789
|
+
constructor() {
|
|
1790
|
+
this._emitter = new or.EventEmitter();
|
|
1791
|
+
}
|
|
1792
|
+
/** Публикация события */
|
|
1793
|
+
emit(e, t) {
|
|
1794
|
+
this._emitter.emit(e, t);
|
|
1795
|
+
}
|
|
1796
|
+
/** Подписка на событие */
|
|
1797
|
+
on(e, t) {
|
|
1798
|
+
this._emitter.on(e, t);
|
|
1799
|
+
}
|
|
1800
|
+
/** Отписка от события */
|
|
1801
|
+
off(e, t) {
|
|
1802
|
+
this._emitter.off(e, t);
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1805
|
+
Re = ur([
|
|
1806
|
+
z()
|
|
1807
|
+
], Re);
|
|
1808
|
+
var X = /* @__PURE__ */ ((e) => (e.SelectHover = "select.hover", e.SelectClick = "select.click", e))(X || {}), lr = Object.getOwnPropertyDescriptor, fr = (e, t, r, s) => {
|
|
1809
|
+
for (var o = s > 1 ? void 0 : s ? lr(t, r) : t, n = e.length - 1, l; n >= 0; n--)
|
|
1810
|
+
(l = e[n]) && (o = l(o) || o);
|
|
1811
|
+
return o;
|
|
1812
|
+
}, tt = (e, t) => (r, s) => t(r, s, e);
|
|
1813
|
+
let Pe = class extends st {
|
|
131
1814
|
/**
|
|
132
1815
|
* Инициализация сцены редактора.
|
|
133
1816
|
* Создает сетку, оси координат и orbit-контроллер.
|
|
134
|
-
* @param canvas - HTMLCanvasElement для рендеринга
|
|
135
1817
|
*/
|
|
136
|
-
constructor(e) {
|
|
137
|
-
super(e);
|
|
138
|
-
const
|
|
139
|
-
|
|
1818
|
+
constructor(e, t) {
|
|
1819
|
+
super(e), this._canvas = e, this._bus = t;
|
|
1820
|
+
const r = new Tt(this.gl.gl, { size: 10, divisions: 10 });
|
|
1821
|
+
r.position.y = -1e-3, r.setParent(this.scene), new At(this.gl.gl, { size: 6, symmetric: !0 }).setParent(this.scene), this._orbit = new Bt(this.camera, { element: this.canvas }), this._raycast = new kt(), this._mouse = new jt(), this._isEventListenersAdded = !1;
|
|
140
1822
|
}
|
|
1823
|
+
/** Orbit-контроллер для управления камерой */
|
|
1824
|
+
_orbit;
|
|
1825
|
+
/** Raycast для подсветки моделей при наведении */
|
|
1826
|
+
_raycast;
|
|
1827
|
+
/** Курсор мыши для остлеживания наведения на 3D-модель */
|
|
1828
|
+
_mouse;
|
|
1829
|
+
/** Были ли зарегистрированы обработчики событий для мыши */
|
|
1830
|
+
_isEventListenersAdded;
|
|
141
1831
|
/**
|
|
142
1832
|
* Обновление состояния рендерера.
|
|
143
1833
|
*/
|
|
144
1834
|
update() {
|
|
145
|
-
this.
|
|
1835
|
+
this._orbit?.update();
|
|
146
1836
|
}
|
|
147
1837
|
/**
|
|
148
1838
|
* Метод для добавления фигуры.
|
|
149
1839
|
* Настройка raycast.
|
|
150
|
-
* @param figure Данные фигуры: position, normal, uv
|
|
1840
|
+
* @param figure - Данные фигуры: position, normal, uv
|
|
151
1841
|
*/
|
|
152
1842
|
addFigure(e) {
|
|
153
1843
|
const t = super.addFigure(e);
|
|
154
1844
|
if (t.geometry) {
|
|
155
|
-
const
|
|
156
|
-
t.geometry.raycast =
|
|
1845
|
+
const r = t.geometry.constructor.name;
|
|
1846
|
+
t.geometry.raycast = r.includes("Sphere") ? "sphere" : "box";
|
|
157
1847
|
}
|
|
158
|
-
return
|
|
159
|
-
this.updateHitUniform(i);
|
|
160
|
-
}), this.isEventListenersAdded || this.initMouseListeners(), t;
|
|
1848
|
+
return this._isEventListenersAdded || this.initMouseListeners(), t;
|
|
161
1849
|
}
|
|
162
1850
|
/**
|
|
163
|
-
*
|
|
1851
|
+
* Устанавливает callback, который будет вызываться перед рендером конкретного меша.
|
|
1852
|
+
*
|
|
1853
|
+
* @param mesh - Меш, для которого нужно задать callback.
|
|
1854
|
+
* @param f - Функция обратного вызова, выполняемая перед рендером меша.
|
|
1855
|
+
* @internal
|
|
164
1856
|
*/
|
|
165
|
-
|
|
166
|
-
|
|
1857
|
+
setMeshBeforeRender(e, t) {
|
|
1858
|
+
e.onBeforeRender(t);
|
|
167
1859
|
}
|
|
168
1860
|
/**
|
|
169
1861
|
* Инициализация обработчиков мыши для raycast
|
|
170
1862
|
*/
|
|
171
1863
|
initMouseListeners() {
|
|
172
|
-
document.addEventListener("mousemove", this.
|
|
1864
|
+
document.addEventListener("mousemove", this._handleMouseMove, !1), document.addEventListener("click", this._handleMouseClick, !1), this._isEventListenersAdded = !0;
|
|
173
1865
|
}
|
|
174
1866
|
/**
|
|
175
1867
|
* Обработчик движения мыши
|
|
176
1868
|
*/
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
this.mouse.set(2 * (e.x / this.gl.width) - 1, 2 * (1 - e.y / this.gl.height) - 1), this.raycast.castMouse(this.camera, this.mouse), this.meshes.forEach((i) => i.isHit = !1), this.raycast.intersectBounds(this.meshes).forEach((i) => i.isHit = !0);
|
|
1869
|
+
_handleMouseMove = (e) => {
|
|
1870
|
+
this._processRaycastEvent(e, X.SelectHover, !0);
|
|
180
1871
|
};
|
|
1872
|
+
/**
|
|
1873
|
+
* Обработчик клика мыши
|
|
1874
|
+
*/
|
|
1875
|
+
_handleMouseClick = (e) => {
|
|
1876
|
+
this._processRaycastEvent(e, X.SelectClick, !1);
|
|
1877
|
+
};
|
|
1878
|
+
/**
|
|
1879
|
+
* Универсальная логика raycast-события
|
|
1880
|
+
*/
|
|
1881
|
+
_processRaycastEvent(e, t, r) {
|
|
1882
|
+
if (this._orbit.isInteracting) return;
|
|
1883
|
+
this._mouse.set(2 * (e.x / this.gl.width) - 1, 2 * (1 - e.y / this.gl.height) - 1), this._raycast.castMouse(this.camera, this._mouse), r && this.meshes.forEach((n) => n.isHit = !1);
|
|
1884
|
+
const s = this._raycast.intersectBounds(this.meshes), o = s.length ? s[0] : null;
|
|
1885
|
+
this._bus.emit(t, o ? { mesh: o } : null), r && s.forEach((n) => n.isHit = !0);
|
|
1886
|
+
}
|
|
181
1887
|
/** Деструктор */
|
|
182
1888
|
destroy() {
|
|
183
|
-
this.
|
|
1889
|
+
this._isEventListenersAdded && (document.removeEventListener("mousemove", this._handleMouseMove, !1), document.removeEventListener("click", this._handleMouseClick, !1), this._isEventListenersAdded = !1), this._orbit.destroy(), this._orbit = null, this._raycast = null, this._mouse = null, super.destroy();
|
|
184
1890
|
}
|
|
185
|
-
}
|
|
186
|
-
|
|
1891
|
+
};
|
|
1892
|
+
Pe = fr([
|
|
1893
|
+
z(),
|
|
1894
|
+
tt(0, W("Canvas")),
|
|
1895
|
+
tt(1, W("EventBus"))
|
|
1896
|
+
], Pe);
|
|
1897
|
+
class Ir extends st {
|
|
187
1898
|
/** Orbit-контроллер для управления камерой */
|
|
188
|
-
|
|
1899
|
+
_orbit;
|
|
189
1900
|
/**
|
|
190
1901
|
* Инициализация сцены предпросмотра.
|
|
191
1902
|
* @param canvas - HTMLCanvasElement для рендеринга
|
|
192
1903
|
*/
|
|
193
|
-
constructor(
|
|
194
|
-
super(
|
|
1904
|
+
constructor(t) {
|
|
1905
|
+
super(t), this._orbit = new it(this.camera, {
|
|
195
1906
|
element: this.canvas,
|
|
196
|
-
target: new
|
|
1907
|
+
target: new Dt(0, 0, 0),
|
|
197
1908
|
minPolarAngle: Math.PI / 2,
|
|
198
1909
|
maxPolarAngle: Math.PI / 2,
|
|
199
1910
|
enableRotate: !0,
|
|
@@ -205,10 +1916,10 @@ class z extends u {
|
|
|
205
1916
|
* Обновление состояния рендерера.
|
|
206
1917
|
*/
|
|
207
1918
|
update() {
|
|
208
|
-
this.
|
|
1919
|
+
this._orbit?.update();
|
|
209
1920
|
}
|
|
210
1921
|
}
|
|
211
|
-
class
|
|
1922
|
+
class cr {
|
|
212
1923
|
/** Тип фигуры */
|
|
213
1924
|
type;
|
|
214
1925
|
/** Позиции вершин */
|
|
@@ -223,82 +1934,323 @@ class A {
|
|
|
223
1934
|
* Создаёт новую фигуру
|
|
224
1935
|
* @param data - исходные данные фигуры
|
|
225
1936
|
*/
|
|
226
|
-
constructor(
|
|
227
|
-
this.type =
|
|
1937
|
+
constructor(t) {
|
|
1938
|
+
this.type = t.type, this.position = t.position, this.normal = t.normal ?? [], this.uv = t.uv ?? [], this.material = t.material;
|
|
228
1939
|
}
|
|
229
1940
|
}
|
|
230
|
-
var
|
|
231
|
-
class
|
|
1941
|
+
var ct = /* @__PURE__ */ ((e) => (e[e.Cube = 0] = "Cube", e[e.Sphere = 1] = "Sphere", e[e.Plane = 2] = "Plane", e[e.Cylinder = 3] = "Cylinder", e[e.Custom = 4] = "Custom", e))(ct || {}), te = /* @__PURE__ */ ((e) => (e.Plane = "plane", e.Wireframe = "wireframe", e.Texture = "texture", e))(te || {}), de = /* @__PURE__ */ ((e) => (e.Mesh = "mesh", e.Face = "face", e.Edge = "edge", e.Vertex = "vertex", e))(de || {});
|
|
1942
|
+
class Lr {
|
|
232
1943
|
/** Позиции вершин */
|
|
233
|
-
|
|
1944
|
+
_positions = [];
|
|
234
1945
|
/** Нормали вершин */
|
|
235
|
-
|
|
1946
|
+
_normals = [];
|
|
236
1947
|
/** UV-координаты (опционально) */
|
|
237
|
-
|
|
1948
|
+
_uvs = [];
|
|
238
1949
|
// Временные поля для парсинга файла
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
1950
|
+
_tmpPositions = [];
|
|
1951
|
+
_tmpNormals = [];
|
|
1952
|
+
_tmpUVs = [];
|
|
242
1953
|
/**
|
|
243
1954
|
* Загружает OBJ-модель в Figure
|
|
244
|
-
* @param objContent Строка содержимого .obj файла
|
|
1955
|
+
* @param objContent - Строка содержимого .obj файла
|
|
245
1956
|
*/
|
|
246
|
-
load(
|
|
247
|
-
const
|
|
1957
|
+
load(t) {
|
|
1958
|
+
const r = t.split(`
|
|
248
1959
|
`);
|
|
249
|
-
for (const
|
|
250
|
-
if (!
|
|
251
|
-
const
|
|
252
|
-
switch (
|
|
1960
|
+
for (const o of r) {
|
|
1961
|
+
if (!o.trim() || o.startsWith("#")) continue;
|
|
1962
|
+
const n = o.trim().split(/\s+/);
|
|
1963
|
+
switch (n[0]) {
|
|
253
1964
|
case "v":
|
|
254
|
-
this.
|
|
1965
|
+
this._tmpPositions.push(n.slice(1).map(Number));
|
|
255
1966
|
break;
|
|
256
1967
|
case "vn":
|
|
257
|
-
this.
|
|
1968
|
+
this._tmpNormals.push(n.slice(1).map(Number));
|
|
258
1969
|
break;
|
|
259
1970
|
case "vt":
|
|
260
|
-
this.
|
|
1971
|
+
this._tmpUVs.push(n.slice(1).map(Number));
|
|
261
1972
|
break;
|
|
262
1973
|
case "f":
|
|
263
|
-
this.processFaceLine(
|
|
1974
|
+
this.processFaceLine(n);
|
|
264
1975
|
break;
|
|
265
1976
|
}
|
|
266
1977
|
}
|
|
267
|
-
const
|
|
268
|
-
type:
|
|
269
|
-
position: this.
|
|
270
|
-
...this.
|
|
271
|
-
...this.
|
|
1978
|
+
const s = {
|
|
1979
|
+
type: ct.Custom,
|
|
1980
|
+
position: this._positions,
|
|
1981
|
+
...this._normals.length > 0 && { normal: this._normals },
|
|
1982
|
+
...this._uvs.length > 0 && { uv: this._uvs }
|
|
272
1983
|
};
|
|
273
|
-
return new
|
|
1984
|
+
return new cr(s);
|
|
274
1985
|
}
|
|
275
1986
|
/**
|
|
276
1987
|
* Обрабатывает строку face (f) и разворачивает индексы в массивы для рендеринга
|
|
277
1988
|
*/
|
|
278
|
-
processFaceLine(
|
|
279
|
-
for (let
|
|
280
|
-
const
|
|
281
|
-
if (!
|
|
282
|
-
const [
|
|
283
|
-
if (
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
if (
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
}
|
|
291
|
-
if (m !== void 0) {
|
|
292
|
-
const n = this.tmpNormals[m - 1];
|
|
293
|
-
n && this.normals.push(...n);
|
|
1989
|
+
processFaceLine(t) {
|
|
1990
|
+
for (let r = 1; r < t.length; r++) {
|
|
1991
|
+
const s = t[r];
|
|
1992
|
+
if (!s) continue;
|
|
1993
|
+
const [o, n, l] = s.split("/"), w = o ? parseInt(o, 10) : void 0, R = n ? parseInt(n, 10) : void 0, _ = l ? parseInt(l, 10) : void 0;
|
|
1994
|
+
if (w !== void 0) {
|
|
1995
|
+
const S = this._tmpPositions[w - 1];
|
|
1996
|
+
S && this._positions.push(...S);
|
|
1997
|
+
}
|
|
1998
|
+
if (R !== void 0) {
|
|
1999
|
+
const S = this._tmpUVs[R - 1];
|
|
2000
|
+
S && this._uvs.push(...S);
|
|
294
2001
|
}
|
|
2002
|
+
if (_ !== void 0) {
|
|
2003
|
+
const S = this._tmpNormals[_ - 1];
|
|
2004
|
+
S && this._normals.push(...S);
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
var hr = Object.getOwnPropertyDescriptor, dr = (e, t, r, s) => {
|
|
2010
|
+
for (var o = s > 1 ? void 0 : s ? hr(t, r) : t, n = e.length - 1, l; n >= 0; n--)
|
|
2011
|
+
(l = e[n]) && (o = l(o) || o);
|
|
2012
|
+
return o;
|
|
2013
|
+
}, vr = (e, t) => (r, s) => t(r, s, e);
|
|
2014
|
+
let Ee = class {
|
|
2015
|
+
/** Текущий режим отображения */
|
|
2016
|
+
_currentMode = te.Plane;
|
|
2017
|
+
/** Хендлеры, которые управляют отображением */
|
|
2018
|
+
_handlers;
|
|
2019
|
+
constructor(e) {
|
|
2020
|
+
this._handlers = new Map(e.map((t) => [t.mode, t]));
|
|
2021
|
+
}
|
|
2022
|
+
/** Установка режима отображения */
|
|
2023
|
+
manage(e) {
|
|
2024
|
+
e !== this._currentMode && (this._handlers.get(this._currentMode)?.rollback(), e !== te.Plane && this._handlers.get(e)?.handle(), this._currentMode = e);
|
|
2025
|
+
}
|
|
2026
|
+
/** Освобождение ресурсов */
|
|
2027
|
+
destroy() {
|
|
2028
|
+
this._handlers && this._handlers.clear(), this._currentMode = te.Plane;
|
|
2029
|
+
}
|
|
2030
|
+
};
|
|
2031
|
+
Ee = dr([
|
|
2032
|
+
z(),
|
|
2033
|
+
vr(0, ft("IDisplayHandler"))
|
|
2034
|
+
], Ee);
|
|
2035
|
+
var he = /* @__PURE__ */ ((e) => (e.Hover = "hover", e.Click = "click", e))(he || {}), pr = Object.getOwnPropertyDescriptor, yr = (e, t, r, s) => {
|
|
2036
|
+
for (var o = s > 1 ? void 0 : s ? pr(t, r) : t, n = e.length - 1, l; n >= 0; n--)
|
|
2037
|
+
(l = e[n]) && (o = l(o) || o);
|
|
2038
|
+
return o;
|
|
2039
|
+
}, rt = (e, t) => (r, s) => t(r, s, e);
|
|
2040
|
+
let Ce = class {
|
|
2041
|
+
constructor(e, t) {
|
|
2042
|
+
this._eventBus = e, this._handlers = new Map(t.map((r) => [r.mode, r])), this._eventBus.on(X.SelectHover, this._onHover), this._eventBus.on(X.SelectClick, this._onClick);
|
|
2043
|
+
}
|
|
2044
|
+
/** Текущий режим выборки */
|
|
2045
|
+
_currentMode = de.Mesh;
|
|
2046
|
+
/** Хендлеры, которые управляют выборкой */
|
|
2047
|
+
_handlers;
|
|
2048
|
+
manage(e) {
|
|
2049
|
+
e !== this._currentMode && (this._handlers.get(this._currentMode)?.rollback(), this._currentMode = e);
|
|
2050
|
+
}
|
|
2051
|
+
/** Обработчик события наведения на модель */
|
|
2052
|
+
_onHover = (e) => {
|
|
2053
|
+
if (!e) return;
|
|
2054
|
+
this._handlers.get(this._currentMode)?.handle(e, he.Hover);
|
|
2055
|
+
};
|
|
2056
|
+
/** Обработчик события клика на модель */
|
|
2057
|
+
_onClick = (e) => {
|
|
2058
|
+
if (!e) return;
|
|
2059
|
+
this._handlers.get(this._currentMode)?.handle(e, he.Click);
|
|
2060
|
+
};
|
|
2061
|
+
destroy() {
|
|
2062
|
+
this._eventBus.off(X.SelectHover, this._onHover);
|
|
2063
|
+
}
|
|
2064
|
+
};
|
|
2065
|
+
Ce = yr([
|
|
2066
|
+
z(),
|
|
2067
|
+
rt(0, W("EventBus")),
|
|
2068
|
+
rt(1, ft("ISelectHandler"))
|
|
2069
|
+
], Ce);
|
|
2070
|
+
var _r = Object.getOwnPropertyDescriptor, mr = (e, t, r, s) => {
|
|
2071
|
+
for (var o = s > 1 ? void 0 : s ? _r(t, r) : t, n = e.length - 1, l; n >= 0; n--)
|
|
2072
|
+
(l = e[n]) && (o = l(o) || o);
|
|
2073
|
+
return o;
|
|
2074
|
+
}, gr = (e, t) => (r, s) => t(r, s, e);
|
|
2075
|
+
let Se = class {
|
|
2076
|
+
constructor(e) {
|
|
2077
|
+
this._api = e, this._wireMeshes = [], this._context = this._api.getContext(), this._wireMeshProgram = new Ht(this._context);
|
|
2078
|
+
}
|
|
2079
|
+
/** Режим отображения */
|
|
2080
|
+
mode = te.Wireframe;
|
|
2081
|
+
/** Wireframe-модели для добавленных на сцену объектов */
|
|
2082
|
+
_wireMeshes;
|
|
2083
|
+
/** Настройки рендеринга для режима wireframe */
|
|
2084
|
+
_wireMeshProgram;
|
|
2085
|
+
/** WebGl контекст */
|
|
2086
|
+
_context;
|
|
2087
|
+
/**
|
|
2088
|
+
* Применяет wireframe-режим к сцене.
|
|
2089
|
+
*/
|
|
2090
|
+
handle() {
|
|
2091
|
+
const e = this._api.getMeshes();
|
|
2092
|
+
this.createWireMeshes(e), this._api.removeMeshes(e), this._api.addMeshes(this._wireMeshes);
|
|
2093
|
+
}
|
|
2094
|
+
/**
|
|
2095
|
+
* Отменяет wireframe-режим у сцены.
|
|
2096
|
+
*/
|
|
2097
|
+
rollback() {
|
|
2098
|
+
const e = this._api.getMeshes();
|
|
2099
|
+
this._api.removeMeshes(this._wireMeshes), this._api.addMeshes(e);
|
|
2100
|
+
}
|
|
2101
|
+
/**
|
|
2102
|
+
* Освобождает ресурсы хендлера, удаляет wireframe-модели со сцены.
|
|
2103
|
+
*/
|
|
2104
|
+
destroy() {
|
|
2105
|
+
this._wireMeshes && (this._wireMeshes.length = 0, this._wireMeshes = []);
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* Создание wireframe-моделей для фигур на сцене.
|
|
2109
|
+
*/
|
|
2110
|
+
createWireMeshes(e) {
|
|
2111
|
+
for (const t of e) {
|
|
2112
|
+
const r = new Nt(this._context, {
|
|
2113
|
+
geometry: t.geometry,
|
|
2114
|
+
program: this._wireMeshProgram
|
|
2115
|
+
});
|
|
2116
|
+
this._wireMeshes.push(r);
|
|
295
2117
|
}
|
|
296
2118
|
}
|
|
2119
|
+
};
|
|
2120
|
+
Se = mr([
|
|
2121
|
+
z(),
|
|
2122
|
+
gr(0, W("RendererApi"))
|
|
2123
|
+
], Se);
|
|
2124
|
+
var wr = Object.getOwnPropertyDescriptor, Mr = (e, t, r, s) => {
|
|
2125
|
+
for (var o = s > 1 ? void 0 : s ? wr(t, r) : t, n = e.length - 1, l; n >= 0; n--)
|
|
2126
|
+
(l = e[n]) && (o = l(o) || o);
|
|
2127
|
+
return o;
|
|
2128
|
+
}, br = (e, t) => (r, s) => t(r, s, e);
|
|
2129
|
+
let xe = class {
|
|
2130
|
+
constructor(e) {
|
|
2131
|
+
this._api = e, this._program = e.getProgram(), this._selectedMesh = null;
|
|
2132
|
+
}
|
|
2133
|
+
/** Режим выборки */
|
|
2134
|
+
mode = de.Mesh;
|
|
2135
|
+
/** Текущая программа для рендеринга фигуры*/
|
|
2136
|
+
_program;
|
|
2137
|
+
/** Выбранная фигура */
|
|
2138
|
+
_selectedMesh;
|
|
2139
|
+
handle(e, t) {
|
|
2140
|
+
if (!e) return;
|
|
2141
|
+
const { mesh: r } = e;
|
|
2142
|
+
t === he.Hover ? this._api.setMeshBeforeRender(r, () => this._onHover(r)) : this._api.setMeshBeforeRender(r, () => this._onClick(r));
|
|
2143
|
+
}
|
|
2144
|
+
/** Обработчик события при наведении курсора мыши на модель */
|
|
2145
|
+
_onHover = (e) => {
|
|
2146
|
+
e.program.uniforms.uHit.value = e.isHit ? 1 : 0;
|
|
2147
|
+
};
|
|
2148
|
+
/** Обработчик события при клике на модель */
|
|
2149
|
+
_onClick = (e) => {
|
|
2150
|
+
this._selectedMesh && this._selectedMesh.program?.uniforms.uSelected && (this._selectedMesh.program.uniforms.uSelected.value = 0), this._selectedMesh = e, e.program?.uniforms.uSelected && (e.program.uniforms.uSelected.value = 1), console.log(`Selected mesh: ${e.id}`);
|
|
2151
|
+
};
|
|
2152
|
+
/** Выключение подсветки у моделей */
|
|
2153
|
+
rollback() {
|
|
2154
|
+
this._program.uniforms.uHit.value = 0;
|
|
2155
|
+
}
|
|
2156
|
+
destroy() {
|
|
2157
|
+
this.rollback();
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
xe = Mr([
|
|
2161
|
+
z(),
|
|
2162
|
+
br(0, W("RendererApi"))
|
|
2163
|
+
], xe);
|
|
2164
|
+
var Or = Object.getOwnPropertyDescriptor, Rr = (e, t, r, s) => {
|
|
2165
|
+
for (var o = s > 1 ? void 0 : s ? Or(t, r) : t, n = e.length - 1, l; n >= 0; n--)
|
|
2166
|
+
(l = e[n]) && (o = l(o) || o);
|
|
2167
|
+
return o;
|
|
2168
|
+
}, Pr = (e, t) => (r, s) => t(r, s, e);
|
|
2169
|
+
let Ie = class {
|
|
2170
|
+
constructor(e) {
|
|
2171
|
+
this._renderer = e;
|
|
2172
|
+
}
|
|
2173
|
+
addMesh(e) {
|
|
2174
|
+
this._renderer.addMesh(e);
|
|
2175
|
+
}
|
|
2176
|
+
addMeshes(e) {
|
|
2177
|
+
for (const t of e)
|
|
2178
|
+
this._renderer.addMesh(t);
|
|
2179
|
+
}
|
|
2180
|
+
removeMesh(e) {
|
|
2181
|
+
this._renderer.removeMesh(e);
|
|
2182
|
+
}
|
|
2183
|
+
removeMeshes(e) {
|
|
2184
|
+
for (const t of e)
|
|
2185
|
+
this._renderer.removeMesh(t);
|
|
2186
|
+
}
|
|
2187
|
+
getMeshes() {
|
|
2188
|
+
return this._renderer.getMeshes();
|
|
2189
|
+
}
|
|
2190
|
+
getContext() {
|
|
2191
|
+
return this._renderer.getContext();
|
|
2192
|
+
}
|
|
2193
|
+
getProgram() {
|
|
2194
|
+
return this._renderer.getProgram();
|
|
2195
|
+
}
|
|
2196
|
+
setMeshBeforeRender(e, t) {
|
|
2197
|
+
this._renderer.setMeshBeforeRender(e, t);
|
|
2198
|
+
}
|
|
2199
|
+
};
|
|
2200
|
+
Ie = Rr([
|
|
2201
|
+
z(),
|
|
2202
|
+
Pr(0, W("EditorRenderer"))
|
|
2203
|
+
], Ie);
|
|
2204
|
+
var Er = Object.getOwnPropertyDescriptor, Cr = (e, t, r, s) => {
|
|
2205
|
+
for (var o = s > 1 ? void 0 : s ? Er(t, r) : t, n = e.length - 1, l; n >= 0; n--)
|
|
2206
|
+
(l = e[n]) && (o = l(o) || o);
|
|
2207
|
+
return o;
|
|
2208
|
+
}, ge = (e, t) => (r, s) => t(r, s, e);
|
|
2209
|
+
let Le = class {
|
|
2210
|
+
constructor(e, t, r) {
|
|
2211
|
+
this._displayManager = e, this._selectManager = t, this._renderer = r, t.manage(de.Mesh);
|
|
2212
|
+
}
|
|
2213
|
+
setDisplayMode(e) {
|
|
2214
|
+
this._displayManager.manage(e);
|
|
2215
|
+
}
|
|
2216
|
+
setSelectMode(e) {
|
|
2217
|
+
this._selectManager.manage(e);
|
|
2218
|
+
}
|
|
2219
|
+
resizeRenderer() {
|
|
2220
|
+
this._renderer.resize();
|
|
2221
|
+
}
|
|
2222
|
+
updateRenderer() {
|
|
2223
|
+
this._renderer.loop();
|
|
2224
|
+
}
|
|
2225
|
+
addFigure(e) {
|
|
2226
|
+
this._renderer.addFigure(e);
|
|
2227
|
+
}
|
|
2228
|
+
destroy() {
|
|
2229
|
+
this._displayManager.destroy(), this._selectManager.destroy(), this._renderer.destroy();
|
|
2230
|
+
}
|
|
2231
|
+
};
|
|
2232
|
+
Le = Cr([
|
|
2233
|
+
z(),
|
|
2234
|
+
ge(0, W("IDisplayManager")),
|
|
2235
|
+
ge(1, W("ISelectManager")),
|
|
2236
|
+
ge(2, W("EditorRenderer"))
|
|
2237
|
+
], Le);
|
|
2238
|
+
let nt = !1;
|
|
2239
|
+
const F = ir.createChildContainer();
|
|
2240
|
+
function Sr(e) {
|
|
2241
|
+
return nt || (F.registerInstance("Canvas", e), F.registerSingleton("EventBus", Re), F.registerSingleton("EditorRenderer", Pe), F.registerSingleton("RendererApi", Ie), F.registerSingleton("IDisplayHandler", Se), F.registerSingleton("ISelectHandler", xe), F.registerSingleton("IDisplayManager", Ee), F.registerSingleton("ISelectManager", Ce), F.registerSingleton("EditorHub", Le), nt = !0), F;
|
|
2242
|
+
}
|
|
2243
|
+
function Tr(e) {
|
|
2244
|
+
return Sr(e).resolve("EditorHub");
|
|
297
2245
|
}
|
|
298
2246
|
export {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
2247
|
+
Le as EditorHub,
|
|
2248
|
+
Wt as EditorMesh,
|
|
2249
|
+
Pe as EditorRenderer,
|
|
2250
|
+
Re as EventBus,
|
|
2251
|
+
X as EventTopics,
|
|
2252
|
+
Lr as ObjLoader,
|
|
2253
|
+
Ir as PreviewRenderer,
|
|
2254
|
+
st as Renderer,
|
|
2255
|
+
Tr as createAppHub
|
|
304
2256
|
};
|