@planara/core 2.4.0 → 2.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/index.es.js CHANGED
@@ -1,30 +1,30 @@
1
1
  import "reflect-metadata";
2
- import * as l from "three";
3
- import { Controls as yt, Vector3 as c, Quaternion as O, Raycaster as Ct, Object3D as xe, MeshBasicMaterial as bt, LineBasicMaterial as It, CylinderGeometry as S, BoxGeometry as M, BufferGeometry as Be, Float32BufferAttribute as Ke, Mesh as h, OctahedronGeometry as ue, Line as N, TorusGeometry as te, SphereGeometry as jt, Euler as Rt, Matrix4 as wt, PlaneGeometry as Ht, DoubleSide as kt, MOUSE as J, TOUCH as V, Spherical as Ve, Vector2 as L, Ray as Yt, Plane as Zt, MathUtils as zt } from "three";
4
- import { FigureType as C, SelectMode as I, Figure as Xt, DisplayMode as ae, ToolType as G, SceneMode as he } from "@planara/types";
5
- import { SymmetricAxesHelper as Nt, OrbitWithState as Ft, CameraAxesGizmo as Qt } from "@planara/three";
6
- import { injectable as w, inject as u, injectAll as ve, container as Ut } from "tsyringe";
7
- import { EventEmitter as Wt } from "events";
8
- import { makeAutoObservable as $t } from "mobx";
9
- const Gt = {
10
- [C.Plane]: () => new l.PlaneGeometry(1, 1, 1, 1),
11
- [C.Cube]: () => new l.BoxGeometry(1, 1, 1, 1, 1, 1),
12
- [C.UVSphere]: () => new l.SphereGeometry(0.5, 32, 16),
13
- [C.Icosphere]: () => new l.IcosahedronGeometry(0.5, 0),
14
- [C.Cylinder]: () => new l.CylinderGeometry(0.5, 0.5, 1, 32, 1, !1),
15
- [C.Cone]: () => new l.ConeGeometry(0.5, 1, 32, 1, !1),
16
- [C.Torus]: () => new l.TorusGeometry(0.5, 0.2, 16, 64),
17
- [C.Circle]: () => new l.CircleGeometry(0.5, 32),
18
- [C.Sphere]: () => new l.SphereGeometry(0.5, 32, 16),
19
- [C.Custom]: function() {
2
+ import * as a from "three";
3
+ import { Controls as Ye, Vector3 as D, MOUSE as j, TOUCH as x, Quaternion as be, Spherical as ve, Vector2 as E, Ray as Ue, Plane as We, MathUtils as ze } from "three";
4
+ import { FigureType as P, SelectMode as v, Figure as Ze, DisplayMode as k, ToolType as C, SceneMode as V } from "@planara/types";
5
+ import { SymmetricAxesHelper as $e, OrbitWithState as Fe, CameraAxesGizmo as Be, ModelingTransformControls as Xe } from "@planara/three";
6
+ import { injectable as u, inject as h, injectAll as W, container as Ge } from "tsyringe";
7
+ import { EventEmitter as Ke } from "events";
8
+ import { makeAutoObservable as qe } from "mobx";
9
+ const Qe = {
10
+ [P.Plane]: () => new a.PlaneGeometry(1, 1, 1, 1),
11
+ [P.Cube]: () => new a.BoxGeometry(1, 1, 1, 1, 1, 1),
12
+ [P.UVSphere]: () => new a.SphereGeometry(0.5, 32, 16),
13
+ [P.Icosphere]: () => new a.IcosahedronGeometry(0.5, 0),
14
+ [P.Cylinder]: () => new a.CylinderGeometry(0.5, 0.5, 1, 32, 1, !1),
15
+ [P.Cone]: () => new a.ConeGeometry(0.5, 1, 32, 1, !1),
16
+ [P.Torus]: () => new a.TorusGeometry(0.5, 0.2, 16, 64),
17
+ [P.Circle]: () => new a.CircleGeometry(0.5, 32),
18
+ [P.Sphere]: () => new a.SphereGeometry(0.5, 32, 16),
19
+ [P.Custom]: function() {
20
20
  throw new Error("Custom geometry is not generated here.");
21
21
  }
22
- }, vt = new l.MeshStandardMaterial({
22
+ }, je = new a.MeshStandardMaterial({
23
23
  color: 12566463,
24
24
  metalness: 0,
25
25
  roughness: 0.6
26
- });
27
- class Mt {
26
+ }), Je = 8;
27
+ class Re {
28
28
  /** Корневой объект сцены */
29
29
  scene;
30
30
  /** Камера для сцены */
@@ -40,15 +40,15 @@ class Mt {
40
40
  * @param canvas - HTMLCanvasElement для рендеринга
41
41
  */
42
42
  constructor(e) {
43
- this.canvas = e, this.scene = new l.Scene(), this.scene.background = new l.Color(1710618), this.camera = new l.PerspectiveCamera(
43
+ this.canvas = e, this.scene = new a.Scene(), this.scene.background = new a.Color(1710618), this.camera = new a.PerspectiveCamera(
44
44
  45,
45
45
  e.clientWidth / e.clientHeight,
46
46
  0.1,
47
47
  1e3
48
- ), this.camera.position.set(1, 1, 7), this.renderer = new l.WebGLRenderer({ canvas: e, antialias: !0 }), this.renderer.setSize(e.clientWidth, e.clientHeight);
49
- const s = new l.AmbientLight(16777215, 0.5);
48
+ ), this.camera.position.set(1, 1, 7), this.renderer = new a.WebGLRenderer({ canvas: e, antialias: !0 }), this.renderer.setSize(e.clientWidth, e.clientHeight);
49
+ const s = new a.AmbientLight(16777215, 0.5);
50
50
  this.scene.add(s);
51
- const i = new l.DirectionalLight(16777215, 1);
51
+ const i = new a.DirectionalLight(16777215, 1);
52
52
  i.position.set(5, 10, 7), this.scene.add(i);
53
53
  }
54
54
  /**
@@ -79,9 +79,9 @@ class Mt {
79
79
  * @param figure - Данные фигуры: position, normal, uv
80
80
  */
81
81
  addFigure(e) {
82
- const s = new l.BufferGeometry();
83
- s.setAttribute("position", new l.Float32BufferAttribute(e.position, 3)), e.normal && s.setAttribute("normal", new l.Float32BufferAttribute(e.normal, 3)), e.uv && s.setAttribute("uv", new l.Float32BufferAttribute(e.uv, 2));
84
- const i = new l.Mesh(s, vt);
82
+ const s = new a.BufferGeometry();
83
+ s.setAttribute("position", new a.Float32BufferAttribute(e.position, 3)), e.normal && s.setAttribute("normal", new a.Float32BufferAttribute(e.normal, 3)), e.uv && s.setAttribute("uv", new a.Float32BufferAttribute(e.uv, 2));
84
+ const i = new a.Mesh(s, je);
85
85
  return this.scene.add(i), this.meshes.push(i), i;
86
86
  }
87
87
  /**
@@ -172,582 +172,15 @@ class Mt {
172
172
  this.meshes && (this.meshes.length = 0, this.meshes = []), this.scene = null, this.camera = null, this.renderer?.dispose(), this.canvas = null;
173
173
  }
174
174
  }
175
- const W = new Ct(), v = new c(), F = new c(), m = new O(), Je = {
176
- X: new c(1, 0, 0),
177
- Y: new c(0, 1, 0),
178
- Z: new c(0, 0, 1)
179
- }, Me = { type: "change" }, et = { type: "mouseDown", mode: null }, tt = { type: "mouseUp", mode: null }, st = { type: "objectChange" };
180
- class qt extends yt {
181
- /**
182
- * Constructs a new controls instance.
183
- *
184
- * @param {Camera} camera - The camera of the rendered scene.
185
- * @param {?HTMLElement} domElement - The HTML element used for event listeners.
186
- */
187
- constructor(e, s = null) {
188
- super(void 0, s);
189
- const i = new ts(this);
190
- this._root = i;
191
- const o = new ss();
192
- this._gizmo = o, i.add(o);
193
- const r = new is();
194
- this._plane = r, i.add(r);
195
- const n = this;
196
- function a(T, Q) {
197
- let B = Q;
198
- Object.defineProperty(n, T, {
199
- get: function() {
200
- return B !== void 0 ? B : Q;
201
- },
202
- set: function(U) {
203
- B !== U && (B = U, r[T] = U, o[T] = U, n.dispatchEvent({ type: T + "-changed", value: U }), n.dispatchEvent(Me));
204
- }
205
- }), n[T] = Q, r[T] = Q, o[T] = Q;
206
- }
207
- a("camera", e), a("object", void 0), a("enabled", !0), a("axis", null), a("mode", "translate"), a("translationSnap", null), a("rotationSnap", null), a("scaleSnap", null), a("space", "world"), a("size", 1), a("dragging", !1), a("showX", !0), a("showY", !0), a("showZ", !0), a("minX", -1 / 0), a("maxX", 1 / 0), a("minY", -1 / 0), a("maxY", 1 / 0), a("minZ", -1 / 0), a("maxZ", 1 / 0);
208
- const d = new c(), g = new c(), b = new O(), H = new O(), x = new c(), q = new O(), le = new c(), k = new c(), Y = new c(), j = 0, Z = new c();
209
- a("worldPosition", d), a("worldPositionStart", g), a("worldQuaternion", b), a("worldQuaternionStart", H), a("cameraPosition", x), a("cameraQuaternion", q), a("pointStart", le), a("pointEnd", k), a("rotationAxis", Y), a("rotationAngle", j), a("eye", Z), this._offset = new c(), this._startNorm = new c(), this._endNorm = new c(), this._cameraScale = new c(), this._parentPosition = new c(), this._parentQuaternion = new O(), this._parentQuaternionInv = new O(), this._parentScale = new c(), this._worldScaleStart = new c(), this._worldQuaternionInv = new O(), this._worldScale = new c(), this._positionStart = new c(), this._quaternionStart = new O(), this._scaleStart = new c(), this._getPointer = Bt.bind(this), this._onPointerDown = Vt.bind(this), this._onPointerHover = Kt.bind(this), this._onPointerMove = Jt.bind(this), this._onPointerUp = es.bind(this), s !== null && this.connect(s);
210
- }
211
- connect(e) {
212
- super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp), this.domElement.style.touchAction = "none";
213
- }
214
- disconnect() {
215
- this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointermove", this._onPointerHover), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.style.touchAction = "auto";
216
- }
217
- /**
218
- * Returns the visual representation of the controls. Add the helper to your scene to
219
- * visually transform the attached 3D object.
220
- *
221
- * @return {TransformControlsRoot} The helper.
222
- */
223
- getHelper() {
224
- return this._root;
225
- }
226
- pointerHover(e) {
227
- if (this.object === void 0 || this.dragging === !0) return;
228
- e !== null && W.setFromCamera(e, this.camera);
229
- const s = Pe(this._gizmo.picker[this.mode], W);
230
- s ? this.axis = s.object.name : this.axis = null;
231
- }
232
- pointerDown(e) {
233
- if (!(this.object === void 0 || this.dragging === !0 || e != null && e.button !== 0) && this.axis !== null) {
234
- e !== null && W.setFromCamera(e, this.camera);
235
- const s = Pe(this._plane, W, !0);
236
- s && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(s.point).sub(this.worldPositionStart)), this.dragging = !0, et.mode = this.mode, this.dispatchEvent(et);
237
- }
238
- }
239
- pointerMove(e) {
240
- const s = this.axis, i = this.mode, o = this.object;
241
- let r = this.space;
242
- if (i === "scale" ? r = "local" : (s === "E" || s === "XYZE" || s === "XYZ") && (r = "world"), o === void 0 || s === null || this.dragging === !1 || e !== null && e.button !== -1) return;
243
- e !== null && W.setFromCamera(e, this.camera);
244
- const n = Pe(this._plane, W, !0);
245
- if (n) {
246
- if (this.pointEnd.copy(n.point).sub(this.worldPositionStart), i === "translate")
247
- this._offset.copy(this.pointEnd).sub(this.pointStart), r === "local" && s !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), s.indexOf("X") === -1 && (this._offset.x = 0), s.indexOf("Y") === -1 && (this._offset.y = 0), s.indexOf("Z") === -1 && (this._offset.z = 0), r === "local" && s !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), o.position.copy(this._offset).add(this._positionStart), this.translationSnap && (r === "local" && (o.position.applyQuaternion(m.copy(this._quaternionStart).invert()), s.search("X") !== -1 && (o.position.x = Math.round(o.position.x / this.translationSnap) * this.translationSnap), s.search("Y") !== -1 && (o.position.y = Math.round(o.position.y / this.translationSnap) * this.translationSnap), s.search("Z") !== -1 && (o.position.z = Math.round(o.position.z / this.translationSnap) * this.translationSnap), o.position.applyQuaternion(this._quaternionStart)), r === "world" && (o.parent && o.position.add(v.setFromMatrixPosition(o.parent.matrixWorld)), s.search("X") !== -1 && (o.position.x = Math.round(o.position.x / this.translationSnap) * this.translationSnap), s.search("Y") !== -1 && (o.position.y = Math.round(o.position.y / this.translationSnap) * this.translationSnap), s.search("Z") !== -1 && (o.position.z = Math.round(o.position.z / this.translationSnap) * this.translationSnap), o.parent && o.position.sub(v.setFromMatrixPosition(o.parent.matrixWorld)))), o.position.x = Math.max(this.minX, Math.min(this.maxX, o.position.x)), o.position.y = Math.max(this.minY, Math.min(this.maxY, o.position.y)), o.position.z = Math.max(this.minZ, Math.min(this.maxZ, o.position.z));
248
- else if (i === "scale") {
249
- if (s.search("XYZ") !== -1) {
250
- let a = this.pointEnd.length() / this.pointStart.length();
251
- this.pointEnd.dot(this.pointStart) < 0 && (a *= -1), F.set(a, a, a);
252
- } else
253
- v.copy(this.pointStart), F.copy(this.pointEnd), v.applyQuaternion(this._worldQuaternionInv), F.applyQuaternion(this._worldQuaternionInv), F.divide(v), s.search("X") === -1 && (F.x = 1), s.search("Y") === -1 && (F.y = 1), s.search("Z") === -1 && (F.z = 1);
254
- o.scale.copy(this._scaleStart).multiply(F), this.scaleSnap && (s.search("X") !== -1 && (o.scale.x = Math.round(o.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), s.search("Y") !== -1 && (o.scale.y = Math.round(o.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), s.search("Z") !== -1 && (o.scale.z = Math.round(o.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
255
- } else if (i === "rotate") {
256
- this._offset.copy(this.pointEnd).sub(this.pointStart);
257
- const a = 20 / this.worldPosition.distanceTo(v.setFromMatrixPosition(this.camera.matrixWorld));
258
- let d = !1;
259
- s === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(v.copy(this.rotationAxis).cross(this.eye)) * a) : (s === "X" || s === "Y" || s === "Z") && (this.rotationAxis.copy(Je[s]), v.copy(Je[s]), r === "local" && v.applyQuaternion(this.worldQuaternion), v.cross(this.eye), v.length() === 0 ? d = !0 : this.rotationAngle = this._offset.dot(v.normalize()) * a), (s === "E" || d) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), r === "local" && s !== "E" && s !== "XYZE" ? (o.quaternion.copy(this._quaternionStart), o.quaternion.multiply(m.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), o.quaternion.copy(m.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), o.quaternion.multiply(this._quaternionStart).normalize());
260
- }
261
- this.dispatchEvent(Me), this.dispatchEvent(st);
262
- }
263
- }
264
- pointerUp(e) {
265
- e !== null && e.button !== 0 || (this.dragging && this.axis !== null && (tt.mode = this.mode, this.dispatchEvent(tt)), this.dragging = !1, this.axis = null);
266
- }
267
- dispose() {
268
- this.disconnect(), this._root.dispose();
269
- }
270
- /**
271
- * Sets the 3D object that should be transformed and ensures the controls UI is visible.
272
- *
273
- * @param {Object3D} object - The 3D object that should be transformed.
274
- * @return {TransformControls} A reference to this controls.
275
- */
276
- attach(e) {
277
- return this.object = e, this._root.visible = !0, this;
278
- }
279
- /**
280
- * Removes the current 3D object from the controls and makes the helper UI invisible.
281
- *
282
- * @return {TransformControls} A reference to this controls.
283
- */
284
- detach() {
285
- return this.object = void 0, this.axis = null, this._root.visible = !1, this;
286
- }
287
- /**
288
- * Resets the object's position, rotation and scale to when the current transform began.
289
- */
290
- reset() {
291
- this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(Me), this.dispatchEvent(st), this.pointStart.copy(this.pointEnd));
292
- }
293
- /**
294
- * Returns the raycaster that is used for user interaction. This object is shared between all
295
- * instances of `TransformControls`.
296
- *
297
- * @returns {Raycaster} The internal raycaster.
298
- */
299
- getRaycaster() {
300
- return W;
301
- }
302
- /**
303
- * Returns the transformation mode.
304
- *
305
- * @returns {'translate'|'rotate'|'scale'} The transformation mode.
306
- */
307
- getMode() {
308
- return this.mode;
309
- }
310
- /**
311
- * Sets the given transformation mode.
312
- *
313
- * @param {'translate'|'rotate'|'scale'} mode - The transformation mode to set.
314
- */
315
- setMode(e) {
316
- this.mode = e;
317
- }
318
- /**
319
- * Sets the translation snap.
320
- *
321
- * @param {?number} translationSnap - The translation snap to set.
322
- */
323
- setTranslationSnap(e) {
324
- this.translationSnap = e;
325
- }
326
- /**
327
- * Sets the rotation snap.
328
- *
329
- * @param {?number} rotationSnap - The rotation snap to set.
330
- */
331
- setRotationSnap(e) {
332
- this.rotationSnap = e;
333
- }
334
- /**
335
- * Sets the scale snap.
336
- *
337
- * @param {?number} scaleSnap - The scale snap to set.
338
- */
339
- setScaleSnap(e) {
340
- this.scaleSnap = e;
341
- }
342
- /**
343
- * Sets the size of the helper UI.
344
- *
345
- * @param {number} size - The size to set.
346
- */
347
- setSize(e) {
348
- this.size = e;
349
- }
350
- /**
351
- * Sets the coordinate space in which transformations are applied.
352
- *
353
- * @param {'world'|'local'} space - The space to set.
354
- */
355
- setSpace(e) {
356
- this.space = e;
357
- }
358
- /**
359
- * Sets the colors of the control's gizmo.
360
- *
361
- * @param {number|Color|string} xAxis - The x-axis color.
362
- * @param {number|Color|string} yAxis - The y-axis color.
363
- * @param {number|Color|string} zAxis - The z-axis color.
364
- * @param {number|Color|string} active - The color for active elements.
365
- */
366
- setColors(e, s, i, o) {
367
- const r = this._gizmo.materialLib;
368
- r.xAxis.color.set(e), r.yAxis.color.set(s), r.zAxis.color.set(i), r.active.color.set(o), r.xAxisTransparent.color.set(e), r.yAxisTransparent.color.set(s), r.zAxisTransparent.color.set(i), r.activeTransparent.color.set(o), r.xAxis._color && r.xAxis._color.set(e), r.yAxis._color && r.yAxis._color.set(s), r.zAxis._color && r.zAxis._color.set(i), r.active._color && r.active._color.set(o), r.xAxisTransparent._color && r.xAxisTransparent._color.set(e), r.yAxisTransparent._color && r.yAxisTransparent._color.set(s), r.zAxisTransparent._color && r.zAxisTransparent._color.set(i), r.activeTransparent._color && r.activeTransparent._color.set(o);
369
- }
370
- }
371
- function Bt(t) {
372
- if (this.domElement.ownerDocument.pointerLockElement)
373
- return {
374
- x: 0,
375
- y: 0,
376
- button: t.button
377
- };
378
- {
379
- const e = this.domElement.getBoundingClientRect();
380
- return {
381
- x: (t.clientX - e.left) / e.width * 2 - 1,
382
- y: -(t.clientY - e.top) / e.height * 2 + 1,
383
- button: t.button
384
- };
385
- }
386
- }
387
- function Kt(t) {
388
- if (this.enabled)
389
- switch (t.pointerType) {
390
- case "mouse":
391
- case "pen":
392
- this.pointerHover(this._getPointer(t));
393
- break;
394
- }
395
- }
396
- function Vt(t) {
397
- this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(t.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(t)), this.pointerDown(this._getPointer(t)));
398
- }
399
- function Jt(t) {
400
- this.enabled && this.pointerMove(this._getPointer(t));
401
- }
402
- function es(t) {
403
- this.enabled && (this.domElement.releasePointerCapture(t.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(t)));
404
- }
405
- function Pe(t, e, s) {
406
- const i = e.intersectObject(t, !0);
407
- for (let o = 0; o < i.length; o++)
408
- if (i[o].object.visible || s)
409
- return i[o];
410
- return !1;
411
- }
412
- const me = new Rt(), _ = new c(0, 1, 0), it = new c(0, 0, 0), ot = new wt(), fe = new O(), we = new O(), R = new c(), nt = new wt(), ne = new c(1, 0, 0), $ = new c(0, 1, 0), re = new c(0, 0, 1), ge = new c(), se = new c(), ie = new c();
413
- class ts extends xe {
414
- constructor(e) {
415
- super(), this.isTransformControlsRoot = !0, this.controls = e, this.visible = !1;
416
- }
417
- // updateMatrixWorld updates key transformation variables
418
- updateMatrixWorld(e) {
419
- const s = this.controls;
420
- s.object !== void 0 && (s.object.updateMatrixWorld(), s.object.parent === null ? console.error("TransformControls: The attached 3D object must be a part of the scene graph.") : s.object.parent.matrixWorld.decompose(s._parentPosition, s._parentQuaternion, s._parentScale), s.object.matrixWorld.decompose(s.worldPosition, s.worldQuaternion, s._worldScale), s._parentQuaternionInv.copy(s._parentQuaternion).invert(), s._worldQuaternionInv.copy(s.worldQuaternion).invert()), s.camera.updateMatrixWorld(), s.camera.matrixWorld.decompose(s.cameraPosition, s.cameraQuaternion, s._cameraScale), s.camera.isOrthographicCamera ? s.camera.getWorldDirection(s.eye).negate() : s.eye.copy(s.cameraPosition).sub(s.worldPosition).normalize(), super.updateMatrixWorld(e);
421
- }
422
- dispose() {
423
- this.traverse(function(e) {
424
- e.geometry && e.geometry.dispose(), e.material && e.material.dispose();
425
- });
426
- }
427
- }
428
- class ss extends xe {
429
- constructor() {
430
- super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
431
- const e = new bt({
432
- depthTest: !1,
433
- depthWrite: !1,
434
- fog: !1,
435
- toneMapped: !1,
436
- transparent: !0
437
- }), s = new It({
438
- depthTest: !1,
439
- depthWrite: !1,
440
- fog: !1,
441
- toneMapped: !1,
442
- transparent: !0
443
- }), i = e.clone();
444
- i.opacity = 0.15;
445
- const o = s.clone();
446
- o.opacity = 0.5;
447
- const r = e.clone();
448
- r.color.setHex(16711680);
449
- const n = e.clone();
450
- n.color.setHex(65280);
451
- const a = e.clone();
452
- a.color.setHex(255);
453
- const d = e.clone();
454
- d.color.setHex(16711680), d.opacity = 0.5;
455
- const g = e.clone();
456
- g.color.setHex(65280), g.opacity = 0.5;
457
- const b = e.clone();
458
- b.color.setHex(255), b.opacity = 0.5;
459
- const H = e.clone();
460
- H.opacity = 0.25;
461
- const x = e.clone();
462
- x.color.setHex(16776960), x.opacity = 0.25;
463
- const q = e.clone();
464
- q.color.setHex(16776960);
465
- const le = e.clone();
466
- le.color.setHex(7895160), this.materialLib = {
467
- xAxis: r,
468
- yAxis: n,
469
- zAxis: a,
470
- active: q,
471
- xAxisTransparent: d,
472
- yAxisTransparent: g,
473
- zAxisTransparent: b,
474
- activeTransparent: x
475
- };
476
- const k = new S(0, 0.04, 0.1, 12);
477
- k.translate(0, 0.05, 0);
478
- const Y = new M(0.08, 0.08, 0.08);
479
- Y.translate(0, 0.04, 0);
480
- const j = new Be();
481
- j.setAttribute("position", new Ke([0, 0, 0, 1, 0, 0], 3));
482
- const Z = new S(75e-4, 75e-4, 0.5, 3);
483
- Z.translate(0, 0.25, 0);
484
- function T(D, ce) {
485
- const A = new te(D, 75e-4, 3, 64, ce * Math.PI * 2);
486
- return A.rotateY(Math.PI / 2), A.rotateX(Math.PI / 2), A;
487
- }
488
- function Q() {
489
- const D = new Be();
490
- return D.setAttribute("position", new Ke([0, 0, 0, 1, 1, 1], 3)), D;
491
- }
492
- const B = {
493
- X: [
494
- [new h(k, r), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
495
- [new h(k, r), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
496
- [new h(Z, r), [0, 0, 0], [0, 0, -Math.PI / 2]]
497
- ],
498
- Y: [
499
- [new h(k, n), [0, 0.5, 0]],
500
- [new h(k, n), [0, -0.5, 0], [Math.PI, 0, 0]],
501
- [new h(Z, n)]
502
- ],
503
- Z: [
504
- [new h(k, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
505
- [new h(k, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
506
- [new h(Z, a), null, [Math.PI / 2, 0, 0]]
507
- ],
508
- XYZ: [
509
- [new h(new ue(0.1, 0), H), [0, 0, 0]]
510
- ],
511
- XY: [
512
- [new h(new M(0.15, 0.15, 0.01), b), [0.15, 0.15, 0]]
513
- ],
514
- YZ: [
515
- [new h(new M(0.15, 0.15, 0.01), d), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
516
- ],
517
- XZ: [
518
- [new h(new M(0.15, 0.15, 0.01), g), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
519
- ]
520
- }, U = {
521
- X: [
522
- [new h(new S(0.2, 0, 0.6, 4), i), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
523
- [new h(new S(0.2, 0, 0.6, 4), i), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
524
- ],
525
- Y: [
526
- [new h(new S(0.2, 0, 0.6, 4), i), [0, 0.3, 0]],
527
- [new h(new S(0.2, 0, 0.6, 4), i), [0, -0.3, 0], [0, 0, Math.PI]]
528
- ],
529
- Z: [
530
- [new h(new S(0.2, 0, 0.6, 4), i), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
531
- [new h(new S(0.2, 0, 0.6, 4), i), [0, 0, -0.3], [-Math.PI / 2, 0, 0]]
532
- ],
533
- XYZ: [
534
- [new h(new ue(0.2, 0), i)]
535
- ],
536
- XY: [
537
- [new h(new M(0.2, 0.2, 0.01), i), [0.15, 0.15, 0]]
538
- ],
539
- YZ: [
540
- [new h(new M(0.2, 0.2, 0.01), i), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
541
- ],
542
- XZ: [
543
- [new h(new M(0.2, 0.2, 0.01), i), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
544
- ]
545
- }, St = {
546
- START: [
547
- [new h(new ue(0.01, 2), o), null, null, null, "helper"]
548
- ],
549
- END: [
550
- [new h(new ue(0.01, 2), o), null, null, null, "helper"]
551
- ],
552
- DELTA: [
553
- [new N(Q(), o), null, null, null, "helper"]
554
- ],
555
- X: [
556
- [new N(j, o), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
557
- ],
558
- Y: [
559
- [new N(j, o), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
560
- ],
561
- Z: [
562
- [new N(j, o), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
563
- ]
564
- }, Et = {
565
- XYZE: [
566
- [new h(T(0.5, 1), le), null, [0, Math.PI / 2, 0]]
567
- ],
568
- X: [
569
- [new h(T(0.5, 0.5), r)]
570
- ],
571
- Y: [
572
- [new h(T(0.5, 0.5), n), null, [0, 0, -Math.PI / 2]]
573
- ],
574
- Z: [
575
- [new h(T(0.5, 0.5), a), null, [0, Math.PI / 2, 0]]
576
- ],
577
- E: [
578
- [new h(T(0.75, 1), x), null, [0, Math.PI / 2, 0]]
579
- ]
580
- }, xt = {
581
- AXIS: [
582
- [new N(j, o), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
583
- ]
584
- }, Tt = {
585
- XYZE: [
586
- [new h(new jt(0.25, 10, 8), i)]
587
- ],
588
- X: [
589
- [new h(new te(0.5, 0.1, 4, 24), i), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]
590
- ],
591
- Y: [
592
- [new h(new te(0.5, 0.1, 4, 24), i), [0, 0, 0], [Math.PI / 2, 0, 0]]
593
- ],
594
- Z: [
595
- [new h(new te(0.5, 0.1, 4, 24), i), [0, 0, 0], [0, 0, -Math.PI / 2]]
596
- ],
597
- E: [
598
- [new h(new te(0.75, 0.1, 2, 24), i)]
599
- ]
600
- }, Dt = {
601
- X: [
602
- [new h(Y, r), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
603
- [new h(Z, r), [0, 0, 0], [0, 0, -Math.PI / 2]],
604
- [new h(Y, r), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
605
- ],
606
- Y: [
607
- [new h(Y, n), [0, 0.5, 0]],
608
- [new h(Z, n)],
609
- [new h(Y, n), [0, -0.5, 0], [0, 0, Math.PI]]
610
- ],
611
- Z: [
612
- [new h(Y, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
613
- [new h(Z, a), [0, 0, 0], [Math.PI / 2, 0, 0]],
614
- [new h(Y, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
615
- ],
616
- XY: [
617
- [new h(new M(0.15, 0.15, 0.01), b), [0.15, 0.15, 0]]
618
- ],
619
- YZ: [
620
- [new h(new M(0.15, 0.15, 0.01), d), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
621
- ],
622
- XZ: [
623
- [new h(new M(0.15, 0.15, 0.01), g), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
624
- ],
625
- XYZ: [
626
- [new h(new M(0.1, 0.1, 0.1), H)]
627
- ]
628
- }, Ot = {
629
- X: [
630
- [new h(new S(0.2, 0, 0.6, 4), i), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
631
- [new h(new S(0.2, 0, 0.6, 4), i), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
632
- ],
633
- Y: [
634
- [new h(new S(0.2, 0, 0.6, 4), i), [0, 0.3, 0]],
635
- [new h(new S(0.2, 0, 0.6, 4), i), [0, -0.3, 0], [0, 0, Math.PI]]
636
- ],
637
- Z: [
638
- [new h(new S(0.2, 0, 0.6, 4), i), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
639
- [new h(new S(0.2, 0, 0.6, 4), i), [0, 0, -0.3], [-Math.PI / 2, 0, 0]]
640
- ],
641
- XY: [
642
- [new h(new M(0.2, 0.2, 0.01), i), [0.15, 0.15, 0]]
643
- ],
644
- YZ: [
645
- [new h(new M(0.2, 0.2, 0.01), i), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
646
- ],
647
- XZ: [
648
- [new h(new M(0.2, 0.2, 0.01), i), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
649
- ],
650
- XYZ: [
651
- [new h(new M(0.2, 0.2, 0.2), i), [0, 0, 0]]
652
- ]
653
- }, At = {
654
- X: [
655
- [new N(j, o), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
656
- ],
657
- Y: [
658
- [new N(j, o), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
659
- ],
660
- Z: [
661
- [new N(j, o), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
662
- ]
663
- };
664
- function z(D) {
665
- const ce = new xe();
666
- for (const A in D)
667
- for (let K = D[A].length; K--; ) {
668
- const P = D[A][K][0].clone(), de = D[A][K][1], pe = D[A][K][2], _e = D[A][K][3], Lt = D[A][K][4];
669
- P.name = A, P.tag = Lt, de && P.position.set(de[0], de[1], de[2]), pe && P.rotation.set(pe[0], pe[1], pe[2]), _e && P.scale.set(_e[0], _e[1], _e[2]), P.updateMatrix();
670
- const qe = P.geometry.clone();
671
- qe.applyMatrix4(P.matrix), P.geometry = qe, P.renderOrder = 1 / 0, P.position.set(0, 0, 0), P.rotation.set(0, 0, 0), P.scale.set(1, 1, 1), ce.add(P);
672
- }
673
- return ce;
674
- }
675
- this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = z(B)), this.add(this.gizmo.rotate = z(Et)), this.add(this.gizmo.scale = z(Dt)), this.add(this.picker.translate = z(U)), this.add(this.picker.rotate = z(Tt)), this.add(this.picker.scale = z(Ot)), this.add(this.helper.translate = z(St)), this.add(this.helper.rotate = z(xt)), this.add(this.helper.scale = z(At)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
676
- }
677
- // updateMatrixWorld will update transformations and appearance of individual handles
678
- updateMatrixWorld(e) {
679
- const i = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion : we;
680
- this.gizmo.translate.visible = this.mode === "translate", this.gizmo.rotate.visible = this.mode === "rotate", this.gizmo.scale.visible = this.mode === "scale", this.helper.translate.visible = this.mode === "translate", this.helper.rotate.visible = this.mode === "rotate", this.helper.scale.visible = this.mode === "scale";
681
- let o = [];
682
- o = o.concat(this.picker[this.mode].children), o = o.concat(this.gizmo[this.mode].children), o = o.concat(this.helper[this.mode].children);
683
- for (let r = 0; r < o.length; r++) {
684
- const n = o[r];
685
- n.visible = !0, n.rotation.set(0, 0, 0), n.position.copy(this.worldPosition);
686
- let a;
687
- if (this.camera.isOrthographicCamera ? a = (this.camera.top - this.camera.bottom) / this.camera.zoom : a = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), n.scale.set(1, 1, 1).multiplyScalar(a * this.size / 4), n.tag === "helper") {
688
- n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (m.setFromEuler(me.set(0, 0, 0)), n.quaternion.copy(i).multiply(m), Math.abs(_.copy(ne).applyQuaternion(i).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Y" && (m.setFromEuler(me.set(0, 0, Math.PI / 2)), n.quaternion.copy(i).multiply(m), Math.abs(_.copy($).applyQuaternion(i).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Z" && (m.setFromEuler(me.set(0, Math.PI / 2, 0)), n.quaternion.copy(i).multiply(m), Math.abs(_.copy(re).applyQuaternion(i).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "XYZE" && (m.setFromEuler(me.set(0, Math.PI / 2, 0)), _.copy(this.rotationAxis), n.quaternion.setFromRotationMatrix(ot.lookAt(it, _, $)), n.quaternion.multiply(m), n.visible = this.dragging), this.axis === "E" && (n.visible = !1)) : n.name === "START" ? (n.position.copy(this.worldPositionStart), n.visible = this.dragging) : n.name === "END" ? (n.position.copy(this.worldPosition), n.visible = this.dragging) : n.name === "DELTA" ? (n.position.copy(this.worldPositionStart), n.quaternion.copy(this.worldQuaternionStart), v.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), v.applyQuaternion(this.worldQuaternionStart.clone().invert()), n.scale.copy(v), n.visible = this.dragging) : (n.quaternion.copy(i), this.dragging ? n.position.copy(this.worldPositionStart) : n.position.copy(this.worldPosition), this.axis && (n.visible = this.axis.search(n.name) !== -1));
689
- continue;
690
- }
691
- n.quaternion.copy(i), this.mode === "translate" || this.mode === "scale" ? (n.name === "X" && Math.abs(_.copy(ne).applyQuaternion(i).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Y" && Math.abs(_.copy($).applyQuaternion(i).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Z" && Math.abs(_.copy(re).applyQuaternion(i).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XY" && Math.abs(_.copy(re).applyQuaternion(i).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "YZ" && Math.abs(_.copy(ne).applyQuaternion(i).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XZ" && Math.abs(_.copy($).applyQuaternion(i).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1)) : this.mode === "rotate" && (fe.copy(i), _.copy(this.eye).applyQuaternion(m.copy(i).invert()), n.name.search("E") !== -1 && n.quaternion.setFromRotationMatrix(ot.lookAt(this.eye, it, $)), n.name === "X" && (m.setFromAxisAngle(ne, Math.atan2(-_.y, _.z)), m.multiplyQuaternions(fe, m), n.quaternion.copy(m)), n.name === "Y" && (m.setFromAxisAngle($, Math.atan2(_.x, _.z)), m.multiplyQuaternions(fe, m), n.quaternion.copy(m)), n.name === "Z" && (m.setFromAxisAngle(re, Math.atan2(_.y, _.x)), m.multiplyQuaternions(fe, m), n.quaternion.copy(m))), n.visible = n.visible && (n.name.indexOf("X") === -1 || this.showX), n.visible = n.visible && (n.name.indexOf("Y") === -1 || this.showY), n.visible = n.visible && (n.name.indexOf("Z") === -1 || this.showZ), n.visible = n.visible && (n.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), n.material._color = n.material._color || n.material.color.clone(), n.material._opacity = n.material._opacity || n.material.opacity, n.material.color.copy(n.material._color), n.material.opacity = n.material._opacity, this.enabled && this.axis && (n.name === this.axis ? (n.material.color.copy(this.materialLib.active.color), n.material.opacity = 1) : this.axis.split("").some(function(d) {
692
- return n.name === d;
693
- }) && (n.material.color.copy(this.materialLib.active.color), n.material.opacity = 1));
694
- }
695
- super.updateMatrixWorld(e);
696
- }
697
- }
698
- class is extends h {
699
- constructor() {
700
- super(
701
- new Ht(1e5, 1e5, 2, 2),
702
- new bt({ visible: !1, wireframe: !0, side: kt, transparent: !0, opacity: 0.1, toneMapped: !1 })
703
- ), this.isTransformControlsPlane = !0, this.type = "TransformControlsPlane";
704
- }
705
- updateMatrixWorld(e) {
706
- let s = this.space;
707
- switch (this.position.copy(this.worldPosition), this.mode === "scale" && (s = "local"), ge.copy(ne).applyQuaternion(s === "local" ? this.worldQuaternion : we), se.copy($).applyQuaternion(s === "local" ? this.worldQuaternion : we), ie.copy(re).applyQuaternion(s === "local" ? this.worldQuaternion : we), _.copy(se), this.mode) {
708
- case "translate":
709
- case "scale":
710
- switch (this.axis) {
711
- case "X":
712
- _.copy(this.eye).cross(ge), R.copy(ge).cross(_);
713
- break;
714
- case "Y":
715
- _.copy(this.eye).cross(se), R.copy(se).cross(_);
716
- break;
717
- case "Z":
718
- _.copy(this.eye).cross(ie), R.copy(ie).cross(_);
719
- break;
720
- case "XY":
721
- R.copy(ie);
722
- break;
723
- case "YZ":
724
- R.copy(ge);
725
- break;
726
- case "XZ":
727
- _.copy(ie), R.copy(se);
728
- break;
729
- case "XYZ":
730
- case "E":
731
- R.set(0, 0, 0);
732
- break;
733
- }
734
- break;
735
- case "rotate":
736
- default:
737
- R.set(0, 0, 0);
738
- }
739
- R.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (nt.lookAt(v.set(0, 0, 0), R, _), this.quaternion.setFromRotationMatrix(nt)), super.updateMatrixWorld(e);
740
- }
741
- }
742
- var os = Object.getOwnPropertyDescriptor, ns = (t, e, s, i) => {
743
- for (var o = i > 1 ? void 0 : i ? os(e, s) : e, r = t.length - 1, n; r >= 0; r--)
744
- (n = t[r]) && (o = n(o) || o);
745
- return o;
175
+ var et = Object.getOwnPropertyDescriptor, tt = (t, e, s, i) => {
176
+ for (var r = i > 1 ? void 0 : i ? et(e, s) : e, o = t.length - 1, n; o >= 0; o--)
177
+ (n = t[o]) && (r = n(r) || r);
178
+ return r;
746
179
  };
747
- let Te = class {
180
+ let X = class {
748
181
  _emitter;
749
182
  constructor() {
750
- this._emitter = new Wt();
183
+ this._emitter = new Ke();
751
184
  }
752
185
  /** Публикация события */
753
186
  emit(t, e) {
@@ -762,28 +195,54 @@ let Te = class {
762
195
  this._emitter.off(t, e);
763
196
  }
764
197
  };
765
- Te = ns([
766
- w()
767
- ], Te);
768
- var ee = /* @__PURE__ */ ((t) => (t.SelectHover = "select.hover", t.SelectClick = "select.click", t.ToolSelect = "tool.select", t))(ee || {});
769
- const rs = 0.03, as = 10;
770
- var hs = Object.getOwnPropertyDescriptor, ls = (t, e, s, i) => {
771
- for (var o = i > 1 ? void 0 : i ? hs(e, s) : e, r = t.length - 1, n; r >= 0; r--)
772
- (n = t[r]) && (o = n(o) || o);
773
- return o;
774
- }, rt = (t, e) => (s, i) => e(s, i, t);
775
- let De = class extends Mt {
198
+ X = tt([
199
+ u()
200
+ ], X);
201
+ var R = /* @__PURE__ */ ((t) => (t.SelectHover = "select.hover", t.SelectClick = "select.click", t.ToolSelect = "tool.select", t))(R || {});
202
+ const st = 0.03, it = 0.05, Ie = 0, rt = 1, ot = 2, L = 31, z = 16776960, Z = 16755200, nt = 2236962, at = 2236962, ht = (t) => !!t && t.isMesh, He = (t) => {
203
+ let e = t;
204
+ for (; e; ) {
205
+ if (e.isMesh) return e;
206
+ e = e.parent;
207
+ }
208
+ return null;
209
+ }, ke = (t) => {
210
+ const e = new a.BufferGeometry();
211
+ e.setAttribute("position", t.getAttribute("position")), e.computeBoundingSphere(), e.computeBoundingBox();
212
+ const s = new a.PointsMaterial({
213
+ color: at,
214
+ size: 6,
215
+ sizeAttenuation: !1,
216
+ depthTest: !1,
217
+ depthWrite: !1,
218
+ transparent: !0,
219
+ opacity: 0.9
220
+ }), i = new a.Points(e, s);
221
+ return i.layers.set(ot), i.renderOrder = 1e3, i.visible = !1, i;
222
+ }, Ve = (t) => {
223
+ const e = new a.EdgesGeometry(t), s = new a.LineSegments(
224
+ e,
225
+ new a.LineBasicMaterial({ color: nt, linewidth: 1 })
226
+ );
227
+ return s.layers.set(rt), s;
228
+ };
229
+ var lt = Object.getOwnPropertyDescriptor, ct = (t, e, s, i) => {
230
+ for (var r = i > 1 ? void 0 : i ? lt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
231
+ (n = t[o]) && (r = n(r) || r);
232
+ return r;
233
+ }, ye = (t, e) => (s, i) => e(s, i, t);
234
+ let G = class extends Re {
776
235
  constructor(t, e) {
777
236
  super(t), this._canvas = t, this._bus = e;
778
- const s = new l.GridHelper(10, 10);
237
+ const s = new a.GridHelper(10, 10);
779
238
  s.position.y = -1e-3, this.scene.add(s);
780
- const i = new Nt(6);
781
- this.scene.add(i), this._orbit = new Ft(this.camera, this.renderer.domElement), this._orbit.enableDamping = !0, this._orbit.dampingFactor = 0.05, this._cameraGizmo = new Qt(this.renderer, this.camera, {
239
+ const i = new $e(6);
240
+ this.scene.add(i), this._orbit = new Fe(this.camera, this.renderer.domElement), this._orbit.enableDamping = !0, this._orbit.dampingFactor = 0.05, this._cameraGizmo = new Be(this.renderer, this.camera, {
782
241
  size: 96,
783
242
  // Размер квадрата
784
243
  margin: 36
785
244
  // Отступы по сторонам (снизу и справа)
786
- }), this._raycaster = new l.Raycaster(), this._mouse = new l.Vector2(), this.scene.add(new l.HemisphereLight(16777215, 4473924, 0.6)), this.camera.layers.enable(0), this.camera.layers.enable(1), this._transform = new qt(this.camera, this.renderer.domElement), this._transformHelper = this._transform.getHelper(), this.scene.add(this._transformHelper), this._isEventListenersAdded || this._initMouseListeners();
245
+ }), this._raycaster = new a.Raycaster(), this._mouse = new a.Vector2(), this.scene.add(new a.HemisphereLight(16777215, 4473924, 0.6)), this.camera.layers.enable(0), this.camera.layers.enable(1), this._transform = new Xe(this.camera, this.renderer.domElement), this._transformHelper = this._transform.getHelper(), this.scene.add(this._transformHelper), this._isEventListenersAdded || this._initMouseListeners();
787
246
  }
788
247
  /** Orbit-контроллер для управления камерой */
789
248
  _orbit;
@@ -812,12 +271,11 @@ let De = class extends Mt {
812
271
  /** Добавление фигуры на сцену */
813
272
  addFigure(t) {
814
273
  const e = super.addFigure(t);
815
- e.layers.enable(0);
816
- const s = new l.EdgesGeometry(e.geometry), i = new l.LineSegments(
817
- s,
818
- new l.LineBasicMaterial({ color: 8947848, linewidth: 1 })
819
- );
820
- return i.layers.set(1), e.add(i), e;
274
+ e.layers.enable(Ie);
275
+ const s = Ve(e.geometry);
276
+ e.add(s);
277
+ const i = ke(e.geometry);
278
+ return e.add(i), e;
821
279
  }
822
280
  /**
823
281
  * Смена отображения `TransformControls` в зависимости от типа инструмента.
@@ -849,15 +307,15 @@ let De = class extends Mt {
849
307
  setRaycastMode(t) {
850
308
  const e = this._raycaster;
851
309
  switch (e.params.Line.threshold = 0, e.params.Points.threshold = 0, t) {
852
- case I.Mesh:
853
- case I.Face:
310
+ case v.Mesh:
311
+ case v.Face:
854
312
  e.layers.set(0);
855
313
  break;
856
- case I.Edge:
857
- e.layers.set(1), e.params.Line.threshold = rs;
314
+ case v.Edge:
315
+ e.layers.set(1), e.params.Line.threshold = st;
858
316
  break;
859
- case I.Vertex:
860
- e.layers.set(2), e.params.Points.threshold = as;
317
+ case v.Vertex:
318
+ e.layers.set(2), e.params.Points.threshold = it;
861
319
  break;
862
320
  }
863
321
  }
@@ -877,27 +335,27 @@ let De = class extends Mt {
877
335
  }
878
336
  /** Обработчик события для hover */
879
337
  _handleMouseMove = (t) => {
880
- this._processRaycastEvent(t, ee.SelectHover, !0);
338
+ this._processRaycastEvent(t, R.SelectHover, !0);
881
339
  };
882
340
  /** Обработчик события на click */
883
341
  _handleMouseClick = (t) => {
884
- this._processRaycastEvent(t, ee.SelectClick, !1);
342
+ this._processRaycastEvent(t, R.SelectClick, !1);
885
343
  };
886
344
  /** Вспомогательный метод для получения модели, которую выбрали и отправки события в event bus */
887
345
  _processRaycastEvent(t, e, s) {
888
346
  if (this._orbit.isInteracting || this._transform.dragging) return;
889
347
  const i = this._canvas.getBoundingClientRect();
890
348
  this._mouse.x = (t.clientX - i.left) / i.width * 2 - 1, this._mouse.y = -((t.clientY - i.top) / i.height) * 2 + 1, this._raycaster.setFromCamera(this._mouse, this.camera);
891
- const r = this._raycaster.intersectObjects(this.meshes, !0)[0] ?? null, n = r?.object ?? null;
892
- s ? n !== this._lastHovered && (this.meshes.forEach((a) => a.userData.isHit = !1), n && (n.userData.isHit = !0), this._lastHovered = n, this._bus.emit(e, r ? { intersection: r } : null)) : this._bus.emit(e, r ? { intersection: r } : null);
349
+ const o = this._raycaster.intersectObjects(this.meshes, !0)[0] ?? null, n = o?.object ?? null;
350
+ s ? n !== this._lastHovered && (this.meshes.forEach((c) => c.userData.isHit = !1), n && (n.userData.isHit = !0), this._lastHovered = n, this._bus.emit(e, o ? { intersection: o } : null)) : this._bus.emit(e, o ? { intersection: o } : null);
893
351
  }
894
352
  };
895
- De = ls([
896
- w(),
897
- rt(0, u("Canvas")),
898
- rt(1, u("EventBus"))
899
- ], De);
900
- const at = { type: "change" }, Ue = { type: "start" }, Pt = { type: "end" }, ye = new Yt(), ht = new Zt(), cs = Math.cos(70 * zt.DEG2RAD), y = new c(), E = 2 * Math.PI, p = {
353
+ G = ct([
354
+ u(),
355
+ ye(0, h("Canvas")),
356
+ ye(1, h("EventBus"))
357
+ ], G);
358
+ const Me = { type: "change" }, pe = { type: "start" }, Ne = { type: "end" }, U = new Ue(), we = new We(), dt = Math.cos(70 * ze.DEG2RAD), p = new D(), g = 2 * Math.PI, l = {
901
359
  NONE: -1,
902
360
  ROTATE: 0,
903
361
  DOLLY: 1,
@@ -906,8 +364,8 @@ const at = { type: "change" }, Ue = { type: "start" }, Pt = { type: "end" }, ye
906
364
  TOUCH_PAN: 4,
907
365
  TOUCH_DOLLY_PAN: 5,
908
366
  TOUCH_DOLLY_ROTATE: 6
909
- }, Se = 1e-6;
910
- class ds extends yt {
367
+ }, F = 1e-6;
368
+ class _t extends Ye {
911
369
  /**
912
370
  * Constructs a new controls instance.
913
371
  *
@@ -915,7 +373,7 @@ class ds extends yt {
915
373
  * @param {?HTMLElement} domElement - The HTML element used for event listeners.
916
374
  */
917
375
  constructor(e, s = null) {
918
- super(e, s), this.state = p.NONE, this.target = new c(), this.cursor = new c(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: J.ROTATE, MIDDLE: J.DOLLY, RIGHT: J.PAN }, this.touches = { ONE: V.ROTATE, TWO: V.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new c(), this._lastQuaternion = new O(), this._lastTargetPosition = new c(), this._quat = new O().setFromUnitVectors(e.up, new c(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Ve(), this._sphericalDelta = new Ve(), this._scale = 1, this._panOffset = new c(), this._rotateStart = new L(), this._rotateEnd = new L(), this._rotateDelta = new L(), this._panStart = new L(), this._panEnd = new L(), this._panDelta = new L(), this._dollyStart = new L(), this._dollyEnd = new L(), this._dollyDelta = new L(), this._dollyDirection = new c(), this._mouse = new L(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = _s.bind(this), this._onPointerDown = ps.bind(this), this._onPointerUp = us.bind(this), this._onContextMenu = vs.bind(this), this._onMouseWheel = gs.bind(this), this._onKeyDown = ys.bind(this), this._onTouchStart = bs.bind(this), this._onTouchMove = ws.bind(this), this._onMouseDown = ms.bind(this), this._onMouseMove = fs.bind(this), this._interceptControlDown = Ms.bind(this), this._interceptControlUp = Ps.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
376
+ super(e, s), this.state = l.NONE, this.target = new D(), this.cursor = new D(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: j.ROTATE, MIDDLE: j.DOLLY, RIGHT: j.PAN }, this.touches = { ONE: x.ROTATE, TWO: x.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new D(), this._lastQuaternion = new be(), this._lastTargetPosition = new D(), this._quat = new be().setFromUnitVectors(e.up, new D(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ve(), this._sphericalDelta = new ve(), this._scale = 1, this._panOffset = new D(), this._rotateStart = new E(), this._rotateEnd = new E(), this._rotateDelta = new E(), this._panStart = new E(), this._panEnd = new E(), this._panDelta = new E(), this._dollyStart = new E(), this._dollyEnd = new E(), this._dollyDelta = new E(), this._dollyDirection = new D(), this._mouse = new E(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = ut.bind(this), this._onPointerDown = pt.bind(this), this._onPointerUp = mt.bind(this), this._onContextMenu = wt.bind(this), this._onMouseWheel = bt.bind(this), this._onKeyDown = vt.bind(this), this._onTouchStart = yt.bind(this), this._onTouchMove = Mt.bind(this), this._onMouseDown = ft.bind(this), this._onMouseMove = gt.bind(this), this._interceptControlDown = Et.bind(this), this._interceptControlUp = Pt.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
919
377
  }
920
378
  connect(e) {
921
379
  super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
@@ -976,45 +434,45 @@ class ds extends yt {
976
434
  * was called, or the initial state.
977
435
  */
978
436
  reset() {
979
- this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(at), this.update(), this.state = p.NONE;
437
+ this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Me), this.update(), this.state = l.NONE;
980
438
  }
981
439
  update(e = null) {
982
440
  const s = this.object.position;
983
- y.copy(s).sub(this.target), y.applyQuaternion(this._quat), this._spherical.setFromVector3(y), this.autoRotate && this.state === p.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
984
- let i = this.minAzimuthAngle, o = this.maxAzimuthAngle;
985
- isFinite(i) && isFinite(o) && (i < -Math.PI ? i += E : i > Math.PI && (i -= E), o < -Math.PI ? o += E : o > Math.PI && (o -= E), i <= o ? this._spherical.theta = Math.max(i, Math.min(o, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (i + o) / 2 ? Math.max(i, this._spherical.theta) : Math.min(o, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
986
- let r = !1;
441
+ p.copy(s).sub(this.target), p.applyQuaternion(this._quat), this._spherical.setFromVector3(p), this.autoRotate && this.state === l.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
442
+ let i = this.minAzimuthAngle, r = this.maxAzimuthAngle;
443
+ isFinite(i) && isFinite(r) && (i < -Math.PI ? i += g : i > Math.PI && (i -= g), r < -Math.PI ? r += g : r > Math.PI && (r -= g), i <= r ? this._spherical.theta = Math.max(i, Math.min(r, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (i + r) / 2 ? Math.max(i, this._spherical.theta) : Math.min(r, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
444
+ let o = !1;
987
445
  if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
988
446
  this._spherical.radius = this._clampDistance(this._spherical.radius);
989
447
  else {
990
448
  const n = this._spherical.radius;
991
- this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), r = n != this._spherical.radius;
449
+ this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), o = n != this._spherical.radius;
992
450
  }
993
- if (y.setFromSpherical(this._spherical), y.applyQuaternion(this._quatInverse), s.copy(this.target).add(y), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
451
+ if (p.setFromSpherical(this._spherical), p.applyQuaternion(this._quatInverse), s.copy(this.target).add(p), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
994
452
  let n = null;
995
453
  if (this.object.isPerspectiveCamera) {
996
- const a = y.length();
997
- n = this._clampDistance(a * this._scale);
998
- const d = a - n;
999
- this.object.position.addScaledVector(this._dollyDirection, d), this.object.updateMatrixWorld(), r = !!d;
454
+ const c = p.length();
455
+ n = this._clampDistance(c * this._scale);
456
+ const _ = c - n;
457
+ this.object.position.addScaledVector(this._dollyDirection, _), this.object.updateMatrixWorld(), o = !!_;
1000
458
  } else if (this.object.isOrthographicCamera) {
1001
- const a = new c(this._mouse.x, this._mouse.y, 0);
1002
- a.unproject(this.object);
1003
- const d = this.object.zoom;
1004
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), r = d !== this.object.zoom;
1005
- const g = new c(this._mouse.x, this._mouse.y, 0);
1006
- g.unproject(this.object), this.object.position.sub(g).add(a), this.object.updateMatrixWorld(), n = y.length();
459
+ const c = new D(this._mouse.x, this._mouse.y, 0);
460
+ c.unproject(this.object);
461
+ const _ = this.object.zoom;
462
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), o = _ !== this.object.zoom;
463
+ const m = new D(this._mouse.x, this._mouse.y, 0);
464
+ m.unproject(this.object), this.object.position.sub(m).add(c), this.object.updateMatrixWorld(), n = p.length();
1007
465
  } else
1008
466
  console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
1009
- n !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(n).add(this.object.position) : (ye.origin.copy(this.object.position), ye.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(ye.direction)) < cs ? this.object.lookAt(this.target) : (ht.setFromNormalAndCoplanarPoint(this.object.up, this.target), ye.intersectPlane(ht, this.target))));
467
+ n !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(n).add(this.object.position) : (U.origin.copy(this.object.position), U.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(U.direction)) < dt ? this.object.lookAt(this.target) : (we.setFromNormalAndCoplanarPoint(this.object.up, this.target), U.intersectPlane(we, this.target))));
1010
468
  } else if (this.object.isOrthographicCamera) {
1011
469
  const n = this.object.zoom;
1012
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), n !== this.object.zoom && (this.object.updateProjectionMatrix(), r = !0);
470
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), n !== this.object.zoom && (this.object.updateProjectionMatrix(), o = !0);
1013
471
  }
1014
- return this._scale = 1, this._performCursorZoom = !1, r || this._lastPosition.distanceToSquared(this.object.position) > Se || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Se || this._lastTargetPosition.distanceToSquared(this.target) > Se ? (this.dispatchEvent(at), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
472
+ return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) > F || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > F || this._lastTargetPosition.distanceToSquared(this.target) > F ? (this.dispatchEvent(Me), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
1015
473
  }
1016
474
  _getAutoRotationAngle(e) {
1017
- return e !== null ? E / 60 * this.autoRotateSpeed * e : E / 60 / 60 * this.autoRotateSpeed;
475
+ return e !== null ? g / 60 * this.autoRotateSpeed * e : g / 60 / 60 * this.autoRotateSpeed;
1018
476
  }
1019
477
  _getZoomScale(e) {
1020
478
  const s = Math.abs(e * 0.01);
@@ -1027,19 +485,19 @@ class ds extends yt {
1027
485
  this._sphericalDelta.phi -= e;
1028
486
  }
1029
487
  _panLeft(e, s) {
1030
- y.setFromMatrixColumn(s, 0), y.multiplyScalar(-e), this._panOffset.add(y);
488
+ p.setFromMatrixColumn(s, 0), p.multiplyScalar(-e), this._panOffset.add(p);
1031
489
  }
1032
490
  _panUp(e, s) {
1033
- this.screenSpacePanning === !0 ? y.setFromMatrixColumn(s, 1) : (y.setFromMatrixColumn(s, 0), y.crossVectors(this.object.up, y)), y.multiplyScalar(e), this._panOffset.add(y);
491
+ this.screenSpacePanning === !0 ? p.setFromMatrixColumn(s, 1) : (p.setFromMatrixColumn(s, 0), p.crossVectors(this.object.up, p)), p.multiplyScalar(e), this._panOffset.add(p);
1034
492
  }
1035
493
  // deltaX and deltaY are in pixels; right and down are positive
1036
494
  _pan(e, s) {
1037
495
  const i = this.domElement;
1038
496
  if (this.object.isPerspectiveCamera) {
1039
- const o = this.object.position;
1040
- y.copy(o).sub(this.target);
1041
- let r = y.length();
1042
- r *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * r / i.clientHeight, this.object.matrix), this._panUp(2 * s * r / i.clientHeight, this.object.matrix);
497
+ const r = this.object.position;
498
+ p.copy(r).sub(this.target);
499
+ let o = p.length();
500
+ o *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * o / i.clientHeight, this.object.matrix), this._panUp(2 * s * o / i.clientHeight, this.object.matrix);
1043
501
  } else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / i.clientWidth, this.object.matrix), this._panUp(s * (this.object.top - this.object.bottom) / this.object.zoom / i.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
1044
502
  }
1045
503
  _dollyOut(e) {
@@ -1052,8 +510,8 @@ class ds extends yt {
1052
510
  if (!this.zoomToCursor)
1053
511
  return;
1054
512
  this._performCursorZoom = !0;
1055
- const i = this.domElement.getBoundingClientRect(), o = e - i.left, r = s - i.top, n = i.width, a = i.height;
1056
- this._mouse.x = o / n * 2 - 1, this._mouse.y = -(r / a) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
513
+ const i = this.domElement.getBoundingClientRect(), r = e - i.left, o = s - i.top, n = i.width, c = i.height;
514
+ this._mouse.x = r / n * 2 - 1, this._mouse.y = -(o / c) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
1057
515
  }
1058
516
  _clampDistance(e) {
1059
517
  return Math.max(this.minDistance, Math.min(this.maxDistance, e));
@@ -1073,7 +531,7 @@ class ds extends yt {
1073
531
  _handleMouseMoveRotate(e) {
1074
532
  this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
1075
533
  const s = this.domElement;
1076
- this._rotateLeft(E * this._rotateDelta.x / s.clientHeight), this._rotateUp(E * this._rotateDelta.y / s.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
534
+ this._rotateLeft(g * this._rotateDelta.x / s.clientHeight), this._rotateUp(g * this._rotateDelta.y / s.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
1077
535
  }
1078
536
  _handleMouseMoveDolly(e) {
1079
537
  this._dollyEnd.set(e.clientX, e.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
@@ -1088,16 +546,16 @@ class ds extends yt {
1088
546
  let s = !1;
1089
547
  switch (e.code) {
1090
548
  case this.keys.UP:
1091
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(E * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), s = !0;
549
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(g * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), s = !0;
1092
550
  break;
1093
551
  case this.keys.BOTTOM:
1094
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-E * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), s = !0;
552
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-g * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), s = !0;
1095
553
  break;
1096
554
  case this.keys.LEFT:
1097
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(E * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), s = !0;
555
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(g * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), s = !0;
1098
556
  break;
1099
557
  case this.keys.RIGHT:
1100
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-E * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), s = !0;
558
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-g * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), s = !0;
1101
559
  break;
1102
560
  }
1103
561
  s && (e.preventDefault(), this.update());
@@ -1106,21 +564,21 @@ class ds extends yt {
1106
564
  if (this._pointers.length === 1)
1107
565
  this._rotateStart.set(e.pageX, e.pageY);
1108
566
  else {
1109
- const s = this._getSecondPointerPosition(e), i = 0.5 * (e.pageX + s.x), o = 0.5 * (e.pageY + s.y);
1110
- this._rotateStart.set(i, o);
567
+ const s = this._getSecondPointerPosition(e), i = 0.5 * (e.pageX + s.x), r = 0.5 * (e.pageY + s.y);
568
+ this._rotateStart.set(i, r);
1111
569
  }
1112
570
  }
1113
571
  _handleTouchStartPan(e) {
1114
572
  if (this._pointers.length === 1)
1115
573
  this._panStart.set(e.pageX, e.pageY);
1116
574
  else {
1117
- const s = this._getSecondPointerPosition(e), i = 0.5 * (e.pageX + s.x), o = 0.5 * (e.pageY + s.y);
1118
- this._panStart.set(i, o);
575
+ const s = this._getSecondPointerPosition(e), i = 0.5 * (e.pageX + s.x), r = 0.5 * (e.pageY + s.y);
576
+ this._panStart.set(i, r);
1119
577
  }
1120
578
  }
1121
579
  _handleTouchStartDolly(e) {
1122
- const s = this._getSecondPointerPosition(e), i = e.pageX - s.x, o = e.pageY - s.y, r = Math.sqrt(i * i + o * o);
1123
- this._dollyStart.set(0, r);
580
+ const s = this._getSecondPointerPosition(e), i = e.pageX - s.x, r = e.pageY - s.y, o = Math.sqrt(i * i + r * r);
581
+ this._dollyStart.set(0, o);
1124
582
  }
1125
583
  _handleTouchStartDollyPan(e) {
1126
584
  this.enableZoom && this._handleTouchStartDolly(e), this.enablePan && this._handleTouchStartPan(e);
@@ -1132,27 +590,27 @@ class ds extends yt {
1132
590
  if (this._pointers.length == 1)
1133
591
  this._rotateEnd.set(e.pageX, e.pageY);
1134
592
  else {
1135
- const i = this._getSecondPointerPosition(e), o = 0.5 * (e.pageX + i.x), r = 0.5 * (e.pageY + i.y);
1136
- this._rotateEnd.set(o, r);
593
+ const i = this._getSecondPointerPosition(e), r = 0.5 * (e.pageX + i.x), o = 0.5 * (e.pageY + i.y);
594
+ this._rotateEnd.set(r, o);
1137
595
  }
1138
596
  this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
1139
597
  const s = this.domElement;
1140
- this._rotateLeft(E * this._rotateDelta.x / s.clientHeight), this._rotateUp(E * this._rotateDelta.y / s.clientHeight), this._rotateStart.copy(this._rotateEnd);
598
+ this._rotateLeft(g * this._rotateDelta.x / s.clientHeight), this._rotateUp(g * this._rotateDelta.y / s.clientHeight), this._rotateStart.copy(this._rotateEnd);
1141
599
  }
1142
600
  _handleTouchMovePan(e) {
1143
601
  if (this._pointers.length === 1)
1144
602
  this._panEnd.set(e.pageX, e.pageY);
1145
603
  else {
1146
- const s = this._getSecondPointerPosition(e), i = 0.5 * (e.pageX + s.x), o = 0.5 * (e.pageY + s.y);
1147
- this._panEnd.set(i, o);
604
+ const s = this._getSecondPointerPosition(e), i = 0.5 * (e.pageX + s.x), r = 0.5 * (e.pageY + s.y);
605
+ this._panEnd.set(i, r);
1148
606
  }
1149
607
  this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
1150
608
  }
1151
609
  _handleTouchMoveDolly(e) {
1152
- const s = this._getSecondPointerPosition(e), i = e.pageX - s.x, o = e.pageY - s.y, r = Math.sqrt(i * i + o * o);
1153
- this._dollyEnd.set(0, r), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
1154
- const n = (e.pageX + s.x) * 0.5, a = (e.pageY + s.y) * 0.5;
1155
- this._updateZoomParameters(n, a);
610
+ const s = this._getSecondPointerPosition(e), i = e.pageX - s.x, r = e.pageY - s.y, o = Math.sqrt(i * i + r * r);
611
+ this._dollyEnd.set(0, o), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
612
+ const n = (e.pageX + s.x) * 0.5, c = (e.pageY + s.y) * 0.5;
613
+ this._updateZoomParameters(n, c);
1156
614
  }
1157
615
  _handleTouchMoveDollyPan(e) {
1158
616
  this.enableZoom && this._handleTouchMoveDolly(e), this.enablePan && this._handleTouchMovePan(e);
@@ -1179,7 +637,7 @@ class ds extends yt {
1179
637
  }
1180
638
  _trackPointer(e) {
1181
639
  let s = this._pointerPositions[e.pointerId];
1182
- s === void 0 && (s = new L(), this._pointerPositions[e.pointerId] = s), s.set(e.pageX, e.pageY);
640
+ s === void 0 && (s = new E(), this._pointerPositions[e.pointerId] = s), s.set(e.pageX, e.pageY);
1183
641
  }
1184
642
  _getSecondPointerPosition(e) {
1185
643
  const s = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
@@ -1203,16 +661,16 @@ class ds extends yt {
1203
661
  return e.ctrlKey && !this._controlActive && (i.deltaY *= 10), i;
1204
662
  }
1205
663
  }
1206
- function ps(t) {
664
+ function pt(t) {
1207
665
  this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(t.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(t) && (this._addPointer(t), t.pointerType === "touch" ? this._onTouchStart(t) : this._onMouseDown(t)));
1208
666
  }
1209
- function _s(t) {
667
+ function ut(t) {
1210
668
  this.enabled !== !1 && (t.pointerType === "touch" ? this._onTouchMove(t) : this._onMouseMove(t));
1211
669
  }
1212
- function us(t) {
670
+ function mt(t) {
1213
671
  switch (this._removePointer(t), this._pointers.length) {
1214
672
  case 0:
1215
- this.domElement.releasePointerCapture(t.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(Pt), this.state = p.NONE;
673
+ this.domElement.releasePointerCapture(t.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(Ne), this.state = l.NONE;
1216
674
  break;
1217
675
  case 1:
1218
676
  const e = this._pointers[0], s = this._pointerPositions[e];
@@ -1220,7 +678,7 @@ function us(t) {
1220
678
  break;
1221
679
  }
1222
680
  }
1223
- function ms(t) {
681
+ function ft(t) {
1224
682
  let e;
1225
683
  switch (t.button) {
1226
684
  case 0:
@@ -1236,126 +694,126 @@ function ms(t) {
1236
694
  e = -1;
1237
695
  }
1238
696
  switch (e) {
1239
- case J.DOLLY:
697
+ case j.DOLLY:
1240
698
  if (this.enableZoom === !1) return;
1241
- this._handleMouseDownDolly(t), this.state = p.DOLLY;
699
+ this._handleMouseDownDolly(t), this.state = l.DOLLY;
1242
700
  break;
1243
- case J.ROTATE:
701
+ case j.ROTATE:
1244
702
  if (t.ctrlKey || t.metaKey || t.shiftKey) {
1245
703
  if (this.enablePan === !1) return;
1246
- this._handleMouseDownPan(t), this.state = p.PAN;
704
+ this._handleMouseDownPan(t), this.state = l.PAN;
1247
705
  } else {
1248
706
  if (this.enableRotate === !1) return;
1249
- this._handleMouseDownRotate(t), this.state = p.ROTATE;
707
+ this._handleMouseDownRotate(t), this.state = l.ROTATE;
1250
708
  }
1251
709
  break;
1252
- case J.PAN:
710
+ case j.PAN:
1253
711
  if (t.ctrlKey || t.metaKey || t.shiftKey) {
1254
712
  if (this.enableRotate === !1) return;
1255
- this._handleMouseDownRotate(t), this.state = p.ROTATE;
713
+ this._handleMouseDownRotate(t), this.state = l.ROTATE;
1256
714
  } else {
1257
715
  if (this.enablePan === !1) return;
1258
- this._handleMouseDownPan(t), this.state = p.PAN;
716
+ this._handleMouseDownPan(t), this.state = l.PAN;
1259
717
  }
1260
718
  break;
1261
719
  default:
1262
- this.state = p.NONE;
720
+ this.state = l.NONE;
1263
721
  }
1264
- this.state !== p.NONE && this.dispatchEvent(Ue);
722
+ this.state !== l.NONE && this.dispatchEvent(pe);
1265
723
  }
1266
- function fs(t) {
724
+ function gt(t) {
1267
725
  switch (this.state) {
1268
- case p.ROTATE:
726
+ case l.ROTATE:
1269
727
  if (this.enableRotate === !1) return;
1270
728
  this._handleMouseMoveRotate(t);
1271
729
  break;
1272
- case p.DOLLY:
730
+ case l.DOLLY:
1273
731
  if (this.enableZoom === !1) return;
1274
732
  this._handleMouseMoveDolly(t);
1275
733
  break;
1276
- case p.PAN:
734
+ case l.PAN:
1277
735
  if (this.enablePan === !1) return;
1278
736
  this._handleMouseMovePan(t);
1279
737
  break;
1280
738
  }
1281
739
  }
1282
- function gs(t) {
1283
- this.enabled === !1 || this.enableZoom === !1 || this.state !== p.NONE || (t.preventDefault(), this.dispatchEvent(Ue), this._handleMouseWheel(this._customWheelEvent(t)), this.dispatchEvent(Pt));
740
+ function bt(t) {
741
+ this.enabled === !1 || this.enableZoom === !1 || this.state !== l.NONE || (t.preventDefault(), this.dispatchEvent(pe), this._handleMouseWheel(this._customWheelEvent(t)), this.dispatchEvent(Ne));
1284
742
  }
1285
- function ys(t) {
743
+ function vt(t) {
1286
744
  this.enabled !== !1 && this._handleKeyDown(t);
1287
745
  }
1288
- function bs(t) {
746
+ function yt(t) {
1289
747
  switch (this._trackPointer(t), this._pointers.length) {
1290
748
  case 1:
1291
749
  switch (this.touches.ONE) {
1292
- case V.ROTATE:
750
+ case x.ROTATE:
1293
751
  if (this.enableRotate === !1) return;
1294
- this._handleTouchStartRotate(t), this.state = p.TOUCH_ROTATE;
752
+ this._handleTouchStartRotate(t), this.state = l.TOUCH_ROTATE;
1295
753
  break;
1296
- case V.PAN:
754
+ case x.PAN:
1297
755
  if (this.enablePan === !1) return;
1298
- this._handleTouchStartPan(t), this.state = p.TOUCH_PAN;
756
+ this._handleTouchStartPan(t), this.state = l.TOUCH_PAN;
1299
757
  break;
1300
758
  default:
1301
- this.state = p.NONE;
759
+ this.state = l.NONE;
1302
760
  }
1303
761
  break;
1304
762
  case 2:
1305
763
  switch (this.touches.TWO) {
1306
- case V.DOLLY_PAN:
764
+ case x.DOLLY_PAN:
1307
765
  if (this.enableZoom === !1 && this.enablePan === !1) return;
1308
- this._handleTouchStartDollyPan(t), this.state = p.TOUCH_DOLLY_PAN;
766
+ this._handleTouchStartDollyPan(t), this.state = l.TOUCH_DOLLY_PAN;
1309
767
  break;
1310
- case V.DOLLY_ROTATE:
768
+ case x.DOLLY_ROTATE:
1311
769
  if (this.enableZoom === !1 && this.enableRotate === !1) return;
1312
- this._handleTouchStartDollyRotate(t), this.state = p.TOUCH_DOLLY_ROTATE;
770
+ this._handleTouchStartDollyRotate(t), this.state = l.TOUCH_DOLLY_ROTATE;
1313
771
  break;
1314
772
  default:
1315
- this.state = p.NONE;
773
+ this.state = l.NONE;
1316
774
  }
1317
775
  break;
1318
776
  default:
1319
- this.state = p.NONE;
777
+ this.state = l.NONE;
1320
778
  }
1321
- this.state !== p.NONE && this.dispatchEvent(Ue);
779
+ this.state !== l.NONE && this.dispatchEvent(pe);
1322
780
  }
1323
- function ws(t) {
781
+ function Mt(t) {
1324
782
  switch (this._trackPointer(t), this.state) {
1325
- case p.TOUCH_ROTATE:
783
+ case l.TOUCH_ROTATE:
1326
784
  if (this.enableRotate === !1) return;
1327
785
  this._handleTouchMoveRotate(t), this.update();
1328
786
  break;
1329
- case p.TOUCH_PAN:
787
+ case l.TOUCH_PAN:
1330
788
  if (this.enablePan === !1) return;
1331
789
  this._handleTouchMovePan(t), this.update();
1332
790
  break;
1333
- case p.TOUCH_DOLLY_PAN:
791
+ case l.TOUCH_DOLLY_PAN:
1334
792
  if (this.enableZoom === !1 && this.enablePan === !1) return;
1335
793
  this._handleTouchMoveDollyPan(t), this.update();
1336
794
  break;
1337
- case p.TOUCH_DOLLY_ROTATE:
795
+ case l.TOUCH_DOLLY_ROTATE:
1338
796
  if (this.enableZoom === !1 && this.enableRotate === !1) return;
1339
797
  this._handleTouchMoveDollyRotate(t), this.update();
1340
798
  break;
1341
799
  default:
1342
- this.state = p.NONE;
800
+ this.state = l.NONE;
1343
801
  }
1344
802
  }
1345
- function vs(t) {
803
+ function wt(t) {
1346
804
  this.enabled !== !1 && t.preventDefault();
1347
805
  }
1348
- function Ms(t) {
806
+ function Et(t) {
1349
807
  t.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
1350
808
  }
1351
- function Ps(t) {
809
+ function Pt(t) {
1352
810
  t.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
1353
811
  }
1354
- class gi extends Mt {
812
+ class bs extends Re {
1355
813
  /** Orbit-контроллер для управления камерой */
1356
814
  _orbit;
1357
815
  constructor(e) {
1358
- super(e), this.camera.position.set(1, 1, 7), this.camera.lookAt(0, 0, 0), this._orbit = new ds(this.camera, this.canvas), this._orbit.target.set(0, 0, 0), this._orbit.minPolarAngle = Math.PI / 2, this._orbit.maxPolarAngle = Math.PI / 2, this._orbit.enableRotate = !0, this._orbit.enableZoom = !1, this._orbit.enablePan = !1;
816
+ super(e), this.camera.position.set(1, 1, 7), this.camera.lookAt(0, 0, 0), this._orbit = new _t(this.camera, this.canvas), this._orbit.target.set(0, 0, 0), this._orbit.minPolarAngle = Math.PI / 2, this._orbit.maxPolarAngle = Math.PI / 2, this._orbit.enableRotate = !0, this._orbit.enableZoom = !1, this._orbit.enablePan = !1;
1359
817
  }
1360
818
  /**
1361
819
  * Обновление состояния рендерера.
@@ -1364,7 +822,7 @@ class gi extends Mt {
1364
822
  this._orbit?.update();
1365
823
  }
1366
824
  }
1367
- class yi {
825
+ class vs {
1368
826
  /** Позиции вершин */
1369
827
  _positions = [];
1370
828
  /** Нормали вершин */
@@ -1382,31 +840,31 @@ class yi {
1382
840
  load(e) {
1383
841
  const s = e.split(`
1384
842
  `);
1385
- for (const o of s) {
1386
- if (!o.trim() || o.startsWith("#")) continue;
1387
- const r = o.trim().split(/\s+/);
1388
- switch (r[0]) {
843
+ for (const r of s) {
844
+ if (!r.trim() || r.startsWith("#")) continue;
845
+ const o = r.trim().split(/\s+/);
846
+ switch (o[0]) {
1389
847
  case "v":
1390
- this._tmpPositions.push(r.slice(1).map(Number));
848
+ this._tmpPositions.push(o.slice(1).map(Number));
1391
849
  break;
1392
850
  case "vn":
1393
- this._tmpNormals.push(r.slice(1).map(Number));
851
+ this._tmpNormals.push(o.slice(1).map(Number));
1394
852
  break;
1395
853
  case "vt":
1396
- this._tmpUVs.push(r.slice(1).map(Number));
854
+ this._tmpUVs.push(o.slice(1).map(Number));
1397
855
  break;
1398
856
  case "f":
1399
- this.processFaceLine(r);
857
+ this.processFaceLine(o);
1400
858
  break;
1401
859
  }
1402
860
  }
1403
861
  const i = {
1404
- type: C.Custom,
862
+ type: P.Custom,
1405
863
  position: this._positions,
1406
864
  ...this._normals.length > 0 && { normal: this._normals },
1407
865
  ...this._uvs.length > 0 && { uv: this._uvs }
1408
866
  };
1409
- return new Xt(i);
867
+ return new Ze(i);
1410
868
  }
1411
869
  /**
1412
870
  * Обрабатывает строку face (f) и разворачивает индексы в массивы для рендеринга
@@ -1415,60 +873,60 @@ class yi {
1415
873
  for (let s = 1; s < e.length; s++) {
1416
874
  const i = e[s];
1417
875
  if (!i) continue;
1418
- const [o, r, n] = i.split("/"), a = o ? parseInt(o, 10) : void 0, d = r ? parseInt(r, 10) : void 0, g = n ? parseInt(n, 10) : void 0;
1419
- if (a !== void 0) {
1420
- const b = this._tmpPositions[a - 1];
1421
- b && this._positions.push(...b);
876
+ const [r, o, n] = i.split("/"), c = r ? parseInt(r, 10) : void 0, _ = o ? parseInt(o, 10) : void 0, m = n ? parseInt(n, 10) : void 0;
877
+ if (c !== void 0) {
878
+ const f = this._tmpPositions[c - 1];
879
+ f && this._positions.push(...f);
1422
880
  }
1423
- if (d !== void 0) {
1424
- const b = this._tmpUVs[d - 1];
1425
- b && this._uvs.push(...b);
881
+ if (_ !== void 0) {
882
+ const f = this._tmpUVs[_ - 1];
883
+ f && this._uvs.push(...f);
1426
884
  }
1427
- if (g !== void 0) {
1428
- const b = this._tmpNormals[g - 1];
1429
- b && this._normals.push(...b);
885
+ if (m !== void 0) {
886
+ const f = this._tmpNormals[m - 1];
887
+ f && this._normals.push(...f);
1430
888
  }
1431
889
  }
1432
890
  }
1433
891
  }
1434
- var Ss = Object.getOwnPropertyDescriptor, Es = (t, e, s, i) => {
1435
- for (var o = i > 1 ? void 0 : i ? Ss(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1436
- (n = t[r]) && (o = n(o) || o);
1437
- return o;
1438
- }, lt = (t, e) => (s, i) => e(s, i, t);
1439
- let Oe = class {
892
+ var St = Object.getOwnPropertyDescriptor, Ot = (t, e, s, i) => {
893
+ for (var r = i > 1 ? void 0 : i ? St(e, s) : e, o = t.length - 1, n; o >= 0; o--)
894
+ (n = t[o]) && (r = n(r) || r);
895
+ return r;
896
+ }, Ee = (t, e) => (s, i) => e(s, i, t);
897
+ let K = class {
1440
898
  constructor(t, e) {
1441
899
  this._store = e, this._handlers = new Map(t.map((s) => [s.mode, s]));
1442
900
  }
1443
901
  /** Текущий режим отображения */
1444
- _currentMode = ae.Plane;
902
+ _currentMode = k.Plane;
1445
903
  /** Хендлеры, которые управляют отображением */
1446
904
  _handlers;
1447
905
  /** Установка режима отображения */
1448
906
  manage(t) {
1449
- t !== this._currentMode && (this._handlers.get(this._currentMode)?.rollback(), t !== ae.Plane && this._handlers.get(t)?.handle(), this._currentMode = t, this._store.setDisplayMode(this._currentMode));
907
+ t !== this._currentMode && (this._handlers.get(this._currentMode)?.rollback(), t !== k.Plane && this._handlers.get(t)?.handle(), this._currentMode = t, this._store.setDisplayMode(this._currentMode));
1450
908
  }
1451
909
  /** Освобождает ресурсы менеджера. */
1452
910
  dispose() {
1453
- this._handlers && this._handlers.clear(), this._currentMode = ae.Plane, this._store.setDisplayMode(this._currentMode);
911
+ this._handlers && this._handlers.clear(), this._currentMode = k.Plane, this._store.setDisplayMode(this._currentMode);
1454
912
  }
1455
913
  };
1456
- Oe = Es([
1457
- w(),
1458
- lt(0, ve("IDisplayHandler")),
1459
- lt(1, u("IEditorStore"))
1460
- ], Oe);
1461
- var X = /* @__PURE__ */ ((t) => (t.Hover = "hover", t.Click = "click", t))(X || {}), xs = Object.getOwnPropertyDescriptor, Ts = (t, e, s, i) => {
1462
- for (var o = i > 1 ? void 0 : i ? xs(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1463
- (n = t[r]) && (o = n(o) || o);
1464
- return o;
1465
- }, Ee = (t, e) => (s, i) => e(s, i, t);
1466
- let Ae = class {
914
+ K = Ot([
915
+ u(),
916
+ Ee(0, W("IDisplayHandler")),
917
+ Ee(1, h("IEditorStore"))
918
+ ], K);
919
+ var S = /* @__PURE__ */ ((t) => (t.Hover = "hover", t.Click = "click", t))(S || {}), Dt = Object.getOwnPropertyDescriptor, Lt = (t, e, s, i) => {
920
+ for (var r = i > 1 ? void 0 : i ? Dt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
921
+ (n = t[o]) && (r = n(r) || r);
922
+ return r;
923
+ }, B = (t, e) => (s, i) => e(s, i, t);
924
+ let q = class {
1467
925
  constructor(t, e, s) {
1468
- this._eventBus = t, this._store = s, this._handlers = new Map(e.map((i) => [i.mode, i])), this._eventBus.on(ee.SelectHover, this._onHover), this._eventBus.on(ee.SelectClick, this._onClick);
926
+ this._eventBus = t, this._store = s, this._handlers = new Map(e.map((i) => [i.mode, i])), this._eventBus.on(R.SelectHover, this._onHover), this._eventBus.on(R.SelectClick, this._onClick);
1469
927
  }
1470
928
  /** Текущий режим выборки */
1471
- _currentMode = I.Mesh;
929
+ _currentMode = v.Mesh;
1472
930
  /** Хендлеры, которые управляют выборкой */
1473
931
  _handlers;
1474
932
  /** Переключает режим выбора */
@@ -1477,36 +935,36 @@ let Ae = class {
1477
935
  }
1478
936
  /** Обработчик события наведения на модель */
1479
937
  _onHover = (t) => {
1480
- this._handlers.get(this._currentMode)?.handle(t, X.Hover);
938
+ this._handlers.get(this._currentMode)?.handle(t, S.Hover);
1481
939
  };
1482
940
  /** Обработчик события клика на модель */
1483
941
  _onClick = (t) => {
1484
- this._handlers.get(this._currentMode)?.handle(t, X.Click);
942
+ this._handlers.get(this._currentMode)?.handle(t, S.Click);
1485
943
  };
1486
944
  /** Освобождает ресурсы менеджера. */
1487
945
  dispose() {
1488
- this._handlers && this._handlers.clear(), this._eventBus.off(ee.SelectHover, this._onHover), this._currentMode = I.Mesh, this._store.setSelectMode(this._currentMode);
946
+ this._handlers && this._handlers.clear(), this._eventBus.off(R.SelectHover, this._onHover), this._currentMode = v.Mesh, this._store.setSelectMode(this._currentMode);
1489
947
  }
1490
948
  };
1491
- Ae = Ts([
1492
- w(),
1493
- Ee(0, u("EventBus")),
1494
- Ee(1, ve("ISelectHandler")),
1495
- Ee(2, u("IEditorStore"))
1496
- ], Ae);
1497
- var Ds = Object.getOwnPropertyDescriptor, Os = (t, e, s, i) => {
1498
- for (var o = i > 1 ? void 0 : i ? Ds(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1499
- (n = t[r]) && (o = n(o) || o);
1500
- return o;
1501
- }, ct = (t, e) => (s, i) => e(s, i, t);
1502
- let Le = class {
949
+ q = Lt([
950
+ u(),
951
+ B(0, h("EventBus")),
952
+ B(1, W("ISelectHandler")),
953
+ B(2, h("IEditorStore"))
954
+ ], q);
955
+ var Tt = Object.getOwnPropertyDescriptor, Ct = (t, e, s, i) => {
956
+ for (var r = i > 1 ? void 0 : i ? Tt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
957
+ (n = t[o]) && (r = n(r) || r);
958
+ return r;
959
+ }, Pe = (t, e) => (s, i) => e(s, i, t);
960
+ let Q = class {
1503
961
  constructor(t, e) {
1504
962
  this._store = e, this._handlers = new Map(t.map((s) => [s.mode, s])), this._unsubSelected = this._store.onSelectedObjectChange(() => {
1505
963
  this._handlers.get(this._currentTool)?.handle();
1506
964
  });
1507
965
  }
1508
966
  /** Текущий выбранный инструмент */
1509
- _currentTool = G.Translate;
967
+ _currentTool = C.Translate;
1510
968
  /** Хендлеры, которые управляют инструментами */
1511
969
  _handlers;
1512
970
  _unsubSelected;
@@ -1515,22 +973,22 @@ let Le = class {
1515
973
  }
1516
974
  /** Освобождает ресурсы менеджера. */
1517
975
  dispose() {
1518
- this._unsubSelected?.(), this._handlers && this._handlers.clear(), this._currentTool = G.Translate, this._store.setToolType(this._currentTool);
976
+ this._unsubSelected?.(), this._handlers && this._handlers.clear(), this._currentTool = C.Translate, this._store.setToolType(this._currentTool);
1519
977
  }
1520
978
  };
1521
- Le = Os([
1522
- w(),
1523
- ct(0, ve("IToolHandler")),
1524
- ct(1, u("IEditorStore"))
1525
- ], Le);
1526
- var As = Object.getOwnPropertyDescriptor, Ls = (t, e, s, i) => {
1527
- for (var o = i > 1 ? void 0 : i ? As(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1528
- (n = t[r]) && (o = n(o) || o);
1529
- return o;
1530
- }, Cs = (t, e) => (s, i) => e(s, i, t);
1531
- let Ce = class {
979
+ Q = Ct([
980
+ u(),
981
+ Pe(0, W("IToolHandler")),
982
+ Pe(1, h("IEditorStore"))
983
+ ], Q);
984
+ var At = Object.getOwnPropertyDescriptor, xt = (t, e, s, i) => {
985
+ for (var r = i > 1 ? void 0 : i ? At(e, s) : e, o = t.length - 1, n; o >= 0; o--)
986
+ (n = t[o]) && (r = n(r) || r);
987
+ return r;
988
+ }, jt = (t, e) => (s, i) => e(s, i, t);
989
+ let J = class {
1532
990
  /** Текущий режим редактирования сцены */
1533
- _currentMode = he.AddFigure;
991
+ _currentMode = V.AddFigure;
1534
992
  /** Хендлеры, которые управляют отображением */
1535
993
  _handlers;
1536
994
  constructor(t) {
@@ -1538,35 +996,35 @@ let Ce = class {
1538
996
  }
1539
997
  /** Установка режима редактирования сцены */
1540
998
  manage(t, e) {
1541
- console.log("manage", t), t === he.AddFigure ? this._handlers.get(t)?.handle(e) : this._handlers.get(t)?.handle(), this._currentMode = t;
999
+ console.log("manage", t), t === V.AddFigure ? this._handlers.get(t)?.handle(e) : this._handlers.get(t)?.handle(), this._currentMode = t;
1542
1000
  }
1543
1001
  /** Освобождает ресурсы менеджера. */
1544
1002
  dispose() {
1545
- this._handlers && this._handlers.clear(), this._currentMode = he.AddFigure;
1003
+ this._handlers && this._handlers.clear(), this._currentMode = V.AddFigure;
1546
1004
  }
1547
1005
  };
1548
- Ce = Ls([
1549
- w(),
1550
- Cs(0, ve("ISceneHandler"))
1551
- ], Ce);
1552
- var Is = Object.getOwnPropertyDescriptor, js = (t, e, s, i) => {
1553
- for (var o = i > 1 ? void 0 : i ? Is(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1554
- (n = t[r]) && (o = n(o) || o);
1555
- return o;
1556
- }, Rs = (t, e) => (s, i) => e(s, i, t);
1557
- let Ie = class {
1006
+ J = xt([
1007
+ u(),
1008
+ jt(0, W("ISceneHandler"))
1009
+ ], J);
1010
+ var Rt = Object.getOwnPropertyDescriptor, It = (t, e, s, i) => {
1011
+ for (var r = i > 1 ? void 0 : i ? Rt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1012
+ (n = t[o]) && (r = n(r) || r);
1013
+ return r;
1014
+ }, Ht = (t, e) => (s, i) => e(s, i, t);
1015
+ let ee = class {
1558
1016
  constructor(t) {
1559
1017
  this._api = t;
1560
1018
  }
1561
1019
  /** Режим отображения. */
1562
- mode = ae.Wireframe;
1020
+ mode = k.Wireframe;
1563
1021
  /** Сохраняем предыдущие значения wireframe для отката. */
1564
1022
  _prevWireframe = /* @__PURE__ */ new Map();
1565
1023
  /** Сохраняем исходные цвета материалов для отката */
1566
1024
  _prevColorMesh = /* @__PURE__ */ new Map();
1567
1025
  _prevColorLines = /* @__PURE__ */ new Map();
1568
1026
  /** Цвет ребер для wireframe-режима. */
1569
- _wireColor = new l.Color(65535);
1027
+ _wireColor = new a.Color(65535);
1570
1028
  /** Применяет wireframe-режим к сцене. */
1571
1029
  handle() {
1572
1030
  const t = this._api.getMeshes();
@@ -1575,13 +1033,13 @@ let Ie = class {
1575
1033
  for (const i of s) this._enableWireframeOnMaterial(i);
1576
1034
  e.traverse((i) => {
1577
1035
  if (i.isLineSegments) {
1578
- const o = i;
1579
- if (!this._prevColorLines.has(o.material)) {
1580
- const n = o.material;
1036
+ const r = i;
1037
+ if (!this._prevColorLines.has(r.material)) {
1038
+ const n = r.material;
1581
1039
  this._prevColorLines.set(n, n.color.clone());
1582
1040
  }
1583
- const r = o.material;
1584
- r.color.copy(this._wireColor), r.needsUpdate = !0;
1041
+ const o = r.material;
1042
+ o.color.copy(this._wireColor), o.needsUpdate = !0;
1585
1043
  }
1586
1044
  });
1587
1045
  }
@@ -1610,35 +1068,34 @@ let Ie = class {
1610
1068
  "wireframe" in e && !this._prevWireframe.has(t) && (this._prevWireframe.set(t, !!e.wireframe), e.wireframe = !0, t.needsUpdate = !0), e.color?.isColor && (this._prevColorMesh.has(t) || this._prevColorMesh.set(t, e.color.clone()), e.color.copy(this._wireColor));
1611
1069
  }
1612
1070
  };
1613
- Ie = js([
1614
- w(),
1615
- Rs(0, u("RendererApi"))
1616
- ], Ie);
1617
- const We = 16776960, $e = 16755200, Hs = 2236962;
1618
- var ks = Object.getOwnPropertyDescriptor, Ys = (t, e, s, i) => {
1619
- for (var o = i > 1 ? void 0 : i ? ks(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1620
- (n = t[r]) && (o = n(o) || o);
1621
- return o;
1622
- }, dt = (t, e) => (s, i) => e(s, i, t);
1623
- let je = class {
1071
+ ee = It([
1072
+ u(),
1073
+ Ht(0, h("RendererApi"))
1074
+ ], ee);
1075
+ var kt = Object.getOwnPropertyDescriptor, Vt = (t, e, s, i) => {
1076
+ for (var r = i > 1 ? void 0 : i ? kt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1077
+ (n = t[o]) && (r = n(r) || r);
1078
+ return r;
1079
+ }, Se = (t, e) => (s, i) => e(s, i, t);
1080
+ let te = class {
1624
1081
  constructor(t, e) {
1625
1082
  this._api = t, this._store = e;
1626
1083
  }
1627
1084
  /** Режим, которым управляет хендлер, нужен только менеджеру */
1628
- mode = I.Mesh;
1085
+ mode = v.Mesh;
1629
1086
  /** Фигура, на которую навелись в данный момент */
1630
1087
  _hoveredMesh = null;
1631
1088
  /** Фигура, которую выбрали в данный момент */
1632
1089
  _selectedMesh = null;
1633
1090
  // Цвета, необходимые для переключения
1634
1091
  /** Цвет ребер для фигуры, на которую навелись */
1635
- _hoverColor = We;
1092
+ _hoverColor = z;
1636
1093
  /** Цвет ребер для выделенной фигуры */
1637
- _selectColor = $e;
1094
+ _selectColor = Z;
1638
1095
  /** Исходные цвета материалов линий для отката */
1639
1096
  _origLineColors = /* @__PURE__ */ new WeakMap();
1640
1097
  handle(t, e) {
1641
- if (this._api.setRaycastMode(this.mode), e === X.Hover) {
1098
+ if (this._api.setRaycastMode(this.mode), e === S.Hover) {
1642
1099
  if (!t) {
1643
1100
  this._hoveredMesh && this._hoveredMesh !== this._selectedMesh && this._restoreEdgesColor(this._hoveredMesh), this._hoveredMesh = null;
1644
1101
  return;
@@ -1646,7 +1103,7 @@ let je = class {
1646
1103
  const s = t.intersection.object;
1647
1104
  this._hoveredMesh !== s && (this._hoveredMesh && this._hoveredMesh !== this._selectedMesh && this._restoreEdgesColor(this._hoveredMesh), s !== this._selectedMesh && this._paintEdges(s, this._hoverColor), this._hoveredMesh = s);
1648
1105
  }
1649
- if (e === X.Click) {
1106
+ if (e === S.Click) {
1650
1107
  if (!t) {
1651
1108
  this._selectedMesh && (this._restoreEdgesColor(this._selectedMesh), this._selectedMesh = null, this._store.setSelectedObject(null));
1652
1109
  return;
@@ -1669,8 +1126,8 @@ let je = class {
1669
1126
  t.children.forEach((s) => {
1670
1127
  const i = s;
1671
1128
  if (i.isLineSegments && i.material) {
1672
- const o = i.material;
1673
- this._origLineColors.has(i) || this._origLineColors.set(i, o.color.clone()), o.color.setHex(e), o.needsUpdate = !0;
1129
+ const r = i.material;
1130
+ this._origLineColors.has(i) || this._origLineColors.set(i, r.color.clone()), r.color.setHex(e), r.needsUpdate = !0;
1674
1131
  }
1675
1132
  });
1676
1133
  }
@@ -1684,42 +1141,42 @@ let je = class {
1684
1141
  if (s.isLineSegments && s.material) {
1685
1142
  const i = this._origLineColors.get(s);
1686
1143
  if (i) {
1687
- const o = s.material;
1688
- o.color.copy(i), o.needsUpdate = !0;
1144
+ const r = s.material;
1145
+ r.color.copy(i), r.needsUpdate = !0;
1689
1146
  }
1690
1147
  }
1691
1148
  });
1692
1149
  }
1693
1150
  };
1694
- je = Ys([
1695
- w(),
1696
- dt(0, u("RendererApi")),
1697
- dt(1, u("IEditorStore"))
1698
- ], je);
1699
- var Zs = Object.getOwnPropertyDescriptor, zs = (t, e, s, i) => {
1700
- for (var o = i > 1 ? void 0 : i ? Zs(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1701
- (n = t[r]) && (o = n(o) || o);
1702
- return o;
1703
- }, Xs = (t, e) => (s, i) => e(s, i, t);
1704
- let Re = class {
1151
+ te = Vt([
1152
+ u(),
1153
+ Se(0, h("RendererApi")),
1154
+ Se(1, h("IEditorStore"))
1155
+ ], te);
1156
+ var Nt = Object.getOwnPropertyDescriptor, Yt = (t, e, s, i) => {
1157
+ for (var r = i > 1 ? void 0 : i ? Nt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1158
+ (n = t[o]) && (r = n(r) || r);
1159
+ return r;
1160
+ }, Ut = (t, e) => (s, i) => e(s, i, t);
1161
+ let se = class {
1705
1162
  constructor(t) {
1706
1163
  this._api = t;
1707
1164
  }
1708
1165
  /** Режим, которым управляет хендлер, нужен только менеджеру */
1709
- mode = I.Face;
1166
+ mode = v.Face;
1710
1167
  /** Текущая наведённая грань */
1711
1168
  _hovered = null;
1712
1169
  /** Текущая выбранная грань */
1713
1170
  _selected = null;
1714
1171
  // Цвета, необходимые для переключения
1715
1172
  /** Цвет грани, на которую навелись */
1716
- _hoverColor = We;
1173
+ _hoverColor = z;
1717
1174
  /** Цвет выделенной граней */
1718
- _selectColor = $e;
1175
+ _selectColor = Z;
1719
1176
  /** Изначальный цвет граней у модели, перед наложением эффектов*/
1720
1177
  _defaultColor = 2236962;
1721
1178
  handle(t, e) {
1722
- this._api.setRaycastMode(this.mode), e === X.Hover && console.log(t), e === X.Click && console.log(t);
1179
+ this._api.setRaycastMode(this.mode), e === S.Hover && console.log(t), e === S.Click && console.log(t);
1723
1180
  }
1724
1181
  rollback() {
1725
1182
  throw new Error("Method not implemented.");
@@ -1729,11 +1186,137 @@ let Re = class {
1729
1186
  throw new Error("Method not implemented.");
1730
1187
  }
1731
1188
  };
1732
- Re = zs([
1733
- w(),
1734
- Xs(0, u("RendererApi"))
1735
- ], Re);
1736
- class Ge {
1189
+ se = Yt([
1190
+ u(),
1191
+ Ut(0, h("RendererApi"))
1192
+ ], se);
1193
+ var Wt = Object.getOwnPropertyDescriptor, zt = (t, e, s, i) => {
1194
+ for (var r = i > 1 ? void 0 : i ? Wt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1195
+ (n = t[o]) && (r = n(r) || r);
1196
+ return r;
1197
+ }, Oe = (t, e) => (s, i) => e(s, i, t);
1198
+ let ie = class {
1199
+ constructor(t, e) {
1200
+ this._api = t, this._store = e, this._api.enableCameraLayer(L), this._hoverVertex = this._makeOverlayVertex(this._hoverColor), this._selectVertex = this._makeOverlayVertex(this._selectColor), this._api.addObject(this._hoverVertex, L), this._api.addObject(this._selectVertex, L);
1201
+ }
1202
+ /** Режим, которым управляет хендлер, нужен только менеджеру */
1203
+ mode = v.Vertex;
1204
+ _hovered = null;
1205
+ _selected = null;
1206
+ /** Текущая наведённая вершина. */
1207
+ _hoverVertex;
1208
+ /** Текущая выбранная вершина. */
1209
+ _selectVertex;
1210
+ // Цвета, необходимые для переключения
1211
+ /** Цвет ребра, на которое навелись */
1212
+ _hoverColor = z;
1213
+ /** Цвет выделенного ребра */
1214
+ _selectColor = Z;
1215
+ handle(t, e) {
1216
+ if (this._api.setRaycastMode(this.mode), e === S.Hover) {
1217
+ if (!t) {
1218
+ this._hoverVertex.visible = !1, this._hovered = null;
1219
+ return;
1220
+ }
1221
+ const s = t.intersection.object;
1222
+ if (!s?.isPoints) return;
1223
+ const i = s, r = t.intersection.index ?? -1;
1224
+ if (r < 0) return;
1225
+ this._selected && this._same({ points: i, index: r }, this._selected) ? this._hoverVertex.visible = !1 : (this._writeWorldVertex(this._hoverVertex, i, r), this._hoverVertex.visible = !0);
1226
+ return;
1227
+ }
1228
+ if (e === S.Click) {
1229
+ if (!t) {
1230
+ this._selectVertex.visible = !1, this._selected = null, this._store.setSelectedObject(null);
1231
+ return;
1232
+ }
1233
+ const s = t.intersection.object;
1234
+ if (!s?.isPoints) return;
1235
+ const i = s, r = t.intersection.index ?? -1;
1236
+ if (r < 0) return;
1237
+ this._writeWorldVertex(this._selectVertex, i, r), this._centerVertexOnPoint(this._selectVertex, i, r), this._selectVertex.visible = !0, this._prepareVertexMetadata(i, r), this._store.setSelectedObject(this._selectVertex), this._selected = { points: i, index: r }, this._hovered && this._same(this._hovered, this._selected) && (this._hoverVertex.visible = !1);
1238
+ return;
1239
+ }
1240
+ }
1241
+ rollback() {
1242
+ this._hoverVertex.visible = !1, this._selectVertex.visible = !1, this._hovered = this._selected = null;
1243
+ }
1244
+ dispose() {
1245
+ this.rollback(), this._api.removeObject(this._hoverVertex), this._api.removeObject(this._selectVertex), this._hoverVertex.geometry.dispose(), this._hoverVertex.material.dispose(), this._selectVertex.geometry.dispose(), this._selectVertex.material.dispose();
1246
+ }
1247
+ _makeOverlayVertex(t, e = Je) {
1248
+ const s = new a.BufferGeometry();
1249
+ s.setAttribute("position", new a.Float32BufferAttribute([0, 0, 0], 3));
1250
+ const i = new a.PointsMaterial({
1251
+ color: t,
1252
+ size: e,
1253
+ sizeAttenuation: !1,
1254
+ depthTest: !1,
1255
+ depthWrite: !1,
1256
+ transparent: !0,
1257
+ opacity: 1
1258
+ }), r = new a.Points(s, i);
1259
+ return r.renderOrder = 1e3, r.raycast = () => {
1260
+ }, r.layers.set(L), r.visible = !1, r;
1261
+ }
1262
+ /** Локальную вершину points переводим в world и пишем в target (прокси-точку) */
1263
+ _writeWorldVertex(t, e, s) {
1264
+ const i = e.geometry.getAttribute("position"), r = new a.Vector3(
1265
+ i.getX(s),
1266
+ i.getY(s),
1267
+ i.getZ(s)
1268
+ ).applyMatrix4(e.matrixWorld), o = t.geometry.getAttribute("position");
1269
+ o.setXYZ(0, r.x, r.y, r.z), o.needsUpdate = !0;
1270
+ }
1271
+ _same(t, e) {
1272
+ return !!t && !!e && t.points === e.points && t.index === e.index;
1273
+ }
1274
+ /** Готовит метаданные для выбранной вершины и пишет их в _selectVertex.userData */
1275
+ _prepareVertexMetadata(t, e) {
1276
+ const s = He(t);
1277
+ if (!s) return;
1278
+ const i = t.geometry.getAttribute("position"), r = new a.Vector3(
1279
+ i.getX(e),
1280
+ i.getY(e),
1281
+ i.getZ(e)
1282
+ ).applyMatrix4(t.matrixWorld), o = new a.Matrix4().copy(s.matrixWorld).invert(), n = r.clone().applyMatrix4(o), _ = s.geometry.getAttribute("position"), m = 1e-6, f = m * m, T = new a.Vector3(), b = [];
1283
+ for (let M = 0; M < _.count; M++)
1284
+ T.fromBufferAttribute(_, M), T.distanceToSquared(n) < f && b.push(M);
1285
+ const O = s.children.find((M) => M?.isLineSegments);
1286
+ let y = [];
1287
+ if (O) {
1288
+ const M = new a.Matrix4().copy(O.matrixWorld).invert(), N = r.clone().applyMatrix4(M), I = O.geometry.getAttribute("position"), Y = new a.Vector3();
1289
+ for (let A = 0; A < I.count; A++)
1290
+ Y.fromBufferAttribute(I, A), Y.distanceToSquared(N) < f && y.push(A);
1291
+ }
1292
+ this._selectVertex.userData.vertexInfo = {
1293
+ points: t,
1294
+ index: e,
1295
+ mesh: s,
1296
+ vertexIndices: b,
1297
+ lines: O ?? null,
1298
+ edgeVertexIndices: y
1299
+ };
1300
+ }
1301
+ /** Центрует прокси-вершину на выбранной точке */
1302
+ _centerVertexOnPoint(t, e, s) {
1303
+ const i = e.geometry.getAttribute("position"), r = new a.Vector3(
1304
+ i.getX(s),
1305
+ i.getY(s),
1306
+ i.getZ(s)
1307
+ ).applyMatrix4(e.matrixWorld);
1308
+ t.position.copy(r);
1309
+ const o = t.geometry;
1310
+ let n = o.getAttribute("position");
1311
+ (!n || n.count < 1) && (o.setAttribute("position", new a.BufferAttribute(new Float32Array(3), 3)), n = o.getAttribute("position")), n.setXYZ(0, 0, 0, 0), n.needsUpdate = !0, t.quaternion.identity(), t.scale.set(1, 1, 1), t.updateMatrixWorld(!0);
1312
+ }
1313
+ };
1314
+ ie = zt([
1315
+ u(),
1316
+ Oe(0, h("RendererApi")),
1317
+ Oe(1, h("IEditorStore"))
1318
+ ], ie);
1319
+ class ue {
1737
1320
  constructor(e, s) {
1738
1321
  this.api = e, this.store = s;
1739
1322
  }
@@ -1757,69 +1340,68 @@ class Ge {
1757
1340
  this.rollback();
1758
1341
  }
1759
1342
  }
1760
- var Ns = Object.getOwnPropertyDescriptor, Fs = (t, e, s, i) => {
1761
- for (var o = i > 1 ? void 0 : i ? Ns(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1762
- (n = t[r]) && (o = n(o) || o);
1763
- return o;
1764
- }, pt = (t, e) => (s, i) => e(s, i, t);
1765
- let He = class extends Ge {
1343
+ var Zt = Object.getOwnPropertyDescriptor, $t = (t, e, s, i) => {
1344
+ for (var r = i > 1 ? void 0 : i ? Zt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1345
+ (n = t[o]) && (r = n(r) || r);
1346
+ return r;
1347
+ }, De = (t, e) => (s, i) => e(s, i, t);
1348
+ let re = class extends ue {
1766
1349
  /** Инструмент, которым управляет хендлер, нужен только менеджеру */
1767
- mode = G.Translate;
1350
+ mode = C.Translate;
1768
1351
  constructor(t, e) {
1769
1352
  super(t, e);
1770
1353
  }
1771
1354
  };
1772
- He = Fs([
1773
- w(),
1774
- pt(0, u("RendererApi")),
1775
- pt(1, u("IEditorStore"))
1776
- ], He);
1777
- var Qs = Object.getOwnPropertyDescriptor, Us = (t, e, s, i) => {
1778
- for (var o = i > 1 ? void 0 : i ? Qs(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1779
- (n = t[r]) && (o = n(o) || o);
1780
- return o;
1781
- }, _t = (t, e) => (s, i) => e(s, i, t);
1782
- let ke = class extends Ge {
1355
+ re = $t([
1356
+ u(),
1357
+ De(0, h("RendererApi")),
1358
+ De(1, h("IEditorStore"))
1359
+ ], re);
1360
+ var Ft = Object.getOwnPropertyDescriptor, Bt = (t, e, s, i) => {
1361
+ for (var r = i > 1 ? void 0 : i ? Ft(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1362
+ (n = t[o]) && (r = n(r) || r);
1363
+ return r;
1364
+ }, Le = (t, e) => (s, i) => e(s, i, t);
1365
+ let oe = class extends ue {
1783
1366
  /** Инструмент, которым управляет хендлер, нужен только менеджеру */
1784
- mode = G.Scale;
1367
+ mode = C.Scale;
1785
1368
  constructor(t, e) {
1786
1369
  super(t, e);
1787
1370
  }
1788
1371
  };
1789
- ke = Us([
1790
- w(),
1791
- _t(0, u("RendererApi")),
1792
- _t(1, u("IEditorStore"))
1793
- ], ke);
1794
- var Ws = Object.getOwnPropertyDescriptor, $s = (t, e, s, i) => {
1795
- for (var o = i > 1 ? void 0 : i ? Ws(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1796
- (n = t[r]) && (o = n(o) || o);
1797
- return o;
1798
- }, ut = (t, e) => (s, i) => e(s, i, t);
1799
- let Ye = class extends Ge {
1372
+ oe = Bt([
1373
+ u(),
1374
+ Le(0, h("RendererApi")),
1375
+ Le(1, h("IEditorStore"))
1376
+ ], oe);
1377
+ var Xt = Object.getOwnPropertyDescriptor, Gt = (t, e, s, i) => {
1378
+ for (var r = i > 1 ? void 0 : i ? Xt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1379
+ (n = t[o]) && (r = n(r) || r);
1380
+ return r;
1381
+ }, Te = (t, e) => (s, i) => e(s, i, t);
1382
+ let ne = class extends ue {
1800
1383
  /** Инструмент, которым управляет хендлер, нужен только менеджеру */
1801
- mode = G.Rotate;
1384
+ mode = C.Rotate;
1802
1385
  constructor(t, e) {
1803
1386
  super(t, e);
1804
1387
  }
1805
1388
  };
1806
- Ye = $s([
1807
- w(),
1808
- ut(0, u("RendererApi")),
1809
- ut(1, u("IEditorStore"))
1810
- ], Ye);
1811
- const be = 31;
1812
- var Gs = Object.getOwnPropertyDescriptor, qs = (t, e, s, i) => {
1813
- for (var o = i > 1 ? void 0 : i ? Gs(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1814
- (n = t[r]) && (o = n(o) || o);
1815
- return o;
1816
- }, mt = (t, e) => (s, i) => e(s, i, t);
1817
- let Ze = class {
1389
+ ne = Gt([
1390
+ u(),
1391
+ Te(0, h("RendererApi")),
1392
+ Te(1, h("IEditorStore"))
1393
+ ], ne);
1394
+ var Kt = Object.getOwnPropertyDescriptor, qt = (t, e, s, i) => {
1395
+ for (var r = i > 1 ? void 0 : i ? Kt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1396
+ (n = t[o]) && (r = n(r) || r);
1397
+ return r;
1398
+ }, Ce = (t, e) => (s, i) => e(s, i, t);
1399
+ let ae = class {
1818
1400
  constructor(t, e) {
1819
- this._api = t, this._store = e, this._api.enableCameraLayer(be), this._hoverLine = this._makeOverlayLine(this._hoverColor), this._selectLine = this._makeOverlayLine(this._selectColor), this._api.addObject(this._hoverLine, be), this._api.addObject(this._selectLine, be);
1401
+ this._api = t, this._store = e, this._api.enableCameraLayer(L), this._hoverLine = this._makeOverlayLine(this._hoverColor), this._selectLine = this._makeOverlayLine(this._selectColor), this._api.addObject(this._hoverLine, L), this._api.addObject(this._selectLine, L);
1820
1402
  }
1821
1403
  /** Режим, которым управляет хендлер, нужен только менеджеру */
1822
- mode = I.Edge;
1404
+ mode = v.Edge;
1823
1405
  /** Текущее наведённое ребро. */
1824
1406
  _hoverLine;
1825
1407
  /** Текущее выбранное ребро. */
@@ -1830,33 +1412,33 @@ let Ze = class {
1830
1412
  _selected = null;
1831
1413
  // Цвета, необходимые для переключения
1832
1414
  /** Цвет ребра, на которое навелись */
1833
- _hoverColor = We;
1415
+ _hoverColor = z;
1834
1416
  /** Цвет выделенного ребра */
1835
- _selectColor = $e;
1417
+ _selectColor = Z;
1836
1418
  /** Обработка текущего режима выборки. */
1837
1419
  handle(t, e) {
1838
- if (this._api.setRaycastMode(this.mode), e === X.Hover) {
1420
+ if (this._api.setRaycastMode(this.mode), e === S.Hover) {
1839
1421
  if (!t) {
1840
1422
  this._hoverLine.visible = !1, this._hovered = null;
1841
1423
  return;
1842
1424
  }
1843
1425
  const s = t.intersection.object;
1844
1426
  if (!s?.isLineSegments) return;
1845
- const i = s, o = Math.floor((t.intersection.index ?? -1) / 2);
1846
- if (o < 0) return;
1847
- this._selected && this._same({ lines: i, seg: o }, this._selected) ? this._hoverLine.visible = !1 : (this._writeWorldSegment(this._hoverLine, i, o), this._hoverLine.visible = !0), this._hovered = { lines: i, seg: o };
1427
+ const i = s, r = Math.floor((t.intersection.index ?? -1) / 2);
1428
+ if (r < 0) return;
1429
+ this._selected && this._same({ lines: i, seg: r }, this._selected) ? this._hoverLine.visible = !1 : (this._writeWorldSegment(this._hoverLine, i, r), this._hoverLine.visible = !0), this._hovered = { lines: i, seg: r };
1848
1430
  return;
1849
1431
  }
1850
- if (e === X.Click) {
1432
+ if (e === S.Click) {
1851
1433
  if (!t) {
1852
1434
  this._selectLine.visible = !1, this._selected = null, this._store.setSelectedObject(null);
1853
1435
  return;
1854
1436
  }
1855
1437
  const s = t.intersection.object;
1856
1438
  if (!s?.isLineSegments) return;
1857
- const i = s, o = Math.floor((t.intersection.index ?? -1) / 2);
1858
- if (o < 0) return;
1859
- this._writeWorldSegment(this._selectLine, i, o), this._centerAndOrientLineOnSegment(this._selectLine, i, o), this._selectLine.visible = !0, this._store.setSelectedObject(this._selectLine), this._selected = { lines: i, seg: o }, this._hovered && this._same(this._hovered, this._selected) && (this._hoverLine.visible = !1);
1439
+ const i = s, r = Math.floor((t.intersection.index ?? -1) / 2);
1440
+ if (r < 0) return;
1441
+ this._writeWorldSegment(this._selectLine, i, r), this._centerAndOrientLineOnSegment(this._selectLine, i, r), this._selectLine.visible = !0, this._prepareEdgeMetadata(i, r), this._store.setSelectedObject(this._selectLine), this._selected = { lines: i, seg: r }, this._hovered && this._same(this._hovered, this._selected) && (this._hoverLine.visible = !1);
1860
1442
  }
1861
1443
  }
1862
1444
  /** Откат текущего режима выборки */
@@ -1867,77 +1449,104 @@ let Ze = class {
1867
1449
  dispose() {
1868
1450
  this.rollback(), this._api.removeObject(this._hoverLine), this._api.removeObject(this._selectLine), this._hoverLine.geometry.dispose(), this._hoverLine.material.dispose(), this._selectLine.geometry.dispose(), this._selectLine.material.dispose();
1869
1451
  }
1452
+ /** Инициализация буферных линий для режима (hover и click).
1453
+ * На весь режим будет использовано 2 глобальных линии на сцене,
1454
+ * использоваться они будут только для обозначения геометрии ребер конкретной фигуры.
1455
+ */
1870
1456
  _makeOverlayLine(t) {
1871
- const e = new l.BufferGeometry();
1872
- e.setAttribute("position", new l.Float32BufferAttribute(6, 3));
1873
- const s = new l.LineBasicMaterial({
1457
+ const e = new a.BufferGeometry();
1458
+ e.setAttribute("position", new a.Float32BufferAttribute(6, 3));
1459
+ const s = new a.LineBasicMaterial({
1874
1460
  color: t,
1875
1461
  depthTest: !1,
1876
1462
  depthWrite: !1,
1877
1463
  transparent: !0,
1878
1464
  opacity: 1
1879
- }), i = new l.Line(e, s);
1465
+ }), i = new a.Line(e, s);
1880
1466
  return i.renderOrder = 1e3, i.raycast = () => {
1881
- }, i.layers.set(be), i.visible = !1, i;
1467
+ }, i.layers.set(L), i.visible = !1, i;
1882
1468
  }
1883
1469
  /** Локальные точки сегмента переводим в target (который висит на сцене) */
1884
1470
  _writeWorldSegment(t, e, s) {
1885
- const i = e.geometry.getAttribute("position"), o = s * 2, r = o + 1, n = new l.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
1471
+ const i = e.geometry.getAttribute("position"), r = s * 2, o = r + 1, n = new a.Vector3(i.getX(r), i.getY(r), i.getZ(r)).applyMatrix4(
1886
1472
  e.matrixWorld
1887
- ), a = new l.Vector3(i.getX(r), i.getY(r), i.getZ(r)).applyMatrix4(
1473
+ ), c = new a.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
1888
1474
  e.matrixWorld
1889
- ), d = t.geometry.getAttribute("position");
1890
- d.setXYZ(0, n.x, n.y, n.z), d.setXYZ(1, a.x, a.y, a.z), d.needsUpdate = !0;
1475
+ ), _ = t.geometry.getAttribute("position");
1476
+ _.setXYZ(0, n.x, n.y, n.z), _.setXYZ(1, c.x, c.y, c.z), _.needsUpdate = !0;
1891
1477
  }
1892
1478
  _same(t, e) {
1893
1479
  return !!t && !!e && t.lines === e.lines && t.seg === e.seg;
1894
1480
  }
1895
1481
  /** Центрует `THREE.Line` на сегменте и ориентирует её вдоль ребра */
1896
1482
  _centerAndOrientLineOnSegment(t, e, s) {
1897
- const i = e.geometry.getAttribute("position"), o = s * 2, r = o + 1, n = new l.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
1483
+ const i = e.geometry.getAttribute("position"), r = s * 2, o = r + 1, n = new a.Vector3(i.getX(r), i.getY(r), i.getZ(r)).applyMatrix4(
1898
1484
  e.matrixWorld
1899
- ), a = new l.Vector3(i.getX(r), i.getY(r), i.getZ(r)).applyMatrix4(
1485
+ ), c = new a.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
1900
1486
  e.matrixWorld
1901
- ), d = new l.Vector3().subVectors(a, n), g = d.length();
1902
- if (!isFinite(g) || g === 0) return;
1903
- const b = new l.Vector3().addVectors(n, a).multiplyScalar(0.5);
1904
- t.position.copy(b);
1905
- const H = t.geometry;
1906
- let x = H.getAttribute("position");
1907
- (!x || x.count < 2) && (H.setAttribute("position", new l.BufferAttribute(new Float32Array(6), 3)), x = H.getAttribute("position")), x.setXYZ(0, -g / 2, 0, 0), x.setXYZ(1, g / 2, 0, 0), x.needsUpdate = !0, d.normalize();
1908
- const q = new l.Quaternion().setFromUnitVectors(new l.Vector3(1, 0, 0), d);
1909
- t.quaternion.copy(q), t.updateMatrixWorld(!0);
1487
+ ), _ = new a.Vector3().subVectors(c, n), m = _.length();
1488
+ if (!isFinite(m) || m === 0) return;
1489
+ const f = new a.Vector3().addVectors(n, c).multiplyScalar(0.5);
1490
+ t.position.copy(f);
1491
+ const T = t.geometry;
1492
+ let b = T.getAttribute("position");
1493
+ (!b || b.count < 2) && (T.setAttribute("position", new a.BufferAttribute(new Float32Array(6), 3)), b = T.getAttribute("position")), b.setXYZ(0, -m / 2, 0, 0), b.setXYZ(1, m / 2, 0, 0), b.needsUpdate = !0, _.normalize();
1494
+ const O = new a.Quaternion().setFromUnitVectors(new a.Vector3(1, 0, 0), _);
1495
+ t.quaternion.copy(O), t.updateMatrixWorld(!0);
1496
+ }
1497
+ /** Запись метаданных выбранного ребра для использования инструментов */
1498
+ _prepareEdgeMetadata(t, e) {
1499
+ const s = He(t);
1500
+ if (!s) return;
1501
+ const i = t.geometry.getAttribute("position"), r = e * 2, o = r + 1, n = new a.Vector3(i.getX(r), i.getY(r), i.getZ(r)).applyMatrix4(
1502
+ t.matrixWorld
1503
+ ), c = new a.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
1504
+ t.matrixWorld
1505
+ ), _ = new a.Matrix4().copy(s.matrixWorld).invert(), m = n.clone().applyMatrix4(_), f = c.clone().applyMatrix4(_), b = s.geometry.getAttribute("position"), O = new a.Vector3(), y = 1e-6, M = [], N = [];
1506
+ for (let w = 0; w < b.count; w++)
1507
+ O.fromBufferAttribute(b, w), O.distanceToSquared(m) < y * y ? M.push(w) : O.distanceToSquared(f) < y * y && N.push(w);
1508
+ const I = new a.Matrix4().copy(t.matrixWorld).invert(), Y = n.clone().applyMatrix4(I), A = c.clone().applyMatrix4(I), me = t.geometry.getAttribute("position"), $ = new a.Vector3(), fe = [], ge = [];
1509
+ for (let w = 0; w < me.count; w++)
1510
+ $.fromBufferAttribute(me, w), $.distanceToSquared(Y) < y * y ? fe.push(w) : $.distanceToSquared(A) < y * y && ge.push(w);
1511
+ this._selectLine.userData.edgeInfo = {
1512
+ lines: t,
1513
+ seg: e,
1514
+ mesh: s,
1515
+ aIndices: M,
1516
+ bIndices: N,
1517
+ aEdgeIndices: fe,
1518
+ bEdgeIndices: ge
1519
+ };
1910
1520
  }
1911
1521
  };
1912
- Ze = qs([
1913
- w(),
1914
- mt(0, u("RendererApi")),
1915
- mt(1, u("IEditorStore"))
1916
- ], Ze);
1917
- var Bs = Object.getOwnPropertyDescriptor, Ks = (t, e, s, i) => {
1918
- for (var o = i > 1 ? void 0 : i ? Bs(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1919
- (n = t[r]) && (o = n(o) || o);
1920
- return o;
1921
- }, Vs = (t, e) => (s, i) => e(s, i, t);
1922
- let ze = class {
1522
+ ae = qt([
1523
+ u(),
1524
+ Ce(0, h("RendererApi")),
1525
+ Ce(1, h("IEditorStore"))
1526
+ ], ae);
1527
+ var Qt = Object.getOwnPropertyDescriptor, Jt = (t, e, s, i) => {
1528
+ for (var r = i > 1 ? void 0 : i ? Qt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1529
+ (n = t[o]) && (r = n(r) || r);
1530
+ return r;
1531
+ }, es = (t, e) => (s, i) => e(s, i, t);
1532
+ let he = class {
1923
1533
  constructor(t) {
1924
1534
  this._api = t;
1925
1535
  }
1926
1536
  /** Режим редактирования сцены */
1927
- mode = he.AddFigure;
1537
+ mode = V.AddFigure;
1928
1538
  /** Последняя добавленная фигура, нужно для отката через `ctrl + z`. */
1929
1539
  _lastAddedMesh = null;
1930
1540
  /** Добавление базовых фигур на сцену, которые приписаны в `FigureType`. */
1931
1541
  handle(t) {
1932
- const e = Gt[t](), s = e.getAttribute("position");
1933
- s && s.setUsage && s.setUsage(l.DynamicDrawUsage);
1934
- const i = new l.Mesh(e, vt);
1935
- i.layers.enable(0);
1936
- const o = new l.EdgesGeometry(i.geometry), r = new l.LineSegments(
1937
- o,
1938
- new l.LineBasicMaterial({ color: Hs, linewidth: 1 })
1939
- );
1940
- r.layers.set(1), i.add(r), this._api.addMesh(i), this._lastAddedMesh = i;
1542
+ const e = Qe[t](), s = e.getAttribute("position");
1543
+ s && s.setUsage && s.setUsage(a.DynamicDrawUsage);
1544
+ const i = new a.Mesh(e, je);
1545
+ i.layers.enable(Ie);
1546
+ const r = Ve(i.geometry);
1547
+ i.add(r);
1548
+ const o = ke(i.geometry);
1549
+ i.add(o), this._api.addMesh(i), this._lastAddedMesh = i;
1941
1550
  }
1942
1551
  /** Срабатывает только на `ctrl + z`. */
1943
1552
  rollback() {
@@ -1948,27 +1557,26 @@ let ze = class {
1948
1557
  this._lastAddedMesh = null;
1949
1558
  }
1950
1559
  };
1951
- ze = Ks([
1952
- w(),
1953
- Vs(0, u("RendererApi"))
1954
- ], ze);
1955
- const Js = (t) => !!t && t.isMesh;
1956
- var ei = Object.getOwnPropertyDescriptor, ti = (t, e, s, i) => {
1957
- for (var o = i > 1 ? void 0 : i ? ei(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1958
- (n = t[r]) && (o = n(o) || o);
1959
- return o;
1960
- }, ft = (t, e) => (s, i) => e(s, i, t);
1961
- let Xe = class {
1560
+ he = Jt([
1561
+ u(),
1562
+ es(0, h("RendererApi"))
1563
+ ], he);
1564
+ var ts = Object.getOwnPropertyDescriptor, ss = (t, e, s, i) => {
1565
+ for (var r = i > 1 ? void 0 : i ? ts(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1566
+ (n = t[o]) && (r = n(r) || r);
1567
+ return r;
1568
+ }, Ae = (t, e) => (s, i) => e(s, i, t);
1569
+ let le = class {
1962
1570
  constructor(t, e) {
1963
1571
  this._api = t, this._store = e;
1964
1572
  }
1965
1573
  /** Режим редактирования сцены */
1966
- mode = he.DeleteFigure;
1574
+ mode = V.DeleteFigure;
1967
1575
  /** Последняя удаленная фигура, сохраняем для отката через `ctrl + z` */
1968
1576
  _lastDeletedMesh = null;
1969
1577
  handle() {
1970
1578
  const t = this._store.getSelectedObject();
1971
- Js(t) && (this._api.removeMesh(t), this._store.setSelectedObject(null), this._lastDeletedMesh = t);
1579
+ ht(t) && (this._api.removeMesh(t), this._store.setSelectedObject(null), this._lastDeletedMesh = t);
1972
1580
  }
1973
1581
  /** Срабатывает только на `ctrl + z`. */
1974
1582
  rollback() {
@@ -1979,17 +1587,17 @@ let Xe = class {
1979
1587
  this._lastDeletedMesh = null;
1980
1588
  }
1981
1589
  };
1982
- Xe = ti([
1983
- w(),
1984
- ft(0, u("RendererApi")),
1985
- ft(1, u("IEditorStore"))
1986
- ], Xe);
1987
- var si = Object.getOwnPropertyDescriptor, ii = (t, e, s, i) => {
1988
- for (var o = i > 1 ? void 0 : i ? si(e, s) : e, r = t.length - 1, n; r >= 0; r--)
1989
- (n = t[r]) && (o = n(o) || o);
1990
- return o;
1991
- }, oi = (t, e) => (s, i) => e(s, i, t);
1992
- let Ne = class {
1590
+ le = ss([
1591
+ u(),
1592
+ Ae(0, h("RendererApi")),
1593
+ Ae(1, h("IEditorStore"))
1594
+ ], le);
1595
+ var is = Object.getOwnPropertyDescriptor, rs = (t, e, s, i) => {
1596
+ for (var r = i > 1 ? void 0 : i ? is(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1597
+ (n = t[o]) && (r = n(r) || r);
1598
+ return r;
1599
+ }, os = (t, e) => (s, i) => e(s, i, t);
1600
+ let ce = class {
1993
1601
  constructor(t) {
1994
1602
  this._renderer = t;
1995
1603
  }
@@ -2044,18 +1652,18 @@ let Ne = class {
2044
1652
  this._renderer.enableCameraLayer(t);
2045
1653
  }
2046
1654
  };
2047
- Ne = ii([
2048
- w(),
2049
- oi(0, u("EditorRenderer"))
2050
- ], Ne);
2051
- var ni = Object.getOwnPropertyDescriptor, ri = (t, e, s, i) => {
2052
- for (var o = i > 1 ? void 0 : i ? ni(e, s) : e, r = t.length - 1, n; r >= 0; r--)
2053
- (n = t[r]) && (o = n(o) || o);
2054
- return o;
2055
- }, oe = (t, e) => (s, i) => e(s, i, t);
2056
- let Fe = class {
2057
- constructor(t, e, s, i, o) {
2058
- this._displayManager = t, this._selectManager = e, this._toolManager = s, this._sceneManager = i, this._renderer = o, this.setSelectMode(I.Mesh), this.setToolMode(G.Translate);
1655
+ ce = rs([
1656
+ u(),
1657
+ os(0, h("EditorRenderer"))
1658
+ ], ce);
1659
+ var ns = Object.getOwnPropertyDescriptor, as = (t, e, s, i) => {
1660
+ for (var r = i > 1 ? void 0 : i ? ns(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1661
+ (n = t[o]) && (r = n(r) || r);
1662
+ return r;
1663
+ }, H = (t, e) => (s, i) => e(s, i, t);
1664
+ let de = class {
1665
+ constructor(t, e, s, i, r) {
1666
+ this._displayManager = t, this._selectManager = e, this._toolManager = s, this._sceneManager = i, this._renderer = r, this.setSelectMode(v.Mesh), this.setToolMode(C.Translate);
2059
1667
  }
2060
1668
  setDisplayMode(t) {
2061
1669
  this._displayManager.manage(t);
@@ -2082,32 +1690,32 @@ let Fe = class {
2082
1690
  this._displayManager.dispose(), this._selectManager.dispose(), this._renderer.dispose();
2083
1691
  }
2084
1692
  };
2085
- Fe = ri([
2086
- w(),
2087
- oe(0, u("IDisplayManager")),
2088
- oe(1, u("ISelectManager")),
2089
- oe(2, u("IToolManager")),
2090
- oe(3, u("ISceneManager")),
2091
- oe(4, u("EditorRenderer"))
2092
- ], Fe);
2093
- var ai = Object.getOwnPropertyDescriptor, hi = (t, e, s, i) => {
2094
- for (var o = i > 1 ? void 0 : i ? ai(e, s) : e, r = t.length - 1, n; r >= 0; r--)
2095
- (n = t[r]) && (o = n(o) || o);
2096
- return o;
1693
+ de = as([
1694
+ u(),
1695
+ H(0, h("IDisplayManager")),
1696
+ H(1, h("ISelectManager")),
1697
+ H(2, h("IToolManager")),
1698
+ H(3, h("ISceneManager")),
1699
+ H(4, h("EditorRenderer"))
1700
+ ], de);
1701
+ var hs = Object.getOwnPropertyDescriptor, ls = (t, e, s, i) => {
1702
+ for (var r = i > 1 ? void 0 : i ? hs(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1703
+ (n = t[o]) && (r = n(r) || r);
1704
+ return r;
2097
1705
  };
2098
- let Qe = class {
1706
+ let _e = class {
2099
1707
  /** Текущий режим выборки. */
2100
- _selectMode = I.Mesh;
1708
+ _selectMode = v.Mesh;
2101
1709
  /** Текущий выбранный инструмент. */
2102
- _toolType = G.Translate;
1710
+ _toolType = C.Translate;
2103
1711
  /** Выбранный режим отображения. */
2104
- _displayMode = ae.Plane;
1712
+ _displayMode = k.Plane;
2105
1713
  /** Выбранный объект на сцене. */
2106
1714
  _selectedObject = null;
2107
1715
  /** Слушатели событий по изменению выбранного объекта. */
2108
1716
  _selectedListeners = /* @__PURE__ */ new Set();
2109
1717
  constructor() {
2110
- $t(this, {}, { autoBind: !0 });
1718
+ qe(this, {}, { autoBind: !0 });
2111
1719
  }
2112
1720
  /** @inheritdoc */
2113
1721
  getSelectMode() {
@@ -2149,24 +1757,24 @@ let Qe = class {
2149
1757
  return this._selectedListeners.add(t), () => this._selectedListeners.delete(t);
2150
1758
  }
2151
1759
  };
2152
- Qe = hi([
2153
- w()
2154
- ], Qe);
2155
- let gt = !1;
2156
- const f = Ut.createChildContainer();
2157
- function li(t) {
2158
- return gt || (f.registerInstance("Canvas", t), f.registerSingleton("EventBus", Te), f.registerSingleton("EditorRenderer", De), f.registerSingleton("RendererApi", Ne), f.registerSingleton("IDisplayHandler", Ie), f.registerSingleton("ISelectHandler", je), f.registerSingleton("ISelectHandler", Re), f.registerSingleton("ISelectHandler", Ze), f.registerSingleton("IToolHandler", He), f.registerSingleton("IToolHandler", ke), f.registerSingleton("IToolHandler", Ye), f.registerSingleton("ISceneHandler", ze), f.registerSingleton("ISceneHandler", Xe), f.registerSingleton("IDisplayManager", Oe), f.registerSingleton("ISelectManager", Ae), f.registerSingleton("IToolManager", Le), f.registerSingleton("ISceneManager", Ce), f.registerSingleton("EditorHub", Fe), f.registerSingleton("IEditorStore", Qe), gt = !0), f;
1760
+ _e = ls([
1761
+ u()
1762
+ ], _e);
1763
+ let xe = !1;
1764
+ const d = Ge.createChildContainer();
1765
+ function cs(t) {
1766
+ return xe || (d.registerInstance("Canvas", t), d.registerSingleton("EventBus", X), d.registerSingleton("EditorRenderer", G), d.registerSingleton("RendererApi", ce), d.registerSingleton("IDisplayHandler", ee), d.registerSingleton("ISelectHandler", te), d.registerSingleton("ISelectHandler", se), d.registerSingleton("ISelectHandler", ae), d.registerSingleton("ISelectHandler", ie), d.registerSingleton("IToolHandler", re), d.registerSingleton("IToolHandler", oe), d.registerSingleton("IToolHandler", ne), d.registerSingleton("ISceneHandler", he), d.registerSingleton("ISceneHandler", le), d.registerSingleton("IDisplayManager", K), d.registerSingleton("ISelectManager", q), d.registerSingleton("IToolManager", Q), d.registerSingleton("ISceneManager", J), d.registerSingleton("EditorHub", de), d.registerSingleton("IEditorStore", _e), xe = !0), d;
2159
1767
  }
2160
- function bi(t) {
2161
- return li(t).resolve("EditorHub");
1768
+ function ys(t) {
1769
+ return cs(t).resolve("EditorHub");
2162
1770
  }
2163
1771
  export {
2164
- Fe as EditorHub,
2165
- De as EditorRenderer,
2166
- Te as EventBus,
2167
- ee as EventTopics,
2168
- yi as ObjLoader,
2169
- gi as PreviewRenderer,
2170
- Mt as Renderer,
2171
- bi as createAppHub
1772
+ de as EditorHub,
1773
+ G as EditorRenderer,
1774
+ X as EventBus,
1775
+ R as EventTopics,
1776
+ vs as ObjLoader,
1777
+ bs as PreviewRenderer,
1778
+ Re as Renderer,
1779
+ ys as createAppHub
2172
1780
  };