@planara/core 2.7.1 → 2.8.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
2
  import * as a from "three";
3
- import { Controls as Ue, Vector3 as T, MOUSE as I, TOUCH as R, Quaternion as ve, Spherical as ye, Vector2 as w, Ray as We, Plane as Fe, MathUtils as Ze } from "three";
4
- import { FigureType as S, SelectMode as v, Figure as $e, DisplayMode as V, DEFAULT_TOOL_RULES as Me, ToolType as C, SceneMode as N } from "@planara/types";
5
- import { SymmetricAxesHelper as Be, OrbitWithState as Xe, CameraAxesGizmo as Ge, ModelingTransformControls as Ke } from "@planara/three";
6
- import { injectable as u, inject as h, injectAll as W, container as qe } from "tsyringe";
7
- import { EventEmitter as Qe } from "events";
8
- import { makeAutoObservable as Je } from "mobx";
9
- const et = {
10
- [S.Plane]: () => new a.PlaneGeometry(1, 1, 1, 1),
11
- [S.Cube]: () => new a.BoxGeometry(1, 1, 1, 1, 1, 1),
12
- [S.UVSphere]: () => new a.SphereGeometry(0.5, 32, 16),
13
- [S.Icosphere]: () => new a.IcosahedronGeometry(0.5, 0),
14
- [S.Cylinder]: () => new a.CylinderGeometry(0.5, 0.5, 1, 32, 1, !1),
15
- [S.Cone]: () => new a.ConeGeometry(0.5, 1, 32, 1, !1),
16
- [S.Torus]: () => new a.TorusGeometry(0.5, 0.2, 16, 64),
17
- [S.Circle]: () => new a.CircleGeometry(0.5, 32),
18
- [S.Sphere]: () => new a.SphereGeometry(0.5, 32, 16),
19
- [S.Custom]: function() {
3
+ import { Controls as Ke, Vector3 as I, MOUSE as Y, TOUCH as z, Quaternion as Ee, Spherical as xe, Vector2 as L, Ray as qe, Plane as Qe, MathUtils as Je } from "three";
4
+ import { FigureType as D, SelectMode as y, Figure as et, DisplayMode as $, DEFAULT_TOOL_RULES as Pe, ToolType as F, SceneMode as U } from "@planara/types";
5
+ import { SymmetricAxesHelper as tt, OrbitWithState as st, CameraAxesGizmo as it, ModelingTransformControls as rt } from "@planara/three";
6
+ import { injectable as M, inject as _, injectAll as G, container as ot } from "tsyringe";
7
+ import { EventEmitter as nt } from "events";
8
+ import { makeAutoObservable as at } from "mobx";
9
+ const ht = {
10
+ [D.Plane]: () => new a.PlaneGeometry(1, 1, 1, 1),
11
+ [D.Cube]: () => new a.BoxGeometry(1, 1, 1, 1, 1, 1),
12
+ [D.UVSphere]: () => new a.SphereGeometry(0.5, 32, 16),
13
+ [D.Icosphere]: () => new a.IcosahedronGeometry(0.5, 0),
14
+ [D.Cylinder]: () => new a.CylinderGeometry(0.5, 0.5, 1, 32, 1, !1),
15
+ [D.Cone]: () => new a.ConeGeometry(0.5, 1, 32, 1, !1),
16
+ [D.Torus]: () => new a.TorusGeometry(0.5, 0.2, 16, 64),
17
+ [D.Circle]: () => new a.CircleGeometry(0.5, 32),
18
+ [D.Sphere]: () => new a.SphereGeometry(0.5, 32, 16),
19
+ [D.Custom]: function() {
20
20
  throw new Error("Custom geometry is not generated here.");
21
21
  }
22
- }, Ie = new a.MeshStandardMaterial({
22
+ }, ze = new a.MeshStandardMaterial({
23
23
  color: 12566463,
24
24
  metalness: 0,
25
25
  roughness: 0.6
26
- }), tt = 8;
27
- class He {
26
+ }), lt = 8;
27
+ class Ne {
28
28
  /** Корневой объект сцены */
29
29
  scene;
30
30
  /** Камера для сцены */
@@ -81,7 +81,7 @@ class He {
81
81
  addFigure(e) {
82
82
  const s = new a.BufferGeometry();
83
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, Ie);
84
+ const i = new a.Mesh(s, ze);
85
85
  return this.scene.add(i), this.meshes.push(i), i;
86
86
  }
87
87
  /**
@@ -172,15 +172,15 @@ class He {
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
- var st = Object.getOwnPropertyDescriptor, it = (t, e, s, i) => {
176
- for (var r = i > 1 ? void 0 : i ? st(e, s) : e, o = t.length - 1, n; o >= 0; o--)
175
+ var ct = Object.getOwnPropertyDescriptor, dt = (t, e, s, i) => {
176
+ for (var r = i > 1 ? void 0 : i ? ct(e, s) : e, o = t.length - 1, n; o >= 0; o--)
177
177
  (n = t[o]) && (r = n(r) || r);
178
178
  return r;
179
179
  };
180
- let G = class {
180
+ let Q = class {
181
181
  _emitter;
182
182
  constructor() {
183
- this._emitter = new Qe();
183
+ this._emitter = new nt();
184
184
  }
185
185
  /** Публикация события */
186
186
  emit(t, e) {
@@ -195,22 +195,22 @@ let G = class {
195
195
  this._emitter.off(t, e);
196
196
  }
197
197
  };
198
- G = it([
199
- u()
200
- ], G);
198
+ Q = dt([
199
+ M()
200
+ ], Q);
201
201
  var H = /* @__PURE__ */ ((t) => (t.SelectHover = "select.hover", t.SelectClick = "select.click", t.ToolSelect = "tool.select", t))(H || {});
202
- const rt = 0.03, ot = 0.05, ke = 0, nt = 1, at = 2, L = 31, F = 16776960, Z = 16755200, ht = 2236962, lt = 2236962, ct = (t) => !!t && t.isMesh, Ve = (t) => {
202
+ const _t = 0.03, ut = 0.05, J = 0, pt = 1, mt = 2, T = 31, Z = 16776960, X = 16755200, ft = 2236962, gt = 2236962, bt = (t) => !!t && t.isMesh, Ye = (t) => {
203
203
  let e = t;
204
204
  for (; e; ) {
205
205
  if (e.isMesh) return e;
206
206
  e = e.parent;
207
207
  }
208
208
  return null;
209
- }, Ne = (t) => {
209
+ }, $e = (t) => {
210
210
  const e = new a.BufferGeometry();
211
211
  e.setAttribute("position", t.getAttribute("position")), e.computeBoundingSphere(), e.computeBoundingBox();
212
212
  const s = new a.PointsMaterial({
213
- color: lt,
213
+ color: gt,
214
214
  size: 6,
215
215
  sizeAttenuation: !1,
216
216
  depthTest: !1,
@@ -218,36 +218,36 @@ const rt = 0.03, ot = 0.05, ke = 0, nt = 1, at = 2, L = 31, F = 16776960, Z = 16
218
218
  transparent: !0,
219
219
  opacity: 0.9
220
220
  }), i = new a.Points(e, s);
221
- return i.layers.set(at), i.renderOrder = 1e3, i.visible = !1, i;
222
- }, Ye = (t) => {
221
+ return i.layers.set(mt), i.renderOrder = 1e3, i.visible = !1, i;
222
+ }, Ue = (t) => {
223
223
  const e = new a.EdgesGeometry(t), s = new a.LineSegments(
224
224
  e,
225
- new a.LineBasicMaterial({ color: ht, linewidth: 1 })
225
+ new a.LineBasicMaterial({ color: ft, linewidth: 1 })
226
226
  );
227
- return s.layers.set(nt), s;
228
- }, dt = (t) => {
227
+ return s.layers.set(pt), s;
228
+ }, vt = (t) => {
229
229
  const e = { x: t.position.x, y: t.position.y, z: t.position.z }, s = { x: t.rotation.x, y: t.rotation.y, z: t.rotation.z }, i = { x: t.scale.x, y: t.scale.y, z: t.scale.z }, r = new a.Box3().setFromObject(t), o = new a.Vector3();
230
230
  r.getSize(o);
231
231
  const n = { x: o.x, y: o.y, z: o.z };
232
232
  return { position: e, rotation: s, scale: i, size: n };
233
233
  };
234
- var _t = Object.getOwnPropertyDescriptor, pt = (t, e, s, i) => {
235
- for (var r = i > 1 ? void 0 : i ? _t(e, s) : e, o = t.length - 1, n; o >= 0; o--)
234
+ var yt = Object.getOwnPropertyDescriptor, Mt = (t, e, s, i) => {
235
+ for (var r = i > 1 ? void 0 : i ? yt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
236
236
  (n = t[o]) && (r = n(r) || r);
237
237
  return r;
238
- }, Ee = (t, e) => (s, i) => e(s, i, t);
239
- let K = class extends He {
238
+ }, Oe = (t, e) => (s, i) => e(s, i, t);
239
+ let ee = class extends Ne {
240
240
  constructor(t, e) {
241
241
  super(t), this._canvas = t, this._bus = e;
242
242
  const s = new a.GridHelper(10, 10);
243
243
  s.position.y = -1e-3, this.scene.add(s);
244
- const i = new Be(6);
245
- this.scene.add(i), this._orbit = new Xe(this.camera, this.renderer.domElement), this._orbit.enableDamping = !0, this._orbit.dampingFactor = 0.05, this._cameraGizmo = new Ge(this.renderer, this.camera, {
244
+ const i = new tt(6);
245
+ this.scene.add(i), this._orbit = new st(this.camera, this.renderer.domElement), this._orbit.enableDamping = !0, this._orbit.dampingFactor = 0.05, this._cameraGizmo = new it(this.renderer, this.camera, {
246
246
  size: 96,
247
247
  // Размер квадрата
248
248
  margin: 36
249
249
  // Отступы по сторонам (снизу и справа)
250
- }), 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 Ke(this.camera, this.renderer.domElement), this._transformHelper = this._transform.getHelper(), this.scene.add(this._transformHelper), this._isEventListenersAdded || this._initMouseListeners();
250
+ }), 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 rt(this.camera, this.renderer.domElement), this._transformHelper = this._transform.getHelper(), this.scene.add(this._transformHelper), this._isEventListenersAdded || this._initMouseListeners();
251
251
  }
252
252
  /** Orbit-контроллер для управления камерой */
253
253
  _orbit;
@@ -261,10 +261,11 @@ let K = class extends He {
261
261
  /** Были ли инициализированы обработчики событий (hover/click) */
262
262
  _isEventListenersAdded = !1;
263
263
  /**
264
- * Последняя модель на которую наводились,
264
+ * Ключ последней модели, на которую наводились,
265
265
  * необходима для отправки только уникальных событий в event bus
266
266
  */
267
- _lastHovered = null;
267
+ _lastHoverKey = null;
268
+ _currentRaycastMode = y.Mesh;
268
269
  /** Gizmo для управления отображением perspective camera */
269
270
  _cameraGizmo;
270
271
  _transformListeners = /* @__PURE__ */ new Set();
@@ -277,10 +278,10 @@ let K = class extends He {
277
278
  /** Добавление фигуры на сцену */
278
279
  addFigure(t) {
279
280
  const e = super.addFigure(t);
280
- e.layers.enable(ke);
281
- const s = Ye(e.geometry);
281
+ e.layers.enable(J);
282
+ const s = Ue(e.geometry);
282
283
  e.add(s);
283
- const i = Ne(e.geometry);
284
+ const i = $e(e.geometry);
284
285
  return e.add(i), e;
285
286
  }
286
287
  /**
@@ -319,30 +320,30 @@ let K = class extends He {
319
320
  */
320
321
  setRaycastMode(t) {
321
322
  const e = this._raycaster;
322
- switch (e.params.Line.threshold = 0, e.params.Points.threshold = 0, t) {
323
- case v.Mesh:
324
- case v.Face:
323
+ switch (e.params.Line.threshold = 0, e.params.Points.threshold = 0, this._currentRaycastMode = t, this._lastHoverKey = null, t) {
324
+ case y.Mesh:
325
+ case y.Face:
325
326
  e.layers.set(0);
326
327
  break;
327
- case v.Edge:
328
- e.layers.set(1), e.params.Line.threshold = rt;
328
+ case y.Edge:
329
+ e.layers.set(1), e.params.Line.threshold = _t;
329
330
  break;
330
- case v.Vertex:
331
- e.layers.set(2), e.params.Points.threshold = ot;
331
+ case y.Vertex:
332
+ e.layers.set(2), e.params.Points.threshold = ut;
332
333
  break;
333
334
  }
334
335
  }
335
336
  dispose() {
336
- this._isEventListenersAdded && (this.canvas.removeEventListener("mousemove", this._handleMouseMove, !1), this.canvas.removeEventListener("click", this._handleMouseClick, !1), this.canvas.removeEventListener("pointerdown", (t) => this._transform.pointerDown(t)), this.canvas.removeEventListener("pointermove", (t) => this._transform.pointerMove(t)), this.canvas.removeEventListener("pointerup", (t) => this._transform.pointerUp(t)), this.canvas.removeEventListener("pointerleave", () => this._transform.pointerHover(null)), this._transform.removeEventListener("dragging-changed", () => {
337
+ this._isEventListenersAdded && (this._canvas.removeEventListener("mousemove", this._handleMouseMove, !1), this._canvas.removeEventListener("click", this._handleMouseClick, !1), this._canvas.removeEventListener("dblclick", this._handleDoubleClick, !1), this._canvas.removeEventListener("pointerdown", (t) => this._transform.pointerDown(t)), this._canvas.removeEventListener("pointermove", (t) => this._transform.pointerMove(t)), this._canvas.removeEventListener("pointerup", (t) => this._transform.pointerUp(t)), this._canvas.removeEventListener("pointerleave", () => this._transform.pointerHover(null)), this._transform.removeEventListener("dragging-changed", () => {
337
338
  this._orbit.enabled = !this._transform.dragging;
338
- }), this._transformListeners.clear(), this._isEventListenersAdded = !1), this._orbit?.dispose(), this._transform?.dispose(), this._transformHelper?.parent && this._transformHelper.parent.remove(this._transformHelper), this._lastHovered = null, super.dispose();
339
+ }), this._transformListeners.clear(), this._isEventListenersAdded = !1), this._orbit?.dispose(), this._transform?.dispose(), this._transformHelper?.parent && this._transformHelper.parent.remove(this._transformHelper), this._lastHoverKey = null, super.dispose();
339
340
  }
340
341
  render() {
341
- super.render(), this._cameraGizmo.render(this.canvas.width, this.canvas.height);
342
+ super.render(), this._cameraGizmo.render(this._canvas.width, this._canvas.height);
342
343
  }
343
344
  /** Инициализация обработчиков событий на hover/click */
344
345
  _initMouseListeners() {
345
- this.canvas.addEventListener("mousemove", this._handleMouseMove, !1), this.canvas.addEventListener("click", this._handleMouseClick, !1), this.canvas.addEventListener("pointerdown", (t) => this._transform.pointerDown(t)), this.canvas.addEventListener("pointermove", (t) => this._transform.pointerMove(t)), this.canvas.addEventListener("pointerup", (t) => this._transform.pointerUp(t)), this.canvas.addEventListener("pointerleave", () => this._transform.pointerHover(null)), this._transform.addEventListener("dragging-changed", () => {
346
+ this._canvas.addEventListener("mousemove", this._handleMouseMove, !1), this._canvas.addEventListener("click", this._handleMouseClick, !1), this._canvas.addEventListener("dblclick", this._handleDoubleClick, !1), this._canvas.addEventListener("pointerdown", (t) => this._transform.pointerDown(t)), this._canvas.addEventListener("pointermove", (t) => this._transform.pointerMove(t)), this._canvas.addEventListener("pointerup", (t) => this._transform.pointerUp(t)), this._canvas.addEventListener("pointerleave", () => this._transform.pointerHover(null)), this._transform.addEventListener("dragging-changed", () => {
346
347
  this._orbit.enabled = !this._transform.dragging;
347
348
  }), this._transform.addEventListener("objectChange", () => {
348
349
  for (const t of this._transformListeners) t();
@@ -356,21 +357,70 @@ let K = class extends He {
356
357
  _handleMouseClick = (t) => {
357
358
  this._processRaycastEvent(t, H.SelectClick, !1);
358
359
  };
360
+ /** Возвращает ближайшее пересечение по текущему положению курсора */
361
+ _getHitIntersection(t) {
362
+ if (this._orbit.isInteracting || this._transform.dragging) return;
363
+ const e = this._canvas.getBoundingClientRect();
364
+ this._mouse.x = (t.clientX - e.left) / e.width * 2 - 1, this._mouse.y = -((t.clientY - e.top) / e.height) * 2 + 1, this._raycaster.setFromCamera(this._mouse, this.camera);
365
+ const s = this._raycaster.intersectObjects(this.meshes, !0)[0] ?? null;
366
+ if (this._currentRaycastMode === y.Mesh || this._currentRaycastMode === y.Face)
367
+ return s;
368
+ const i = this._raycaster.layers.mask;
369
+ this._raycaster.layers.set(J);
370
+ const r = this._raycaster.intersectObjects(this.meshes, !0)[0] ?? null;
371
+ return this._raycaster.layers.mask = i, this._getVisibleHit(s, r);
372
+ }
373
+ _handleDoubleClick = (t) => {
374
+ const e = this._getHitIntersection(t);
375
+ e !== void 0 && (e || this._bus.emit(H.SelectClick, null));
376
+ };
377
+ // Hover сравнивается не только по object, но и по режимному ключу попадания.
378
+ // Это нужно для Face/Edge/Vertex режимов, где разные элементы могут принадлежать одному и тому же Object3D.
359
379
  /** Вспомогательный метод для получения модели, которую выбрали и отправки события в event bus */
360
380
  _processRaycastEvent(t, e, s) {
361
- if (this._orbit.isInteracting || this._transform.dragging) return;
362
- const i = this._canvas.getBoundingClientRect();
363
- 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);
364
- const o = this._raycaster.intersectObjects(this.meshes, !0)[0] ?? null, n = o?.object ?? null;
365
- 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);
381
+ const i = this._getHitIntersection(t);
382
+ if (i === void 0) return;
383
+ const r = i?.object ?? null;
384
+ if (s) {
385
+ if (!i) {
386
+ this.meshes.forEach((n) => n.userData.isHit = !1), this._lastHoverKey = null, this._bus.emit(e, null);
387
+ return;
388
+ }
389
+ const o = this._makeHoverKey(i);
390
+ o !== this._lastHoverKey && (this.meshes.forEach((n) => n.userData.isHit = !1), r && (r.userData.isHit = !0), this._lastHoverKey = o, this._bus.emit(e, { intersection: i }));
391
+ return;
392
+ }
393
+ i && this._bus.emit(e, { intersection: i });
394
+ }
395
+ /** Поиск видимой части меша
396
+ * необходимо это для того, чтобы отправлять только видимые элементы модели, а не все попадания
397
+ */
398
+ _getVisibleHit(t, e, s = 1e-4) {
399
+ return t ? e ? t.distance <= e.distance + s ? t : null : t : null;
400
+ }
401
+ /** Строит ключ hover-пересечения с учетом текущего режима выборки */
402
+ _makeHoverKey(t) {
403
+ if (!t) return null;
404
+ const e = t.object.uuid;
405
+ switch (this._currentRaycastMode) {
406
+ case y.Face:
407
+ return `${e}:face:${t.faceIndex ?? -1}`;
408
+ case y.Edge:
409
+ return `${e}:edge:${Math.floor((t.index ?? -1) / 2)}`;
410
+ case y.Vertex:
411
+ return `${e}:vertex:${t.index ?? -1}`;
412
+ case y.Mesh:
413
+ default:
414
+ return `${e}:mesh`;
415
+ }
366
416
  }
367
417
  };
368
- K = pt([
369
- u(),
370
- Ee(0, h("Canvas")),
371
- Ee(1, h("EventBus"))
372
- ], K);
373
- const we = { type: "change" }, ue = { type: "start" }, ze = { type: "end" }, U = new We(), Se = new Fe(), ut = Math.cos(70 * Ze.DEG2RAD), p = new T(), g = 2 * Math.PI, l = {
418
+ ee = Mt([
419
+ M(),
420
+ Oe(0, _("Canvas")),
421
+ Oe(1, _("EventBus"))
422
+ ], ee);
423
+ const Te = { type: "change" }, be = { type: "start" }, Be = { type: "end" }, B = new qe(), Le = new Qe(), wt = Math.cos(70 * Je.DEG2RAD), v = new I(), P = 2 * Math.PI, p = {
374
424
  NONE: -1,
375
425
  ROTATE: 0,
376
426
  DOLLY: 1,
@@ -379,8 +429,8 @@ const we = { type: "change" }, ue = { type: "start" }, ze = { type: "end" }, U =
379
429
  TOUCH_PAN: 4,
380
430
  TOUCH_DOLLY_PAN: 5,
381
431
  TOUCH_DOLLY_ROTATE: 6
382
- }, B = 1e-6;
383
- class mt extends Ue {
432
+ }, K = 1e-6;
433
+ class St extends Ke {
384
434
  /**
385
435
  * Constructs a new controls instance.
386
436
  *
@@ -388,7 +438,7 @@ class mt extends Ue {
388
438
  * @param {?HTMLElement} domElement - The HTML element used for event listeners.
389
439
  */
390
440
  constructor(e, s = null) {
391
- super(e, s), this.state = l.NONE, this.target = new T(), this.cursor = new T(), 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: I.ROTATE, MIDDLE: I.DOLLY, RIGHT: I.PAN }, this.touches = { ONE: R.ROTATE, TWO: R.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new T(), this._lastQuaternion = new ve(), this._lastTargetPosition = new T(), this._quat = new ve().setFromUnitVectors(e.up, new T(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ye(), this._sphericalDelta = new ye(), this._scale = 1, this._panOffset = new T(), this._rotateStart = new w(), this._rotateEnd = new w(), this._rotateDelta = new w(), this._panStart = new w(), this._panEnd = new w(), this._panDelta = new w(), this._dollyStart = new w(), this._dollyEnd = new w(), this._dollyDelta = new w(), this._dollyDirection = new T(), this._mouse = new w(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = gt.bind(this), this._onPointerDown = ft.bind(this), this._onPointerUp = bt.bind(this), this._onContextMenu = Pt.bind(this), this._onMouseWheel = Mt.bind(this), this._onKeyDown = Et.bind(this), this._onTouchStart = wt.bind(this), this._onTouchMove = St.bind(this), this._onMouseDown = vt.bind(this), this._onMouseMove = yt.bind(this), this._interceptControlDown = Ot.bind(this), this._interceptControlUp = Tt.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
441
+ super(e, s), this.state = p.NONE, this.target = new I(), this.cursor = new I(), 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: Y.ROTATE, MIDDLE: Y.DOLLY, RIGHT: Y.PAN }, this.touches = { ONE: z.ROTATE, TWO: z.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new I(), this._lastQuaternion = new Ee(), this._lastTargetPosition = new I(), this._quat = new Ee().setFromUnitVectors(e.up, new I(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new xe(), this._sphericalDelta = new xe(), this._scale = 1, this._panOffset = new I(), 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 I(), this._mouse = new L(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = xt.bind(this), this._onPointerDown = Et.bind(this), this._onPointerUp = Pt.bind(this), this._onContextMenu = It.bind(this), this._onMouseWheel = Lt.bind(this), this._onKeyDown = Dt.bind(this), this._onTouchStart = Ct.bind(this), this._onTouchMove = At.bind(this), this._onMouseDown = Ot.bind(this), this._onMouseMove = Tt.bind(this), this._interceptControlDown = jt.bind(this), this._interceptControlUp = Rt.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
392
442
  }
393
443
  connect(e) {
394
444
  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";
@@ -449,13 +499,13 @@ class mt extends Ue {
449
499
  * was called, or the initial state.
450
500
  */
451
501
  reset() {
452
- this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(we), this.update(), this.state = l.NONE;
502
+ this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Te), this.update(), this.state = p.NONE;
453
503
  }
454
504
  update(e = null) {
455
505
  const s = this.object.position;
456
- 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);
506
+ v.copy(s).sub(this.target), v.applyQuaternion(this._quat), this._spherical.setFromVector3(v), 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);
457
507
  let i = this.minAzimuthAngle, r = this.maxAzimuthAngle;
458
- 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);
508
+ isFinite(i) && isFinite(r) && (i < -Math.PI ? i += P : i > Math.PI && (i -= P), r < -Math.PI ? r += P : r > Math.PI && (r -= P), 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);
459
509
  let o = !1;
460
510
  if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
461
511
  this._spherical.radius = this._clampDistance(this._spherical.radius);
@@ -463,31 +513,31 @@ class mt extends Ue {
463
513
  const n = this._spherical.radius;
464
514
  this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), o = n != this._spherical.radius;
465
515
  }
466
- 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) {
516
+ if (v.setFromSpherical(this._spherical), v.applyQuaternion(this._quatInverse), s.copy(this.target).add(v), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
467
517
  let n = null;
468
518
  if (this.object.isPerspectiveCamera) {
469
- const c = p.length();
470
- n = this._clampDistance(c * this._scale);
471
- const _ = c - n;
472
- this.object.position.addScaledVector(this._dollyDirection, _), this.object.updateMatrixWorld(), o = !!_;
519
+ const h = v.length();
520
+ n = this._clampDistance(h * this._scale);
521
+ const l = h - n;
522
+ this.object.position.addScaledVector(this._dollyDirection, l), this.object.updateMatrixWorld(), o = !!l;
473
523
  } else if (this.object.isOrthographicCamera) {
474
- const c = new T(this._mouse.x, this._mouse.y, 0);
475
- c.unproject(this.object);
476
- const _ = this.object.zoom;
477
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), o = _ !== this.object.zoom;
478
- const m = new T(this._mouse.x, this._mouse.y, 0);
479
- m.unproject(this.object), this.object.position.sub(m).add(c), this.object.updateMatrixWorld(), n = p.length();
524
+ const h = new I(this._mouse.x, this._mouse.y, 0);
525
+ h.unproject(this.object);
526
+ const l = this.object.zoom;
527
+ this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), o = l !== this.object.zoom;
528
+ const c = new I(this._mouse.x, this._mouse.y, 0);
529
+ c.unproject(this.object), this.object.position.sub(c).add(h), this.object.updateMatrixWorld(), n = v.length();
480
530
  } else
481
531
  console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
482
- 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)) < ut ? this.object.lookAt(this.target) : (Se.setFromNormalAndCoplanarPoint(this.object.up, this.target), U.intersectPlane(Se, this.target))));
532
+ n !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(n).add(this.object.position) : (B.origin.copy(this.object.position), B.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(B.direction)) < wt ? this.object.lookAt(this.target) : (Le.setFromNormalAndCoplanarPoint(this.object.up, this.target), B.intersectPlane(Le, this.target))));
483
533
  } else if (this.object.isOrthographicCamera) {
484
534
  const n = this.object.zoom;
485
535
  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);
486
536
  }
487
- return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) > B || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > B || this._lastTargetPosition.distanceToSquared(this.target) > B ? (this.dispatchEvent(we), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
537
+ return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) > K || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > K || this._lastTargetPosition.distanceToSquared(this.target) > K ? (this.dispatchEvent(Te), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
488
538
  }
489
539
  _getAutoRotationAngle(e) {
490
- return e !== null ? g / 60 * this.autoRotateSpeed * e : g / 60 / 60 * this.autoRotateSpeed;
540
+ return e !== null ? P / 60 * this.autoRotateSpeed * e : P / 60 / 60 * this.autoRotateSpeed;
491
541
  }
492
542
  _getZoomScale(e) {
493
543
  const s = Math.abs(e * 0.01);
@@ -500,18 +550,18 @@ class mt extends Ue {
500
550
  this._sphericalDelta.phi -= e;
501
551
  }
502
552
  _panLeft(e, s) {
503
- p.setFromMatrixColumn(s, 0), p.multiplyScalar(-e), this._panOffset.add(p);
553
+ v.setFromMatrixColumn(s, 0), v.multiplyScalar(-e), this._panOffset.add(v);
504
554
  }
505
555
  _panUp(e, s) {
506
- this.screenSpacePanning === !0 ? p.setFromMatrixColumn(s, 1) : (p.setFromMatrixColumn(s, 0), p.crossVectors(this.object.up, p)), p.multiplyScalar(e), this._panOffset.add(p);
556
+ this.screenSpacePanning === !0 ? v.setFromMatrixColumn(s, 1) : (v.setFromMatrixColumn(s, 0), v.crossVectors(this.object.up, v)), v.multiplyScalar(e), this._panOffset.add(v);
507
557
  }
508
558
  // deltaX and deltaY are in pixels; right and down are positive
509
559
  _pan(e, s) {
510
560
  const i = this.domElement;
511
561
  if (this.object.isPerspectiveCamera) {
512
562
  const r = this.object.position;
513
- p.copy(r).sub(this.target);
514
- let o = p.length();
563
+ v.copy(r).sub(this.target);
564
+ let o = v.length();
515
565
  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);
516
566
  } 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);
517
567
  }
@@ -525,8 +575,8 @@ class mt extends Ue {
525
575
  if (!this.zoomToCursor)
526
576
  return;
527
577
  this._performCursorZoom = !0;
528
- const i = this.domElement.getBoundingClientRect(), r = e - i.left, o = s - i.top, n = i.width, c = i.height;
529
- 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();
578
+ const i = this.domElement.getBoundingClientRect(), r = e - i.left, o = s - i.top, n = i.width, h = i.height;
579
+ this._mouse.x = r / n * 2 - 1, this._mouse.y = -(o / h) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
530
580
  }
531
581
  _clampDistance(e) {
532
582
  return Math.max(this.minDistance, Math.min(this.maxDistance, e));
@@ -546,7 +596,7 @@ class mt extends Ue {
546
596
  _handleMouseMoveRotate(e) {
547
597
  this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
548
598
  const s = this.domElement;
549
- this._rotateLeft(g * this._rotateDelta.x / s.clientHeight), this._rotateUp(g * this._rotateDelta.y / s.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
599
+ this._rotateLeft(P * this._rotateDelta.x / s.clientHeight), this._rotateUp(P * this._rotateDelta.y / s.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
550
600
  }
551
601
  _handleMouseMoveDolly(e) {
552
602
  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();
@@ -561,16 +611,16 @@ class mt extends Ue {
561
611
  let s = !1;
562
612
  switch (e.code) {
563
613
  case this.keys.UP:
564
- 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;
614
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(P * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), s = !0;
565
615
  break;
566
616
  case this.keys.BOTTOM:
567
- 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;
617
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-P * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), s = !0;
568
618
  break;
569
619
  case this.keys.LEFT:
570
- 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;
620
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(P * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), s = !0;
571
621
  break;
572
622
  case this.keys.RIGHT:
573
- 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;
623
+ e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-P * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), s = !0;
574
624
  break;
575
625
  }
576
626
  s && (e.preventDefault(), this.update());
@@ -610,7 +660,7 @@ class mt extends Ue {
610
660
  }
611
661
  this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
612
662
  const s = this.domElement;
613
- this._rotateLeft(g * this._rotateDelta.x / s.clientHeight), this._rotateUp(g * this._rotateDelta.y / s.clientHeight), this._rotateStart.copy(this._rotateEnd);
663
+ this._rotateLeft(P * this._rotateDelta.x / s.clientHeight), this._rotateUp(P * this._rotateDelta.y / s.clientHeight), this._rotateStart.copy(this._rotateEnd);
614
664
  }
615
665
  _handleTouchMovePan(e) {
616
666
  if (this._pointers.length === 1)
@@ -624,8 +674,8 @@ class mt extends Ue {
624
674
  _handleTouchMoveDolly(e) {
625
675
  const s = this._getSecondPointerPosition(e), i = e.pageX - s.x, r = e.pageY - s.y, o = Math.sqrt(i * i + r * r);
626
676
  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);
627
- const n = (e.pageX + s.x) * 0.5, c = (e.pageY + s.y) * 0.5;
628
- this._updateZoomParameters(n, c);
677
+ const n = (e.pageX + s.x) * 0.5, h = (e.pageY + s.y) * 0.5;
678
+ this._updateZoomParameters(n, h);
629
679
  }
630
680
  _handleTouchMoveDollyPan(e) {
631
681
  this.enableZoom && this._handleTouchMoveDolly(e), this.enablePan && this._handleTouchMovePan(e);
@@ -652,7 +702,7 @@ class mt extends Ue {
652
702
  }
653
703
  _trackPointer(e) {
654
704
  let s = this._pointerPositions[e.pointerId];
655
- s === void 0 && (s = new w(), this._pointerPositions[e.pointerId] = s), s.set(e.pageX, e.pageY);
705
+ s === void 0 && (s = new L(), this._pointerPositions[e.pointerId] = s), s.set(e.pageX, e.pageY);
656
706
  }
657
707
  _getSecondPointerPosition(e) {
658
708
  const s = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
@@ -676,16 +726,16 @@ class mt extends Ue {
676
726
  return e.ctrlKey && !this._controlActive && (i.deltaY *= 10), i;
677
727
  }
678
728
  }
679
- function ft(t) {
729
+ function Et(t) {
680
730
  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)));
681
731
  }
682
- function gt(t) {
732
+ function xt(t) {
683
733
  this.enabled !== !1 && (t.pointerType === "touch" ? this._onTouchMove(t) : this._onMouseMove(t));
684
734
  }
685
- function bt(t) {
735
+ function Pt(t) {
686
736
  switch (this._removePointer(t), this._pointers.length) {
687
737
  case 0:
688
- this.domElement.releasePointerCapture(t.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(ze), this.state = l.NONE;
738
+ this.domElement.releasePointerCapture(t.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(Be), this.state = p.NONE;
689
739
  break;
690
740
  case 1:
691
741
  const e = this._pointers[0], s = this._pointerPositions[e];
@@ -693,7 +743,7 @@ function bt(t) {
693
743
  break;
694
744
  }
695
745
  }
696
- function vt(t) {
746
+ function Ot(t) {
697
747
  let e;
698
748
  switch (t.button) {
699
749
  case 0:
@@ -709,126 +759,126 @@ function vt(t) {
709
759
  e = -1;
710
760
  }
711
761
  switch (e) {
712
- case I.DOLLY:
762
+ case Y.DOLLY:
713
763
  if (this.enableZoom === !1) return;
714
- this._handleMouseDownDolly(t), this.state = l.DOLLY;
764
+ this._handleMouseDownDolly(t), this.state = p.DOLLY;
715
765
  break;
716
- case I.ROTATE:
766
+ case Y.ROTATE:
717
767
  if (t.ctrlKey || t.metaKey || t.shiftKey) {
718
768
  if (this.enablePan === !1) return;
719
- this._handleMouseDownPan(t), this.state = l.PAN;
769
+ this._handleMouseDownPan(t), this.state = p.PAN;
720
770
  } else {
721
771
  if (this.enableRotate === !1) return;
722
- this._handleMouseDownRotate(t), this.state = l.ROTATE;
772
+ this._handleMouseDownRotate(t), this.state = p.ROTATE;
723
773
  }
724
774
  break;
725
- case I.PAN:
775
+ case Y.PAN:
726
776
  if (t.ctrlKey || t.metaKey || t.shiftKey) {
727
777
  if (this.enableRotate === !1) return;
728
- this._handleMouseDownRotate(t), this.state = l.ROTATE;
778
+ this._handleMouseDownRotate(t), this.state = p.ROTATE;
729
779
  } else {
730
780
  if (this.enablePan === !1) return;
731
- this._handleMouseDownPan(t), this.state = l.PAN;
781
+ this._handleMouseDownPan(t), this.state = p.PAN;
732
782
  }
733
783
  break;
734
784
  default:
735
- this.state = l.NONE;
785
+ this.state = p.NONE;
736
786
  }
737
- this.state !== l.NONE && this.dispatchEvent(ue);
787
+ this.state !== p.NONE && this.dispatchEvent(be);
738
788
  }
739
- function yt(t) {
789
+ function Tt(t) {
740
790
  switch (this.state) {
741
- case l.ROTATE:
791
+ case p.ROTATE:
742
792
  if (this.enableRotate === !1) return;
743
793
  this._handleMouseMoveRotate(t);
744
794
  break;
745
- case l.DOLLY:
795
+ case p.DOLLY:
746
796
  if (this.enableZoom === !1) return;
747
797
  this._handleMouseMoveDolly(t);
748
798
  break;
749
- case l.PAN:
799
+ case p.PAN:
750
800
  if (this.enablePan === !1) return;
751
801
  this._handleMouseMovePan(t);
752
802
  break;
753
803
  }
754
804
  }
755
- function Mt(t) {
756
- this.enabled === !1 || this.enableZoom === !1 || this.state !== l.NONE || (t.preventDefault(), this.dispatchEvent(ue), this._handleMouseWheel(this._customWheelEvent(t)), this.dispatchEvent(ze));
805
+ function Lt(t) {
806
+ this.enabled === !1 || this.enableZoom === !1 || this.state !== p.NONE || (t.preventDefault(), this.dispatchEvent(be), this._handleMouseWheel(this._customWheelEvent(t)), this.dispatchEvent(Be));
757
807
  }
758
- function Et(t) {
808
+ function Dt(t) {
759
809
  this.enabled !== !1 && this._handleKeyDown(t);
760
810
  }
761
- function wt(t) {
811
+ function Ct(t) {
762
812
  switch (this._trackPointer(t), this._pointers.length) {
763
813
  case 1:
764
814
  switch (this.touches.ONE) {
765
- case R.ROTATE:
815
+ case z.ROTATE:
766
816
  if (this.enableRotate === !1) return;
767
- this._handleTouchStartRotate(t), this.state = l.TOUCH_ROTATE;
817
+ this._handleTouchStartRotate(t), this.state = p.TOUCH_ROTATE;
768
818
  break;
769
- case R.PAN:
819
+ case z.PAN:
770
820
  if (this.enablePan === !1) return;
771
- this._handleTouchStartPan(t), this.state = l.TOUCH_PAN;
821
+ this._handleTouchStartPan(t), this.state = p.TOUCH_PAN;
772
822
  break;
773
823
  default:
774
- this.state = l.NONE;
824
+ this.state = p.NONE;
775
825
  }
776
826
  break;
777
827
  case 2:
778
828
  switch (this.touches.TWO) {
779
- case R.DOLLY_PAN:
829
+ case z.DOLLY_PAN:
780
830
  if (this.enableZoom === !1 && this.enablePan === !1) return;
781
- this._handleTouchStartDollyPan(t), this.state = l.TOUCH_DOLLY_PAN;
831
+ this._handleTouchStartDollyPan(t), this.state = p.TOUCH_DOLLY_PAN;
782
832
  break;
783
- case R.DOLLY_ROTATE:
833
+ case z.DOLLY_ROTATE:
784
834
  if (this.enableZoom === !1 && this.enableRotate === !1) return;
785
- this._handleTouchStartDollyRotate(t), this.state = l.TOUCH_DOLLY_ROTATE;
835
+ this._handleTouchStartDollyRotate(t), this.state = p.TOUCH_DOLLY_ROTATE;
786
836
  break;
787
837
  default:
788
- this.state = l.NONE;
838
+ this.state = p.NONE;
789
839
  }
790
840
  break;
791
841
  default:
792
- this.state = l.NONE;
842
+ this.state = p.NONE;
793
843
  }
794
- this.state !== l.NONE && this.dispatchEvent(ue);
844
+ this.state !== p.NONE && this.dispatchEvent(be);
795
845
  }
796
- function St(t) {
846
+ function At(t) {
797
847
  switch (this._trackPointer(t), this.state) {
798
- case l.TOUCH_ROTATE:
848
+ case p.TOUCH_ROTATE:
799
849
  if (this.enableRotate === !1) return;
800
850
  this._handleTouchMoveRotate(t), this.update();
801
851
  break;
802
- case l.TOUCH_PAN:
852
+ case p.TOUCH_PAN:
803
853
  if (this.enablePan === !1) return;
804
854
  this._handleTouchMovePan(t), this.update();
805
855
  break;
806
- case l.TOUCH_DOLLY_PAN:
856
+ case p.TOUCH_DOLLY_PAN:
807
857
  if (this.enableZoom === !1 && this.enablePan === !1) return;
808
858
  this._handleTouchMoveDollyPan(t), this.update();
809
859
  break;
810
- case l.TOUCH_DOLLY_ROTATE:
860
+ case p.TOUCH_DOLLY_ROTATE:
811
861
  if (this.enableZoom === !1 && this.enableRotate === !1) return;
812
862
  this._handleTouchMoveDollyRotate(t), this.update();
813
863
  break;
814
864
  default:
815
- this.state = l.NONE;
865
+ this.state = p.NONE;
816
866
  }
817
867
  }
818
- function Pt(t) {
868
+ function It(t) {
819
869
  this.enabled !== !1 && t.preventDefault();
820
870
  }
821
- function Ot(t) {
871
+ function jt(t) {
822
872
  t.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
823
873
  }
824
- function Tt(t) {
874
+ function Rt(t) {
825
875
  t.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
826
876
  }
827
- class Es extends He {
877
+ class Ls extends Ne {
828
878
  /** Orbit-контроллер для управления камерой */
829
879
  _orbit;
830
880
  constructor(e) {
831
- super(e), this.camera.position.set(1, 1, 7), this.camera.lookAt(0, 0, 0), this._orbit = new mt(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;
881
+ super(e), this.camera.position.set(1, 1, 7), this.camera.lookAt(0, 0, 0), this._orbit = new St(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;
832
882
  }
833
883
  /**
834
884
  * Обновление состояния рендерера.
@@ -837,7 +887,7 @@ class Es extends He {
837
887
  this._orbit?.update();
838
888
  }
839
889
  }
840
- class ws {
890
+ class Ds {
841
891
  /** Позиции вершин */
842
892
  _positions = [];
843
893
  /** Нормали вершин */
@@ -874,12 +924,12 @@ class ws {
874
924
  }
875
925
  }
876
926
  const i = {
877
- type: S.Custom,
927
+ type: D.Custom,
878
928
  position: this._positions,
879
929
  ...this._normals.length > 0 && { normal: this._normals },
880
930
  ...this._uvs.length > 0 && { uv: this._uvs }
881
931
  };
882
- return new $e(i);
932
+ return new et(i);
883
933
  }
884
934
  /**
885
935
  * Обрабатывает строку face (f) и разворачивает индексы в массивы для рендеринга
@@ -888,60 +938,60 @@ class ws {
888
938
  for (let s = 1; s < e.length; s++) {
889
939
  const i = e[s];
890
940
  if (!i) continue;
891
- 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;
892
- if (c !== void 0) {
893
- const f = this._tmpPositions[c - 1];
894
- f && this._positions.push(...f);
941
+ const [r, o, n] = i.split("/"), h = r ? parseInt(r, 10) : void 0, l = o ? parseInt(o, 10) : void 0, c = n ? parseInt(n, 10) : void 0;
942
+ if (h !== void 0) {
943
+ const d = this._tmpPositions[h - 1];
944
+ d && this._positions.push(...d);
895
945
  }
896
- if (_ !== void 0) {
897
- const f = this._tmpUVs[_ - 1];
898
- f && this._uvs.push(...f);
946
+ if (l !== void 0) {
947
+ const d = this._tmpUVs[l - 1];
948
+ d && this._uvs.push(...d);
899
949
  }
900
- if (m !== void 0) {
901
- const f = this._tmpNormals[m - 1];
902
- f && this._normals.push(...f);
950
+ if (c !== void 0) {
951
+ const d = this._tmpNormals[c - 1];
952
+ d && this._normals.push(...d);
903
953
  }
904
954
  }
905
955
  }
906
956
  }
907
- var Lt = Object.getOwnPropertyDescriptor, Dt = (t, e, s, i) => {
908
- for (var r = i > 1 ? void 0 : i ? Lt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
957
+ var Vt = Object.getOwnPropertyDescriptor, kt = (t, e, s, i) => {
958
+ for (var r = i > 1 ? void 0 : i ? Vt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
909
959
  (n = t[o]) && (r = n(r) || r);
910
960
  return r;
911
- }, Pe = (t, e) => (s, i) => e(s, i, t);
912
- let q = class {
961
+ }, De = (t, e) => (s, i) => e(s, i, t);
962
+ let te = class {
913
963
  constructor(t, e) {
914
964
  this._store = e, this._handlers = new Map(t.map((s) => [s.mode, s]));
915
965
  }
916
966
  /** Текущий режим отображения */
917
- _currentMode = V.Plane;
967
+ _currentMode = $.Plane;
918
968
  /** Хендлеры, которые управляют отображением */
919
969
  _handlers;
920
970
  /** Установка режима отображения */
921
971
  manage(t) {
922
- t !== this._currentMode && (this._handlers.get(this._currentMode)?.rollback(), t !== V.Plane && this._handlers.get(t)?.handle(), this._currentMode = t, this._store.setDisplayMode(this._currentMode));
972
+ t !== this._currentMode && (this._handlers.get(this._currentMode)?.rollback(), t !== $.Plane && this._handlers.get(t)?.handle(), this._currentMode = t, this._store.setDisplayMode(this._currentMode));
923
973
  }
924
974
  /** Освобождает ресурсы менеджера. */
925
975
  dispose() {
926
- this._handlers && this._handlers.clear(), this._currentMode = V.Plane, this._store.setDisplayMode(this._currentMode);
976
+ this._handlers && this._handlers.clear(), this._currentMode = $.Plane, this._store.setDisplayMode(this._currentMode);
927
977
  }
928
978
  };
929
- q = Dt([
930
- u(),
931
- Pe(0, W("IDisplayHandler")),
932
- Pe(1, h("IEditorStore"))
933
- ], q);
934
- var P = /* @__PURE__ */ ((t) => (t.Hover = "hover", t.Click = "click", t))(P || {}), Ct = Object.getOwnPropertyDescriptor, At = (t, e, s, i) => {
935
- for (var r = i > 1 ? void 0 : i ? Ct(e, s) : e, o = t.length - 1, n; o >= 0; o--)
979
+ te = kt([
980
+ M(),
981
+ De(0, G("IDisplayHandler")),
982
+ De(1, _("IEditorStore"))
983
+ ], te);
984
+ var C = /* @__PURE__ */ ((t) => (t.Hover = "hover", t.Click = "click", t))(C || {}), Ht = Object.getOwnPropertyDescriptor, Ft = (t, e, s, i) => {
985
+ for (var r = i > 1 ? void 0 : i ? Ht(e, s) : e, o = t.length - 1, n; o >= 0; o--)
936
986
  (n = t[o]) && (r = n(r) || r);
937
987
  return r;
938
- }, X = (t, e) => (s, i) => e(s, i, t);
939
- let Q = class {
988
+ }, q = (t, e) => (s, i) => e(s, i, t);
989
+ let se = class {
940
990
  constructor(t, e, s) {
941
991
  this._eventBus = t, this._store = s, this._handlers = new Map(e.map((i) => [i.mode, i])), this._eventBus.on(H.SelectHover, this._onHover), this._eventBus.on(H.SelectClick, this._onClick);
942
992
  }
943
993
  /** Текущий режим выборки */
944
- _currentMode = v.Mesh;
994
+ _currentMode = y.Mesh;
945
995
  /** Хендлеры, которые управляют выборкой */
946
996
  _handlers;
947
997
  /** Переключает режим выбора */
@@ -950,46 +1000,46 @@ let Q = class {
950
1000
  }
951
1001
  /** Обработчик события наведения на модель */
952
1002
  _onHover = (t) => {
953
- this._handlers.get(this._currentMode)?.handle(t, P.Hover);
1003
+ this._handlers.get(this._currentMode)?.handle(t, C.Hover);
954
1004
  };
955
1005
  /** Обработчик события клика на модель */
956
1006
  _onClick = (t) => {
957
- this._handlers.get(this._currentMode)?.handle(t, P.Click);
1007
+ this._handlers.get(this._currentMode)?.handle(t, C.Click);
958
1008
  };
959
1009
  /** Освобождает ресурсы менеджера. */
960
1010
  dispose() {
961
- this._handlers && this._handlers.clear(), this._eventBus.off(H.SelectHover, this._onHover), this._currentMode = v.Mesh, this._store.setSelectMode(this._currentMode);
1011
+ this._handlers && this._handlers.clear(), this._eventBus.off(H.SelectHover, this._onHover), this._currentMode = y.Mesh, this._store.setSelectMode(this._currentMode);
962
1012
  }
963
1013
  };
964
- Q = At([
965
- u(),
966
- X(0, h("EventBus")),
967
- X(1, W("ISelectHandler")),
968
- X(2, h("IEditorStore"))
969
- ], Q);
970
- class xt {
1014
+ se = Ft([
1015
+ M(),
1016
+ q(0, _("EventBus")),
1017
+ q(1, G("ISelectHandler")),
1018
+ q(2, _("IEditorStore"))
1019
+ ], se);
1020
+ class Wt {
971
1021
  /** Доступен ли инструмент при текущем режиме выборки */
972
1022
  isToolEnabled(e, s) {
973
- return Me[s].includes(e);
1023
+ return Pe[s].includes(e);
974
1024
  }
975
1025
  /** Получение доступных инструментов для режима выборки*/
976
1026
  getEnabledTools(e) {
977
- return Me[e];
1027
+ return Pe[e];
978
1028
  }
979
1029
  }
980
- var Rt = Object.getOwnPropertyDescriptor, jt = (t, e, s, i) => {
981
- for (var r = i > 1 ? void 0 : i ? Rt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1030
+ var zt = Object.getOwnPropertyDescriptor, Nt = (t, e, s, i) => {
1031
+ for (var r = i > 1 ? void 0 : i ? zt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
982
1032
  (n = t[o]) && (r = n(r) || r);
983
1033
  return r;
984
- }, Oe = (t, e) => (s, i) => e(s, i, t);
985
- let J = class {
1034
+ }, Ce = (t, e) => (s, i) => e(s, i, t);
1035
+ let ie = class {
986
1036
  constructor(t, e) {
987
1037
  this._store = e, this._handlers = new Map(t.map((s) => [s.mode, s])), this._unsubSelected = this._store.onSelectedObjectChange(() => {
988
1038
  this._handlers.get(this._currentTool)?.handle();
989
- }), this._policy = new xt();
1039
+ }), this._policy = new Wt();
990
1040
  }
991
1041
  /** Текущий выбранный инструмент */
992
- _currentTool = C.Translate;
1042
+ _currentTool = F.Translate;
993
1043
  /** Хендлеры, которые управляют инструментами */
994
1044
  _handlers;
995
1045
  /** Событие обновления выбора объекта */
@@ -1003,22 +1053,22 @@ let J = class {
1003
1053
  }
1004
1054
  /** Освобождает ресурсы менеджера. */
1005
1055
  dispose() {
1006
- this._unsubSelected?.(), this._handlers && this._handlers.clear(), this._currentTool = C.Translate, this._store.setToolType(this._currentTool);
1056
+ this._unsubSelected?.(), this._handlers && this._handlers.clear(), this._currentTool = F.Translate, this._store.setToolType(this._currentTool);
1007
1057
  }
1008
1058
  };
1009
- J = jt([
1010
- u(),
1011
- Oe(0, W("IToolHandler")),
1012
- Oe(1, h("IEditorStore"))
1013
- ], J);
1014
- var It = Object.getOwnPropertyDescriptor, Ht = (t, e, s, i) => {
1015
- for (var r = i > 1 ? void 0 : i ? It(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1059
+ ie = Nt([
1060
+ M(),
1061
+ Ce(0, G("IToolHandler")),
1062
+ Ce(1, _("IEditorStore"))
1063
+ ], ie);
1064
+ var Yt = Object.getOwnPropertyDescriptor, $t = (t, e, s, i) => {
1065
+ for (var r = i > 1 ? void 0 : i ? Yt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1016
1066
  (n = t[o]) && (r = n(r) || r);
1017
1067
  return r;
1018
- }, kt = (t, e) => (s, i) => e(s, i, t);
1019
- let ee = class {
1068
+ }, Ut = (t, e) => (s, i) => e(s, i, t);
1069
+ let re = class {
1020
1070
  /** Текущий режим редактирования сцены */
1021
- _currentMode = N.AddFigure;
1071
+ _currentMode = U.AddFigure;
1022
1072
  /** Хендлеры, которые управляют отображением */
1023
1073
  _handlers;
1024
1074
  constructor(t) {
@@ -1026,28 +1076,28 @@ let ee = class {
1026
1076
  }
1027
1077
  /** Установка режима редактирования сцены */
1028
1078
  manage(t, e) {
1029
- t === N.AddFigure ? this._handlers.get(t)?.handle(e) : this._handlers.get(t)?.handle(), this._currentMode = t;
1079
+ t === U.AddFigure ? this._handlers.get(t)?.handle(e) : this._handlers.get(t)?.handle(), this._currentMode = t;
1030
1080
  }
1031
1081
  /** Освобождает ресурсы менеджера. */
1032
1082
  dispose() {
1033
- this._handlers && this._handlers.clear(), this._currentMode = N.AddFigure;
1083
+ this._handlers && this._handlers.clear(), this._currentMode = U.AddFigure;
1034
1084
  }
1035
1085
  };
1036
- ee = Ht([
1037
- u(),
1038
- kt(0, W("ISceneHandler"))
1039
- ], ee);
1040
- var Vt = Object.getOwnPropertyDescriptor, Nt = (t, e, s, i) => {
1041
- for (var r = i > 1 ? void 0 : i ? Vt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1086
+ re = $t([
1087
+ M(),
1088
+ Ut(0, G("ISceneHandler"))
1089
+ ], re);
1090
+ var Bt = Object.getOwnPropertyDescriptor, Gt = (t, e, s, i) => {
1091
+ for (var r = i > 1 ? void 0 : i ? Bt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1042
1092
  (n = t[o]) && (r = n(r) || r);
1043
1093
  return r;
1044
- }, Yt = (t, e) => (s, i) => e(s, i, t);
1045
- let te = class {
1094
+ }, Zt = (t, e) => (s, i) => e(s, i, t);
1095
+ let oe = class {
1046
1096
  constructor(t) {
1047
1097
  this._api = t;
1048
1098
  }
1049
1099
  /** Режим отображения. */
1050
- mode = V.Wireframe;
1100
+ mode = $.Wireframe;
1051
1101
  /** Сохраняем предыдущие значения wireframe для отката. */
1052
1102
  _prevWireframe = /* @__PURE__ */ new Map();
1053
1103
  /** Сохраняем исходные цвета материалов для отката */
@@ -1098,34 +1148,34 @@ let te = class {
1098
1148
  "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));
1099
1149
  }
1100
1150
  };
1101
- te = Nt([
1102
- u(),
1103
- Yt(0, h("RendererApi"))
1104
- ], te);
1105
- var zt = Object.getOwnPropertyDescriptor, Ut = (t, e, s, i) => {
1106
- for (var r = i > 1 ? void 0 : i ? zt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1151
+ oe = Gt([
1152
+ M(),
1153
+ Zt(0, _("RendererApi"))
1154
+ ], oe);
1155
+ var Xt = Object.getOwnPropertyDescriptor, Kt = (t, e, s, i) => {
1156
+ for (var r = i > 1 ? void 0 : i ? Xt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1107
1157
  (n = t[o]) && (r = n(r) || r);
1108
1158
  return r;
1109
- }, Te = (t, e) => (s, i) => e(s, i, t);
1110
- let se = class {
1159
+ }, Ae = (t, e) => (s, i) => e(s, i, t);
1160
+ let ne = class {
1111
1161
  constructor(t, e) {
1112
1162
  this._api = t, this._store = e;
1113
1163
  }
1114
1164
  /** Режим, которым управляет хендлер, нужен только менеджеру */
1115
- mode = v.Mesh;
1165
+ mode = y.Mesh;
1116
1166
  /** Фигура, на которую навелись в данный момент */
1117
1167
  _hoveredMesh = null;
1118
1168
  /** Фигура, которую выбрали в данный момент */
1119
1169
  _selectedMesh = null;
1120
1170
  // Цвета, необходимые для переключения
1121
1171
  /** Цвет ребер для фигуры, на которую навелись */
1122
- _hoverColor = F;
1172
+ _hoverColor = Z;
1123
1173
  /** Цвет ребер для выделенной фигуры */
1124
- _selectColor = Z;
1174
+ _selectColor = X;
1125
1175
  /** Исходные цвета материалов линий для отката */
1126
1176
  _origLineColors = /* @__PURE__ */ new WeakMap();
1127
1177
  handle(t, e) {
1128
- if (this._api.setRaycastMode(this.mode), e === P.Hover) {
1178
+ if (this._api.setRaycastMode(this.mode), e === C.Hover) {
1129
1179
  if (!t) {
1130
1180
  this._hoveredMesh && this._hoveredMesh !== this._selectedMesh && this._restoreEdgesColor(this._hoveredMesh), this._hoveredMesh = null;
1131
1181
  return;
@@ -1133,7 +1183,7 @@ let se = class {
1133
1183
  const s = t.intersection.object;
1134
1184
  this._hoveredMesh !== s && (this._hoveredMesh && this._hoveredMesh !== this._selectedMesh && this._restoreEdgesColor(this._hoveredMesh), s !== this._selectedMesh && this._paintEdges(s, this._hoverColor), this._hoveredMesh = s);
1135
1185
  }
1136
- if (e === P.Click) {
1186
+ if (e === C.Click) {
1137
1187
  if (!t) {
1138
1188
  this._selectedMesh && (this._restoreEdgesColor(this._selectedMesh), this._selectedMesh = null, this._store.setSelectedObject(null));
1139
1189
  return;
@@ -1143,7 +1193,7 @@ let se = class {
1143
1193
  }
1144
1194
  }
1145
1195
  rollback() {
1146
- this._hoveredMesh && this._restoreEdgesColor(this._hoveredMesh), this._selectedMesh && this._restoreEdgesColor(this._selectedMesh), this._hoveredMesh = this._selectedMesh = null;
1196
+ this._hoveredMesh && this._restoreEdgesColor(this._hoveredMesh), this._selectedMesh && this._restoreEdgesColor(this._selectedMesh), this._hoveredMesh = this._selectedMesh = null, this._store.setSelectedObject(null);
1147
1197
  }
1148
1198
  /** Освобождает ресурсы хендлера, удаляет слушатели и очищает внутренние данные. */
1149
1199
  dispose() {
@@ -1178,59 +1228,309 @@ let se = class {
1178
1228
  });
1179
1229
  }
1180
1230
  };
1181
- se = Ut([
1182
- u(),
1183
- Te(0, h("RendererApi")),
1184
- Te(1, h("IEditorStore"))
1185
- ], se);
1186
- var Wt = Object.getOwnPropertyDescriptor, Ft = (t, e, s, i) => {
1187
- for (var r = i > 1 ? void 0 : i ? Wt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1231
+ ne = Kt([
1232
+ M(),
1233
+ Ae(0, _("RendererApi")),
1234
+ Ae(1, _("IEditorStore"))
1235
+ ], ne);
1236
+ var qt = Object.getOwnPropertyDescriptor, Qt = (t, e, s, i) => {
1237
+ for (var r = i > 1 ? void 0 : i ? qt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1188
1238
  (n = t[o]) && (r = n(r) || r);
1189
1239
  return r;
1190
- }, Zt = (t, e) => (s, i) => e(s, i, t);
1191
- let ie = class {
1192
- constructor(t) {
1193
- this._api = t;
1240
+ }, Ie = (t, e) => (s, i) => e(s, i, t);
1241
+ let ae = class {
1242
+ constructor(t, e) {
1243
+ this._api = t, this._store = e, this._api.enableCameraLayer(T), this._hoverFace = this._makeOverlayFace(this._hoverColor), this._selectFace = this._makeOverlayFace(this._selectColor), this._api.addObject(this._hoverFace, T), this._api.addObject(this._selectFace, T);
1194
1244
  }
1195
1245
  /** Режим, которым управляет хендлер, нужен только менеджеру */
1196
- mode = v.Face;
1246
+ mode = y.Face;
1197
1247
  /** Текущая наведённая грань */
1198
- _hovered = null;
1248
+ _hoverFace;
1199
1249
  /** Текущая выбранная грань */
1250
+ _selectFace;
1251
+ // Группы треугольников, которые образуют грань
1252
+ //
1253
+ // !!NB:
1254
+ // Все грани фигур состоят из треугольников, их объединение даст необходимую грань
1255
+ /** Текущая группа треугольников для наведённой грани */
1256
+ _hovered = null;
1257
+ /** Текущая группа треугольников для выбранной грани */
1200
1258
  _selected = null;
1201
1259
  // Цвета, необходимые для переключения
1202
1260
  /** Цвет грани, на которую навелись */
1203
- _hoverColor = F;
1261
+ _hoverColor = Z;
1204
1262
  /** Цвет выделенной граней */
1205
- _selectColor = Z;
1206
- /** Изначальный цвет граней у модели, перед наложением эффектов*/
1207
- _defaultColor = 2236962;
1263
+ _selectColor = X;
1264
+ // Погрешности для поиска треугольников и сборки граней
1265
+ /** Погрешность на сравнение нормалей */
1266
+ _normalEps = 1e-4;
1267
+ /** Погрешность на принадлежность одной плоскости */
1268
+ _planeEps = 1e-4;
1269
+ /** Обработка текущего режима выборки. */
1208
1270
  handle(t, e) {
1209
- this._api.setRaycastMode(this.mode), e === P.Hover && console.log(t), e === P.Click && console.log(t);
1271
+ if (this._api.setRaycastMode(this.mode), e === C.Hover) {
1272
+ if (!t) {
1273
+ this._hoverFace.visible = !1, this._hovered = null;
1274
+ return;
1275
+ }
1276
+ const s = t.intersection.object;
1277
+ if (!s?.isMesh) return;
1278
+ const i = s, r = t.intersection.faceIndex ?? -1;
1279
+ if (r < 0) return;
1280
+ const o = this._collectFaceGroup(i, r);
1281
+ if (!o) return;
1282
+ this._selected && this._same(o, this._selected) ? this._hoverFace.visible = !1 : (this._writeWorldFaceGroup(this._hoverFace, o), this._hoverFace.visible = !0), this._hovered = o;
1283
+ return;
1284
+ }
1285
+ if (e === C.Click) {
1286
+ if (!t) {
1287
+ this._selectFace.visible = !1, this._selected = null, this._store.setSelectedObject(null);
1288
+ return;
1289
+ }
1290
+ const s = t.intersection.object;
1291
+ if (!s?.isMesh) return;
1292
+ const i = s, r = t.intersection.faceIndex ?? -1;
1293
+ if (r < 0) return;
1294
+ const o = this._collectFaceGroup(i, r);
1295
+ if (!o) return;
1296
+ this._writeWorldFaceGroup(this._selectFace, o), this._centerFaceProxy(this._selectFace), this._selectFace.visible = !0, this._prepareFaceMetadata(o), this._store.setSelectedObject(this._selectFace), this._selected = o, this._hovered && this._same(this._hovered, this._selected) && (this._hoverFace.visible = !1);
1297
+ }
1210
1298
  }
1299
+ /** Откат текущего режима выборки */
1211
1300
  rollback() {
1212
- throw new Error("Method not implemented.");
1301
+ this._hoverFace.visible = !1, this._selectFace.visible = !1, this._resetFaceProxyTransform(this._selectFace), this._resetFaceProxyTransform(this._hoverFace), this._hovered = this._selected = null, this._store.setSelectedObject(null);
1213
1302
  }
1214
1303
  /** Освобождает ресурсы хендлера, удаляет слушатели и очищает внутренние данные. */
1215
1304
  dispose() {
1216
- throw new Error("Method not implemented.");
1305
+ this.rollback(), this._api.removeObject(this._hoverFace), this._api.removeObject(this._selectFace), this._hoverFace.geometry.dispose(), this._hoverFace.material.dispose(), this._selectFace.geometry.dispose(), this._selectFace.material.dispose();
1306
+ }
1307
+ /**
1308
+ * Инициализация overlay mesh для режима (hover и click).
1309
+ * На весь режим используются 2 глобальных mesh на сцене,
1310
+ * геометрия которых переписывается под текущую грань.
1311
+ */
1312
+ _makeOverlayFace(t) {
1313
+ const e = new a.BufferGeometry(), s = new a.MeshBasicMaterial({
1314
+ color: t,
1315
+ transparent: !0,
1316
+ opacity: 0.35,
1317
+ depthTest: !1,
1318
+ depthWrite: !1,
1319
+ side: a.DoubleSide,
1320
+ polygonOffset: !0,
1321
+ polygonOffsetFactor: -1,
1322
+ polygonOffsetUnits: -1
1323
+ }), i = new a.Mesh(e, s);
1324
+ return i.renderOrder = 1e3, i.layers.set(T), i.visible = !1, i.raycast = () => {
1325
+ }, i;
1326
+ }
1327
+ /**
1328
+ * Сбор логической грани как связной группы компланарных треугольников.
1329
+ * Если geometry неиндексированная — пока возвращаем только стартовый triangle.
1330
+ */
1331
+ _collectFaceGroup(t, e) {
1332
+ const s = t.geometry, i = s.getAttribute("position");
1333
+ if (!i) return null;
1334
+ const r = s.index;
1335
+ if (!r) {
1336
+ const E = e * 3, O = e * 3 + 1, A = e * 3 + 2;
1337
+ return {
1338
+ mesh: t,
1339
+ faceIndex: e,
1340
+ triangleIndices: [e],
1341
+ vertexIndices: [E, O, A],
1342
+ proxyVertexMap: [E, O, A]
1343
+ };
1344
+ }
1345
+ const o = Math.floor(r.count / 3);
1346
+ if (e < 0 || e >= o) return null;
1347
+ const n = this._buildTriangleAdjacency(r, i), [h, l, c] = this._getTriangleIndices(r, e), d = this._readVertex(i, h), g = this._readVertex(i, l), m = this._readVertex(i, c), f = new a.Vector3().subVectors(g, d).cross(new a.Vector3().subVectors(m, d)).normalize(), u = new a.Plane().setFromNormalAndCoplanarPoint(f, d), w = /* @__PURE__ */ new Set(), S = [], j = [e];
1348
+ for (; j.length > 0; ) {
1349
+ const E = j.pop();
1350
+ if (w.has(E)) continue;
1351
+ w.add(E);
1352
+ const [O, A, k] = this._getTriangleIndices(r, E), x = this._readVertex(i, O), ye = this._readVertex(i, A), Me = this._readVertex(i, k), Ge = new a.Vector3().subVectors(ye, x).cross(new a.Vector3().subVectors(Me, x)).normalize(), Ze = Math.abs(Ge.dot(f)) >= 1 - this._normalEps, Xe = Math.abs(u.distanceToPoint(x)) < this._planeEps && Math.abs(u.distanceToPoint(ye)) < this._planeEps && Math.abs(u.distanceToPoint(Me)) < this._planeEps;
1353
+ if (!Ze || !Xe) continue;
1354
+ S.push(E);
1355
+ const we = n.get(E);
1356
+ if (we)
1357
+ for (const Se of we)
1358
+ w.has(Se) || j.push(Se);
1359
+ }
1360
+ S.sort((E, O) => E - O);
1361
+ const R = /* @__PURE__ */ new Set(), V = [];
1362
+ for (const E of S) {
1363
+ const [O, A, k] = this._getTriangleIndices(r, E);
1364
+ R.add(O), R.add(A), R.add(k), V.push(O, A, k);
1365
+ }
1366
+ return {
1367
+ mesh: t,
1368
+ faceIndex: e,
1369
+ triangleIndices: S,
1370
+ vertexIndices: Array.from(R),
1371
+ proxyVertexMap: V
1372
+ };
1373
+ }
1374
+ /** Перезаписывает overlay mesh world-space треугольниками выбранной грани */
1375
+ _writeWorldFaceGroup(t, e) {
1376
+ const s = e.mesh.geometry, i = s.getAttribute("position"), r = s.index, o = new Float32Array(e.triangleIndices.length * 9);
1377
+ let n = 0;
1378
+ for (const l of e.triangleIndices) {
1379
+ let c, d, g;
1380
+ r ? [c, d, g] = this._getTriangleIndices(r, l) : (c = l * 3, d = l * 3 + 1, g = l * 3 + 2);
1381
+ const m = this._readVertex(i, c).applyMatrix4(e.mesh.matrixWorld), f = this._readVertex(i, d).applyMatrix4(e.mesh.matrixWorld), u = this._readVertex(i, g).applyMatrix4(e.mesh.matrixWorld);
1382
+ o[n++] = m.x, o[n++] = m.y, o[n++] = m.z, o[n++] = f.x, o[n++] = f.y, o[n++] = f.z, o[n++] = u.x, o[n++] = u.y, o[n++] = u.z;
1383
+ }
1384
+ const h = t.geometry;
1385
+ h.setAttribute("position", new a.BufferAttribute(o, 3)), h.setIndex(null), h.computeVertexNormals(), h.computeBoundingBox(), h.computeBoundingSphere();
1386
+ }
1387
+ /** Сравнение двух логических граней */
1388
+ _same(t, e) {
1389
+ return !!t && !!e && t.mesh === e.mesh && t.triangleIndices.length === e.triangleIndices.length && t.triangleIndices.every((s, i) => s === e.triangleIndices[i]);
1390
+ }
1391
+ /** Подготовка метаданных выбранной грани для инструментов */
1392
+ _prepareFaceMetadata(t) {
1393
+ const { vertexIndexGroups: e, proxyVertexMap: s, lines: i, lineVertexIndexGroups: r } = this._buildFaceVertexGroups(t);
1394
+ this._selectFace.userData.faceInfo = {
1395
+ mesh: t.mesh,
1396
+ faceIndex: t.faceIndex,
1397
+ triangleIndices: t.triangleIndices,
1398
+ vertexIndices: t.vertexIndices,
1399
+ vertexIndexGroups: e,
1400
+ proxyVertexMap: s,
1401
+ lines: i,
1402
+ lineVertexIndexGroups: r
1403
+ };
1404
+ }
1405
+ /**
1406
+ * Центрирует proxy-грань, чтобы TransformControls работали с ней как с обычным объектом.
1407
+ * После записи world-space вершин переносит геометрию в локальные координаты proxy mesh.
1408
+ */
1409
+ _centerFaceProxy(t) {
1410
+ const e = t.geometry, s = e.getAttribute("position");
1411
+ if (!s || s.count === 0) return;
1412
+ const i = new a.Vector3();
1413
+ for (let r = 0; r < s.count; r++)
1414
+ i.x += s.getX(r), i.y += s.getY(r), i.z += s.getZ(r);
1415
+ i.multiplyScalar(1 / s.count);
1416
+ for (let r = 0; r < s.count; r++)
1417
+ s.setXYZ(r, s.getX(r) - i.x, s.getY(r) - i.y, s.getZ(r) - i.z);
1418
+ s.needsUpdate = !0, t.position.copy(i), t.quaternion.identity(), t.scale.set(1, 1, 1), t.updateMatrixWorld(!0), e.computeBoundingBox(), e.computeBoundingSphere();
1419
+ }
1420
+ /** Регистрирует ребро треугольника в edge map */
1421
+ _pushEdge(t, e, s, i) {
1422
+ const r = e < s ? `${e}_${s}` : `${s}_${e}`, o = t.get(r);
1423
+ o ? o.push(i) : t.set(r, [i]);
1424
+ }
1425
+ /** Строит граф соседства треугольников по общим ребрам */
1426
+ _buildTriangleAdjacency(t, e) {
1427
+ const s = Math.floor(t.count / 3), i = /* @__PURE__ */ new Map(), r = this._buildWeldMap(t, e);
1428
+ for (let h = 0; h < s; h++) {
1429
+ const [l, c, d] = this._getTriangleIndices(t, h), g = r.get(l), m = r.get(c), f = r.get(d);
1430
+ this._pushEdge(i, g, m, h), this._pushEdge(i, m, f, h), this._pushEdge(i, f, g, h);
1431
+ }
1432
+ const o = /* @__PURE__ */ new Map();
1433
+ for (let h = 0; h < s; h++)
1434
+ o.set(h, /* @__PURE__ */ new Set());
1435
+ for (const h of i.values())
1436
+ if (!(h.length < 2))
1437
+ for (let l = 0; l < h.length; l++)
1438
+ for (let c = 0; c < h.length; c++)
1439
+ l !== c && o.get(h[l])?.add(h[c]);
1440
+ const n = /* @__PURE__ */ new Map();
1441
+ for (const [h, l] of o)
1442
+ n.set(h, Array.from(l));
1443
+ return n;
1444
+ }
1445
+ /** Возвращает индексы трех вершин треугольника */
1446
+ _getTriangleIndices(t, e) {
1447
+ return [t.getX(e * 3), t.getX(e * 3 + 1), t.getX(e * 3 + 2)];
1448
+ }
1449
+ /** Читает вершину из position buffer в local space geometry */
1450
+ _readVertex(t, e) {
1451
+ return new a.Vector3(t.getX(e), t.getY(e), t.getZ(e));
1452
+ }
1453
+ /** Построение ключа вершины по позиции */
1454
+ _vertexKey(t, e, s = 1e-6) {
1455
+ const i = Math.round(t.getX(e) / s), r = Math.round(t.getY(e) / s), o = Math.round(t.getZ(e) / s);
1456
+ return `${i}_${r}_${o}`;
1457
+ }
1458
+ /**
1459
+ * Строит отображение исходных индексов вершин в "сваренные" ids по координате.
1460
+ * Нужно для случаев, когда соседние треугольники визуально делят ребро,
1461
+ * но используют разные индексы вершин (например, цилиндрические крышки, UV seams и т.п.).
1462
+ */
1463
+ _buildWeldMap(t, e) {
1464
+ const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1465
+ let r = 0;
1466
+ for (let o = 0; o < t.count; o++) {
1467
+ const n = t.getX(o);
1468
+ if (i.has(n)) continue;
1469
+ const h = this._vertexKey(e, n);
1470
+ let l = s.get(h);
1471
+ l == null && (l = r++, s.set(h, l)), i.set(n, l);
1472
+ }
1473
+ return i;
1474
+ }
1475
+ /** Сбрасывает transform proxy-граням */
1476
+ _resetFaceProxyTransform(t) {
1477
+ t.position.set(0, 0, 0), t.quaternion.identity(), t.scale.set(1, 1, 1), t.updateMatrixWorld(!0);
1478
+ }
1479
+ _buildFaceVertexGroups(t) {
1480
+ const s = t.mesh.geometry.getAttribute("position"), i = 1e-6, r = new a.Vector3(), o = t.vertexIndices, n = [], h = /* @__PURE__ */ new Map();
1481
+ for (const m of o) {
1482
+ const f = this._readVertex(s, m), u = [];
1483
+ for (let S = 0; S < s.count; S++)
1484
+ r.fromBufferAttribute(s, S), r.distanceToSquared(f) < i * i && u.push(S);
1485
+ const w = n.length;
1486
+ n.push(u);
1487
+ for (const S of u)
1488
+ h.set(S, w);
1489
+ }
1490
+ const l = [];
1491
+ for (const m of t.proxyVertexMap) {
1492
+ const f = h.get(m);
1493
+ l.push(f ?? -1);
1494
+ }
1495
+ const c = this._findChildLines(t.mesh), d = c ? this._buildLineVertexGroups(t, c) : void 0, g = {
1496
+ vertexIndexGroups: n,
1497
+ proxyVertexMap: l
1498
+ };
1499
+ return c && (g.lines = c), d && (g.lineVertexIndexGroups = d), g;
1500
+ }
1501
+ _findChildLines(t) {
1502
+ for (const e of t.children)
1503
+ if (e.isLineSegments)
1504
+ return e;
1505
+ return null;
1506
+ }
1507
+ _buildLineVertexGroups(t, e) {
1508
+ const i = e.geometry.getAttribute("position"), o = t.mesh.geometry.getAttribute("position"), n = 1e-6, h = new a.Vector3(), l = e.matrixWorld, c = t.mesh.matrixWorld, d = [];
1509
+ for (const g of t.vertexIndices) {
1510
+ const m = this._readVertex(o, g).applyMatrix4(c), f = [];
1511
+ for (let u = 0; u < i.count; u++)
1512
+ h.fromBufferAttribute(i, u).applyMatrix4(l), h.distanceToSquared(m) < n * n && f.push(u);
1513
+ d.push(f);
1514
+ }
1515
+ return d;
1217
1516
  }
1218
1517
  };
1219
- ie = Ft([
1220
- u(),
1221
- Zt(0, h("RendererApi"))
1222
- ], ie);
1223
- var $t = Object.getOwnPropertyDescriptor, Bt = (t, e, s, i) => {
1224
- for (var r = i > 1 ? void 0 : i ? $t(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1518
+ ae = Qt([
1519
+ M(),
1520
+ Ie(0, _("RendererApi")),
1521
+ Ie(1, _("IEditorStore"))
1522
+ ], ae);
1523
+ var Jt = Object.getOwnPropertyDescriptor, es = (t, e, s, i) => {
1524
+ for (var r = i > 1 ? void 0 : i ? Jt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1225
1525
  (n = t[o]) && (r = n(r) || r);
1226
1526
  return r;
1227
- }, Le = (t, e) => (s, i) => e(s, i, t);
1228
- let re = class {
1527
+ }, je = (t, e) => (s, i) => e(s, i, t);
1528
+ let he = class {
1229
1529
  constructor(t, e) {
1230
- 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);
1530
+ this._api = t, this._store = e, this._api.enableCameraLayer(T), this._hoverVertex = this._makeOverlayVertex(this._hoverColor), this._selectVertex = this._makeOverlayVertex(this._selectColor), this._api.addObject(this._hoverVertex, T), this._api.addObject(this._selectVertex, T);
1231
1531
  }
1232
1532
  /** Режим, которым управляет хендлер, нужен только менеджеру */
1233
- mode = v.Vertex;
1533
+ mode = y.Vertex;
1234
1534
  _hovered = null;
1235
1535
  _selected = null;
1236
1536
  /** Текущая наведённая вершина. */
@@ -1239,11 +1539,11 @@ let re = class {
1239
1539
  _selectVertex;
1240
1540
  // Цвета, необходимые для переключения
1241
1541
  /** Цвет ребра, на которое навелись */
1242
- _hoverColor = F;
1542
+ _hoverColor = Z;
1243
1543
  /** Цвет выделенного ребра */
1244
- _selectColor = Z;
1544
+ _selectColor = X;
1245
1545
  handle(t, e) {
1246
- if (this._api.setRaycastMode(this.mode), e === P.Hover) {
1546
+ if (this._api.setRaycastMode(this.mode), e === C.Hover) {
1247
1547
  if (!t) {
1248
1548
  this._hoverVertex.visible = !1, this._hovered = null;
1249
1549
  return;
@@ -1255,7 +1555,7 @@ let re = class {
1255
1555
  this._selected && this._same({ points: i, index: r }, this._selected) ? this._hoverVertex.visible = !1 : (this._writeWorldVertex(this._hoverVertex, i, r), this._hoverVertex.visible = !0);
1256
1556
  return;
1257
1557
  }
1258
- if (e === P.Click) {
1558
+ if (e === C.Click) {
1259
1559
  if (!t) {
1260
1560
  this._selectVertex.visible = !1, this._selected = null, this._store.setSelectedObject(null);
1261
1561
  return;
@@ -1269,12 +1569,12 @@ let re = class {
1269
1569
  }
1270
1570
  }
1271
1571
  rollback() {
1272
- this._hoverVertex.visible = !1, this._selectVertex.visible = !1, this._hovered = this._selected = null;
1572
+ this._hoverVertex.visible = !1, this._selectVertex.visible = !1, this._hovered = this._selected = null, this._store.setSelectedObject(null);
1273
1573
  }
1274
1574
  dispose() {
1275
1575
  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();
1276
1576
  }
1277
- _makeOverlayVertex(t, e = tt) {
1577
+ _makeOverlayVertex(t, e = lt) {
1278
1578
  const s = new a.BufferGeometry();
1279
1579
  s.setAttribute("position", new a.Float32BufferAttribute([0, 0, 0], 3));
1280
1580
  const i = new a.PointsMaterial({
@@ -1287,7 +1587,7 @@ let re = class {
1287
1587
  opacity: 1
1288
1588
  }), r = new a.Points(s, i);
1289
1589
  return r.renderOrder = 1e3, r.raycast = () => {
1290
- }, r.layers.set(L), r.visible = !1, r;
1590
+ }, r.layers.set(T), r.visible = !1, r;
1291
1591
  }
1292
1592
  /** Локальную вершину points переводим в world и пишем в target (прокси-точку) */
1293
1593
  _writeWorldVertex(t, e, s) {
@@ -1303,29 +1603,29 @@ let re = class {
1303
1603
  }
1304
1604
  /** Готовит метаданные для выбранной вершины и пишет их в _selectVertex.userData */
1305
1605
  _prepareVertexMetadata(t, e) {
1306
- const s = Ve(t);
1606
+ const s = Ye(t);
1307
1607
  if (!s) return;
1308
1608
  const i = t.geometry.getAttribute("position"), r = new a.Vector3(
1309
1609
  i.getX(e),
1310
1610
  i.getY(e),
1311
1611
  i.getZ(e)
1312
- ).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, D = new a.Vector3(), b = [];
1313
- for (let M = 0; M < _.count; M++)
1314
- D.fromBufferAttribute(_, M), D.distanceToSquared(n) < f && b.push(M);
1315
- const O = s.children.find((M) => M?.isLineSegments);
1316
- let y = [];
1317
- if (O) {
1318
- const M = new a.Matrix4().copy(O.matrixWorld).invert(), Y = r.clone().applyMatrix4(M), k = O.geometry.getAttribute("position"), z = new a.Vector3();
1319
- for (let A = 0; A < k.count; A++)
1320
- z.fromBufferAttribute(k, A), z.distanceToSquared(Y) < f && y.push(A);
1612
+ ).applyMatrix4(t.matrixWorld), o = new a.Matrix4().copy(s.matrixWorld).invert(), n = r.clone().applyMatrix4(o), l = s.geometry.getAttribute("position"), c = 1e-6, d = c * c, g = new a.Vector3(), m = [];
1613
+ for (let w = 0; w < l.count; w++)
1614
+ g.fromBufferAttribute(l, w), g.distanceToSquared(n) < d && m.push(w);
1615
+ const f = s.children.find((w) => w?.isLineSegments);
1616
+ let u = [];
1617
+ if (f) {
1618
+ const w = new a.Matrix4().copy(f.matrixWorld).invert(), S = r.clone().applyMatrix4(w), j = f.geometry.getAttribute("position"), R = new a.Vector3();
1619
+ for (let V = 0; V < j.count; V++)
1620
+ R.fromBufferAttribute(j, V), R.distanceToSquared(S) < d && u.push(V);
1321
1621
  }
1322
1622
  this._selectVertex.userData.vertexInfo = {
1323
1623
  points: t,
1324
1624
  index: e,
1325
1625
  mesh: s,
1326
- vertexIndices: b,
1327
- lines: O ?? null,
1328
- edgeVertexIndices: y
1626
+ vertexIndices: m,
1627
+ lines: f ?? null,
1628
+ edgeVertexIndices: u
1329
1629
  };
1330
1630
  }
1331
1631
  /** Центрует прокси-вершину на выбранной точке */
@@ -1341,12 +1641,12 @@ let re = class {
1341
1641
  (!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);
1342
1642
  }
1343
1643
  };
1344
- re = Bt([
1345
- u(),
1346
- Le(0, h("RendererApi")),
1347
- Le(1, h("IEditorStore"))
1348
- ], re);
1349
- class me {
1644
+ he = es([
1645
+ M(),
1646
+ je(0, _("RendererApi")),
1647
+ je(1, _("IEditorStore"))
1648
+ ], he);
1649
+ class ve {
1350
1650
  constructor(e, s) {
1351
1651
  this.api = e, this.store = s, this._unsubscribeTransform = this.api.onTransformChange(() => {
1352
1652
  this.store.getSelectedObject() && this.store.notifySelectedTransformChange?.();
@@ -1373,68 +1673,68 @@ class me {
1373
1673
  this.rollback(), this._unsubscribeTransform && this._unsubscribeTransform();
1374
1674
  }
1375
1675
  }
1376
- var Xt = Object.getOwnPropertyDescriptor, Gt = (t, e, s, i) => {
1377
- for (var r = i > 1 ? void 0 : i ? Xt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1676
+ var ts = Object.getOwnPropertyDescriptor, ss = (t, e, s, i) => {
1677
+ for (var r = i > 1 ? void 0 : i ? ts(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1378
1678
  (n = t[o]) && (r = n(r) || r);
1379
1679
  return r;
1380
- }, De = (t, e) => (s, i) => e(s, i, t);
1381
- let oe = class extends me {
1680
+ }, Re = (t, e) => (s, i) => e(s, i, t);
1681
+ let le = class extends ve {
1382
1682
  /** Инструмент, которым управляет хендлер, нужен только менеджеру */
1383
- mode = C.Translate;
1683
+ mode = F.Translate;
1384
1684
  constructor(t, e) {
1385
1685
  super(t, e);
1386
1686
  }
1387
1687
  };
1388
- oe = Gt([
1389
- u(),
1390
- De(0, h("RendererApi")),
1391
- De(1, h("IEditorStore"))
1392
- ], oe);
1393
- var Kt = Object.getOwnPropertyDescriptor, qt = (t, e, s, i) => {
1394
- for (var r = i > 1 ? void 0 : i ? Kt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1688
+ le = ss([
1689
+ M(),
1690
+ Re(0, _("RendererApi")),
1691
+ Re(1, _("IEditorStore"))
1692
+ ], le);
1693
+ var is = Object.getOwnPropertyDescriptor, rs = (t, e, s, i) => {
1694
+ for (var r = i > 1 ? void 0 : i ? is(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1395
1695
  (n = t[o]) && (r = n(r) || r);
1396
1696
  return r;
1397
- }, Ce = (t, e) => (s, i) => e(s, i, t);
1398
- let ne = class extends me {
1697
+ }, Ve = (t, e) => (s, i) => e(s, i, t);
1698
+ let ce = class extends ve {
1399
1699
  /** Инструмент, которым управляет хендлер, нужен только менеджеру */
1400
- mode = C.Scale;
1700
+ mode = F.Scale;
1401
1701
  constructor(t, e) {
1402
1702
  super(t, e);
1403
1703
  }
1404
1704
  };
1405
- ne = qt([
1406
- u(),
1407
- Ce(0, h("RendererApi")),
1408
- Ce(1, h("IEditorStore"))
1409
- ], ne);
1410
- var Qt = Object.getOwnPropertyDescriptor, Jt = (t, e, s, i) => {
1411
- for (var r = i > 1 ? void 0 : i ? Qt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1705
+ ce = rs([
1706
+ M(),
1707
+ Ve(0, _("RendererApi")),
1708
+ Ve(1, _("IEditorStore"))
1709
+ ], ce);
1710
+ var os = Object.getOwnPropertyDescriptor, ns = (t, e, s, i) => {
1711
+ for (var r = i > 1 ? void 0 : i ? os(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1412
1712
  (n = t[o]) && (r = n(r) || r);
1413
1713
  return r;
1414
- }, Ae = (t, e) => (s, i) => e(s, i, t);
1415
- let ae = class extends me {
1714
+ }, ke = (t, e) => (s, i) => e(s, i, t);
1715
+ let de = class extends ve {
1416
1716
  /** Инструмент, которым управляет хендлер, нужен только менеджеру */
1417
- mode = C.Rotate;
1717
+ mode = F.Rotate;
1418
1718
  constructor(t, e) {
1419
1719
  super(t, e);
1420
1720
  }
1421
1721
  };
1422
- ae = Jt([
1423
- u(),
1424
- Ae(0, h("RendererApi")),
1425
- Ae(1, h("IEditorStore"))
1426
- ], ae);
1427
- var es = Object.getOwnPropertyDescriptor, ts = (t, e, s, i) => {
1428
- for (var r = i > 1 ? void 0 : i ? es(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1722
+ de = ns([
1723
+ M(),
1724
+ ke(0, _("RendererApi")),
1725
+ ke(1, _("IEditorStore"))
1726
+ ], de);
1727
+ var as = Object.getOwnPropertyDescriptor, hs = (t, e, s, i) => {
1728
+ for (var r = i > 1 ? void 0 : i ? as(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1429
1729
  (n = t[o]) && (r = n(r) || r);
1430
1730
  return r;
1431
- }, xe = (t, e) => (s, i) => e(s, i, t);
1432
- let he = class {
1731
+ }, He = (t, e) => (s, i) => e(s, i, t);
1732
+ let _e = class {
1433
1733
  constructor(t, e) {
1434
- 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);
1734
+ this._api = t, this._store = e, this._api.enableCameraLayer(T), this._hoverLine = this._makeOverlayLine(this._hoverColor), this._selectLine = this._makeOverlayLine(this._selectColor), this._api.addObject(this._hoverLine, T), this._api.addObject(this._selectLine, T);
1435
1735
  }
1436
1736
  /** Режим, которым управляет хендлер, нужен только менеджеру */
1437
- mode = v.Edge;
1737
+ mode = y.Edge;
1438
1738
  /** Текущее наведённое ребро. */
1439
1739
  _hoverLine;
1440
1740
  /** Текущее выбранное ребро. */
@@ -1445,12 +1745,12 @@ let he = class {
1445
1745
  _selected = null;
1446
1746
  // Цвета, необходимые для переключения
1447
1747
  /** Цвет ребра, на которое навелись */
1448
- _hoverColor = F;
1748
+ _hoverColor = Z;
1449
1749
  /** Цвет выделенного ребра */
1450
- _selectColor = Z;
1750
+ _selectColor = X;
1451
1751
  /** Обработка текущего режима выборки. */
1452
1752
  handle(t, e) {
1453
- if (this._api.setRaycastMode(this.mode), e === P.Hover) {
1753
+ if (this._api.setRaycastMode(this.mode), e === C.Hover) {
1454
1754
  if (!t) {
1455
1755
  this._hoverLine.visible = !1, this._hovered = null;
1456
1756
  return;
@@ -1462,7 +1762,7 @@ let he = class {
1462
1762
  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 };
1463
1763
  return;
1464
1764
  }
1465
- if (e === P.Click) {
1765
+ if (e === C.Click) {
1466
1766
  if (!t) {
1467
1767
  this._selectLine.visible = !1, this._selected = null, this._store.setSelectedObject(null);
1468
1768
  return;
@@ -1476,7 +1776,7 @@ let he = class {
1476
1776
  }
1477
1777
  /** Откат текущего режима выборки */
1478
1778
  rollback() {
1479
- this._hoverLine.visible = !1, this._selectLine.visible = !1, this._hovered = this._selected = null;
1779
+ this._hoverLine.visible = !1, this._selectLine.visible = !1, this._hovered = this._selected = null, this._store.setSelectedObject(null);
1480
1780
  }
1481
1781
  /** Освобождает ресурсы хендлера, удаляет слушатели и очищает внутренние данные. */
1482
1782
  dispose() {
@@ -1497,16 +1797,16 @@ let he = class {
1497
1797
  opacity: 1
1498
1798
  }), i = new a.Line(e, s);
1499
1799
  return i.renderOrder = 1e3, i.raycast = () => {
1500
- }, i.layers.set(L), i.visible = !1, i;
1800
+ }, i.layers.set(T), i.visible = !1, i;
1501
1801
  }
1502
1802
  /** Локальные точки сегмента переводим в target (который висит на сцене) */
1503
1803
  _writeWorldSegment(t, e, s) {
1504
1804
  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(
1505
1805
  e.matrixWorld
1506
- ), c = new a.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
1806
+ ), h = new a.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
1507
1807
  e.matrixWorld
1508
- ), _ = t.geometry.getAttribute("position");
1509
- _.setXYZ(0, n.x, n.y, n.z), _.setXYZ(1, c.x, c.y, c.z), _.needsUpdate = !0;
1808
+ ), l = t.geometry.getAttribute("position");
1809
+ l.setXYZ(0, n.x, n.y, n.z), l.setXYZ(1, h.x, h.y, h.z), l.needsUpdate = !0;
1510
1810
  }
1511
1811
  _same(t, e) {
1512
1812
  return !!t && !!e && t.lines === e.lines && t.seg === e.seg;
@@ -1515,70 +1815,70 @@ let he = class {
1515
1815
  _centerAndOrientLineOnSegment(t, e, s) {
1516
1816
  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(
1517
1817
  e.matrixWorld
1518
- ), c = new a.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
1818
+ ), h = new a.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
1519
1819
  e.matrixWorld
1520
- ), _ = new a.Vector3().subVectors(c, n), m = _.length();
1521
- if (!isFinite(m) || m === 0) return;
1522
- const f = new a.Vector3().addVectors(n, c).multiplyScalar(0.5);
1523
- t.position.copy(f);
1524
- const D = t.geometry;
1525
- let b = D.getAttribute("position");
1526
- (!b || b.count < 2) && (D.setAttribute("position", new a.BufferAttribute(new Float32Array(6), 3)), b = D.getAttribute("position")), b.setXYZ(0, -m / 2, 0, 0), b.setXYZ(1, m / 2, 0, 0), b.needsUpdate = !0, _.normalize();
1527
- const O = new a.Quaternion().setFromUnitVectors(new a.Vector3(1, 0, 0), _);
1528
- t.quaternion.copy(O), t.updateMatrixWorld(!0);
1820
+ ), l = new a.Vector3().subVectors(h, n), c = l.length();
1821
+ if (!isFinite(c) || c === 0) return;
1822
+ const d = new a.Vector3().addVectors(n, h).multiplyScalar(0.5);
1823
+ t.position.copy(d);
1824
+ const g = t.geometry;
1825
+ let m = g.getAttribute("position");
1826
+ (!m || m.count < 2) && (g.setAttribute("position", new a.BufferAttribute(new Float32Array(6), 3)), m = g.getAttribute("position")), m.setXYZ(0, -c / 2, 0, 0), m.setXYZ(1, c / 2, 0, 0), m.needsUpdate = !0, l.normalize();
1827
+ const f = new a.Quaternion().setFromUnitVectors(new a.Vector3(1, 0, 0), l);
1828
+ t.quaternion.copy(f), t.updateMatrixWorld(!0);
1529
1829
  }
1530
1830
  /** Запись метаданных выбранного ребра для использования инструментов */
1531
1831
  _prepareEdgeMetadata(t, e) {
1532
- const s = Ve(t);
1832
+ const s = Ye(t);
1533
1833
  if (!s) return;
1534
1834
  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(
1535
1835
  t.matrixWorld
1536
- ), c = new a.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
1836
+ ), h = new a.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
1537
1837
  t.matrixWorld
1538
- ), _ = 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 = [], Y = [];
1539
- for (let E = 0; E < b.count; E++)
1540
- O.fromBufferAttribute(b, E), O.distanceToSquared(m) < y * y ? M.push(E) : O.distanceToSquared(f) < y * y && Y.push(E);
1541
- const k = new a.Matrix4().copy(t.matrixWorld).invert(), z = n.clone().applyMatrix4(k), A = c.clone().applyMatrix4(k), fe = t.geometry.getAttribute("position"), $ = new a.Vector3(), ge = [], be = [];
1542
- for (let E = 0; E < fe.count; E++)
1543
- $.fromBufferAttribute(fe, E), $.distanceToSquared(z) < y * y ? ge.push(E) : $.distanceToSquared(A) < y * y && be.push(E);
1838
+ ), l = new a.Matrix4().copy(s.matrixWorld).invert(), c = n.clone().applyMatrix4(l), d = h.clone().applyMatrix4(l), m = s.geometry.getAttribute("position"), f = new a.Vector3(), u = 1e-6, w = [], S = [];
1839
+ for (let x = 0; x < m.count; x++)
1840
+ f.fromBufferAttribute(m, x), f.distanceToSquared(c) < u * u ? w.push(x) : f.distanceToSquared(d) < u * u && S.push(x);
1841
+ const j = new a.Matrix4().copy(t.matrixWorld).invert(), R = n.clone().applyMatrix4(j), V = h.clone().applyMatrix4(j), E = t.geometry.getAttribute("position"), O = new a.Vector3(), A = [], k = [];
1842
+ for (let x = 0; x < E.count; x++)
1843
+ O.fromBufferAttribute(E, x), O.distanceToSquared(R) < u * u ? A.push(x) : O.distanceToSquared(V) < u * u && k.push(x);
1544
1844
  this._selectLine.userData.edgeInfo = {
1545
1845
  lines: t,
1546
1846
  seg: e,
1547
1847
  mesh: s,
1548
- aIndices: M,
1549
- bIndices: Y,
1550
- aEdgeIndices: ge,
1551
- bEdgeIndices: be
1848
+ aIndices: w,
1849
+ bIndices: S,
1850
+ aEdgeIndices: A,
1851
+ bEdgeIndices: k
1552
1852
  };
1553
1853
  }
1554
1854
  };
1555
- he = ts([
1556
- u(),
1557
- xe(0, h("RendererApi")),
1558
- xe(1, h("IEditorStore"))
1559
- ], he);
1560
- var ss = Object.getOwnPropertyDescriptor, is = (t, e, s, i) => {
1561
- for (var r = i > 1 ? void 0 : i ? ss(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1855
+ _e = hs([
1856
+ M(),
1857
+ He(0, _("RendererApi")),
1858
+ He(1, _("IEditorStore"))
1859
+ ], _e);
1860
+ var ls = Object.getOwnPropertyDescriptor, cs = (t, e, s, i) => {
1861
+ for (var r = i > 1 ? void 0 : i ? ls(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1562
1862
  (n = t[o]) && (r = n(r) || r);
1563
1863
  return r;
1564
- }, rs = (t, e) => (s, i) => e(s, i, t);
1565
- let le = class {
1864
+ }, ds = (t, e) => (s, i) => e(s, i, t);
1865
+ let ue = class {
1566
1866
  constructor(t) {
1567
1867
  this._api = t;
1568
1868
  }
1569
1869
  /** Режим редактирования сцены */
1570
- mode = N.AddFigure;
1870
+ mode = U.AddFigure;
1571
1871
  /** Последняя добавленная фигура, нужно для отката через `ctrl + z`. */
1572
1872
  _lastAddedMesh = null;
1573
1873
  /** Добавление базовых фигур на сцену, которые приписаны в `FigureType`. */
1574
1874
  handle(t) {
1575
- const e = et[t](), s = e.getAttribute("position");
1875
+ const e = ht[t](), s = e.getAttribute("position");
1576
1876
  s && s.setUsage && s.setUsage(a.DynamicDrawUsage);
1577
- const i = new a.Mesh(e, Ie);
1578
- i.layers.enable(ke);
1579
- const r = Ye(i.geometry);
1877
+ const i = new a.Mesh(e, ze);
1878
+ i.layers.enable(J);
1879
+ const r = Ue(i.geometry);
1580
1880
  i.add(r);
1581
- const o = Ne(i.geometry);
1881
+ const o = $e(i.geometry);
1582
1882
  i.add(o), this._api.addMesh(i), this._lastAddedMesh = i;
1583
1883
  }
1584
1884
  /** Срабатывает только на `ctrl + z`. */
@@ -1590,26 +1890,26 @@ let le = class {
1590
1890
  this._lastAddedMesh = null;
1591
1891
  }
1592
1892
  };
1593
- le = is([
1594
- u(),
1595
- rs(0, h("RendererApi"))
1596
- ], le);
1597
- var os = Object.getOwnPropertyDescriptor, ns = (t, e, s, i) => {
1598
- for (var r = i > 1 ? void 0 : i ? os(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1893
+ ue = cs([
1894
+ M(),
1895
+ ds(0, _("RendererApi"))
1896
+ ], ue);
1897
+ var _s = Object.getOwnPropertyDescriptor, us = (t, e, s, i) => {
1898
+ for (var r = i > 1 ? void 0 : i ? _s(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1599
1899
  (n = t[o]) && (r = n(r) || r);
1600
1900
  return r;
1601
- }, Re = (t, e) => (s, i) => e(s, i, t);
1602
- let ce = class {
1901
+ }, Fe = (t, e) => (s, i) => e(s, i, t);
1902
+ let pe = class {
1603
1903
  constructor(t, e) {
1604
1904
  this._api = t, this._store = e;
1605
1905
  }
1606
1906
  /** Режим редактирования сцены */
1607
- mode = N.DeleteFigure;
1907
+ mode = U.DeleteFigure;
1608
1908
  /** Последняя удаленная фигура, сохраняем для отката через `ctrl + z` */
1609
1909
  _lastDeletedMesh = null;
1610
1910
  handle() {
1611
1911
  const t = this._store.getSelectedObject();
1612
- ct(t) && (this._api.removeMesh(t), this._store.setSelectedObject(null), this._lastDeletedMesh = t);
1912
+ bt(t) && (this._api.removeMesh(t), this._store.setSelectedObject(null), this._lastDeletedMesh = t);
1613
1913
  }
1614
1914
  /** Срабатывает только на `ctrl + z`. */
1615
1915
  rollback() {
@@ -1620,17 +1920,17 @@ let ce = class {
1620
1920
  this._lastDeletedMesh = null;
1621
1921
  }
1622
1922
  };
1623
- ce = ns([
1624
- u(),
1625
- Re(0, h("RendererApi")),
1626
- Re(1, h("IEditorStore"))
1627
- ], ce);
1628
- var as = Object.getOwnPropertyDescriptor, hs = (t, e, s, i) => {
1629
- for (var r = i > 1 ? void 0 : i ? as(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1923
+ pe = us([
1924
+ M(),
1925
+ Fe(0, _("RendererApi")),
1926
+ Fe(1, _("IEditorStore"))
1927
+ ], pe);
1928
+ var ps = Object.getOwnPropertyDescriptor, ms = (t, e, s, i) => {
1929
+ for (var r = i > 1 ? void 0 : i ? ps(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1630
1930
  (n = t[o]) && (r = n(r) || r);
1631
1931
  return r;
1632
- }, ls = (t, e) => (s, i) => e(s, i, t);
1633
- let de = class {
1932
+ }, fs = (t, e) => (s, i) => e(s, i, t);
1933
+ let me = class {
1634
1934
  constructor(t) {
1635
1935
  this._renderer = t;
1636
1936
  }
@@ -1689,18 +1989,18 @@ let de = class {
1689
1989
  return this._renderer.onTransformChange(t);
1690
1990
  }
1691
1991
  };
1692
- de = hs([
1693
- u(),
1694
- ls(0, h("EditorRenderer"))
1695
- ], de);
1696
- var cs = Object.getOwnPropertyDescriptor, ds = (t, e, s, i) => {
1697
- for (var r = i > 1 ? void 0 : i ? cs(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1992
+ me = ms([
1993
+ M(),
1994
+ fs(0, _("EditorRenderer"))
1995
+ ], me);
1996
+ var gs = Object.getOwnPropertyDescriptor, bs = (t, e, s, i) => {
1997
+ for (var r = i > 1 ? void 0 : i ? gs(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1698
1998
  (n = t[o]) && (r = n(r) || r);
1699
1999
  return r;
1700
- }, x = (t, e) => (s, i) => e(s, i, t);
1701
- let _e = class {
2000
+ }, W = (t, e) => (s, i) => e(s, i, t);
2001
+ let fe = class {
1702
2002
  constructor(t, e, s, i, r, o) {
1703
- this._displayManager = t, this._selectManager = e, this._toolManager = s, this._sceneManager = i, this._renderer = r, this._store = o, this.setSelectMode(v.Mesh), this.setToolMode(C.Translate);
2003
+ this._displayManager = t, this._selectManager = e, this._toolManager = s, this._sceneManager = i, this._renderer = r, this._store = o, this.setSelectMode(y.Mesh), this.setToolMode(F.Translate);
1704
2004
  }
1705
2005
  setDisplayMode(t) {
1706
2006
  this._displayManager.manage(t);
@@ -1740,27 +2040,27 @@ let _e = class {
1740
2040
  this._displayManager.dispose(), this._selectManager.dispose(), this._renderer.dispose();
1741
2041
  }
1742
2042
  };
1743
- _e = ds([
1744
- u(),
1745
- x(0, h("IDisplayManager")),
1746
- x(1, h("ISelectManager")),
1747
- x(2, h("IToolManager")),
1748
- x(3, h("ISceneManager")),
1749
- x(4, h("EditorRenderer")),
1750
- x(5, h("IEditorStore"))
1751
- ], _e);
1752
- var _s = Object.getOwnPropertyDescriptor, ps = (t, e, s, i) => {
1753
- for (var r = i > 1 ? void 0 : i ? _s(e, s) : e, o = t.length - 1, n; o >= 0; o--)
2043
+ fe = bs([
2044
+ M(),
2045
+ W(0, _("IDisplayManager")),
2046
+ W(1, _("ISelectManager")),
2047
+ W(2, _("IToolManager")),
2048
+ W(3, _("ISceneManager")),
2049
+ W(4, _("EditorRenderer")),
2050
+ W(5, _("IEditorStore"))
2051
+ ], fe);
2052
+ var vs = Object.getOwnPropertyDescriptor, ys = (t, e, s, i) => {
2053
+ for (var r = i > 1 ? void 0 : i ? vs(e, s) : e, o = t.length - 1, n; o >= 0; o--)
1754
2054
  (n = t[o]) && (r = n(r) || r);
1755
2055
  return r;
1756
2056
  };
1757
- let pe = class {
2057
+ let ge = class {
1758
2058
  /** Текущий режим выборки. */
1759
- _selectMode = v.Mesh;
2059
+ _selectMode = y.Mesh;
1760
2060
  /** Текущий выбранный инструмент. */
1761
- _toolType = C.Translate;
2061
+ _toolType = F.Translate;
1762
2062
  /** Выбранный режим отображения. */
1763
- _displayMode = V.Plane;
2063
+ _displayMode = $.Plane;
1764
2064
  /** Выбранный объект на сцене. */
1765
2065
  _selectedObject = null;
1766
2066
  /** Слушатели событий по изменению выбранного объекта. */
@@ -1768,7 +2068,7 @@ let pe = class {
1768
2068
  /** Слушатели событий трансформации выбранного объекта. */
1769
2069
  _transformListeners = /* @__PURE__ */ new Set();
1770
2070
  constructor() {
1771
- Je(this, {}, { autoBind: !0 });
2071
+ at(this, {}, { autoBind: !0 });
1772
2072
  }
1773
2073
  /** @inheritdoc */
1774
2074
  getSelectMode() {
@@ -1801,7 +2101,7 @@ let pe = class {
1801
2101
  /** @inheritdoc */
1802
2102
  getSelectionStats() {
1803
2103
  const t = this._selectedObject;
1804
- return t ? dt(t) : null;
2104
+ return t ? vt(t) : null;
1805
2105
  }
1806
2106
  /** @inheritdoc */
1807
2107
  setSelectedObject(t) {
@@ -1823,28 +2123,28 @@ let pe = class {
1823
2123
  for (const t of this._transformListeners) t();
1824
2124
  }
1825
2125
  };
1826
- pe = ps([
1827
- u()
1828
- ], pe);
1829
- let je = !1;
1830
- const d = qe.createChildContainer();
1831
- function us(t) {
1832
- return je || (d.registerInstance("Canvas", t), d.registerSingleton("EventBus", G), d.registerSingleton("EditorRenderer", K), d.registerSingleton("RendererApi", de), d.registerSingleton("IDisplayHandler", te), d.registerSingleton("ISelectHandler", se), d.registerSingleton("ISelectHandler", ie), d.registerSingleton("ISelectHandler", he), d.registerSingleton("ISelectHandler", re), d.registerSingleton("IToolHandler", oe), d.registerSingleton("IToolHandler", ne), d.registerSingleton("IToolHandler", ae), d.registerSingleton("ISceneHandler", le), d.registerSingleton("ISceneHandler", ce), d.registerSingleton("IDisplayManager", q), d.registerSingleton("ISelectManager", Q), d.registerSingleton("IToolManager", J), d.registerSingleton("ISceneManager", ee), d.registerSingleton("EditorHub", _e), d.registerSingleton("IEditorStore", pe), je = !0), d;
2126
+ ge = ys([
2127
+ M()
2128
+ ], ge);
2129
+ let We = !1;
2130
+ const b = ot.createChildContainer();
2131
+ function Ms(t) {
2132
+ return We || (b.registerInstance("Canvas", t), b.registerSingleton("EventBus", Q), b.registerSingleton("EditorRenderer", ee), b.registerSingleton("RendererApi", me), b.registerSingleton("IDisplayHandler", oe), b.registerSingleton("ISelectHandler", ne), b.registerSingleton("ISelectHandler", ae), b.registerSingleton("ISelectHandler", _e), b.registerSingleton("ISelectHandler", he), b.registerSingleton("IToolHandler", le), b.registerSingleton("IToolHandler", ce), b.registerSingleton("IToolHandler", de), b.registerSingleton("ISceneHandler", ue), b.registerSingleton("ISceneHandler", pe), b.registerSingleton("IDisplayManager", te), b.registerSingleton("ISelectManager", se), b.registerSingleton("IToolManager", ie), b.registerSingleton("ISceneManager", re), b.registerSingleton("EditorHub", fe), b.registerSingleton("IEditorStore", ge), We = !0), b;
1833
2133
  }
1834
- let j = null;
1835
- const Ss = (t) => (j || (j = us(t)), j.resolve("EditorHub")), Ps = () => {
1836
- if (!j)
2134
+ let N = null;
2135
+ const Cs = (t) => (N || (N = Ms(t)), N.resolve("EditorHub")), As = () => {
2136
+ if (!N)
1837
2137
  throw new Error("EditorHub is not initialized. Call createAppHub(canvas) first.");
1838
- return j.resolve("EditorHub");
2138
+ return N.resolve("EditorHub");
1839
2139
  };
1840
2140
  export {
1841
- _e as EditorHub,
1842
- K as EditorRenderer,
1843
- G as EventBus,
2141
+ fe as EditorHub,
2142
+ ee as EditorRenderer,
2143
+ Q as EventBus,
1844
2144
  H as EventTopics,
1845
- ws as ObjLoader,
1846
- Es as PreviewRenderer,
1847
- He as Renderer,
1848
- Ss as createAppHub,
1849
- Ps as getAppHub
2145
+ Ds as ObjLoader,
2146
+ Ls as PreviewRenderer,
2147
+ Ne as Renderer,
2148
+ Cs as createAppHub,
2149
+ As as getAppHub
1850
2150
  };