@mavonengine/editor 0.0.7 → 0.0.8

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.
@@ -1,25 +1,25 @@
1
- import { Quaternion as M, Controls as Ee, Vector3 as l, Raycaster as Le, Object3D as le, MeshBasicMaterial as me, LineBasicMaterial as Xe, CylinderGeometry as g, BoxGeometry as v, BufferGeometry as pe, Float32BufferAttribute as he, Mesh as o, OctahedronGeometry as se, Line as B, TorusGeometry as j, SphereGeometry as He, Euler as Oe, Matrix4 as ce, PlaneGeometry as Ye, DoubleSide as fe, OrthographicCamera as Ze, Color as F, Vector2 as k, WebGLRenderTarget as X, MeshDepthMaterial as Ue, RGBADepthPacking as je, NoBlending as we, HalfFloatType as U, UniformsUtils as Fe, ShaderMaterial as V, AdditiveBlending as Ve } from "three";
2
- import Ge from "@mavonengine/core/Editor/EditorHelper";
1
+ import Le from "@mavonengine/core/Editor/EditorHelper";
3
2
  import c from "@mavonengine/core/Game";
4
- import { AmbientLightPrimitive as We, DirectionalLightShadowPrimitive as qe } from "@mavonengine/core/Prefab/Lights/index";
5
- import { PlanePrimitive as Ke, BoxPrimitive as Ne, SpherePrimitive as $e, ConePrimitive as Je, CylinderPrimitive as et, OctahedronPrimitive as tt, DodecahedronPrimitive as it, CapsulePrimitive as st, IcosahedronPrimitive as nt, TorusKnotPrimitive as at } from "@mavonengine/core/Prefab/Primitives/index";
6
- import rt from "@mavonengine/core/Utils/EventEmitter";
7
- const ot = { type: "change" }, ge = 1e-6, ye = new M();
3
+ import { AmbientLightPrimitive as Xe, DirectionalLightShadowPrimitive as Oe } from "@mavonengine/core/Prefab/Lights/index";
4
+ import { PlanePrimitive as He, BoxPrimitive as Ye, SpherePrimitive as Ze, ConePrimitive as Ue, CylinderPrimitive as je, OctahedronPrimitive as Fe, DodecahedronPrimitive as Ve, CapsulePrimitive as Ge, IcosahedronPrimitive as We, TorusKnotPrimitive as qe } from "@mavonengine/core/Prefab/Primitives/index";
5
+ import Ke from "@mavonengine/core/Utils/EventEmitter";
6
+ import { Quaternion as x, Controls as Ee, Vector3 as l, Raycaster as Ne, Object3D as le, MeshBasicMaterial as me, LineBasicMaterial as $e, CylinderGeometry as g, BoxGeometry as v, BufferGeometry as pe, Float32BufferAttribute as he, Mesh as o, OctahedronGeometry as se, Line as A, TorusGeometry as F, SphereGeometry as Je, Euler as et, Matrix4 as ce, PlaneGeometry as tt, DoubleSide as fe, OrthographicCamera as it, Color as V, Vector2 as D, WebGLRenderTarget as X, MeshDepthMaterial as st, RGBADepthPacking as nt, NoBlending as we, HalfFloatType as j, UniformsUtils as at, ShaderMaterial as G, AdditiveBlending as rt } from "three";
7
+ const ot = { type: "change" }, ge = 1e-6, ye = new x();
8
8
  class lt extends Ee {
9
9
  /**
10
10
  * Constructs a new controls instance.
11
11
  *
12
12
  * @param {Object3D} object - The object that is managed by the controls.
13
- * @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
13
+ * @param {?HTMLElement} domElement - The HTML element used for event listeners.
14
14
  */
15
15
  constructor(e, t = null) {
16
- super(e, t), this.movementSpeed = 1, this.rollSpeed = 5e-3, this.dragToLook = !1, this.autoForward = !1, this._moveState = { up: 0, down: 0, left: 0, right: 0, forward: 0, back: 0, pitchUp: 0, pitchDown: 0, yawLeft: 0, yawRight: 0, rollLeft: 0, rollRight: 0 }, this._moveVector = new l(0, 0, 0), this._rotationVector = new l(0, 0, 0), this._lastQuaternion = new M(), this._lastPosition = new l(), this._status = 0, this._onKeyDown = ht.bind(this), this._onKeyUp = ct.bind(this), this._onPointerMove = dt.bind(this), this._onPointerDown = ut.bind(this), this._onPointerUp = pt.bind(this), this._onPointerCancel = ft.bind(this), this._onContextMenu = mt.bind(this), t !== null && this.connect(t);
16
+ super(e, t), this.movementSpeed = 1, this.rollSpeed = 5e-3, this.dragToLook = !1, this.autoForward = !1, this._moveState = { up: 0, down: 0, left: 0, right: 0, forward: 0, back: 0, pitchUp: 0, pitchDown: 0, yawLeft: 0, yawRight: 0, rollLeft: 0, rollRight: 0 }, this._moveVector = new l(0, 0, 0), this._rotationVector = new l(0, 0, 0), this._lastQuaternion = new x(), this._lastPosition = new l(), this._status = 0, this._onKeyDown = ht.bind(this), this._onKeyUp = ct.bind(this), this._onPointerMove = dt.bind(this), this._onPointerDown = ut.bind(this), this._onPointerUp = pt.bind(this), this._onPointerCancel = ft.bind(this), this._onContextMenu = mt.bind(this), t !== null && this.connect(t);
17
17
  }
18
18
  connect(e) {
19
- super.connect(e), window.addEventListener("keydown", this._onKeyDown), window.addEventListener("keyup", this._onKeyUp), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointerup", this._onPointerUp), this.domElement.addEventListener("pointercancel", this._onPointerCancel), this.domElement.addEventListener("contextmenu", this._onContextMenu);
19
+ super.connect(e), window.addEventListener("keydown", this._onKeyDown), window.addEventListener("keyup", this._onKeyUp), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointerup", this._onPointerUp), this.domElement.addEventListener("pointercancel", this._onPointerCancel), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.style.touchAction = "none";
20
20
  }
21
21
  disconnect() {
22
- window.removeEventListener("keydown", this._onKeyDown), window.removeEventListener("keyup", this._onKeyUp), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointercancel", this._onPointerCancel), this.domElement.removeEventListener("contextmenu", this._onContextMenu);
22
+ window.removeEventListener("keydown", this._onKeyDown), window.removeEventListener("keyup", this._onKeyUp), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointercancel", this._onPointerCancel), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.domElement.style.touchAction = "";
23
23
  }
24
24
  dispose() {
25
25
  this.disconnect();
@@ -187,47 +187,47 @@ function ft() {
187
187
  function mt(h) {
188
188
  this.enabled !== !1 && h.preventDefault();
189
189
  }
190
- const H = new Le(), m = new l(), I = new l(), p = new M(), _e = {
190
+ const O = new Ne(), m = new l(), I = new l(), p = new x(), _e = {
191
191
  X: new l(1, 0, 0),
192
192
  Y: new l(0, 1, 0),
193
193
  Z: new l(0, 0, 1)
194
- }, ue = { type: "change" }, Me = { type: "mouseDown", mode: null }, Se = { type: "mouseUp", mode: null }, xe = { type: "objectChange" };
194
+ }, ue = { type: "change" }, xe = { type: "mouseDown", mode: null }, Me = { type: "mouseUp", mode: null }, Se = { type: "objectChange" };
195
195
  class vt extends Ee {
196
196
  /**
197
197
  * Constructs a new controls instance.
198
198
  *
199
199
  * @param {Camera} camera - The camera of the rendered scene.
200
- * @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
200
+ * @param {?HTMLElement} domElement - The HTML element used for event listeners.
201
201
  */
202
202
  constructor(e, t = null) {
203
203
  super(void 0, t);
204
- const n = new St(this);
204
+ const n = new Mt(this);
205
205
  this._root = n;
206
- const s = new xt();
206
+ const s = new St();
207
207
  this._gizmo = s, n.add(s);
208
- const r = new bt();
209
- this._plane = r, n.add(r);
208
+ const a = new bt();
209
+ this._plane = a, n.add(a);
210
210
  const i = this;
211
- function a(y, z) {
212
- let Y = z;
211
+ function r(y, Q) {
212
+ let Z = Q;
213
213
  Object.defineProperty(i, y, {
214
214
  get: function() {
215
- return Y !== void 0 ? Y : z;
215
+ return Z !== void 0 ? Z : Q;
216
216
  },
217
217
  set: function(L) {
218
- Y !== L && (Y = L, r[y] = L, s[y] = L, i.dispatchEvent({ type: y + "-changed", value: L }), i.dispatchEvent(ue));
218
+ Z !== L && (Z = L, a[y] = L, s[y] = L, i.dispatchEvent({ type: y + "-changed", value: L }), i.dispatchEvent(ue));
219
219
  }
220
- }), i[y] = z, r[y] = z, s[y] = z;
220
+ }), i[y] = Q, a[y] = Q, s[y] = Q;
221
221
  }
222
- a("camera", e), a("object", void 0), a("enabled", !0), a("axis", null), a("mode", "translate"), a("translationSnap", null), a("rotationSnap", null), a("scaleSnap", null), a("space", "world"), a("size", 1), a("dragging", !1), a("showX", !0), a("showY", !0), a("showZ", !0), a("minX", -1 / 0), a("maxX", 1 / 0), a("minY", -1 / 0), a("maxY", 1 / 0), a("minZ", -1 / 0), a("maxZ", 1 / 0);
223
- const d = new l(), f = new l(), D = new M(), R = new M(), Q = new l(), N = new M(), $ = new l(), P = new l(), T = new l(), x = 0, E = new l();
224
- a("worldPosition", d), a("worldPositionStart", f), a("worldQuaternion", D), a("worldQuaternionStart", R), a("cameraPosition", Q), a("cameraQuaternion", N), a("pointStart", $), a("pointEnd", P), a("rotationAxis", T), a("rotationAngle", x), a("eye", E), this._offset = new l(), this._startNorm = new l(), this._endNorm = new l(), this._cameraScale = new l(), this._parentPosition = new l(), this._parentQuaternion = new M(), this._parentQuaternionInv = new M(), this._parentScale = new l(), this._worldScaleStart = new l(), this._worldQuaternionInv = new M(), this._worldScale = new l(), this._positionStart = new l(), this._quaternionStart = new M(), this._scaleStart = new l(), this._getPointer = wt.bind(this), this._onPointerDown = yt.bind(this), this._onPointerHover = gt.bind(this), this._onPointerMove = _t.bind(this), this._onPointerUp = Mt.bind(this), t !== null && this.connect(t);
222
+ r("camera", e), r("object", void 0), r("enabled", !0), r("axis", null), r("mode", "translate"), r("translationSnap", null), r("rotationSnap", null), r("scaleSnap", null), r("space", "world"), r("size", 1), r("dragging", !1), r("showX", !0), r("showY", !0), r("showZ", !0), r("showXY", !0), r("showYZ", !0), r("showXZ", !0), r("minX", -1 / 0), r("maxX", 1 / 0), r("minY", -1 / 0), r("maxY", 1 / 0), r("minZ", -1 / 0), r("maxZ", 1 / 0);
223
+ const u = new l(), f = new l(), P = new x(), z = new x(), B = new l(), Y = new x(), $ = new l(), T = new l(), E = new l(), S = 0, C = new l();
224
+ r("worldPosition", u), r("worldPositionStart", f), r("worldQuaternion", P), r("worldQuaternionStart", z), r("cameraPosition", B), r("cameraQuaternion", Y), r("pointStart", $), r("pointEnd", T), r("rotationAxis", E), r("rotationAngle", S), r("eye", C), this._offset = new l(), this._startNorm = new l(), this._endNorm = new l(), this._cameraScale = new l(), this._parentPosition = new l(), this._parentQuaternion = new x(), this._parentQuaternionInv = new x(), this._parentScale = new l(), this._worldScaleStart = new l(), this._worldQuaternionInv = new x(), this._worldScale = new l(), this._positionStart = new l(), this._quaternionStart = new x(), this._scaleStart = new l(), this._getPointer = wt.bind(this), this._onPointerDown = yt.bind(this), this._onPointerHover = gt.bind(this), this._onPointerMove = _t.bind(this), this._onPointerUp = xt.bind(this), t !== null && this.connect(t);
225
225
  }
226
226
  connect(e) {
227
227
  super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp), this.domElement.style.touchAction = "none";
228
228
  }
229
229
  disconnect() {
230
- this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointermove", this._onPointerHover), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.style.touchAction = "auto";
230
+ this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointermove", this._onPointerHover), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.style.touchAction = "";
231
231
  }
232
232
  /**
233
233
  * Returns the visual representation of the controls. Add the helper to your scene to
@@ -240,44 +240,44 @@ class vt extends Ee {
240
240
  }
241
241
  pointerHover(e) {
242
242
  if (this.object === void 0 || this.dragging === !0) return;
243
- e !== null && H.setFromCamera(e, this.camera);
244
- const t = de(this._gizmo.picker[this.mode], H);
243
+ e !== null && O.setFromCamera(e, this.camera);
244
+ const t = de(this._gizmo.picker[this.mode], O);
245
245
  t ? this.axis = t.object.name : this.axis = null;
246
246
  }
247
247
  pointerDown(e) {
248
248
  if (!(this.object === void 0 || this.dragging === !0 || e != null && e.button !== 0) && this.axis !== null) {
249
- e !== null && H.setFromCamera(e, this.camera);
250
- const t = de(this._plane, H, !0);
251
- t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, Me.mode = this.mode, this.dispatchEvent(Me);
249
+ e !== null && O.setFromCamera(e, this.camera);
250
+ const t = de(this._plane, O, !0);
251
+ t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, xe.mode = this.mode, this.dispatchEvent(xe);
252
252
  }
253
253
  }
254
254
  pointerMove(e) {
255
255
  const t = this.axis, n = this.mode, s = this.object;
256
- let r = this.space;
257
- if (n === "scale" ? r = "local" : (t === "E" || t === "XYZE" || t === "XYZ") && (r = "world"), s === void 0 || t === null || this.dragging === !1 || e !== null && e.button !== -1) return;
258
- e !== null && H.setFromCamera(e, this.camera);
259
- const i = de(this._plane, H, !0);
256
+ let a = this.space;
257
+ if (n === "scale" ? a = "local" : (t === "E" || t === "XYZE" || t === "XYZ") && (a = "world"), s === void 0 || t === null || this.dragging === !1 || e !== null && e.button !== -1) return;
258
+ e !== null && O.setFromCamera(e, this.camera);
259
+ const i = de(this._plane, O, !0);
260
260
  if (i) {
261
261
  if (this.pointEnd.copy(i.point).sub(this.worldPositionStart), n === "translate")
262
- this._offset.copy(this.pointEnd).sub(this.pointStart), r === "local" && t !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), t.indexOf("X") === -1 && (this._offset.x = 0), t.indexOf("Y") === -1 && (this._offset.y = 0), t.indexOf("Z") === -1 && (this._offset.z = 0), r === "local" && t !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), s.position.copy(this._offset).add(this._positionStart), this.translationSnap && (r === "local" && (s.position.applyQuaternion(p.copy(this._quaternionStart).invert()), t.search("X") !== -1 && (s.position.x = Math.round(s.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (s.position.y = Math.round(s.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (s.position.z = Math.round(s.position.z / this.translationSnap) * this.translationSnap), s.position.applyQuaternion(this._quaternionStart)), r === "world" && (s.parent && s.position.add(m.setFromMatrixPosition(s.parent.matrixWorld)), t.search("X") !== -1 && (s.position.x = Math.round(s.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (s.position.y = Math.round(s.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (s.position.z = Math.round(s.position.z / this.translationSnap) * this.translationSnap), s.parent && s.position.sub(m.setFromMatrixPosition(s.parent.matrixWorld)))), s.position.x = Math.max(this.minX, Math.min(this.maxX, s.position.x)), s.position.y = Math.max(this.minY, Math.min(this.maxY, s.position.y)), s.position.z = Math.max(this.minZ, Math.min(this.maxZ, s.position.z));
262
+ this._offset.copy(this.pointEnd).sub(this.pointStart), a === "local" && t !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), t.indexOf("X") === -1 && (this._offset.x = 0), t.indexOf("Y") === -1 && (this._offset.y = 0), t.indexOf("Z") === -1 && (this._offset.z = 0), a === "local" && t !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), s.position.copy(this._offset).add(this._positionStart), this.translationSnap && (a === "local" && (s.position.applyQuaternion(p.copy(this._quaternionStart).invert()), t.search("X") !== -1 && (s.position.x = Math.round(s.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (s.position.y = Math.round(s.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (s.position.z = Math.round(s.position.z / this.translationSnap) * this.translationSnap), s.position.applyQuaternion(this._quaternionStart)), a === "world" && (s.parent && s.position.add(m.setFromMatrixPosition(s.parent.matrixWorld)), t.search("X") !== -1 && (s.position.x = Math.round(s.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (s.position.y = Math.round(s.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (s.position.z = Math.round(s.position.z / this.translationSnap) * this.translationSnap), s.parent && s.position.sub(m.setFromMatrixPosition(s.parent.matrixWorld)))), s.position.x = Math.max(this.minX, Math.min(this.maxX, s.position.x)), s.position.y = Math.max(this.minY, Math.min(this.maxY, s.position.y)), s.position.z = Math.max(this.minZ, Math.min(this.maxZ, s.position.z));
263
263
  else if (n === "scale") {
264
264
  if (t.search("XYZ") !== -1) {
265
- let a = this.pointEnd.length() / this.pointStart.length();
266
- this.pointEnd.dot(this.pointStart) < 0 && (a *= -1), I.set(a, a, a);
265
+ let r = this.pointEnd.length() / this.pointStart.length();
266
+ this.pointEnd.dot(this.pointStart) < 0 && (r *= -1), I.set(r, r, r);
267
267
  } else
268
268
  m.copy(this.pointStart), I.copy(this.pointEnd), m.applyQuaternion(this._worldQuaternionInv), I.applyQuaternion(this._worldQuaternionInv), I.divide(m), t.search("X") === -1 && (I.x = 1), t.search("Y") === -1 && (I.y = 1), t.search("Z") === -1 && (I.z = 1);
269
269
  s.scale.copy(this._scaleStart).multiply(I), this.scaleSnap && (t.search("X") !== -1 && (s.scale.x = Math.round(s.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Y") !== -1 && (s.scale.y = Math.round(s.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Z") !== -1 && (s.scale.z = Math.round(s.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
270
270
  } else if (n === "rotate") {
271
271
  this._offset.copy(this.pointEnd).sub(this.pointStart);
272
- const a = 20 / this.worldPosition.distanceTo(m.setFromMatrixPosition(this.camera.matrixWorld));
273
- let d = !1;
274
- t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(m.copy(this.rotationAxis).cross(this.eye)) * a) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(_e[t]), m.copy(_e[t]), r === "local" && m.applyQuaternion(this.worldQuaternion), m.cross(this.eye), m.length() === 0 ? d = !0 : this.rotationAngle = this._offset.dot(m.normalize()) * a), (t === "E" || d) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), r === "local" && t !== "E" && t !== "XYZE" ? (s.quaternion.copy(this._quaternionStart), s.quaternion.multiply(p.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), s.quaternion.copy(p.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), s.quaternion.multiply(this._quaternionStart).normalize());
272
+ const r = 20 / this.worldPosition.distanceTo(m.setFromMatrixPosition(this.camera.matrixWorld));
273
+ let u = !1;
274
+ t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(m.copy(this.rotationAxis).cross(this.eye)) * r) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(_e[t]), m.copy(_e[t]), a === "local" && m.applyQuaternion(this.worldQuaternion), m.cross(this.eye), m.length() === 0 ? u = !0 : this.rotationAngle = this._offset.dot(m.normalize()) * r), (t === "E" || u) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), a === "local" && t !== "E" && t !== "XYZE" ? (s.quaternion.copy(this._quaternionStart), s.quaternion.multiply(p.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), s.quaternion.copy(p.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), s.quaternion.multiply(this._quaternionStart).normalize());
275
275
  }
276
- this.dispatchEvent(ue), this.dispatchEvent(xe);
276
+ this.dispatchEvent(ue), this.dispatchEvent(Se);
277
277
  }
278
278
  }
279
279
  pointerUp(e) {
280
- e !== null && e.button !== 0 || (this.dragging && this.axis !== null && (Se.mode = this.mode, this.dispatchEvent(Se)), this.dragging = !1, this.axis = null);
280
+ e !== null && e.button !== 0 || (this.dragging && this.axis !== null && (Me.mode = this.mode, this.dispatchEvent(Me)), this.dragging = !1, this.axis = null);
281
281
  }
282
282
  dispose() {
283
283
  this.disconnect(), this._root.dispose();
@@ -303,7 +303,7 @@ class vt extends Ee {
303
303
  * Resets the object's position, rotation and scale to when the current transform began.
304
304
  */
305
305
  reset() {
306
- this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(ue), this.dispatchEvent(xe), this.pointStart.copy(this.pointEnd));
306
+ this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(ue), this.dispatchEvent(Se), this.pointStart.copy(this.pointEnd));
307
307
  }
