@planara/core 2.6.0 → 2.6.1
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.cjs.js +2 -2
- package/dist/index.es.js +199 -184
- package/dist/index.umd.js +2 -2
- package/dist/interfaces/policy/tool-availability-policy.d.ts +12 -0
- package/dist/interfaces/policy/tool-availability-policy.d.ts.map +1 -0
- package/dist/managers/tool/tool-manager.d.ts +3 -0
- package/dist/managers/tool/tool-manager.d.ts.map +1 -1
- package/dist/policy/tool-availability-policy.d.ts +13 -0
- package/dist/policy/tool-availability-policy.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import * as a from "three";
|
|
3
|
-
import { Controls as
|
|
4
|
-
import { FigureType as P, SelectMode as v, Figure as Ze, DisplayMode as k, ToolType as C, SceneMode as V } from "@planara/types";
|
|
5
|
-
import { SymmetricAxesHelper as $e, OrbitWithState as
|
|
6
|
-
import { injectable as u, inject as h, injectAll as W, container as
|
|
7
|
-
import { EventEmitter as
|
|
8
|
-
import { makeAutoObservable as
|
|
9
|
-
const
|
|
3
|
+
import { Controls as Ue, Vector3 as D, MOUSE as j, TOUCH as x, Quaternion as be, Spherical as ve, Vector2 as w, Ray as We, Plane as ze, MathUtils as Fe } from "three";
|
|
4
|
+
import { FigureType as P, SelectMode as v, Figure as Ze, DisplayMode as k, DEFAULT_TOOL_RULES as ye, ToolType as C, SceneMode as V } from "@planara/types";
|
|
5
|
+
import { SymmetricAxesHelper as $e, OrbitWithState as Be, CameraAxesGizmo as Xe, ModelingTransformControls as Ge } from "@planara/three";
|
|
6
|
+
import { injectable as u, inject as h, injectAll as W, container as Ke } from "tsyringe";
|
|
7
|
+
import { EventEmitter as qe } from "events";
|
|
8
|
+
import { makeAutoObservable as Qe } from "mobx";
|
|
9
|
+
const Je = {
|
|
10
10
|
[P.Plane]: () => new a.PlaneGeometry(1, 1, 1, 1),
|
|
11
11
|
[P.Cube]: () => new a.BoxGeometry(1, 1, 1, 1, 1, 1),
|
|
12
12
|
[P.UVSphere]: () => new a.SphereGeometry(0.5, 32, 16),
|
|
@@ -19,12 +19,12 @@ const Qe = {
|
|
|
19
19
|
[P.Custom]: function() {
|
|
20
20
|
throw new Error("Custom geometry is not generated here.");
|
|
21
21
|
}
|
|
22
|
-
},
|
|
22
|
+
}, Re = new a.MeshStandardMaterial({
|
|
23
23
|
color: 12566463,
|
|
24
24
|
metalness: 0,
|
|
25
25
|
roughness: 0.6
|
|
26
|
-
}),
|
|
27
|
-
class
|
|
26
|
+
}), et = 8;
|
|
27
|
+
class Ie {
|
|
28
28
|
/** Корневой объект сцены */
|
|
29
29
|
scene;
|
|
30
30
|
/** Камера для сцены */
|
|
@@ -81,7 +81,7 @@ class Re {
|
|
|
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,
|
|
84
|
+
const i = new a.Mesh(s, Re);
|
|
85
85
|
return this.scene.add(i), this.meshes.push(i), i;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
@@ -172,15 +172,15 @@ class Re {
|
|
|
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
|
|
176
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
175
|
+
var tt = Object.getOwnPropertyDescriptor, st = (t, e, s, i) => {
|
|
176
|
+
for (var r = i > 1 ? void 0 : i ? tt(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
180
|
let X = class {
|
|
181
181
|
_emitter;
|
|
182
182
|
constructor() {
|
|
183
|
-
this._emitter = new
|
|
183
|
+
this._emitter = new qe();
|
|
184
184
|
}
|
|
185
185
|
/** Публикация события */
|
|
186
186
|
emit(t, e) {
|
|
@@ -195,22 +195,22 @@ let X = class {
|
|
|
195
195
|
this._emitter.off(t, e);
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
|
-
X =
|
|
198
|
+
X = st([
|
|
199
199
|
u()
|
|
200
200
|
], X);
|
|
201
201
|
var R = /* @__PURE__ */ ((t) => (t.SelectHover = "select.hover", t.SelectClick = "select.click", t.ToolSelect = "tool.select", t))(R || {});
|
|
202
|
-
const
|
|
202
|
+
const it = 0.03, rt = 0.05, He = 0, ot = 1, nt = 2, T = 31, z = 16776960, F = 16755200, at = 2236962, ht = 2236962, lt = (t) => !!t && t.isMesh, ke = (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
|
-
},
|
|
209
|
+
}, Ve = (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:
|
|
213
|
+
color: ht,
|
|
214
214
|
size: 6,
|
|
215
215
|
sizeAttenuation: !1,
|
|
216
216
|
depthTest: !1,
|
|
@@ -218,31 +218,31 @@ const st = 0.03, it = 0.05, Ie = 0, rt = 1, ot = 2, L = 31, z = 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(
|
|
222
|
-
},
|
|
221
|
+
return i.layers.set(nt), i.renderOrder = 1e3, i.visible = !1, i;
|
|
222
|
+
}, Ne = (t) => {
|
|
223
223
|
const e = new a.EdgesGeometry(t), s = new a.LineSegments(
|
|
224
224
|
e,
|
|
225
|
-
new a.LineBasicMaterial({ color:
|
|
225
|
+
new a.LineBasicMaterial({ color: at, linewidth: 1 })
|
|
226
226
|
);
|
|
227
|
-
return s.layers.set(
|
|
227
|
+
return s.layers.set(ot), s;
|
|
228
228
|
};
|
|
229
|
-
var
|
|
230
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
229
|
+
var ct = Object.getOwnPropertyDescriptor, dt = (t, e, s, i) => {
|
|
230
|
+
for (var r = i > 1 ? void 0 : i ? ct(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
231
231
|
(n = t[o]) && (r = n(r) || r);
|
|
232
232
|
return r;
|
|
233
|
-
},
|
|
234
|
-
let G = class extends
|
|
233
|
+
}, Me = (t, e) => (s, i) => e(s, i, t);
|
|
234
|
+
let G = class extends Ie {
|
|
235
235
|
constructor(t, e) {
|
|
236
236
|
super(t), this._canvas = t, this._bus = e;
|
|
237
237
|
const s = new a.GridHelper(10, 10);
|
|
238
238
|
s.position.y = -1e-3, this.scene.add(s);
|
|
239
239
|
const i = new $e(6);
|
|
240
|
-
this.scene.add(i), this._orbit = new
|
|
240
|
+
this.scene.add(i), this._orbit = new Be(this.camera, this.renderer.domElement), this._orbit.enableDamping = !0, this._orbit.dampingFactor = 0.05, this._cameraGizmo = new Xe(this.renderer, this.camera, {
|
|
241
241
|
size: 96,
|
|
242
242
|
// Размер квадрата
|
|
243
243
|
margin: 36
|
|
244
244
|
// Отступы по сторонам (снизу и справа)
|
|
245
|
-
}), this._raycaster = new a.Raycaster(), this._mouse = new a.Vector2(), this.scene.add(new a.HemisphereLight(16777215, 4473924, 0.6)), this.camera.layers.enable(0), this.camera.layers.enable(1), this._transform = new
|
|
245
|
+
}), this._raycaster = new a.Raycaster(), this._mouse = new a.Vector2(), this.scene.add(new a.HemisphereLight(16777215, 4473924, 0.6)), this.camera.layers.enable(0), this.camera.layers.enable(1), this._transform = new Ge(this.camera, this.renderer.domElement), this._transformHelper = this._transform.getHelper(), this.scene.add(this._transformHelper), this._isEventListenersAdded || this._initMouseListeners();
|
|
246
246
|
}
|
|
247
247
|
/** Orbit-контроллер для управления камерой */
|
|
248
248
|
_orbit;
|
|
@@ -271,10 +271,10 @@ let G = class extends Re {
|
|
|
271
271
|
/** Добавление фигуры на сцену */
|
|
272
272
|
addFigure(t) {
|
|
273
273
|
const e = super.addFigure(t);
|
|
274
|
-
e.layers.enable(
|
|
275
|
-
const s =
|
|
274
|
+
e.layers.enable(He);
|
|
275
|
+
const s = Ne(e.geometry);
|
|
276
276
|
e.add(s);
|
|
277
|
-
const i =
|
|
277
|
+
const i = Ve(e.geometry);
|
|
278
278
|
return e.add(i), e;
|
|
279
279
|
}
|
|
280
280
|
/**
|
|
@@ -312,10 +312,10 @@ let G = class extends Re {
|
|
|
312
312
|
e.layers.set(0);
|
|
313
313
|
break;
|
|
314
314
|
case v.Edge:
|
|
315
|
-
e.layers.set(1), e.params.Line.threshold =
|
|
315
|
+
e.layers.set(1), e.params.Line.threshold = it;
|
|
316
316
|
break;
|
|
317
317
|
case v.Vertex:
|
|
318
|
-
e.layers.set(2), e.params.Points.threshold =
|
|
318
|
+
e.layers.set(2), e.params.Points.threshold = rt;
|
|
319
319
|
break;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
@@ -350,12 +350,12 @@ let G = class extends Re {
|
|
|
350
350
|
s ? n !== this._lastHovered && (this.meshes.forEach((c) => c.userData.isHit = !1), n && (n.userData.isHit = !0), this._lastHovered = n, this._bus.emit(e, o ? { intersection: o } : null)) : this._bus.emit(e, o ? { intersection: o } : null);
|
|
351
351
|
}
|
|
352
352
|
};
|
|
353
|
-
G =
|
|
353
|
+
G = dt([
|
|
354
354
|
u(),
|
|
355
|
-
|
|
356
|
-
|
|
355
|
+
Me(0, h("Canvas")),
|
|
356
|
+
Me(1, h("EventBus"))
|
|
357
357
|
], G);
|
|
358
|
-
const
|
|
358
|
+
const Ee = { type: "change" }, pe = { type: "start" }, Ye = { type: "end" }, U = new We(), we = new ze(), _t = Math.cos(70 * Fe.DEG2RAD), p = new D(), g = 2 * Math.PI, l = {
|
|
359
359
|
NONE: -1,
|
|
360
360
|
ROTATE: 0,
|
|
361
361
|
DOLLY: 1,
|
|
@@ -364,8 +364,8 @@ const Me = { type: "change" }, pe = { type: "start" }, Ne = { type: "end" }, U =
|
|
|
364
364
|
TOUCH_PAN: 4,
|
|
365
365
|
TOUCH_DOLLY_PAN: 5,
|
|
366
366
|
TOUCH_DOLLY_ROTATE: 6
|
|
367
|
-
},
|
|
368
|
-
class
|
|
367
|
+
}, $ = 1e-6;
|
|
368
|
+
class pt extends Ue {
|
|
369
369
|
/**
|
|
370
370
|
* Constructs a new controls instance.
|
|
371
371
|
*
|
|
@@ -373,7 +373,7 @@ class _t extends Ye {
|
|
|
373
373
|
* @param {?HTMLElement} domElement - The HTML element used for event listeners.
|
|
374
374
|
*/
|
|
375
375
|
constructor(e, s = null) {
|
|
376
|
-
super(e, s), this.state = l.NONE, this.target = new D(), this.cursor = new D(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: j.ROTATE, MIDDLE: j.DOLLY, RIGHT: j.PAN }, this.touches = { ONE: x.ROTATE, TWO: x.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new D(), this._lastQuaternion = new be(), this._lastTargetPosition = new D(), this._quat = new be().setFromUnitVectors(e.up, new D(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ve(), this._sphericalDelta = new ve(), this._scale = 1, this._panOffset = new D(), this._rotateStart = new
|
|
376
|
+
super(e, s), this.state = l.NONE, this.target = new D(), this.cursor = new D(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: j.ROTATE, MIDDLE: j.DOLLY, RIGHT: j.PAN }, this.touches = { ONE: x.ROTATE, TWO: x.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new D(), this._lastQuaternion = new be(), this._lastTargetPosition = new D(), this._quat = new be().setFromUnitVectors(e.up, new D(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ve(), this._sphericalDelta = new ve(), this._scale = 1, this._panOffset = new D(), this._rotateStart = new 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 D(), this._mouse = new w(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = mt.bind(this), this._onPointerDown = ut.bind(this), this._onPointerUp = ft.bind(this), this._onContextMenu = wt.bind(this), this._onMouseWheel = vt.bind(this), this._onKeyDown = yt.bind(this), this._onTouchStart = Mt.bind(this), this._onTouchMove = Et.bind(this), this._onMouseDown = gt.bind(this), this._onMouseMove = bt.bind(this), this._interceptControlDown = Pt.bind(this), this._interceptControlUp = St.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
377
377
|
}
|
|
378
378
|
connect(e) {
|
|
379
379
|
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -434,7 +434,7 @@ class _t extends Ye {
|
|
|
434
434
|
* was called, or the initial state.
|
|
435
435
|
*/
|
|
436
436
|
reset() {
|
|
437
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
437
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Ee), this.update(), this.state = l.NONE;
|
|
438
438
|
}
|
|
439
439
|
update(e = null) {
|
|
440
440
|
const s = this.object.position;
|
|
@@ -464,12 +464,12 @@ class _t extends Ye {
|
|
|
464
464
|
m.unproject(this.object), this.object.position.sub(m).add(c), this.object.updateMatrixWorld(), n = p.length();
|
|
465
465
|
} else
|
|
466
466
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
467
|
-
n !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(n).add(this.object.position) : (U.origin.copy(this.object.position), U.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(U.direction)) <
|
|
467
|
+
n !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(n).add(this.object.position) : (U.origin.copy(this.object.position), U.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(U.direction)) < _t ? this.object.lookAt(this.target) : (we.setFromNormalAndCoplanarPoint(this.object.up, this.target), U.intersectPlane(we, this.target))));
|
|
468
468
|
} else if (this.object.isOrthographicCamera) {
|
|
469
469
|
const n = this.object.zoom;
|
|
470
470
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), n !== this.object.zoom && (this.object.updateProjectionMatrix(), o = !0);
|
|
471
471
|
}
|
|
472
|
-
return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) >
|
|
472
|
+
return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) > $ || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > $ || this._lastTargetPosition.distanceToSquared(this.target) > $ ? (this.dispatchEvent(Ee), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
473
473
|
}
|
|
474
474
|
_getAutoRotationAngle(e) {
|
|
475
475
|
return e !== null ? g / 60 * this.autoRotateSpeed * e : g / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -637,7 +637,7 @@ class _t extends Ye {
|
|
|
637
637
|
}
|
|
638
638
|
_trackPointer(e) {
|
|
639
639
|
let s = this._pointerPositions[e.pointerId];
|
|
640
|
-
s === void 0 && (s = new
|
|
640
|
+
s === void 0 && (s = new w(), this._pointerPositions[e.pointerId] = s), s.set(e.pageX, e.pageY);
|
|
641
641
|
}
|
|
642
642
|
_getSecondPointerPosition(e) {
|
|
643
643
|
const s = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
|
|
@@ -661,16 +661,16 @@ class _t extends Ye {
|
|
|
661
661
|
return e.ctrlKey && !this._controlActive && (i.deltaY *= 10), i;
|
|
662
662
|
}
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function ut(t) {
|
|
665
665
|
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(t.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(t) && (this._addPointer(t), t.pointerType === "touch" ? this._onTouchStart(t) : this._onMouseDown(t)));
|
|
666
666
|
}
|
|
667
|
-
function
|
|
667
|
+
function mt(t) {
|
|
668
668
|
this.enabled !== !1 && (t.pointerType === "touch" ? this._onTouchMove(t) : this._onMouseMove(t));
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function ft(t) {
|
|
671
671
|
switch (this._removePointer(t), this._pointers.length) {
|
|
672
672
|
case 0:
|
|
673
|
-
this.domElement.releasePointerCapture(t.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(
|
|
673
|
+
this.domElement.releasePointerCapture(t.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(Ye), this.state = l.NONE;
|
|
674
674
|
break;
|
|
675
675
|
case 1:
|
|
676
676
|
const e = this._pointers[0], s = this._pointerPositions[e];
|
|
@@ -678,7 +678,7 @@ function mt(t) {
|
|
|
678
678
|
break;
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function gt(t) {
|
|
682
682
|
let e;
|
|
683
683
|
switch (t.button) {
|
|
684
684
|
case 0:
|
|
@@ -721,7 +721,7 @@ function ft(t) {
|
|
|
721
721
|
}
|
|
722
722
|
this.state !== l.NONE && this.dispatchEvent(pe);
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function bt(t) {
|
|
725
725
|
switch (this.state) {
|
|
726
726
|
case l.ROTATE:
|
|
727
727
|
if (this.enableRotate === !1) return;
|
|
@@ -737,13 +737,13 @@ function gt(t) {
|
|
|
737
737
|
break;
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
function bt(t) {
|
|
741
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== l.NONE || (t.preventDefault(), this.dispatchEvent(pe), this._handleMouseWheel(this._customWheelEvent(t)), this.dispatchEvent(Ne));
|
|
742
|
-
}
|
|
743
740
|
function vt(t) {
|
|
744
|
-
this.enabled
|
|
741
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== l.NONE || (t.preventDefault(), this.dispatchEvent(pe), this._handleMouseWheel(this._customWheelEvent(t)), this.dispatchEvent(Ye));
|
|
745
742
|
}
|
|
746
743
|
function yt(t) {
|
|
744
|
+
this.enabled !== !1 && this._handleKeyDown(t);
|
|
745
|
+
}
|
|
746
|
+
function Mt(t) {
|
|
747
747
|
switch (this._trackPointer(t), this._pointers.length) {
|
|
748
748
|
case 1:
|
|
749
749
|
switch (this.touches.ONE) {
|
|
@@ -778,7 +778,7 @@ function yt(t) {
|
|
|
778
778
|
}
|
|
779
779
|
this.state !== l.NONE && this.dispatchEvent(pe);
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function Et(t) {
|
|
782
782
|
switch (this._trackPointer(t), this.state) {
|
|
783
783
|
case l.TOUCH_ROTATE:
|
|
784
784
|
if (this.enableRotate === !1) return;
|
|
@@ -803,17 +803,17 @@ function Mt(t) {
|
|
|
803
803
|
function wt(t) {
|
|
804
804
|
this.enabled !== !1 && t.preventDefault();
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function Pt(t) {
|
|
807
807
|
t.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
808
808
|
}
|
|
809
|
-
function
|
|
809
|
+
function St(t) {
|
|
810
810
|
t.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
811
811
|
}
|
|
812
|
-
class
|
|
812
|
+
class ys extends Ie {
|
|
813
813
|
/** Orbit-контроллер для управления камерой */
|
|
814
814
|
_orbit;
|
|
815
815
|
constructor(e) {
|
|
816
|
-
super(e), this.camera.position.set(1, 1, 7), this.camera.lookAt(0, 0, 0), this._orbit = new
|
|
816
|
+
super(e), this.camera.position.set(1, 1, 7), this.camera.lookAt(0, 0, 0), this._orbit = new pt(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;
|
|
817
817
|
}
|
|
818
818
|
/**
|
|
819
819
|
* Обновление состояния рендерера.
|
|
@@ -822,7 +822,7 @@ class bs extends Re {
|
|
|
822
822
|
this._orbit?.update();
|
|
823
823
|
}
|
|
824
824
|
}
|
|
825
|
-
class
|
|
825
|
+
class Ms {
|
|
826
826
|
/** Позиции вершин */
|
|
827
827
|
_positions = [];
|
|
828
828
|
/** Нормали вершин */
|
|
@@ -889,11 +889,11 @@ class vs {
|
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
|
-
var
|
|
893
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
892
|
+
var Ot = Object.getOwnPropertyDescriptor, Dt = (t, e, s, i) => {
|
|
893
|
+
for (var r = i > 1 ? void 0 : i ? Ot(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
894
894
|
(n = t[o]) && (r = n(r) || r);
|
|
895
895
|
return r;
|
|
896
|
-
},
|
|
896
|
+
}, Pe = (t, e) => (s, i) => e(s, i, t);
|
|
897
897
|
let K = class {
|
|
898
898
|
constructor(t, e) {
|
|
899
899
|
this._store = e, this._handlers = new Map(t.map((s) => [s.mode, s]));
|
|
@@ -911,13 +911,13 @@ let K = class {
|
|
|
911
911
|
this._handlers && this._handlers.clear(), this._currentMode = k.Plane, this._store.setDisplayMode(this._currentMode);
|
|
912
912
|
}
|
|
913
913
|
};
|
|
914
|
-
K =
|
|
914
|
+
K = Dt([
|
|
915
915
|
u(),
|
|
916
|
-
|
|
917
|
-
|
|
916
|
+
Pe(0, W("IDisplayHandler")),
|
|
917
|
+
Pe(1, h("IEditorStore"))
|
|
918
918
|
], K);
|
|
919
|
-
var S = /* @__PURE__ */ ((t) => (t.Hover = "hover", t.Click = "click", t))(S || {}),
|
|
920
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
919
|
+
var S = /* @__PURE__ */ ((t) => (t.Hover = "hover", t.Click = "click", t))(S || {}), Tt = Object.getOwnPropertyDescriptor, Lt = (t, e, s, i) => {
|
|
920
|
+
for (var r = i > 1 ? void 0 : i ? Tt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
921
921
|
(n = t[o]) && (r = n(r) || r);
|
|
922
922
|
return r;
|
|
923
923
|
}, B = (t, e) => (s, i) => e(s, i, t);
|
|
@@ -952,40 +952,55 @@ q = Lt([
|
|
|
952
952
|
B(1, W("ISelectHandler")),
|
|
953
953
|
B(2, h("IEditorStore"))
|
|
954
954
|
], q);
|
|
955
|
-
|
|
956
|
-
|
|
955
|
+
class Ct {
|
|
956
|
+
/** Доступен ли инструмент при текущем режиме выборки */
|
|
957
|
+
isToolEnabled(e, s) {
|
|
958
|
+
return ye[s].includes(e);
|
|
959
|
+
}
|
|
960
|
+
/** Получение доступных инструментов для режима выборки*/
|
|
961
|
+
getEnabledTools(e) {
|
|
962
|
+
return ye[e];
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
var At = Object.getOwnPropertyDescriptor, xt = (t, e, s, i) => {
|
|
966
|
+
for (var r = i > 1 ? void 0 : i ? At(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
957
967
|
(n = t[o]) && (r = n(r) || r);
|
|
958
968
|
return r;
|
|
959
|
-
},
|
|
969
|
+
}, Se = (t, e) => (s, i) => e(s, i, t);
|
|
960
970
|
let Q = class {
|
|
961
971
|
constructor(t, e) {
|
|
962
972
|
this._store = e, this._handlers = new Map(t.map((s) => [s.mode, s])), this._unsubSelected = this._store.onSelectedObjectChange(() => {
|
|
963
973
|
this._handlers.get(this._currentTool)?.handle();
|
|
964
|
-
});
|
|
974
|
+
}), this._policy = new Ct();
|
|
965
975
|
}
|
|
966
976
|
/** Текущий выбранный инструмент */
|
|
967
977
|
_currentTool = C.Translate;
|
|
968
978
|
/** Хендлеры, которые управляют инструментами */
|
|
969
979
|
_handlers;
|
|
980
|
+
/** Событие обновления выбора объекта */
|
|
970
981
|
_unsubSelected;
|
|
982
|
+
/** Политика доступности инструментов */
|
|
983
|
+
_policy;
|
|
971
984
|
manage(t) {
|
|
972
|
-
|
|
985
|
+
if (this._currentTool === t) return;
|
|
986
|
+
const e = this._store.getSelectMode();
|
|
987
|
+
this._policy.isToolEnabled(t, e) && (this._handlers.get(this._currentTool)?.rollback(), this._currentTool = t, this._store.setToolType(this._currentTool), this._handlers.get(this._currentTool)?.handle());
|
|
973
988
|
}
|
|
974
989
|
/** Освобождает ресурсы менеджера. */
|
|
975
990
|
dispose() {
|
|
976
991
|
this._unsubSelected?.(), this._handlers && this._handlers.clear(), this._currentTool = C.Translate, this._store.setToolType(this._currentTool);
|
|
977
992
|
}
|
|
978
993
|
};
|
|
979
|
-
Q =
|
|
994
|
+
Q = xt([
|
|
980
995
|
u(),
|
|
981
|
-
|
|
982
|
-
|
|
996
|
+
Se(0, W("IToolHandler")),
|
|
997
|
+
Se(1, h("IEditorStore"))
|
|
983
998
|
], Q);
|
|
984
|
-
var
|
|
985
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
999
|
+
var jt = Object.getOwnPropertyDescriptor, Rt = (t, e, s, i) => {
|
|
1000
|
+
for (var r = i > 1 ? void 0 : i ? jt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
986
1001
|
(n = t[o]) && (r = n(r) || r);
|
|
987
1002
|
return r;
|
|
988
|
-
},
|
|
1003
|
+
}, It = (t, e) => (s, i) => e(s, i, t);
|
|
989
1004
|
let J = class {
|
|
990
1005
|
/** Текущий режим редактирования сцены */
|
|
991
1006
|
_currentMode = V.AddFigure;
|
|
@@ -1003,15 +1018,15 @@ let J = class {
|
|
|
1003
1018
|
this._handlers && this._handlers.clear(), this._currentMode = V.AddFigure;
|
|
1004
1019
|
}
|
|
1005
1020
|
};
|
|
1006
|
-
J =
|
|
1021
|
+
J = Rt([
|
|
1007
1022
|
u(),
|
|
1008
|
-
|
|
1023
|
+
It(0, W("ISceneHandler"))
|
|
1009
1024
|
], J);
|
|
1010
|
-
var
|
|
1011
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1025
|
+
var Ht = Object.getOwnPropertyDescriptor, kt = (t, e, s, i) => {
|
|
1026
|
+
for (var r = i > 1 ? void 0 : i ? Ht(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1012
1027
|
(n = t[o]) && (r = n(r) || r);
|
|
1013
1028
|
return r;
|
|
1014
|
-
},
|
|
1029
|
+
}, Vt = (t, e) => (s, i) => e(s, i, t);
|
|
1015
1030
|
let ee = class {
|
|
1016
1031
|
constructor(t) {
|
|
1017
1032
|
this._api = t;
|
|
@@ -1068,15 +1083,15 @@ let ee = class {
|
|
|
1068
1083
|
"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));
|
|
1069
1084
|
}
|
|
1070
1085
|
};
|
|
1071
|
-
ee =
|
|
1086
|
+
ee = kt([
|
|
1072
1087
|
u(),
|
|
1073
|
-
|
|
1088
|
+
Vt(0, h("RendererApi"))
|
|
1074
1089
|
], ee);
|
|
1075
|
-
var
|
|
1076
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1090
|
+
var Nt = Object.getOwnPropertyDescriptor, Yt = (t, e, s, i) => {
|
|
1091
|
+
for (var r = i > 1 ? void 0 : i ? Nt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1077
1092
|
(n = t[o]) && (r = n(r) || r);
|
|
1078
1093
|
return r;
|
|
1079
|
-
},
|
|
1094
|
+
}, Oe = (t, e) => (s, i) => e(s, i, t);
|
|
1080
1095
|
let te = class {
|
|
1081
1096
|
constructor(t, e) {
|
|
1082
1097
|
this._api = t, this._store = e;
|
|
@@ -1091,7 +1106,7 @@ let te = class {
|
|
|
1091
1106
|
/** Цвет ребер для фигуры, на которую навелись */
|
|
1092
1107
|
_hoverColor = z;
|
|
1093
1108
|
/** Цвет ребер для выделенной фигуры */
|
|
1094
|
-
_selectColor =
|
|
1109
|
+
_selectColor = F;
|
|
1095
1110
|
/** Исходные цвета материалов линий для отката */
|
|
1096
1111
|
_origLineColors = /* @__PURE__ */ new WeakMap();
|
|
1097
1112
|
handle(t, e) {
|
|
@@ -1148,16 +1163,16 @@ let te = class {
|
|
|
1148
1163
|
});
|
|
1149
1164
|
}
|
|
1150
1165
|
};
|
|
1151
|
-
te =
|
|
1166
|
+
te = Yt([
|
|
1152
1167
|
u(),
|
|
1153
|
-
|
|
1154
|
-
|
|
1168
|
+
Oe(0, h("RendererApi")),
|
|
1169
|
+
Oe(1, h("IEditorStore"))
|
|
1155
1170
|
], te);
|
|
1156
|
-
var
|
|
1157
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1171
|
+
var Ut = Object.getOwnPropertyDescriptor, Wt = (t, e, s, i) => {
|
|
1172
|
+
for (var r = i > 1 ? void 0 : i ? Ut(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1158
1173
|
(n = t[o]) && (r = n(r) || r);
|
|
1159
1174
|
return r;
|
|
1160
|
-
},
|
|
1175
|
+
}, zt = (t, e) => (s, i) => e(s, i, t);
|
|
1161
1176
|
let se = class {
|
|
1162
1177
|
constructor(t) {
|
|
1163
1178
|
this._api = t;
|
|
@@ -1172,7 +1187,7 @@ let se = class {
|
|
|
1172
1187
|
/** Цвет грани, на которую навелись */
|
|
1173
1188
|
_hoverColor = z;
|
|
1174
1189
|
/** Цвет выделенной граней */
|
|
1175
|
-
_selectColor =
|
|
1190
|
+
_selectColor = F;
|
|
1176
1191
|
/** Изначальный цвет граней у модели, перед наложением эффектов*/
|
|
1177
1192
|
_defaultColor = 2236962;
|
|
1178
1193
|
handle(t, e) {
|
|
@@ -1186,18 +1201,18 @@ let se = class {
|
|
|
1186
1201
|
throw new Error("Method not implemented.");
|
|
1187
1202
|
}
|
|
1188
1203
|
};
|
|
1189
|
-
se =
|
|
1204
|
+
se = Wt([
|
|
1190
1205
|
u(),
|
|
1191
|
-
|
|
1206
|
+
zt(0, h("RendererApi"))
|
|
1192
1207
|
], se);
|
|
1193
|
-
var
|
|
1194
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1208
|
+
var Ft = Object.getOwnPropertyDescriptor, Zt = (t, e, s, i) => {
|
|
1209
|
+
for (var r = i > 1 ? void 0 : i ? Ft(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1195
1210
|
(n = t[o]) && (r = n(r) || r);
|
|
1196
1211
|
return r;
|
|
1197
|
-
},
|
|
1212
|
+
}, De = (t, e) => (s, i) => e(s, i, t);
|
|
1198
1213
|
let ie = class {
|
|
1199
1214
|
constructor(t, e) {
|
|
1200
|
-
this._api = t, this._store = e, this._api.enableCameraLayer(
|
|
1215
|
+
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);
|
|
1201
1216
|
}
|
|
1202
1217
|
/** Режим, которым управляет хендлер, нужен только менеджеру */
|
|
1203
1218
|
mode = v.Vertex;
|
|
@@ -1211,7 +1226,7 @@ let ie = class {
|
|
|
1211
1226
|
/** Цвет ребра, на которое навелись */
|
|
1212
1227
|
_hoverColor = z;
|
|
1213
1228
|
/** Цвет выделенного ребра */
|
|
1214
|
-
_selectColor =
|
|
1229
|
+
_selectColor = F;
|
|
1215
1230
|
handle(t, e) {
|
|
1216
1231
|
if (this._api.setRaycastMode(this.mode), e === S.Hover) {
|
|
1217
1232
|
if (!t) {
|
|
@@ -1244,7 +1259,7 @@ let ie = class {
|
|
|
1244
1259
|
dispose() {
|
|
1245
1260
|
this.rollback(), this._api.removeObject(this._hoverVertex), this._api.removeObject(this._selectVertex), this._hoverVertex.geometry.dispose(), this._hoverVertex.material.dispose(), this._selectVertex.geometry.dispose(), this._selectVertex.material.dispose();
|
|
1246
1261
|
}
|
|
1247
|
-
_makeOverlayVertex(t, e =
|
|
1262
|
+
_makeOverlayVertex(t, e = et) {
|
|
1248
1263
|
const s = new a.BufferGeometry();
|
|
1249
1264
|
s.setAttribute("position", new a.Float32BufferAttribute([0, 0, 0], 3));
|
|
1250
1265
|
const i = new a.PointsMaterial({
|
|
@@ -1257,7 +1272,7 @@ let ie = class {
|
|
|
1257
1272
|
opacity: 1
|
|
1258
1273
|
}), r = new a.Points(s, i);
|
|
1259
1274
|
return r.renderOrder = 1e3, r.raycast = () => {
|
|
1260
|
-
}, r.layers.set(
|
|
1275
|
+
}, r.layers.set(T), r.visible = !1, r;
|
|
1261
1276
|
}
|
|
1262
1277
|
/** Локальную вершину points переводим в world и пишем в target (прокси-точку) */
|
|
1263
1278
|
_writeWorldVertex(t, e, s) {
|
|
@@ -1273,15 +1288,15 @@ let ie = class {
|
|
|
1273
1288
|
}
|
|
1274
1289
|
/** Готовит метаданные для выбранной вершины и пишет их в _selectVertex.userData */
|
|
1275
1290
|
_prepareVertexMetadata(t, e) {
|
|
1276
|
-
const s =
|
|
1291
|
+
const s = ke(t);
|
|
1277
1292
|
if (!s) return;
|
|
1278
1293
|
const i = t.geometry.getAttribute("position"), r = new a.Vector3(
|
|
1279
1294
|
i.getX(e),
|
|
1280
1295
|
i.getY(e),
|
|
1281
1296
|
i.getZ(e)
|
|
1282
|
-
).applyMatrix4(t.matrixWorld), o = new a.Matrix4().copy(s.matrixWorld).invert(), n = r.clone().applyMatrix4(o), _ = s.geometry.getAttribute("position"), m = 1e-6, f = m * m,
|
|
1297
|
+
).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, L = new a.Vector3(), b = [];
|
|
1283
1298
|
for (let M = 0; M < _.count; M++)
|
|
1284
|
-
|
|
1299
|
+
L.fromBufferAttribute(_, M), L.distanceToSquared(n) < f && b.push(M);
|
|
1285
1300
|
const O = s.children.find((M) => M?.isLineSegments);
|
|
1286
1301
|
let y = [];
|
|
1287
1302
|
if (O) {
|
|
@@ -1311,10 +1326,10 @@ let ie = class {
|
|
|
1311
1326
|
(!n || n.count < 1) && (o.setAttribute("position", new a.BufferAttribute(new Float32Array(3), 3)), n = o.getAttribute("position")), n.setXYZ(0, 0, 0, 0), n.needsUpdate = !0, t.quaternion.identity(), t.scale.set(1, 1, 1), t.updateMatrixWorld(!0);
|
|
1312
1327
|
}
|
|
1313
1328
|
};
|
|
1314
|
-
ie =
|
|
1329
|
+
ie = Zt([
|
|
1315
1330
|
u(),
|
|
1316
|
-
|
|
1317
|
-
|
|
1331
|
+
De(0, h("RendererApi")),
|
|
1332
|
+
De(1, h("IEditorStore"))
|
|
1318
1333
|
], ie);
|
|
1319
1334
|
class ue {
|
|
1320
1335
|
constructor(e, s) {
|
|
@@ -1340,11 +1355,11 @@ class ue {
|
|
|
1340
1355
|
this.rollback();
|
|
1341
1356
|
}
|
|
1342
1357
|
}
|
|
1343
|
-
var
|
|
1344
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1358
|
+
var $t = Object.getOwnPropertyDescriptor, Bt = (t, e, s, i) => {
|
|
1359
|
+
for (var r = i > 1 ? void 0 : i ? $t(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1345
1360
|
(n = t[o]) && (r = n(r) || r);
|
|
1346
1361
|
return r;
|
|
1347
|
-
},
|
|
1362
|
+
}, Te = (t, e) => (s, i) => e(s, i, t);
|
|
1348
1363
|
let re = class extends ue {
|
|
1349
1364
|
/** Инструмент, которым управляет хендлер, нужен только менеджеру */
|
|
1350
1365
|
mode = C.Translate;
|
|
@@ -1352,13 +1367,13 @@ let re = class extends ue {
|
|
|
1352
1367
|
super(t, e);
|
|
1353
1368
|
}
|
|
1354
1369
|
};
|
|
1355
|
-
re =
|
|
1370
|
+
re = Bt([
|
|
1356
1371
|
u(),
|
|
1357
|
-
|
|
1358
|
-
|
|
1372
|
+
Te(0, h("RendererApi")),
|
|
1373
|
+
Te(1, h("IEditorStore"))
|
|
1359
1374
|
], re);
|
|
1360
|
-
var
|
|
1361
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1375
|
+
var Xt = Object.getOwnPropertyDescriptor, Gt = (t, e, s, i) => {
|
|
1376
|
+
for (var r = i > 1 ? void 0 : i ? Xt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1362
1377
|
(n = t[o]) && (r = n(r) || r);
|
|
1363
1378
|
return r;
|
|
1364
1379
|
}, Le = (t, e) => (s, i) => e(s, i, t);
|
|
@@ -1369,16 +1384,16 @@ let oe = class extends ue {
|
|
|
1369
1384
|
super(t, e);
|
|
1370
1385
|
}
|
|
1371
1386
|
};
|
|
1372
|
-
oe =
|
|
1387
|
+
oe = Gt([
|
|
1373
1388
|
u(),
|
|
1374
1389
|
Le(0, h("RendererApi")),
|
|
1375
1390
|
Le(1, h("IEditorStore"))
|
|
1376
1391
|
], oe);
|
|
1377
|
-
var
|
|
1378
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1392
|
+
var Kt = Object.getOwnPropertyDescriptor, qt = (t, e, s, i) => {
|
|
1393
|
+
for (var r = i > 1 ? void 0 : i ? Kt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1379
1394
|
(n = t[o]) && (r = n(r) || r);
|
|
1380
1395
|
return r;
|
|
1381
|
-
},
|
|
1396
|
+
}, Ce = (t, e) => (s, i) => e(s, i, t);
|
|
1382
1397
|
let ne = class extends ue {
|
|
1383
1398
|
/** Инструмент, которым управляет хендлер, нужен только менеджеру */
|
|
1384
1399
|
mode = C.Rotate;
|
|
@@ -1386,19 +1401,19 @@ let ne = class extends ue {
|
|
|
1386
1401
|
super(t, e);
|
|
1387
1402
|
}
|
|
1388
1403
|
};
|
|
1389
|
-
ne =
|
|
1404
|
+
ne = qt([
|
|
1390
1405
|
u(),
|
|
1391
|
-
|
|
1392
|
-
|
|
1406
|
+
Ce(0, h("RendererApi")),
|
|
1407
|
+
Ce(1, h("IEditorStore"))
|
|
1393
1408
|
], ne);
|
|
1394
|
-
var
|
|
1395
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1409
|
+
var Qt = Object.getOwnPropertyDescriptor, Jt = (t, e, s, i) => {
|
|
1410
|
+
for (var r = i > 1 ? void 0 : i ? Qt(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1396
1411
|
(n = t[o]) && (r = n(r) || r);
|
|
1397
1412
|
return r;
|
|
1398
|
-
},
|
|
1413
|
+
}, Ae = (t, e) => (s, i) => e(s, i, t);
|
|
1399
1414
|
let ae = class {
|
|
1400
1415
|
constructor(t, e) {
|
|
1401
|
-
this._api = t, this._store = e, this._api.enableCameraLayer(
|
|
1416
|
+
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);
|
|
1402
1417
|
}
|
|
1403
1418
|
/** Режим, которым управляет хендлер, нужен только менеджеру */
|
|
1404
1419
|
mode = v.Edge;
|
|
@@ -1414,7 +1429,7 @@ let ae = class {
|
|
|
1414
1429
|
/** Цвет ребра, на которое навелись */
|
|
1415
1430
|
_hoverColor = z;
|
|
1416
1431
|
/** Цвет выделенного ребра */
|
|
1417
|
-
_selectColor =
|
|
1432
|
+
_selectColor = F;
|
|
1418
1433
|
/** Обработка текущего режима выборки. */
|
|
1419
1434
|
handle(t, e) {
|
|
1420
1435
|
if (this._api.setRaycastMode(this.mode), e === S.Hover) {
|
|
@@ -1464,7 +1479,7 @@ let ae = class {
|
|
|
1464
1479
|
opacity: 1
|
|
1465
1480
|
}), i = new a.Line(e, s);
|
|
1466
1481
|
return i.renderOrder = 1e3, i.raycast = () => {
|
|
1467
|
-
}, i.layers.set(
|
|
1482
|
+
}, i.layers.set(T), i.visible = !1, i;
|
|
1468
1483
|
}
|
|
1469
1484
|
/** Локальные точки сегмента переводим в target (который висит на сцене) */
|
|
1470
1485
|
_writeWorldSegment(t, e, s) {
|
|
@@ -1488,26 +1503,26 @@ let ae = class {
|
|
|
1488
1503
|
if (!isFinite(m) || m === 0) return;
|
|
1489
1504
|
const f = new a.Vector3().addVectors(n, c).multiplyScalar(0.5);
|
|
1490
1505
|
t.position.copy(f);
|
|
1491
|
-
const
|
|
1492
|
-
let b =
|
|
1493
|
-
(!b || b.count < 2) && (
|
|
1506
|
+
const L = t.geometry;
|
|
1507
|
+
let b = L.getAttribute("position");
|
|
1508
|
+
(!b || b.count < 2) && (L.setAttribute("position", new a.BufferAttribute(new Float32Array(6), 3)), b = L.getAttribute("position")), b.setXYZ(0, -m / 2, 0, 0), b.setXYZ(1, m / 2, 0, 0), b.needsUpdate = !0, _.normalize();
|
|
1494
1509
|
const O = new a.Quaternion().setFromUnitVectors(new a.Vector3(1, 0, 0), _);
|
|
1495
1510
|
t.quaternion.copy(O), t.updateMatrixWorld(!0);
|
|
1496
1511
|
}
|
|
1497
1512
|
/** Запись метаданных выбранного ребра для использования инструментов */
|
|
1498
1513
|
_prepareEdgeMetadata(t, e) {
|
|
1499
|
-
const s =
|
|
1514
|
+
const s = ke(t);
|
|
1500
1515
|
if (!s) return;
|
|
1501
1516
|
const i = t.geometry.getAttribute("position"), r = e * 2, o = r + 1, n = new a.Vector3(i.getX(r), i.getY(r), i.getZ(r)).applyMatrix4(
|
|
1502
1517
|
t.matrixWorld
|
|
1503
1518
|
), c = new a.Vector3(i.getX(o), i.getY(o), i.getZ(o)).applyMatrix4(
|
|
1504
1519
|
t.matrixWorld
|
|
1505
1520
|
), _ = new a.Matrix4().copy(s.matrixWorld).invert(), m = n.clone().applyMatrix4(_), f = c.clone().applyMatrix4(_), b = s.geometry.getAttribute("position"), O = new a.Vector3(), y = 1e-6, M = [], N = [];
|
|
1506
|
-
for (let
|
|
1507
|
-
O.fromBufferAttribute(b,
|
|
1508
|
-
const I = new a.Matrix4().copy(t.matrixWorld).invert(), Y = n.clone().applyMatrix4(I), A = c.clone().applyMatrix4(I), me = t.geometry.getAttribute("position"),
|
|
1509
|
-
for (let
|
|
1510
|
-
|
|
1521
|
+
for (let E = 0; E < b.count; E++)
|
|
1522
|
+
O.fromBufferAttribute(b, E), O.distanceToSquared(m) < y * y ? M.push(E) : O.distanceToSquared(f) < y * y && N.push(E);
|
|
1523
|
+
const I = new a.Matrix4().copy(t.matrixWorld).invert(), Y = n.clone().applyMatrix4(I), A = c.clone().applyMatrix4(I), me = t.geometry.getAttribute("position"), Z = new a.Vector3(), fe = [], ge = [];
|
|
1524
|
+
for (let E = 0; E < me.count; E++)
|
|
1525
|
+
Z.fromBufferAttribute(me, E), Z.distanceToSquared(Y) < y * y ? fe.push(E) : Z.distanceToSquared(A) < y * y && ge.push(E);
|
|
1511
1526
|
this._selectLine.userData.edgeInfo = {
|
|
1512
1527
|
lines: t,
|
|
1513
1528
|
seg: e,
|
|
@@ -1519,16 +1534,16 @@ let ae = class {
|
|
|
1519
1534
|
};
|
|
1520
1535
|
}
|
|
1521
1536
|
};
|
|
1522
|
-
ae =
|
|
1537
|
+
ae = Jt([
|
|
1523
1538
|
u(),
|
|
1524
|
-
|
|
1525
|
-
|
|
1539
|
+
Ae(0, h("RendererApi")),
|
|
1540
|
+
Ae(1, h("IEditorStore"))
|
|
1526
1541
|
], ae);
|
|
1527
|
-
var
|
|
1528
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1542
|
+
var es = Object.getOwnPropertyDescriptor, ts = (t, e, s, i) => {
|
|
1543
|
+
for (var r = i > 1 ? void 0 : i ? es(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1529
1544
|
(n = t[o]) && (r = n(r) || r);
|
|
1530
1545
|
return r;
|
|
1531
|
-
},
|
|
1546
|
+
}, ss = (t, e) => (s, i) => e(s, i, t);
|
|
1532
1547
|
let he = class {
|
|
1533
1548
|
constructor(t) {
|
|
1534
1549
|
this._api = t;
|
|
@@ -1539,13 +1554,13 @@ let he = class {
|
|
|
1539
1554
|
_lastAddedMesh = null;
|
|
1540
1555
|
/** Добавление базовых фигур на сцену, которые приписаны в `FigureType`. */
|
|
1541
1556
|
handle(t) {
|
|
1542
|
-
const e =
|
|
1557
|
+
const e = Je[t](), s = e.getAttribute("position");
|
|
1543
1558
|
s && s.setUsage && s.setUsage(a.DynamicDrawUsage);
|
|
1544
|
-
const i = new a.Mesh(e,
|
|
1545
|
-
i.layers.enable(
|
|
1546
|
-
const r =
|
|
1559
|
+
const i = new a.Mesh(e, Re);
|
|
1560
|
+
i.layers.enable(He);
|
|
1561
|
+
const r = Ne(i.geometry);
|
|
1547
1562
|
i.add(r);
|
|
1548
|
-
const o =
|
|
1563
|
+
const o = Ve(i.geometry);
|
|
1549
1564
|
i.add(o), this._api.addMesh(i), this._lastAddedMesh = i;
|
|
1550
1565
|
}
|
|
1551
1566
|
/** Срабатывает только на `ctrl + z`. */
|
|
@@ -1557,15 +1572,15 @@ let he = class {
|
|
|
1557
1572
|
this._lastAddedMesh = null;
|
|
1558
1573
|
}
|
|
1559
1574
|
};
|
|
1560
|
-
he =
|
|
1575
|
+
he = ts([
|
|
1561
1576
|
u(),
|
|
1562
|
-
|
|
1577
|
+
ss(0, h("RendererApi"))
|
|
1563
1578
|
], he);
|
|
1564
|
-
var
|
|
1565
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1579
|
+
var is = Object.getOwnPropertyDescriptor, rs = (t, e, s, i) => {
|
|
1580
|
+
for (var r = i > 1 ? void 0 : i ? is(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1566
1581
|
(n = t[o]) && (r = n(r) || r);
|
|
1567
1582
|
return r;
|
|
1568
|
-
},
|
|
1583
|
+
}, xe = (t, e) => (s, i) => e(s, i, t);
|
|
1569
1584
|
let le = class {
|
|
1570
1585
|
constructor(t, e) {
|
|
1571
1586
|
this._api = t, this._store = e;
|
|
@@ -1576,7 +1591,7 @@ let le = class {
|
|
|
1576
1591
|
_lastDeletedMesh = null;
|
|
1577
1592
|
handle() {
|
|
1578
1593
|
const t = this._store.getSelectedObject();
|
|
1579
|
-
|
|
1594
|
+
lt(t) && (this._api.removeMesh(t), this._store.setSelectedObject(null), this._lastDeletedMesh = t);
|
|
1580
1595
|
}
|
|
1581
1596
|
/** Срабатывает только на `ctrl + z`. */
|
|
1582
1597
|
rollback() {
|
|
@@ -1587,16 +1602,16 @@ let le = class {
|
|
|
1587
1602
|
this._lastDeletedMesh = null;
|
|
1588
1603
|
}
|
|
1589
1604
|
};
|
|
1590
|
-
le =
|
|
1605
|
+
le = rs([
|
|
1591
1606
|
u(),
|
|
1592
|
-
|
|
1593
|
-
|
|
1607
|
+
xe(0, h("RendererApi")),
|
|
1608
|
+
xe(1, h("IEditorStore"))
|
|
1594
1609
|
], le);
|
|
1595
|
-
var
|
|
1596
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1610
|
+
var os = Object.getOwnPropertyDescriptor, ns = (t, e, s, i) => {
|
|
1611
|
+
for (var r = i > 1 ? void 0 : i ? os(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1597
1612
|
(n = t[o]) && (r = n(r) || r);
|
|
1598
1613
|
return r;
|
|
1599
|
-
},
|
|
1614
|
+
}, as = (t, e) => (s, i) => e(s, i, t);
|
|
1600
1615
|
let ce = class {
|
|
1601
1616
|
constructor(t) {
|
|
1602
1617
|
this._renderer = t;
|
|
@@ -1652,12 +1667,12 @@ let ce = class {
|
|
|
1652
1667
|
this._renderer.enableCameraLayer(t);
|
|
1653
1668
|
}
|
|
1654
1669
|
};
|
|
1655
|
-
ce =
|
|
1670
|
+
ce = ns([
|
|
1656
1671
|
u(),
|
|
1657
|
-
|
|
1672
|
+
as(0, h("EditorRenderer"))
|
|
1658
1673
|
], ce);
|
|
1659
|
-
var
|
|
1660
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1674
|
+
var hs = Object.getOwnPropertyDescriptor, ls = (t, e, s, i) => {
|
|
1675
|
+
for (var r = i > 1 ? void 0 : i ? hs(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1661
1676
|
(n = t[o]) && (r = n(r) || r);
|
|
1662
1677
|
return r;
|
|
1663
1678
|
}, H = (t, e) => (s, i) => e(s, i, t);
|
|
@@ -1690,7 +1705,7 @@ let de = class {
|
|
|
1690
1705
|
this._displayManager.dispose(), this._selectManager.dispose(), this._renderer.dispose();
|
|
1691
1706
|
}
|
|
1692
1707
|
};
|
|
1693
|
-
de =
|
|
1708
|
+
de = ls([
|
|
1694
1709
|
u(),
|
|
1695
1710
|
H(0, h("IDisplayManager")),
|
|
1696
1711
|
H(1, h("ISelectManager")),
|
|
@@ -1698,8 +1713,8 @@ de = as([
|
|
|
1698
1713
|
H(3, h("ISceneManager")),
|
|
1699
1714
|
H(4, h("EditorRenderer"))
|
|
1700
1715
|
], de);
|
|
1701
|
-
var
|
|
1702
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1716
|
+
var cs = Object.getOwnPropertyDescriptor, ds = (t, e, s, i) => {
|
|
1717
|
+
for (var r = i > 1 ? void 0 : i ? cs(e, s) : e, o = t.length - 1, n; o >= 0; o--)
|
|
1703
1718
|
(n = t[o]) && (r = n(r) || r);
|
|
1704
1719
|
return r;
|
|
1705
1720
|
};
|
|
@@ -1715,7 +1730,7 @@ let _e = class {
|
|
|
1715
1730
|
/** Слушатели событий по изменению выбранного объекта. */
|
|
1716
1731
|
_selectedListeners = /* @__PURE__ */ new Set();
|
|
1717
1732
|
constructor() {
|
|
1718
|
-
|
|
1733
|
+
Qe(this, {}, { autoBind: !0 });
|
|
1719
1734
|
}
|
|
1720
1735
|
/** @inheritdoc */
|
|
1721
1736
|
getSelectMode() {
|
|
@@ -1757,24 +1772,24 @@ let _e = class {
|
|
|
1757
1772
|
return this._selectedListeners.add(t), () => this._selectedListeners.delete(t);
|
|
1758
1773
|
}
|
|
1759
1774
|
};
|
|
1760
|
-
_e =
|
|
1775
|
+
_e = ds([
|
|
1761
1776
|
u()
|
|
1762
1777
|
], _e);
|
|
1763
|
-
let
|
|
1764
|
-
const d =
|
|
1765
|
-
function
|
|
1766
|
-
return
|
|
1778
|
+
let je = !1;
|
|
1779
|
+
const d = Ke.createChildContainer();
|
|
1780
|
+
function _s(t) {
|
|
1781
|
+
return je || (d.registerInstance("Canvas", t), d.registerSingleton("EventBus", X), d.registerSingleton("EditorRenderer", G), d.registerSingleton("RendererApi", ce), d.registerSingleton("IDisplayHandler", ee), d.registerSingleton("ISelectHandler", te), d.registerSingleton("ISelectHandler", se), d.registerSingleton("ISelectHandler", ae), d.registerSingleton("ISelectHandler", ie), d.registerSingleton("IToolHandler", re), d.registerSingleton("IToolHandler", oe), d.registerSingleton("IToolHandler", ne), d.registerSingleton("ISceneHandler", he), d.registerSingleton("ISceneHandler", le), d.registerSingleton("IDisplayManager", K), d.registerSingleton("ISelectManager", q), d.registerSingleton("IToolManager", Q), d.registerSingleton("ISceneManager", J), d.registerSingleton("EditorHub", de), d.registerSingleton("IEditorStore", _e), je = !0), d;
|
|
1767
1782
|
}
|
|
1768
|
-
function
|
|
1769
|
-
return
|
|
1783
|
+
function Es(t) {
|
|
1784
|
+
return _s(t).resolve("EditorHub");
|
|
1770
1785
|
}
|
|
1771
1786
|
export {
|
|
1772
1787
|
de as EditorHub,
|
|
1773
1788
|
G as EditorRenderer,
|
|
1774
1789
|
X as EventBus,
|
|
1775
1790
|
R as EventTopics,
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1791
|
+
Ms as ObjLoader,
|
|
1792
|
+
ys as PreviewRenderer,
|
|
1793
|
+
Ie as Renderer,
|
|
1794
|
+
Es as createAppHub
|
|
1780
1795
|
};
|