308
308
  /**
309
309
  * Returns the raycaster that is used for user interaction. This object is shared between all
@@ -312,7 +312,7 @@ class vt extends Ee {
312
312
  * @returns {Raycaster} The internal raycaster.
313
313
  */
314
314
  getRaycaster() {
315
- return H;
315
+ return O;
316
316
  }
317
317
  /**
318
318
  * Returns the transformation mode.
@@ -370,6 +370,18 @@ class vt extends Ee {
370
370
  setSpace(e) {
371
371
  this.space = e;
372
372
  }
373
+ /**
374
+ * Sets the colors of the control's gizmo.
375
+ *
376
+ * @param {number|Color|string} xAxis - The x-axis color.
377
+ * @param {number|Color|string} yAxis - The y-axis color.
378
+ * @param {number|Color|string} zAxis - The z-axis color.
379
+ * @param {number|Color|string} active - The color for active elements.
380
+ */
381
+ setColors(e, t, n, s) {
382
+ const a = this._gizmo.materialLib;
383
+ a.xAxis.color.set(e), a.yAxis.color.set(t), a.zAxis.color.set(n), a.active.color.set(s), a.xAxisTransparent.color.set(e), a.yAxisTransparent.color.set(t), a.zAxisTransparent.color.set(n), a.activeTransparent.color.set(s), a.xAxis._color && a.xAxis._color.set(e), a.yAxis._color && a.yAxis._color.set(t), a.zAxis._color && a.zAxis._color.set(n), a.active._color && a.active._color.set(s), a.xAxisTransparent._color && a.xAxisTransparent._color.set(e), a.yAxisTransparent._color && a.yAxisTransparent._color.set(t), a.zAxisTransparent._color && a.zAxisTransparent._color.set(n), a.activeTransparent._color && a.activeTransparent._color.set(s);
384
+ }
373
385
  }
374
386
  function wt(h) {
375
387
  if (this.domElement.ownerDocument.pointerLockElement)
@@ -402,7 +414,7 @@ function yt(h) {
402
414
  function _t(h) {
403
415
  this.enabled && this.pointerMove(this._getPointer(h));
404
416
  }
405
- function Mt(h) {
417
+ function xt(h) {
406
418
  this.enabled && (this.domElement.releasePointerCapture(h.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(h)));
407
419
  }
408
420
  function de(h, e, t) {
@@ -412,8 +424,8 @@ function de(h, e, t) {
412
424
  return n[s];
413
425
  return !1;
414
426
  }
415
- const ne = new Oe(), u = new l(0, 1, 0), be = new l(0, 0, 0), Pe = new ce(), ae = new M(), oe = new M(), b = new l(), Te = new ce(), q = new l(1, 0, 0), O = new l(0, 1, 0), K = new l(0, 0, 1), re = new l(), G = new l(), W = new l();
416
- class St extends le {
427
+ const ne = new et(), d = new l(0, 1, 0), be = new l(0, 0, 0), Pe = new ce(), ae = new x(), oe = new x(), b = new l(), Te = new ce(), K = new l(1, 0, 0), H = new l(0, 1, 0), N = new l(0, 0, 1), re = new l(), W = new l(), q = new l();
428
+ class Mt extends le {
417
429
  constructor(e) {
418
430
  super(), this.isTransformControlsRoot = !0, this.controls = e, this.visible = !1;
419
431
  }
@@ -428,7 +440,7 @@ class St extends le {
428
440
  });
429
441
  }
430
442
  }
431
- class xt extends le {
443
+ class St extends le {
432
444
  constructor() {
433
445
  super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
434
446
  const e = new me({
@@ -437,7 +449,7 @@ class xt extends le {
437
449
  fog: !1,
438
450
  toneMapped: !1,
439
451
  transparent: !0
440
- }), t = new Xe({
452
+ }), t = new $e({
441
453
  depthTest: !1,
442
454
  depthWrite: !1,
443
455
  fog: !1,
@@ -447,67 +459,78 @@ class xt extends le {
447
459
  n.opacity = 0.15;
448
460
  const s = t.clone();
449
461
  s.opacity = 0.5;
450
- const r = e.clone();
451
- r.color.setHex(16711680);
462
+ const a = e.clone();
463
+ a.color.setHex(16711680);
452
464
  const i = e.clone();
453
465
  i.color.setHex(65280);
454
- const a = e.clone();
455
- a.color.setHex(255);
456
- const d = e.clone();
457
- d.color.setHex(16711680), d.opacity = 0.5;
466
+ const r = e.clone();
467
+ r.color.setHex(255);
468
+ const u = e.clone();
469
+ u.color.setHex(16711680), u.opacity = 0.5;
458
470
  const f = e.clone();
459
471
  f.color.setHex(65280), f.opacity = 0.5;
460
- const D = e.clone();
461
- D.color.setHex(255), D.opacity = 0.5;
462
- const R = e.clone();
463
- R.opacity = 0.25;
464
- const Q = e.clone();
465
- Q.color.setHex(16776960), Q.opacity = 0.25, e.clone().color.setHex(16776960);
472
+ const P = e.clone();
473
+ P.color.setHex(255), P.opacity = 0.5;
474
+ const z = e.clone();
475
+ z.opacity = 0.25;
476
+ const B = e.clone();
477
+ B.color.setHex(16776960), B.opacity = 0.25;
478
+ const Y = e.clone();
479
+ Y.color.setHex(16776960);
466
480
  const $ = e.clone();
467
- $.color.setHex(7895160);
468
- const P = new g(0, 0.04, 0.1, 12);
469
- P.translate(0, 0.05, 0);
470
- const T = new v(0.08, 0.08, 0.08);
471
- T.translate(0, 0.04, 0);
472
- const x = new pe();
473
- x.setAttribute("position", new he([0, 0, 0, 1, 0, 0], 3));
474
- const E = new g(75e-4, 75e-4, 0.5, 3);
475
- E.translate(0, 0.25, 0);
481
+ $.color.setHex(7895160), this.materialLib = {
482
+ xAxis: a,
483
+ yAxis: i,
484
+ zAxis: r,
485
+ active: Y,
486
+ xAxisTransparent: u,
487
+ yAxisTransparent: f,
488
+ zAxisTransparent: P,
489
+ activeTransparent: B
490
+ };
491
+ const T = new g(0, 0.04, 0.1, 12);
492
+ T.translate(0, 0.05, 0);
493
+ const E = new v(0.08, 0.08, 0.08);
494
+ E.translate(0, 0.04, 0);
495
+ const S = new pe();
496
+ S.setAttribute("position", new he([0, 0, 0, 1, 0, 0], 3));
497
+ const C = new g(75e-4, 75e-4, 0.5, 3);
498
+ C.translate(0, 0.25, 0);
476
499
  function y(_, J) {
477
- const S = new j(_, 75e-4, 3, 64, J * Math.PI * 2);
478
- return S.rotateY(Math.PI / 2), S.rotateX(Math.PI / 2), S;
500
+ const M = new F(_, 75e-4, 3, 64, J * Math.PI * 2);
501
+ return M.rotateY(Math.PI / 2), M.rotateX(Math.PI / 2), M;
479
502
  }
480
- function z() {
503
+ function Q() {
481
504
  const _ = new pe();
482
505
  return _.setAttribute("position", new he([0, 0, 0, 1, 1, 1], 3)), _;
483
506
  }
484
- const Y = {
507
+ const Z = {
485
508
  X: [
486
- [new o(P, r), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
487
- [new o(P, r), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
488
- [new o(E, r), [0, 0, 0], [0, 0, -Math.PI / 2]]
509
+ [new o(T, a), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
510
+ [new o(T, a), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
511
+ [new o(C, a), [0, 0, 0], [0, 0, -Math.PI / 2]]
489
512
  ],
490
513
  Y: [
491
- [new o(P, i), [0, 0.5, 0]],
492
- [new o(P, i), [0, -0.5, 0], [Math.PI, 0, 0]],
493
- [new o(E, i)]
514
+ [new o(T, i), [0, 0.5, 0]],
515
+ [new o(T, i), [0, -0.5, 0], [Math.PI, 0, 0]],
516
+ [new o(C, i)]
494
517
  ],
495
518
  Z: [
496
- [new o(P, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
497
- [new o(P, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
498
- [new o(E, a), null, [Math.PI / 2, 0, 0]]
519
+ [new o(T, r), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
520
+ [new o(T, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
521
+ [new o(C, r), null, [Math.PI / 2, 0, 0]]
499
522
  ],
500
523
  XYZ: [
501
- [new o(new se(0.1, 0), R.clone()), [0, 0, 0]]
524
+ [new o(new se(0.1, 0), z), [0, 0, 0]]
502
525
  ],
503
526
  XY: [
504
- [new o(new v(0.15, 0.15, 0.01), D.clone()), [0.15, 0.15, 0]]
527
+ [new o(new v(0.15, 0.15, 0.01), P), [0.15, 0.15, 0]]
505
528
  ],
506
529
  YZ: [
507
- [new o(new v(0.15, 0.15, 0.01), d.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
530
+ [new o(new v(0.15, 0.15, 0.01), u), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
508
531
  ],
509
532
  XZ: [
510
- [new o(new v(0.15, 0.15, 0.01), f.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
533
+ [new o(new v(0.15, 0.15, 0.01), f), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
511
534
  ]
512
535
  }, L = {
513
536
  X: [
@@ -542,80 +565,80 @@ class xt extends le {
542
565
  [new o(new se(0.01, 2), s), null, null, null, "helper"]
543
566
  ],
544
567
  DELTA: [
545
- [new B(z(), s), null, null, null, "helper"]
568
+ [new A(Q(), s), null, null, null, "helper"]
546
569
  ],
547
570
  X: [
548
- [new B(x, s.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
571
+ [new A(S, s), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
549
572
  ],
550
573
  Y: [
551
- [new B(x, s.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
574
+ [new A(S, s), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
552
575
  ],
553
576
  Z: [
554
- [new B(x, s.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
577
+ [new A(S, s), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
555
578
  ]
556
579
  }, De = {
557
580
  XYZE: [
558
581
  [new o(y(0.5, 1), $), null, [0, Math.PI / 2, 0]]
559
582
  ],
560
583
  X: [
561
- [new o(y(0.5, 0.5), r)]
584
+ [new o(y(0.5, 0.5), a)]
562
585
  ],
563
586
  Y: [
564
587
  [new o(y(0.5, 0.5), i), null, [0, 0, -Math.PI / 2]]
565
588
  ],
566
589
  Z: [
567
- [new o(y(0.5, 0.5), a), null, [0, Math.PI / 2, 0]]
590
+ [new o(y(0.5, 0.5), r), null, [0, Math.PI / 2, 0]]
568
591
  ],
569
592
  E: [
570
- [new o(y(0.75, 1), Q), null, [0, Math.PI / 2, 0]]
593
+ [new o(y(0.75, 1), B), null, [0, Math.PI / 2, 0]]
571
594
  ]
572
595
  }, Be = {
573
596
  AXIS: [
574
- [new B(x, s.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
597
+ [new A(S, s), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
575
598
  ]
576
- }, Ie = {
599
+ }, Ae = {
577
600
  XYZE: [
578
- [new o(new He(0.25, 10, 8), n)]
601
+ [new o(new Je(0.25, 10, 8), n)]
579
602
  ],
580
603
  X: [
581
- [new o(new j(0.5, 0.1, 4, 24), n), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]
604
+ [new o(new F(0.5, 0.1, 4, 24), n), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]
582
605
  ],
583
606
  Y: [
584
- [new o(new j(0.5, 0.1, 4, 24), n), [0, 0, 0], [Math.PI / 2, 0, 0]]
607
+ [new o(new F(0.5, 0.1, 4, 24), n), [0, 0, 0], [Math.PI / 2, 0, 0]]
585
608
  ],
586
609
  Z: [
587
- [new o(new j(0.5, 0.1, 4, 24), n), [0, 0, 0], [0, 0, -Math.PI / 2]]
610
+ [new o(new F(0.5, 0.1, 4, 24), n), [0, 0, 0], [0, 0, -Math.PI / 2]]
588
611
  ],
589
612
  E: [
590
- [new o(new j(0.75, 0.1, 2, 24), n)]
613
+ [new o(new F(0.75, 0.1, 2, 24), n)]
591
614
  ]
592
- }, Ae = {
615
+ }, Ie = {
593
616
  X: [
594
- [new o(T, r), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
595
- [new o(E, r), [0, 0, 0], [0, 0, -Math.PI / 2]],
596
- [new o(T, r), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
617
+ [new o(E, a), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
618
+ [new o(C, a), [0, 0, 0], [0, 0, -Math.PI / 2]],
619
+ [new o(E, a), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
597
620
  ],
598
621
  Y: [
599
- [new o(T, i), [0, 0.5, 0]],
600
- [new o(E, i)],
601
- [new o(T, i), [0, -0.5, 0], [0, 0, Math.PI]]
622
+ [new o(E, i), [0, 0.5, 0]],
623
+ [new o(C, i)],
624
+ [new o(E, i), [0, -0.5, 0], [0, 0, Math.PI]]
602
625
  ],
603
626
  Z: [
604
- [new o(T, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
605
- [new o(E, a), [0, 0, 0], [Math.PI / 2, 0, 0]],
606
- [new o(T, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
627
+ [new o(E, r), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
628
+ [new o(C, r), [0, 0, 0], [Math.PI / 2, 0, 0]],
629
+ [new o(E, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
607
630
  ],
608
631
  XY: [
609
- [new o(new v(0.15, 0.15, 0.01), D), [0.15, 0.15, 0]]
632
+ [new o(new v(0.15, 0.15, 0.01), P), [0.15, 0.15, 0]]
610
633
  ],
611
634
  YZ: [
612
- [new o(new v(0.15, 0.15, 0.01), d), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
635
+ [new o(new v(0.15, 0.15, 0.01), u), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
613
636
  ],
614
637
  XZ: [
615
638
  [new o(new v(0.15, 0.15, 0.01), f), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
616
639
  ],
617
640
  XYZ: [
618
- [new o(new v(0.1, 0.1, 0.1), R.clone())]
641
+ [new o(new v(0.1, 0.1, 0.1), z)]
619
642
  ]
620
643
  }, Re = {
621
644
  X: [
@@ -642,29 +665,29 @@ class xt extends le {
642
665
  XYZ: [
643
666
  [new o(new v(0.2, 0.2, 0.2), n), [0, 0, 0]]
644
667
  ]
645
- }, Qe = {
668
+ }, ze = {
646
669
  X: [
647
- [new B(x, s.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
670
+ [new A(S, s), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
648
671
  ],
649
672
  Y: [
650
- [new B(x, s.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
673
+ [new A(S, s), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
651
674
  ],
652
675
  Z: [
653
- [new B(x, s.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
676
+ [new A(S, s), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
654
677
  ]
655
678
  };
656
- function C(_) {
679
+ function k(_) {
657
680
  const J = new le();
658
- for (const S in _)
659
- for (let Z = _[S].length; Z--; ) {
660
- const w = _[S][Z][0].clone(), ee = _[S][Z][1], te = _[S][Z][2], ie = _[S][Z][3], ze = _[S][Z][4];
661
- w.name = S, w.tag = ze, ee && w.position.set(ee[0], ee[1], ee[2]), te && w.rotation.set(te[0], te[1], te[2]), ie && w.scale.set(ie[0], ie[1], ie[2]), w.updateMatrix();
681
+ for (const M in _)
682
+ for (let U = _[M].length; U--; ) {
683
+ const w = _[M][U][0].clone(), ee = _[M][U][1], te = _[M][U][2], ie = _[M][U][3], Qe = _[M][U][4];
684
+ w.name = M, w.tag = Qe, ee && w.position.set(ee[0], ee[1], ee[2]), te && w.rotation.set(te[0], te[1], te[2]), ie && w.scale.set(ie[0], ie[1], ie[2]), w.updateMatrix();
662
685
  const ve = w.geometry.clone();
663
686
  ve.applyMatrix4(w.matrix), w.geometry = ve, w.renderOrder = 1 / 0, w.position.set(0, 0, 0), w.rotation.set(0, 0, 0), w.scale.set(1, 1, 1), J.add(w);
664
687
  }
665
688
  return J;
666
689
  }
667
- this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = C(Y)), this.add(this.gizmo.rotate = C(De)), this.add(this.gizmo.scale = C(Ae)), this.add(this.picker.translate = C(L)), this.add(this.picker.rotate = C(Ie)), this.add(this.picker.scale = C(Re)), this.add(this.helper.translate = C(ke)), this.add(this.helper.rotate = C(Be)), this.add(this.helper.scale = C(Qe)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
690
+ this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = k(Z)), this.add(this.gizmo.rotate = k(De)), this.add(this.gizmo.scale = k(Ie)), this.add(this.picker.translate = k(L)), this.add(this.picker.rotate = k(Ae)), this.add(this.picker.scale = k(Re)), this.add(this.helper.translate = k(ke)), this.add(this.helper.rotate = k(Be)), this.add(this.helper.scale = k(ze)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
668
691
  }
669
692
  // updateMatrixWorld will update transformations and appearance of individual handles
670
693
  updateMatrixWorld(e) {
@@ -672,17 +695,17 @@ class xt extends le {
672
695
  this.gizmo.translate.visible = this.mode === "translate", this.gizmo.rotate.visible = this.mode === "rotate", this.gizmo.scale.visible = this.mode === "scale", this.helper.translate.visible = this.mode === "translate", this.helper.rotate.visible = this.mode === "rotate", this.helper.scale.visible = this.mode === "scale";
673
696
  let s = [];
674
697
  s = s.concat(this.picker[this.mode].children), s = s.concat(this.gizmo[this.mode].children), s = s.concat(this.helper[this.mode].children);
675
- for (let r = 0; r < s.length; r++) {
676
- const i = s[r];
698
+ for (let a = 0; a < s.length; a++) {
699
+ const i = s[a];
677
700
  i.visible = !0, i.rotation.set(0, 0, 0), i.position.copy(this.worldPosition);
678
- let a;
679
- if (this.camera.isOrthographicCamera ? a = (this.camera.top - this.camera.bottom) / this.camera.zoom : a = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), i.scale.set(1, 1, 1).multiplyScalar(a * this.size / 4), i.tag === "helper") {
680
- i.visible = !1, i.name === "AXIS" ? (i.visible = !!this.axis, this.axis === "X" && (p.setFromEuler(ne.set(0, 0, 0)), i.quaternion.copy(n).multiply(p), Math.abs(u.copy(q).applyQuaternion(n).dot(this.eye)) > 0.9 && (i.visible = !1)), this.axis === "Y" && (p.setFromEuler(ne.set(0, 0, Math.PI / 2)), i.quaternion.copy(n).multiply(p), Math.abs(u.copy(O).applyQuaternion(n).dot(this.eye)) > 0.9 && (i.visible = !1)), this.axis === "Z" && (p.setFromEuler(ne.set(0, Math.PI / 2, 0)), i.quaternion.copy(n).multiply(p), Math.abs(u.copy(K).applyQuaternion(n).dot(this.eye)) > 0.9 && (i.visible = !1)), this.axis === "XYZE" && (p.setFromEuler(ne.set(0, Math.PI / 2, 0)), u.copy(this.rotationAxis), i.quaternion.setFromRotationMatrix(Pe.lookAt(be, u, O)), i.quaternion.multiply(p), i.visible = this.dragging), this.axis === "E" && (i.visible = !1)) : i.name === "START" ? (i.position.copy(this.worldPositionStart), i.visible = this.dragging) : i.name === "END" ? (i.position.copy(this.worldPosition), i.visible = this.dragging) : i.name === "DELTA" ? (i.position.copy(this.worldPositionStart), i.quaternion.copy(this.worldQuaternionStart), m.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), m.applyQuaternion(this.worldQuaternionStart.clone().invert()), i.scale.copy(m), i.visible = this.dragging) : (i.quaternion.copy(n), this.dragging ? i.position.copy(this.worldPositionStart) : i.position.copy(this.worldPosition), this.axis && (i.visible = this.axis.search(i.name) !== -1));
701
+ let r;
702
+ if (this.camera.isOrthographicCamera ? r = (this.camera.top - this.camera.bottom) / this.camera.zoom : r = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), i.scale.set(1, 1, 1).multiplyScalar(r * this.size / 4), i.tag === "helper") {
703
+ i.visible = !1, i.name === "AXIS" ? (i.visible = !!this.axis, this.axis === "X" && (p.setFromEuler(ne.set(0, 0, 0)), i.quaternion.copy(n).multiply(p), Math.abs(d.copy(K).applyQuaternion(n).dot(this.eye)) > 0.9 && (i.visible = !1)), this.axis === "Y" && (p.setFromEuler(ne.set(0, 0, Math.PI / 2)), i.quaternion.copy(n).multiply(p), Math.abs(d.copy(H).applyQuaternion(n).dot(this.eye)) > 0.9 && (i.visible = !1)), this.axis === "Z" && (p.setFromEuler(ne.set(0, Math.PI / 2, 0)), i.quaternion.copy(n).multiply(p), Math.abs(d.copy(N).applyQuaternion(n).dot(this.eye)) > 0.9 && (i.visible = !1)), this.axis === "XYZE" && (p.setFromEuler(ne.set(0, Math.PI / 2, 0)), d.copy(this.rotationAxis), i.quaternion.setFromRotationMatrix(Pe.lookAt(be, d, H)), i.quaternion.multiply(p), i.visible = this.dragging), this.axis === "E" && (i.visible = !1)) : i.name === "START" ? (i.position.copy(this.worldPositionStart), i.visible = this.dragging) : i.name === "END" ? (i.position.copy(this.worldPosition), i.visible = this.dragging) : i.name === "DELTA" ? (i.position.copy(this.worldPositionStart), i.quaternion.copy(this.worldQuaternionStart), m.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), m.applyQuaternion(this.worldQuaternionStart.clone().invert()), i.scale.copy(m), i.visible = this.dragging) : (i.quaternion.copy(n), this.dragging ? i.position.copy(this.worldPositionStart) : i.position.copy(this.worldPosition), this.axis && (i.visible = this.axis.search(i.name) !== -1));
681
704
  continue;
682
705
  }
683
- i.quaternion.copy(n), this.mode === "translate" || this.mode === "scale" ? (i.name === "X" && Math.abs(u.copy(q).applyQuaternion(n).dot(this.eye)) > 0.99 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1), i.name === "Y" && Math.abs(u.copy(O).applyQuaternion(n).dot(this.eye)) > 0.99 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1), i.name === "Z" && Math.abs(u.copy(K).applyQuaternion(n).dot(this.eye)) > 0.99 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1), i.name === "XY" && Math.abs(u.copy(K).applyQuaternion(n).dot(this.eye)) < 0.2 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1), i.name === "YZ" && Math.abs(u.copy(q).applyQuaternion(n).dot(this.eye)) < 0.2 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1), i.name === "XZ" && Math.abs(u.copy(O).applyQuaternion(n).dot(this.eye)) < 0.2 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1)) : this.mode === "rotate" && (ae.copy(n), u.copy(this.eye).applyQuaternion(p.copy(n).invert()), i.name.search("E") !== -1 && i.quaternion.setFromRotationMatrix(Pe.lookAt(this.eye, be, O)), i.name === "X" && (p.setFromAxisAngle(q, Math.atan2(-u.y, u.z)), p.multiplyQuaternions(ae, p), i.quaternion.copy(p)), i.name === "Y" && (p.setFromAxisAngle(O, Math.atan2(u.x, u.z)), p.multiplyQuaternions(ae, p), i.quaternion.copy(p)), i.name === "Z" && (p.setFromAxisAngle(K, Math.atan2(u.y, u.x)), p.multiplyQuaternions(ae, p), i.quaternion.copy(p))), i.visible = i.visible && (i.name.indexOf("X") === -1 || this.showX), i.visible = i.visible && (i.name.indexOf("Y") === -1 || this.showY), i.visible = i.visible && (i.name.indexOf("Z") === -1 || this.showZ), i.visible = i.visible && (i.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), i.material._color = i.material._color || i.material.color.clone(), i.material._opacity = i.material._opacity || i.material.opacity, i.material.color.copy(i.material._color), i.material.opacity = i.material._opacity, this.enabled && this.axis && (i.name === this.axis || this.axis.split("").some(function(d) {
684
- return i.name === d;
685
- })) && (i.material.color.setHex(16776960), i.material.opacity = 1);
706
+ i.quaternion.copy(n), this.mode === "translate" || this.mode === "scale" ? (i.name === "X" && Math.abs(d.copy(K).applyQuaternion(n).dot(this.eye)) > 0.99 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1), i.name === "Y" && Math.abs(d.copy(H).applyQuaternion(n).dot(this.eye)) > 0.99 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1), i.name === "Z" && Math.abs(d.copy(N).applyQuaternion(n).dot(this.eye)) > 0.99 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1), i.name === "XY" && Math.abs(d.copy(N).applyQuaternion(n).dot(this.eye)) < 0.2 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1), i.name === "YZ" && Math.abs(d.copy(K).applyQuaternion(n).dot(this.eye)) < 0.2 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1), i.name === "XZ" && Math.abs(d.copy(H).applyQuaternion(n).dot(this.eye)) < 0.2 && (i.scale.set(1e-10, 1e-10, 1e-10), i.visible = !1)) : this.mode === "rotate" && (ae.copy(n), d.copy(this.eye).applyQuaternion(p.copy(n).invert()), i.name.search("E") !== -1 && i.quaternion.setFromRotationMatrix(Pe.lookAt(this.eye, be, H)), i.name === "X" && (p.setFromAxisAngle(K, Math.atan2(-d.y, d.z)), p.multiplyQuaternions(ae, p), i.quaternion.copy(p)), i.name === "Y" && (p.setFromAxisAngle(H, Math.atan2(d.x, d.z)), p.multiplyQuaternions(ae, p), i.quaternion.copy(p)), i.name === "Z" && (p.setFromAxisAngle(N, Math.atan2(d.y, d.x)), p.multiplyQuaternions(ae, p), i.quaternion.copy(p))), i.visible = i.visible && (i.name.indexOf("X") === -1 || this.showX), i.visible = i.visible && (i.name.indexOf("Y") === -1 || this.showY), i.visible = i.visible && (i.name.indexOf("Z") === -1 || this.showZ), i.visible = i.visible && (i.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), i.visible = i.visible && (i.name.indexOf("XY") === -1 || this.showXY), i.visible = i.visible && (i.name.indexOf("YZ") === -1 || this.showYZ), i.visible = i.visible && (i.name.indexOf("XZ") === -1 || this.showXZ), i.material._color = i.material._color || i.material.color.clone(), i.material._opacity = i.material._opacity || i.material.opacity, i.material.color.copy(i.material._color), i.material.opacity = i.material._opacity, this.enabled && this.axis && (i.name === this.axis ? (i.material.color.copy(this.materialLib.active.color), i.material.opacity = 1) : this.axis.split("").some(function(u) {
707
+ return i.name === u;
708
+ }) && (i.material.color.copy(this.materialLib.active.color), i.material.opacity = 1));
686
709
  }
687
710
  super.updateMatrixWorld(e);
688
711
  }
@@ -690,33 +713,33 @@ class xt extends le {
690
713
  class bt extends o {
691
714
  constructor() {
692
715
  super(
693
- new Ye(1e5, 1e5, 2, 2),
716
+ new tt(1e5, 1e5, 2, 2),
694
717
  new me({ visible: !1, wireframe: !0, side: fe, transparent: !0, opacity: 0.1, toneMapped: !1 })
695
718
  ), this.isTransformControlsPlane = !0, this.type = "TransformControlsPlane";
696
719
  }
697
720
  updateMatrixWorld(e) {
698
721
  let t = this.space;
699
- switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), re.copy(q).applyQuaternion(t === "local" ? this.worldQuaternion : oe), G.copy(O).applyQuaternion(t === "local" ? this.worldQuaternion : oe), W.copy(K).applyQuaternion(t === "local" ? this.worldQuaternion : oe), u.copy(G), this.mode) {
722
+ switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), re.copy(K).applyQuaternion(t === "local" ? this.worldQuaternion : oe), W.copy(H).applyQuaternion(t === "local" ? this.worldQuaternion : oe), q.copy(N).applyQuaternion(t === "local" ? this.worldQuaternion : oe), d.copy(W), this.mode) {
700
723
  case "translate":
701
724
  case "scale":
702
725
  switch (this.axis) {
703
726
  case "X":
704
- u.copy(this.eye).cross(re), b.copy(re).cross(u);
727
+ d.copy(this.eye).cross(re), b.copy(re).cross(d);
705
728
  break;
706
729
  case "Y":
707
- u.copy(this.eye).cross(G), b.copy(G).cross(u);
730
+ d.copy(this.eye).cross(W), b.copy(W).cross(d);
708
731
  break;
709
732
  case "Z":
710
- u.copy(this.eye).cross(W), b.copy(W).cross(u);
733
+ d.copy(this.eye).cross(q), b.copy(q).cross(d);
711
734
  break;
712
735
  case "XY":
713
- b.copy(W);
736
+ b.copy(q);
714
737
  break;
715
738
  case "YZ":
716
739
  b.copy(re);
717
740
  break;
718
741
  case "XZ":
719
- u.copy(W), b.copy(G);
742
+ d.copy(q), b.copy(W);
720
743
  break;
721
744
  case "XYZ":
722
745
  case "E":
@@ -728,7 +751,7 @@ class bt extends o {
728
751
  default:
729
752
  b.set(0, 0, 0);
730
753
  }
731
- b.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (Te.lookAt(m.set(0, 0, 0), b, u), this.quaternion.setFromRotationMatrix(Te)), super.updateMatrixWorld(e);
754
+ b.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (Te.lookAt(m.set(0, 0, 0), b, d), this.quaternion.setFromRotationMatrix(Te)), super.updateMatrixWorld(e);
732
755
  }
733
756
  }
734
757
  class Pt {
@@ -743,7 +766,7 @@ class Pt {
743
766
  *
744
767
  * @abstract
745
768
  * @param {number} width - The width to set.
746
- * @param {number} height - The width to set.
769
+ * @param {number} height - The height to set.
747
770
  */
748
771
  setSize() {
749
772
  }
@@ -771,7 +794,7 @@ class Pt {
771
794
  dispose() {
772
795
  }
773
796
  }
774
- const Tt = new Ze(-1, 1, 1, -1, 0, 1);
797
+ const Tt = new it(-1, 1, 1, -1, 0, 1);
775
798
  class Et extends pe {
776
799
  constructor() {
777
800
  super(), this.setAttribute("position", new he([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3)), this.setAttribute("uv", new he([0, 2, 0, 0, 2, 0], 2));
@@ -851,7 +874,7 @@ const Dt = {
851
874
  }`
852
875
  )
853
876
  };
854
- class A extends Pt {
877
+ class R extends Pt {
855
878
  /**
856
879
  * Constructs a new outline pass.
857
880
  *
@@ -862,23 +885,23 @@ class A extends Pt {
862
885
  *
863
886
  */
864
887
  constructor(e, t, n, s) {
865
- super(), this.renderScene = t, this.renderCamera = n, this.selectedObjects = s !== void 0 ? s : [], this.visibleEdgeColor = new F(1, 1, 1), this.hiddenEdgeColor = new F(0.1, 0.04, 0.02), this.edgeGlow = 0, this.usePatternTexture = !1, this.patternTexture = null, this.edgeThickness = 1, this.edgeStrength = 3, this.downSampleRatio = 2, this.pulsePeriod = 0, this._visibilityCache = /* @__PURE__ */ new Map(), this._selectionCache = /* @__PURE__ */ new Set(), this.resolution = e !== void 0 ? new k(e.x, e.y) : new k(256, 256);
866
- const r = Math.round(this.resolution.x / this.downSampleRatio), i = Math.round(this.resolution.y / this.downSampleRatio);
867
- this.renderTargetMaskBuffer = new X(this.resolution.x, this.resolution.y), this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask", this.renderTargetMaskBuffer.texture.generateMipmaps = !1, this.depthMaterial = new Ue(), this.depthMaterial.side = fe, this.depthMaterial.depthPacking = je, this.depthMaterial.blending = we, this.prepareMaskMaterial = this._getPrepareMaskMaterial(), this.prepareMaskMaterial.side = fe, this.prepareMaskMaterial.fragmentShader = D(this.prepareMaskMaterial.fragmentShader, this.renderCamera), this.renderTargetDepthBuffer = new X(this.resolution.x, this.resolution.y, { type: U }), this.renderTargetDepthBuffer.texture.name = "OutlinePass.depth", this.renderTargetDepthBuffer.texture.generateMipmaps = !1, this.renderTargetMaskDownSampleBuffer = new X(r, i, { type: U }), this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample", this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1, this.renderTargetBlurBuffer1 = new X(r, i, { type: U }), this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1", this.renderTargetBlurBuffer1.texture.generateMipmaps = !1, this.renderTargetBlurBuffer2 = new X(Math.round(r / 2), Math.round(i / 2), { type: U }), this.renderTargetBlurBuffer2.texture.name = "OutlinePass.blur2", this.renderTargetBlurBuffer2.texture.generateMipmaps = !1, this.edgeDetectionMaterial = this._getEdgeDetectionMaterial(), this.renderTargetEdgeBuffer1 = new X(r, i, { type: U }), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.renderTargetEdgeBuffer2 = new X(Math.round(r / 2), Math.round(i / 2), { type: U }), this.renderTargetEdgeBuffer2.texture.name = "OutlinePass.edge2", this.renderTargetEdgeBuffer2.texture.generateMipmaps = !1;
868
- const a = 4, d = 4;
869
- this.separableBlurMaterial1 = this._getSeparableBlurMaterial(a), this.separableBlurMaterial1.uniforms.texSize.value.set(r, i), this.separableBlurMaterial1.uniforms.kernelRadius.value = 1, this.separableBlurMaterial2 = this._getSeparableBlurMaterial(d), this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(r / 2), Math.round(i / 2)), this.separableBlurMaterial2.uniforms.kernelRadius.value = d, this.overlayMaterial = this._getOverlayMaterial();
888
+ super(), this.renderScene = t, this.renderCamera = n, this.selectedObjects = s !== void 0 ? s : [], this.visibleEdgeColor = new V(1, 1, 1), this.hiddenEdgeColor = new V(0.1, 0.04, 0.02), this.edgeGlow = 0, this.usePatternTexture = !1, this.patternTexture = null, this.edgeThickness = 1, this.edgeStrength = 3, this.downSampleRatio = 2, this.pulsePeriod = 0, this._visibilityCache = /* @__PURE__ */ new Map(), this._selectionCache = /* @__PURE__ */ new Set(), this.resolution = e !== void 0 ? new D(e.x, e.y) : new D(256, 256);
889
+ const a = Math.round(this.resolution.x / this.downSampleRatio), i = Math.round(this.resolution.y / this.downSampleRatio);
890
+ this.renderTargetMaskBuffer = new X(this.resolution.x, this.resolution.y), this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask", this.renderTargetMaskBuffer.texture.generateMipmaps = !1, this.depthMaterial = new st(), this.depthMaterial.side = fe, this.depthMaterial.depthPacking = nt, this.depthMaterial.blending = we, this.prepareMaskMaterial = this._getPrepareMaskMaterial(), this.prepareMaskMaterial.side = fe, this.prepareMaskMaterial.fragmentShader = P(this.prepareMaskMaterial.fragmentShader, this.renderCamera), this.renderTargetDepthBuffer = new X(this.resolution.x, this.resolution.y, { type: j }), this.renderTargetDepthBuffer.texture.name = "OutlinePass.depth", this.renderTargetDepthBuffer.texture.generateMipmaps = !1, this.renderTargetMaskDownSampleBuffer = new X(a, i, { type: j }), this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample", this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1, this.renderTargetBlurBuffer1 = new X(a, i, { type: j }), this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1", this.renderTargetBlurBuffer1.texture.generateMipmaps = !1, this.renderTargetBlurBuffer2 = new X(Math.round(a / 2), Math.round(i / 2), { type: j }), this.renderTargetBlurBuffer2.texture.name = "OutlinePass.blur2", this.renderTargetBlurBuffer2.texture.generateMipmaps = !1, this.edgeDetectionMaterial = this._getEdgeDetectionMaterial(), this.renderTargetEdgeBuffer1 = new X(a, i, { type: j }), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.renderTargetEdgeBuffer2 = new X(Math.round(a / 2), Math.round(i / 2), { type: j }), this.renderTargetEdgeBuffer2.texture.name = "OutlinePass.edge2", this.renderTargetEdgeBuffer2.texture.generateMipmaps = !1;
891
+ const r = 4, u = 4;
892
+ this.separableBlurMaterial1 = this._getSeparableBlurMaterial(r), this.separableBlurMaterial1.uniforms.texSize.value.set(a, i), this.separableBlurMaterial1.uniforms.kernelRadius.value = 1, this.separableBlurMaterial2 = this._getSeparableBlurMaterial(u), this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(a / 2), Math.round(i / 2)), this.separableBlurMaterial2.uniforms.kernelRadius.value = u, this.overlayMaterial = this._getOverlayMaterial();
870
893
  const f = Dt;
871
- this.copyUniforms = Fe.clone(f.uniforms), this.materialCopy = new V({
894
+ this.copyUniforms = at.clone(f.uniforms), this.materialCopy = new G({
872
895
  uniforms: this.copyUniforms,
873
896
  vertexShader: f.vertexShader,
874
897
  fragmentShader: f.fragmentShader,
875
898
  blending: we,
876
899
  depthTest: !1,
877
900
  depthWrite: !1
878
- }), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new F(), this.oldClearAlpha = 1, this._fsQuad = new kt(null), this.tempPulseColor1 = new F(), this.tempPulseColor2 = new F(), this.textureMatrix = new ce();
879
- function D(R, Q) {
880
- const N = Q.isPerspectiveCamera ? "perspective" : "orthographic";
881
- return R.replace(/DEPTH_TO_VIEW_Z/g, N + "DepthToViewZ");
901
+ }), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new V(), this.oldClearAlpha = 1, this._fsQuad = new kt(null), this.tempPulseColor1 = new V(), this.tempPulseColor2 = new V(), this.textureMatrix = new ce();
902
+ function P(z, B) {
903
+ const Y = B.isPerspectiveCamera ? "perspective" : "orthographic";
904
+ return z.replace(/DEPTH_TO_VIEW_Z/g, Y + "DepthToViewZ");
882
905
  }
883
906
  }
884
907
  /**
@@ -892,7 +915,7 @@ class A extends Pt {
892
915
  * Sets the size of the pass.
893
916
  *
894
917
  * @param {number} width - The width to set.
895
- * @param {number} height - The width to set.
918
+ * @param {number} height - The height to set.
896
919
  */
897
920
  setSize(e, t) {
898
921
  this.renderTargetMaskBuffer.setSize(e, t), this.renderTargetDepthBuffer.setSize(e, t);
@@ -910,17 +933,17 @@ class A extends Pt {
910
933
  * @param {number} deltaTime - The delta time in seconds.
911
934
  * @param {boolean} maskActive - Whether masking is active or not.
912
935
  */
913
- render(e, t, n, s, r) {
936
+ render(e, t, n, s, a) {
914
937
  if (this.selectedObjects.length > 0) {
915
938
  e.getClearColor(this._oldClearColor), this.oldClearAlpha = e.getClearAlpha();
916
939
  const i = e.autoClear;
917
- e.autoClear = !1, r && e.state.buffers.stencil.setTest(!1), e.setClearColor(16777215, 1), this._updateSelectionCache(), this._changeVisibilityOfSelectedObjects(!1);
918
- const a = this.renderScene.background, d = this.renderScene.overrideMaterial;
919
- if (this.renderScene.background = null, this.renderScene.overrideMaterial = this.depthMaterial, e.setRenderTarget(this.renderTargetDepthBuffer), e.clear(), e.render(this.renderScene, this.renderCamera), this._changeVisibilityOfSelectedObjects(!0), this._visibilityCache.clear(), this._updateTextureMatrix(), this._changeVisibilityOfNonSelectedObjects(!1), this.renderScene.overrideMaterial = this.prepareMaskMaterial, this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near, this.renderCamera.far), this.prepareMaskMaterial.uniforms.depthTexture.value = this.renderTargetDepthBuffer.texture, this.prepareMaskMaterial.uniforms.textureMatrix.value = this.textureMatrix, e.setRenderTarget(this.renderTargetMaskBuffer), e.clear(), e.render(this.renderScene, this.renderCamera), this._changeVisibilityOfNonSelectedObjects(!0), this._visibilityCache.clear(), this._selectionCache.clear(), this.renderScene.background = a, this.renderScene.overrideMaterial = d, this._fsQuad.material = this.materialCopy, this.copyUniforms.tDiffuse.value = this.renderTargetMaskBuffer.texture, e.setRenderTarget(this.renderTargetMaskDownSampleBuffer), e.clear(), this._fsQuad.render(e), this.tempPulseColor1.copy(this.visibleEdgeColor), this.tempPulseColor2.copy(this.hiddenEdgeColor), this.pulsePeriod > 0) {
940
+ e.autoClear = !1, a && e.state.buffers.stencil.setTest(!1), e.setClearColor(16777215, 1), this._updateSelectionCache(), this._changeVisibilityOfSelectedObjects(!1);
941
+ const r = this.renderScene.background, u = this.renderScene.overrideMaterial;
942
+ if (this.renderScene.background = null, this.renderScene.overrideMaterial = this.depthMaterial, e.setRenderTarget(this.renderTargetDepthBuffer), e.clear(), e.render(this.renderScene, this.renderCamera), this._changeVisibilityOfSelectedObjects(!0), this._visibilityCache.clear(), this._updateTextureMatrix(), this._changeVisibilityOfNonSelectedObjects(!1), this.renderScene.overrideMaterial = this.prepareMaskMaterial, this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near, this.renderCamera.far), this.prepareMaskMaterial.uniforms.depthTexture.value = this.renderTargetDepthBuffer.texture, this.prepareMaskMaterial.uniforms.textureMatrix.value = this.textureMatrix, e.setRenderTarget(this.renderTargetMaskBuffer), e.clear(), e.render(this.renderScene, this.renderCamera), this._changeVisibilityOfNonSelectedObjects(!0), this._visibilityCache.clear(), this._selectionCache.clear(), this.renderScene.background = r, this.renderScene.overrideMaterial = u, this._fsQuad.material = this.materialCopy, this.copyUniforms.tDiffuse.value = this.renderTargetMaskBuffer.texture, e.setRenderTarget(this.renderTargetMaskDownSampleBuffer), e.clear(), this._fsQuad.render(e), this.tempPulseColor1.copy(this.visibleEdgeColor), this.tempPulseColor2.copy(this.hiddenEdgeColor), this.pulsePeriod > 0) {
920
943
  const f = 0.625 + Math.cos(performance.now() * 0.01 / this.pulsePeriod) * 0.75 / 2;
921
944
  this.tempPulseColor1.multiplyScalar(f), this.tempPulseColor2.multiplyScalar(f);
922
945
  }
923
- this._fsQuad.material = this.edgeDetectionMaterial, this.edgeDetectionMaterial.uniforms.maskTexture.value = this.renderTargetMaskDownSampleBuffer.texture, this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height), this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value = this.tempPulseColor1, this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value = this.tempPulseColor2, e.setRenderTarget(this.renderTargetEdgeBuffer1), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.separableBlurMaterial1, this.separableBlurMaterial1.uniforms.colorTexture.value = this.renderTargetEdgeBuffer1.texture, this.separableBlurMaterial1.uniforms.direction.value = A.BlurDirectionX, this.separableBlurMaterial1.uniforms.kernelRadius.value = this.edgeThickness, e.setRenderTarget(this.renderTargetBlurBuffer1), e.clear(), this._fsQuad.render(e), this.separableBlurMaterial1.uniforms.colorTexture.value = this.renderTargetBlurBuffer1.texture, this.separableBlurMaterial1.uniforms.direction.value = A.BlurDirectionY, e.setRenderTarget(this.renderTargetEdgeBuffer1), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.separableBlurMaterial2, this.separableBlurMaterial2.uniforms.colorTexture.value = this.renderTargetEdgeBuffer1.texture, this.separableBlurMaterial2.uniforms.direction.value = A.BlurDirectionX, e.setRenderTarget(this.renderTargetBlurBuffer2), e.clear(), this._fsQuad.render(e), this.separableBlurMaterial2.uniforms.colorTexture.value = this.renderTargetBlurBuffer2.texture, this.separableBlurMaterial2.uniforms.direction.value = A.BlurDirectionY, e.setRenderTarget(this.renderTargetEdgeBuffer2), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.overlayMaterial, this.overlayMaterial.uniforms.maskTexture.value = this.renderTargetMaskBuffer.texture, this.overlayMaterial.uniforms.edgeTexture1.value = this.renderTargetEdgeBuffer1.texture, this.overlayMaterial.uniforms.edgeTexture2.value = this.renderTargetEdgeBuffer2.texture, this.overlayMaterial.uniforms.patternTexture.value = this.patternTexture, this.overlayMaterial.uniforms.edgeStrength.value = this.edgeStrength, this.overlayMaterial.uniforms.edgeGlow.value = this.edgeGlow, this.overlayMaterial.uniforms.usePatternTexture.value = this.usePatternTexture, r && e.state.buffers.stencil.setTest(!0), e.setRenderTarget(n), this._fsQuad.render(e), e.setClearColor(this._oldClearColor, this.oldClearAlpha), e.autoClear = i;
946
+ this._fsQuad.material = this.edgeDetectionMaterial, this.edgeDetectionMaterial.uniforms.maskTexture.value = this.renderTargetMaskDownSampleBuffer.texture, this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height), this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value = this.tempPulseColor1, this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value = this.tempPulseColor2, e.setRenderTarget(this.renderTargetEdgeBuffer1), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.separableBlurMaterial1, this.separableBlurMaterial1.uniforms.colorTexture.value = this.renderTargetEdgeBuffer1.texture, this.separableBlurMaterial1.uniforms.direction.value = R.BlurDirectionX, this.separableBlurMaterial1.uniforms.kernelRadius.value = this.edgeThickness, e.setRenderTarget(this.renderTargetBlurBuffer1), e.clear(), this._fsQuad.render(e), this.separableBlurMaterial1.uniforms.colorTexture.value = this.renderTargetBlurBuffer1.texture, this.separableBlurMaterial1.uniforms.direction.value = R.BlurDirectionY, e.setRenderTarget(this.renderTargetEdgeBuffer1), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.separableBlurMaterial2, this.separableBlurMaterial2.uniforms.colorTexture.value = this.renderTargetEdgeBuffer1.texture, this.separableBlurMaterial2.uniforms.direction.value = R.BlurDirectionX, e.setRenderTarget(this.renderTargetBlurBuffer2), e.clear(), this._fsQuad.render(e), this.separableBlurMaterial2.uniforms.colorTexture.value = this.renderTargetBlurBuffer2.texture, this.separableBlurMaterial2.uniforms.direction.value = R.BlurDirectionY, e.setRenderTarget(this.renderTargetEdgeBuffer2), e.clear(), this._fsQuad.render(e), this._fsQuad.material = this.overlayMaterial, this.overlayMaterial.uniforms.maskTexture.value = this.renderTargetMaskBuffer.texture, this.overlayMaterial.uniforms.edgeTexture1.value = this.renderTargetEdgeBuffer1.texture, this.overlayMaterial.uniforms.edgeTexture2.value = this.renderTargetEdgeBuffer2.texture, this.overlayMaterial.uniforms.patternTexture.value = this.patternTexture, this.overlayMaterial.uniforms.edgeStrength.value = this.edgeStrength, this.overlayMaterial.uniforms.edgeGlow.value = this.edgeGlow, this.overlayMaterial.uniforms.usePatternTexture.value = this.usePatternTexture, a && e.state.buffers.stencil.setTest(!0), e.setRenderTarget(n), this._fsQuad.render(e), e.setClearColor(this._oldClearColor, this.oldClearAlpha), e.autoClear = i;
924
947
  }
925
948
  this.renderToScreen && (this._fsQuad.material = this.materialCopy, this.copyUniforms.tDiffuse.value = n.texture, e.setRenderTarget(null), this._fsQuad.render(e));
926
949
  }
@@ -941,13 +964,13 @@ class A extends Pt {
941
964
  }
942
965
  _changeVisibilityOfNonSelectedObjects(e) {
943
966
  const t = this._visibilityCache, n = this._selectionCache;
944
- function s(r) {
945
- if (r.isMesh || r.isSprite) {
946
- if (!n.has(r)) {
947
- const i = r.visible;
948
- (e === !1 || t.get(r) === !0) && (r.visible = e), t.set(r, i);
949
- }
950
- } else (r.isPoints || r.isLine) && (e === !0 ? r.visible = t.get(r) : (t.set(r, r.visible), r.visible = e));
967
+ function s(a) {
968
+ if (a.isPoints || a.isLine || a.isLine2)
969
+ e === !0 ? a.visible = t.get(a) : (t.set(a, a.visible), a.visible = e);
970
+ else if ((a.isMesh || a.isSprite) && !n.has(a)) {
971
+ const i = a.visible;
972
+ (e === !1 || t.get(a) === !0) && (a.visible = e), t.set(a, i);
973
+ }
951
974
  }
952
975
  this.renderScene.traverse(s);
953
976
  }
@@ -972,10 +995,10 @@ class A extends Pt {
972
995
  ), this.textureMatrix.multiply(this.renderCamera.projectionMatrix), this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse);
973
996
  }
974
997
  _getPrepareMaskMaterial() {
975
- return new V({
998
+ return new G({
976
999
  uniforms: {
977
1000
  depthTexture: { value: null },
978
- cameraNearFar: { value: new k(0.5, 0.5) },
1001
+ cameraNearFar: { value: new D(0.5, 0.5) },
979
1002
  textureMatrix: { value: null }
980
1003
  },
981
1004
  vertexShader: `#include <batching_pars_vertex>
@@ -1027,10 +1050,10 @@ class A extends Pt {
1027
1050
  });
1028
1051
  }
1029
1052
  _getEdgeDetectionMaterial() {
1030
- return new V({
1053
+ return new G({
1031
1054
  uniforms: {
1032
1055
  maskTexture: { value: null },
1033
- texSize: { value: new k(0.5, 0.5) },
1056
+ texSize: { value: new D(0.5, 0.5) },
1034
1057
  visibleEdgeColor: { value: new l(1, 1, 1) },
1035
1058
  hiddenEdgeColor: { value: new l(1, 1, 1) }
1036
1059
  },
@@ -1066,14 +1089,14 @@ class A extends Pt {
1066
1089
  });
1067
1090
  }
1068
1091
  _getSeparableBlurMaterial(e) {
1069
- return new V({
1092
+ return new G({
1070
1093
  defines: {
1071
1094
  MAX_RADIUS: e
1072
1095
  },
1073
1096
  uniforms: {
1074
1097
  colorTexture: { value: null },
1075
- texSize: { value: new k(0.5, 0.5) },
1076
- direction: { value: new k(0.5, 0.5) },
1098
+ texSize: { value: new D(0.5, 0.5) },
1099
+ direction: { value: new D(0.5, 0.5) },
1077
1100
  kernelRadius: { value: 1 }
1078
1101
  },
1079
1102
  vertexShader: `varying vec2 vUv;
@@ -1114,7 +1137,7 @@ class A extends Pt {
1114
1137
  });
1115
1138
  }
1116
1139
  _getOverlayMaterial() {
1117
- return new V({
1140
+ return new G({
1118
1141
  uniforms: {
1119
1142
  maskTexture: { value: null },
1120
1143
  edgeTexture1: { value: null },
@@ -1152,40 +1175,40 @@ class A extends Pt {
1152
1175
  finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);
1153
1176
  gl_FragColor = finalColor;
1154
1177
  }`,
1155
- blending: Ve,
1178
+ blending: rt,
1156
1179
  depthTest: !1,
1157
1180
  depthWrite: !1,
1158
1181
  transparent: !0
1159
1182
  });
1160
1183
  }
1161
1184
  }
1162
- A.BlurDirectionX = new k(1, 0);
1163
- A.BlurDirectionY = new k(0, 1);
1185
+ R.BlurDirectionX = new D(1, 0);
1186
+ R.BlurDirectionY = new D(0, 1);
1164
1187
  function Bt(h, e, t, n, s) {
1165
- h.traverse((r) => {
1166
- var i, a;
1167
- if (r instanceof o)
1188
+ h.traverse((a) => {
1189
+ var i, r;
1190
+ if (a instanceof o)
1168
1191
  if (e === "solid") {
1169
- (i = n.get(r.uuid)) == null || i.dispose(), n.delete(r.uuid);
1170
- const d = t.get(r.uuid);
1171
- d && (r.material = d, t.delete(r.uuid));
1192
+ (i = n.get(a.uuid)) == null || i.dispose(), n.delete(a.uuid);
1193
+ const u = t.get(a.uuid);
1194
+ u && (a.material = u, t.delete(a.uuid));
1172
1195
  } else {
1173
- t.has(r.uuid) || t.set(r.uuid, r.material), (a = n.get(r.uuid)) == null || a.dispose(), s.has(r.uuid) || s.set(r.uuid, Math.random() * 16777215);
1174
- const d = s.get(r.uuid), f = new me(
1175
- e === "wireframe" ? { wireframe: !0, color: d } : { color: d }
1196
+ t.has(a.uuid) || t.set(a.uuid, a.material), (r = n.get(a.uuid)) == null || r.dispose(), s.has(a.uuid) || s.set(a.uuid, Math.random() * 16777215);
1197
+ const u = s.get(a.uuid), f = new me(
1198
+ e === "wireframe" ? { wireframe: !0, color: u } : { color: u }
1176
1199
  );
1177
- n.set(r.uuid, f), r.material = f;
1200
+ n.set(a.uuid, f), a.material = f;
1178
1201
  }
1179
1202
  });
1180
1203
  }
1181
- class Ce extends rt {
1204
+ class Ce extends Ke {
1182
1205
  constructor() {
1183
1206
  var e;
1184
1207
  super(), this.activeToolMode = "translate", this.shadeMode = "solid", this.originalMaterials = /* @__PURE__ */ new Map(), this.shadeOverrideMaterials = /* @__PURE__ */ new Map(), this.flatColors = /* @__PURE__ */ new Map(), this.helpers = [], this.lightHelpers = [], this._showHelpers = !0, this.activeAssetCategory = "Object", c.instance().editor = this, (e = c.instance().logger) == null || e.info("Booting Editor"), c.instance().trigger("editorBoot", this), c.instance().trigger("uiDestroy", this), c.instance().world.destroy(), c.instance().scene.traverse((t) => {
1185
1208
  var n, s;
1186
- t instanceof o && ((n = t.geometry) == null || n.dispose(), Array.isArray(t.material) ? t.material.forEach((r) => r.dispose()) : (s = t.material) == null || s.dispose());
1209
+ t instanceof o && ((n = t.geometry) == null || n.dispose(), Array.isArray(t.material) ? t.material.forEach((a) => a.dispose()) : (s = t.material) == null || s.dispose());
1187
1210
  }), c.instance().scene.clear(), this.initEditorScene(), c.instance().contextMenuAbort.abort(), c.instance().uiRoot.innerHTML = "", c.instance().uiRoot.style.opacity = "1", document.title = "MavonEngine | Editor", document.getElementsByTagName("body")[0].removeAttribute("onContextMenu"), Promise.all([
1188
- import("./mount-DicE86w2.mjs"),
1211
+ import("./mount-Da8g-2BI.mjs"),
1189
1212
  Promise.resolve({ })
1190
1213
  ]).then(([{ mountEditorUI: t }]) => {
1191
1214
  this.reactRoot = t(c.instance().uiRoot);
@@ -1200,37 +1223,37 @@ class Ce extends rt {
1200
1223
  });
1201
1224
  }
1202
1225
  initEditorScene() {
1203
- c.instance().camera.instance.position.set(20, 10, 20), c.instance().camera.instance.rotation.set(0, 0, 0), c.instance().camera.instance.rotateY(Math.PI / 360 * 90), c.instance().camera.instance.rotateX(Math.PI / 360 * -45), this.outlinePass = new A(
1204
- new k(c.instance().sizes.width, c.instance().sizes.height),
1226
+ c.instance().camera.instance.position.set(20, 10, 20), c.instance().camera.instance.rotation.set(0, 0, 0), c.instance().camera.instance.rotateY(Math.PI / 360 * 90), c.instance().camera.instance.rotateX(Math.PI / 360 * -45), this.outlinePass = new R(
1227
+ new D(c.instance().sizes.width, c.instance().sizes.height),
1205
1228
  c.instance().scene,
1206
1229
  c.instance().camera.instance
1207
1230
  ), c.instance().renderer.composer.addPass(this.outlinePass), this.initFlyControls();
1208
- const e = new We(new l(0, 5, 0)), t = new qe(new l(10, 15, 5));
1231
+ const e = new Xe(new l(0, 5, 0)), t = new Oe(new l(10, 15, 5));
1209
1232
  t.instance.intensity = 5;
1210
- const n = new Ke(new l(0, 0, 0), 50, 50);
1233
+ const n = new He(new l(0, 0, 0), 50, 50);
1211
1234
  n.setReceiveShadow(!0), n.instance instanceof o && n.instance.material.color.set("#ffbe6f");
1212
- const s = 5, r = [
1213
- new Ne(new l(s, 0.5, 0)),
1214
- new $e(new l(s * 0.707, 1, s * 0.707)),
1215
- new Je(new l(0, 0.5, s)),
1216
- new et(new l(-s * 0.707, 0.5, s * 0.707)),
1217
- new tt(new l(-s, 1, 0)),
1218
- new it(new l(-s * 0.707, 1, -s * 0.707)),
1219
- new st(new l(0, 1, -s)),
1220
- new nt(new l(s * 0.707, 1, -s * 0.707)),
1221
- new at(new l(0, 3.5, 0))
1235
+ const s = 5, a = [
1236
+ new Ye(new l(s, 0.5, 0)),
1237
+ new Ze(new l(s * 0.707, 1, s * 0.707)),
1238
+ new Ue(new l(0, 0.5, s)),
1239
+ new je(new l(-s * 0.707, 0.5, s * 0.707)),
1240
+ new Fe(new l(-s, 1, 0)),
1241
+ new Ve(new l(-s * 0.707, 1, -s * 0.707)),
1242
+ new Ge(new l(0, 1, -s)),
1243
+ new We(new l(s * 0.707, 1, -s * 0.707)),
1244
+ new qe(new l(0, 3.5, 0))
1222
1245
  ];
1223
- r.forEach((a) => a.setCastShadow(!0));
1246
+ a.forEach((r) => r.setCastShadow(!0));
1224
1247
  const i = {};
1225
- [e, t, n, ...r].forEach((a) => i[a.id] = a), c.instance().world.add(i), this.trigger("sceneChanged"), c.instance().input.on("mousedown", (a) => {
1226
- a.target === c.instance().canvas && this.handleCanvasClick(a);
1227
- }), c.instance().input.on("keydown", (a) => {
1228
- a.code === "Escape" && this.activeItem && this.deselect();
1229
- }), this.handleItemDelete(), this.on("setTransformMode", (a) => {
1230
- var d, f;
1231
- this.activeToolMode = a, (d = this.transformControls) == null || d.setMode(a), (f = c.instance().logger) == null || f.info(`Setting editor tool mode: ${a}`);
1232
- }), this.on("setShadeMode", (a) => {
1233
- this.applyShadeMode(a);
1248
+ [e, t, n, ...a].forEach((r) => i[r.id] = r), c.instance().world.add(i), this.trigger("sceneChanged"), c.instance().input.on("mousedown", (r) => {
1249
+ r.target === c.instance().canvas && this.handleCanvasClick(r);
1250
+ }), c.instance().input.on("keydown", (r) => {
1251
+ r.code === "Escape" && this.activeItem && this.deselect();
1252
+ }), this.handleItemDelete(), this.on("setTransformMode", (r) => {
1253
+ var u, f;
1254
+ this.activeToolMode = r, (u = this.transformControls) == null || u.setMode(r), (f = c.instance().logger) == null || f.info(`Setting editor tool mode: ${r}`);
1255
+ }), this.on("setShadeMode", (r) => {
1256
+ this.applyShadeMode(r);
1234
1257
  }), this.on("assetDropped", () => {
1235
1258
  this.shadeMode !== "solid" && this.applyShadeMode(this.shadeMode);
1236
1259
  }), this.initAssetsFilter();
@@ -1256,10 +1279,10 @@ class Ce extends rt {
1256
1279
  for (; t.parent && t.parent !== c.instance().scene; )
1257
1280
  t = t.parent;
1258
1281
  t.traverse((s) => {
1259
- var r, i;
1260
- s instanceof o && ((r = s.geometry) == null || r.dispose(), Array.isArray(s.material) ? s.material.forEach((a) => a.dispose()) : (i = s.material) == null || i.dispose());
1282
+ var a, i;
1283
+ s instanceof o && ((a = s.geometry) == null || a.dispose(), Array.isArray(s.material) ? s.material.forEach((r) => r.dispose()) : (i = s.material) == null || i.dispose());
1261
1284
  }), this.deselect();
1262
- const n = Ge.from(t);
1285
+ const n = Le.from(t);
1263
1286
  n != null && n.owner ? n.owner.destroy() : (n && (n.dispose(), this.helpers = this.helpers.filter((s) => s !== n)), c.instance().scene.remove(t)), this.trigger("sceneChanged");
1264
1287
  }
1265
1288
  });