aptechka 0.5.44 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Animation-6Na1MCtM.cjs +1 -0
- package/lib/Animation-CELiTw3n.js +132 -0
- package/lib/Composed-DmLYTh1b.js +35 -0
- package/lib/Composed-Dx2hs-va.cjs +1 -0
- package/lib/{Damped-P4MkCGoY.js → Damped-Mx_FNNVz.js} +2 -5
- package/lib/Damped-loFiBsBy.cjs +1 -0
- package/lib/{Derived-kPJs5JC5.js → Derived-DlCvc0xQ.js} +1 -1
- package/lib/{Derived-B-g8dYgh.cjs → Derived-a6MDQEPY.cjs} +1 -1
- package/lib/ElementConstructor-CAZ2ra8m.cjs +1 -0
- package/lib/ElementConstructor-OYlPJf2L.js +366 -0
- package/lib/Resource-D3TQormz.cjs +1 -0
- package/lib/Resource-DIcoALGo.js +64 -0
- package/lib/{SourceManager-Q-PB-Rkh.js → SourceManager-Bz329f90.js} +1 -1
- package/lib/{SourceManager-vSlsMKUE.cjs → SourceManager-kxr5eUyL.cjs} +1 -1
- package/lib/Store-6s0YXK4o.cjs +1 -0
- package/lib/{Store-BQXXikps.js → Store-BI2xxXOA.js} +42 -42
- package/lib/Tweened-B_mclQ61.cjs +1 -0
- package/lib/Tweened-NE8M9onF.js +48 -0
- package/lib/{Viewport-DMB0dO-s.cjs → Viewport-CJeKnL5V.cjs} +1 -1
- package/lib/{Viewport-CFFhFKqX.js → Viewport-D9IL7kUQ.js} +1 -1
- package/lib/_createStore-Cf1MyeHa.cjs +1 -0
- package/lib/_createStore-Ck9bHolX.js +12 -0
- package/lib/accordion/AccordionElement.d.ts +3 -0
- package/lib/accordion/index.cjs +1 -1
- package/lib/accordion/index.js +140 -104
- package/lib/animation/Animation.d.ts +10 -18
- package/lib/animation/Damped.d.ts +3 -5
- package/lib/animation/Tweened.d.ts +0 -2
- package/lib/animation/index.cjs +1 -1
- package/lib/animation/index.js +3 -3
- package/lib/attribute/index.cjs +1 -1
- package/lib/attribute/index.js +31 -31
- package/lib/canvas/index.cjs +1 -1
- package/lib/canvas/index.js +3 -3
- package/lib/checkbox/index.cjs +1 -1
- package/lib/checkbox/index.js +3 -3
- package/lib/class-linked-status/index.cjs +1 -1
- package/lib/class-linked-status/index.js +1 -1
- package/lib/controls/index.cjs +1 -1
- package/lib/controls/index.js +3 -3
- package/lib/counter/index.d.ts +8 -0
- package/lib/{createStylesheet-DBCEbDjI.js → createStylesheet-CR_yi5tp.js} +1 -1
- package/lib/{createStylesheet-CqHU9_qv.cjs → createStylesheet-p23sZ7Ey.cjs} +1 -1
- package/lib/css-property/index.cjs +1 -1
- package/lib/css-property/index.d.ts +1 -0
- package/lib/css-property/index.js +36 -32
- package/lib/dev/index.cjs +1 -1
- package/lib/dev/index.js +1 -1
- package/lib/device/index.cjs +1 -1
- package/lib/device/index.js +1 -1
- package/lib/element-constructor/index.cjs +1 -1
- package/lib/element-constructor/index.js +114 -113
- package/lib/en3/core/En3Raycaster.d.ts +20 -0
- package/lib/en3/core/En3View.d.ts +1 -1
- package/lib/en3/core/en3.d.ts +5 -1
- package/lib/en3/helpers/En3Controls.d.ts +5 -0
- package/lib/en3/helpers/En3GridHelper.d.ts +8 -0
- package/lib/en3/helpers/En3Object3dManager.d.ts +12 -0
- package/lib/en3/helpers/En3OrbitControls.d.ts +8 -0
- package/lib/en3/helpers/En3TransformControls.d.ts +8 -0
- package/lib/en3/helpers/index.cjs +1 -0
- package/lib/en3/helpers/index.d.ts +2 -0
- package/lib/en3/helpers/index.js +1165 -0
- package/lib/en3/index.cjs +1 -213
- package/lib/en3/index.d.ts +1 -19
- package/lib/en3/index.js +4 -3305
- package/lib/en3/libs/index.d.ts +1 -0
- package/lib/en3/loaders/{en3GLTFLoader.d.ts → _En3GLTFLoader.d.ts} +2 -4
- package/lib/en3/loaders/_En3TextureLoader.d.ts +8 -0
- package/lib/en3/loaders/index.cjs +1 -0
- package/lib/en3/loaders/index.d.ts +3 -0
- package/lib/en3/loaders/index.js +1757 -0
- package/lib/en3/loaders/loaders.d.ts +13 -0
- package/lib/en3/misc/index.cjs +10 -0
- package/lib/en3/misc/index.d.ts +2 -0
- package/lib/en3/misc/index.js +115 -0
- package/lib/en3/objects/En3Clip.d.ts +1 -1
- package/lib/en3/objects/En3GLTF.d.ts +2 -1
- package/lib/en3/objects/En3ImageLike.d.ts +2 -1
- package/lib/en3/objects/En3SourceConsumer.d.ts +1 -1
- package/lib/en3/objects/fluid/index.d.ts +0 -3
- package/lib/en3/objects/index.d.ts +7 -0
- package/lib/en3/utils/index.cjs +1 -0
- package/lib/en3/utils/index.d.ts +5 -0
- package/lib/en3/utils/index.js +43 -0
- package/lib/en3-C4mzaF6q.cjs +8 -0
- package/lib/en3-hbkN1OPu.js +343 -0
- package/lib/globals-DMjysUXI.js +8 -0
- package/lib/globals-bYKki-b9.cjs +1 -0
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +1 -1
- package/lib/{index-BN9X-l9M.js → index-BAH_fO2N.js} +3 -3
- package/lib/{index-BbgmbQ-5.cjs → index-D1LQUR-R.cjs} +1 -1
- package/lib/instantiate-D19Uvc31.js +125 -0
- package/lib/instantiate-Db5gGSYG.cjs +1 -0
- package/lib/jsx/ComponentElement.d.ts +18 -0
- package/lib/jsx/globals.d.ts +13 -0
- package/lib/jsx/h.d.ts +7 -0
- package/lib/jsx/hooks/basic/_createStore.d.ts +4 -0
- package/lib/jsx/hooks/basic/attachInternals.d.ts +1 -0
- package/lib/jsx/hooks/basic/attachShadow.d.ts +1 -0
- package/lib/jsx/hooks/basic/attachStylesheet.d.ts +3 -0
- package/lib/jsx/hooks/basic/createContext.d.ts +2 -0
- package/lib/jsx/hooks/basic/onConnect.d.ts +3 -0
- package/lib/jsx/hooks/basic/onDisconnect.d.ts +3 -0
- package/lib/jsx/hooks/onAnimationFrame.cjs +1 -0
- package/lib/jsx/hooks/onAnimationFrame.d.ts +6 -0
- package/lib/jsx/hooks/onAnimationFrame.js +22 -0
- package/lib/jsx/hooks/onElementResize.cjs +1 -0
- package/lib/jsx/hooks/onElementResize.d.ts +5 -0
- package/lib/jsx/hooks/onElementResize.js +11 -0
- package/lib/jsx/hooks/onIntersection.cjs +1 -0
- package/lib/jsx/hooks/onIntersection.d.ts +5 -0
- package/lib/jsx/hooks/onIntersection.js +11 -0
- package/lib/jsx/hooks/onWindowResize.cjs +1 -0
- package/lib/jsx/hooks/onWindowResize.d.ts +3 -0
- package/lib/jsx/hooks/onWindowResize.js +8 -0
- package/lib/jsx/hooks/store/createArrayStore.d.ts +3 -0
- package/lib/jsx/hooks/store/createComposed.d.ts +3 -0
- package/lib/jsx/hooks/store/createDerived.d.ts +3 -0
- package/lib/jsx/hooks/store/createDerivedArray.d.ts +3 -0
- package/lib/jsx/hooks/store/createDerivedComponent.d.ts +3 -0
- package/lib/jsx/hooks/store/createDerivedComponents.d.ts +3 -0
- package/lib/jsx/hooks/store/createResource.d.ts +3 -0
- package/lib/jsx/hooks/store/createStore.d.ts +3 -0
- package/lib/jsx/hooks/store/index.cjs +1 -0
- package/lib/jsx/hooks/store/index.d.ts +7 -0
- package/lib/jsx/hooks/store/index.js +49 -0
- package/lib/jsx/hooks/watchAttribute.cjs +1 -0
- package/lib/jsx/hooks/watchAttribute.d.ts +6 -0
- package/lib/jsx/hooks/watchAttribute.js +17 -0
- package/lib/jsx/hooks/watchCSSProperty.cjs +1 -0
- package/lib/jsx/hooks/watchCSSProperty.d.ts +7 -0
- package/lib/jsx/hooks/watchCSSProperty.js +17 -0
- package/lib/jsx/index.cjs +1 -0
- package/lib/jsx/index.d.ts +13 -0
- package/lib/jsx/index.js +91 -0
- package/lib/jsx/instantiate.d.ts +5 -0
- package/lib/jsx/register.d.ts +1 -0
- package/lib/jsx/render.d.ts +6 -0
- package/lib/jsx/type.d.ts +188 -0
- package/lib/ladder/index.cjs +1 -1
- package/lib/ladder/index.d.ts +2 -0
- package/lib/ladder/index.js +84 -66
- package/lib/layout-box/index.cjs +1 -1
- package/lib/layout-box/index.d.ts +9 -0
- package/lib/layout-box/index.js +190 -164
- package/lib/media/index.cjs +1 -1
- package/lib/media/index.js +1 -1
- package/lib/modal/index.cjs +1 -1
- package/lib/modal/index.js +7 -7
- package/lib/morph/Morph.d.ts +2 -2
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.d.ts +1 -1
- package/lib/morph/index.js +135 -143
- package/lib/notifier/index.d.ts +2 -2
- package/lib/notifier/index.js +3 -1
- package/lib/onConnect-DGP866cj.cjs +1 -0
- package/lib/onConnect-y5DrxJ9P.js +7 -0
- package/lib/pointer/index.cjs +1 -1
- package/lib/pointer/index.js +2 -2
- package/lib/polyfills-CM4SCDTt.cjs +1 -0
- package/lib/polyfills-X6KXuHg-.js +33 -0
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +2 -2
- package/lib/router/Router.d.ts +11 -3
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.d.ts +1 -1
- package/lib/router/index.js +185 -165
- package/lib/scroll/ScrollElement.d.ts +2 -19
- package/lib/scroll/ScrollSection.d.ts +23 -0
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +81 -77
- package/lib/select/index.cjs +1 -1
- package/lib/select/index.js +1 -1
- package/lib/sequence/index.cjs +1 -1
- package/lib/sequence/index.js +1 -1
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +2 -2
- package/lib/store/ArrayStore.d.ts +21 -0
- package/lib/store/Store.d.ts +1 -7
- package/lib/store/index.cjs +1 -1
- package/lib/store/index.d.ts +2 -2
- package/lib/store/index.js +65 -139
- package/lib/tags-BqJKcIve.js +485 -0
- package/lib/tags-ld5jemJw.cjs +1 -0
- package/lib/theme/index.cjs +1 -1
- package/lib/theme/index.js +2 -2
- package/lib/tweaker/TweakerBooleanManagerElement.d.ts +1 -1
- package/lib/tweaker/TweakerColorManagerElement.d.ts +1 -1
- package/lib/tweaker/TweakerFolderElement.d.ts +2 -0
- package/lib/tweaker/TweakerLinkManagerElement.d.ts +1 -1
- package/lib/tweaker/TweakerNumberManagerElement.d.ts +4 -8
- package/lib/tweaker/TweakerSelectManagerElement.d.ts +1 -1
- package/lib/tweaker/TweakerStoreManagerElement.d.ts +7 -7
- package/lib/tweaker/TweakerStringManagerElement.d.ts +3 -5
- package/lib/tweaker/index.cjs +3 -3
- package/lib/tweaker/index.js +535 -412
- package/lib/tweaker/tweakerManagerConstructors.d.ts +2 -2
- package/lib/tweaker/tweakerStorage.d.ts +8 -1
- package/lib/url-C3dWnJQg.cjs +1 -0
- package/lib/url-DMNfW7uN.js +22 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +39 -34
- package/lib/utils/number.d.ts +1 -0
- package/lib/utils/url.d.ts +9 -0
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +1 -1
- package/package.json +107 -3
- package/lib/Animation-DDHjrbtL.cjs +0 -1
- package/lib/Animation-Dq_05jlR.js +0 -217
- package/lib/DRACOLoader-C2CFpMGS.cjs +0 -2
- package/lib/DRACOLoader-D2KY2dku.js +0 -241
- package/lib/Damped-l0mnlhar.cjs +0 -1
- package/lib/KTX2Loader-DdUl1XiY.cjs +0 -2
- package/lib/KTX2Loader-DqpAffDj.js +0 -536
- package/lib/Store-C-1ruEIm.cjs +0 -1
- package/lib/Tweened-CwDC2zl8.js +0 -51
- package/lib/Tweened-DIt9j9B-.cjs +0 -1
- package/lib/animation/AnimationLink.d.ts +0 -13
- package/lib/en3/loaders/en3TextureLoader.d.ts +0 -3
- package/lib/en3/test/En3HTML.d.ts +0 -10
- package/lib/polyfills-BA-CL_HF.js +0 -27
- package/lib/polyfills-DHs2SNbz.cjs +0 -1
- package/lib/store/CumulativeResource.d.ts +0 -13
- package/lib/tags-CMPg9ETZ.js +0 -848
- package/lib/tags-Djb6mb1o.cjs +0 -1
- package/lib/tweaker/TweakerRangeManagerElement.d.ts +0 -11
- /package/lib/en3/{loaders → core}/en3Cache.d.ts +0 -0
- /package/lib/{MeshoptDecoder-CMeN3oU0.cjs → en3/libs/index.cjs} +0 -0
- /package/lib/{MeshoptDecoder-6XfTpOG2.js → en3/libs/index.js} +0 -0
- /package/lib/en3/{test → misc}/En3ModifiedMaterial.d.ts +0 -0
- /package/lib/en3/{attachments → misc}/En3SourceManager.d.ts +0 -0
|
@@ -0,0 +1,1165 @@
|
|
|
1
|
+
var pe = (d, o, a) => {
|
|
2
|
+
if (!o.has(d))
|
|
3
|
+
throw TypeError("Cannot " + a);
|
|
4
|
+
};
|
|
5
|
+
var s = (d, o, a) => (pe(d, o, "read from private field"), a ? a.call(d) : o.get(d)), m = (d, o, a) => {
|
|
6
|
+
if (o.has(d))
|
|
7
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
8
|
+
o instanceof WeakSet ? o.add(d) : o.set(d, a);
|
|
9
|
+
}, S = (d, o, a, t) => (pe(d, o, "write to private field"), t ? t.call(d, a) : o.set(d, a), a);
|
|
10
|
+
var te = (d, o, a) => (pe(d, o, "access private method"), a);
|
|
11
|
+
import { e as L } from "../../en3-hbkN1OPu.js";
|
|
12
|
+
import { S as ot } from "../../Store-BI2xxXOA.js";
|
|
13
|
+
import { Ray as hn, Plane as pn, MathUtils as dn, EventDispatcher as un, Vector3 as p, MOUSE as _t, TOUCH as vt, Quaternion as G, Spherical as je, Vector2 as U, Raycaster as mn, Object3D as fe, Euler as fn, Matrix4 as Fe, MeshBasicMaterial as qe, LineBasicMaterial as yn, CylinderGeometry as z, BoxGeometry as k, BufferGeometry as Oe, Float32BufferAttribute as De, Mesh as c, OctahedronGeometry as ee, Line as at, SphereGeometry as wn, TorusGeometry as kt, PlaneGeometry as bn, DoubleSide as gn, GridHelper as En } from "three";
|
|
14
|
+
import { C as Pn } from "../../Composed-DmLYTh1b.js";
|
|
15
|
+
var F, mt, ft, yt, Ht, Tt, ae;
|
|
16
|
+
class Ge {
|
|
17
|
+
constructor(o, a) {
|
|
18
|
+
m(this, Tt);
|
|
19
|
+
m(this, F, void 0);
|
|
20
|
+
m(this, mt, void 0);
|
|
21
|
+
m(this, ft, void 0);
|
|
22
|
+
m(this, yt, void 0);
|
|
23
|
+
m(this, Ht, !0);
|
|
24
|
+
var n;
|
|
25
|
+
S(this, F, o), s(this, F).userData.controlled = !0;
|
|
26
|
+
const t = (a == null ? void 0 : a.step) || 1e-4, i = o.name || "Unnamed", l = ((n = o.userData) == null ? void 0 : n.box) || o;
|
|
27
|
+
S(this, mt, new ot([l.position.x, l.position.y, l.position.z], {
|
|
28
|
+
passport: {
|
|
29
|
+
name: `${i}.Position`,
|
|
30
|
+
manager: {
|
|
31
|
+
type: "number",
|
|
32
|
+
step: t
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})), S(this, ft, new ot([l.rotation.x, l.rotation.y, l.rotation.z], {
|
|
36
|
+
passport: {
|
|
37
|
+
name: `${i}.Rotation`,
|
|
38
|
+
manager: {
|
|
39
|
+
type: "number",
|
|
40
|
+
step: t,
|
|
41
|
+
ease: 0.01
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})), S(this, yt, new ot([l.scale.x, l.scale.y, l.scale.z], {
|
|
45
|
+
passport: {
|
|
46
|
+
name: `${i}.Scale`,
|
|
47
|
+
manager: {
|
|
48
|
+
type: "number",
|
|
49
|
+
step: t
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
})), this.save(), S(this, Ht, !1), s(this, mt).subscribe((h) => {
|
|
53
|
+
te(this, Tt, ae).call(this, "position", h.current);
|
|
54
|
+
}), s(this, ft).subscribe((h) => {
|
|
55
|
+
te(this, Tt, ae).call(this, "rotation", h.current);
|
|
56
|
+
}), s(this, yt).subscribe((h) => {
|
|
57
|
+
te(this, Tt, ae).call(this, "scale", h.current);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
get object3d() {
|
|
61
|
+
return s(this, F);
|
|
62
|
+
}
|
|
63
|
+
destroy() {
|
|
64
|
+
s(this, mt).close(), s(this, ft).close(), s(this, yt).close(), s(this, F).userData.controlled = !1;
|
|
65
|
+
}
|
|
66
|
+
save() {
|
|
67
|
+
const o = (a, t) => {
|
|
68
|
+
(!s(this, Ht) || a.initial === a.current) && (a.current = [t.x, t.y, t.z]);
|
|
69
|
+
};
|
|
70
|
+
o(s(this, mt), s(this, F).position), o(s(this, ft), s(this, F).rotation), o(s(this, yt), s(this, F).scale);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
F = new WeakMap(), mt = new WeakMap(), ft = new WeakMap(), yt = new WeakMap(), Ht = new WeakMap(), Tt = new WeakSet(), ae = function(o, a) {
|
|
74
|
+
const t = s(this, F).userData.box;
|
|
75
|
+
if (t) {
|
|
76
|
+
const i = (l) => ({
|
|
77
|
+
x: a[0] - l.x,
|
|
78
|
+
y: a[1] - l.y,
|
|
79
|
+
z: a[2] - l.z
|
|
80
|
+
});
|
|
81
|
+
o === "position" ? t.setPositionStep(
|
|
82
|
+
"_manager",
|
|
83
|
+
"+",
|
|
84
|
+
i(t.getIncludedPositionSteps("_manager"))
|
|
85
|
+
) : o === "rotation" ? t.setRotationStep(
|
|
86
|
+
"_manager",
|
|
87
|
+
"+",
|
|
88
|
+
i(t.getIncludedRotationSteps("_manager"))
|
|
89
|
+
) : o === "scale" && t.setScaleStep(
|
|
90
|
+
"_manager",
|
|
91
|
+
"+",
|
|
92
|
+
i(t.getIncludedScaleSteps("_manager"))
|
|
93
|
+
);
|
|
94
|
+
} else
|
|
95
|
+
s(this, F)[o].set(...a);
|
|
96
|
+
};
|
|
97
|
+
const Ye = { type: "change" }, de = { type: "start" }, ke = { type: "end" }, ne = new hn(), Re = new pn(), Mn = Math.cos(70 * dn.DEG2RAD);
|
|
98
|
+
class Sn extends un {
|
|
99
|
+
constructor(o, a) {
|
|
100
|
+
super(), this.object = o, this.domElement = a, this.domElement.style.touchAction = "none", this.enabled = !0, this.target = new p(), this.cursor = new p(), 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.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: _t.ROTATE, MIDDLE: _t.DOLLY, RIGHT: _t.PAN }, this.touches = { ONE: vt.ROTATE, TWO: vt.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this.getPolarAngle = function() {
|
|
101
|
+
return h.phi;
|
|
102
|
+
}, this.getAzimuthalAngle = function() {
|
|
103
|
+
return h.theta;
|
|
104
|
+
}, this.getDistance = function() {
|
|
105
|
+
return this.object.position.distanceTo(this.target);
|
|
106
|
+
}, this.listenToKeyEvents = function(e) {
|
|
107
|
+
e.addEventListener("keydown", he), this._domElementKeyEvents = e;
|
|
108
|
+
}, this.stopListenToKeyEvents = function() {
|
|
109
|
+
this._domElementKeyEvents.removeEventListener("keydown", he), this._domElementKeyEvents = null;
|
|
110
|
+
}, this.saveState = function() {
|
|
111
|
+
t.target0.copy(t.target), t.position0.copy(t.object.position), t.zoom0 = t.object.zoom;
|
|
112
|
+
}, this.reset = function() {
|
|
113
|
+
t.target.copy(t.target0), t.object.position.copy(t.position0), t.object.zoom = t.zoom0, t.object.updateProjectionMatrix(), t.dispatchEvent(Ye), t.update(), l = i.NONE;
|
|
114
|
+
}, this.update = function() {
|
|
115
|
+
const e = new p(), r = new G().setFromUnitVectors(o.up, new p(0, 1, 0)), u = r.clone().invert(), y = new p(), Y = new G(), st = new p(), Q = 2 * Math.PI;
|
|
116
|
+
return function(cn = null) {
|
|
117
|
+
const Ae = t.object.position;
|
|
118
|
+
e.copy(Ae).sub(t.target), e.applyQuaternion(r), h.setFromVector3(e), t.autoRotate && l === i.NONE && ht(le(cn)), t.enableDamping ? (h.theta += b.theta * t.dampingFactor, h.phi += b.phi * t.dampingFactor) : (h.theta += b.theta, h.phi += b.phi);
|
|
119
|
+
let tt = t.minAzimuthAngle, et = t.maxAzimuthAngle;
|
|
120
|
+
isFinite(tt) && isFinite(et) && (tt < -Math.PI ? tt += Q : tt > Math.PI && (tt -= Q), et < -Math.PI ? et += Q : et > Math.PI && (et -= Q), tt <= et ? h.theta = Math.max(tt, Math.min(et, h.theta)) : h.theta = h.theta > (tt + et) / 2 ? Math.max(tt, h.theta) : Math.min(et, h.theta)), h.phi = Math.max(t.minPolarAngle, Math.min(t.maxPolarAngle, h.phi)), h.makeSafe(), t.enableDamping === !0 ? t.target.addScaledVector(C, t.dampingFactor) : t.target.add(C), t.target.sub(t.cursor), t.target.clampLength(t.minTargetRadius, t.maxTargetRadius), t.target.add(t.cursor);
|
|
121
|
+
let Dt = !1;
|
|
122
|
+
if (t.zoomToCursor && Et || t.object.isOrthographicCamera)
|
|
123
|
+
h.radius = it(h.radius);
|
|
124
|
+
else {
|
|
125
|
+
const nt = h.radius;
|
|
126
|
+
h.radius = it(h.radius * j), Dt = nt != h.radius;
|
|
127
|
+
}
|
|
128
|
+
if (e.setFromSpherical(h), e.applyQuaternion(u), Ae.copy(t.target).add(e), t.object.lookAt(t.target), t.enableDamping === !0 ? (b.theta *= 1 - t.dampingFactor, b.phi *= 1 - t.dampingFactor, C.multiplyScalar(1 - t.dampingFactor)) : (b.set(0, 0, 0), C.set(0, 0, 0)), t.zoomToCursor && Et) {
|
|
129
|
+
let nt = null;
|
|
130
|
+
if (t.object.isPerspectiveCamera) {
|
|
131
|
+
const Yt = e.length();
|
|
132
|
+
nt = it(Yt * j);
|
|
133
|
+
const Jt = Yt - nt;
|
|
134
|
+
t.object.position.addScaledVector($, Jt), t.object.updateMatrixWorld(), Dt = !!Jt;
|
|
135
|
+
} else if (t.object.isOrthographicCamera) {
|
|
136
|
+
const Yt = new p(I.x, I.y, 0);
|
|
137
|
+
Yt.unproject(t.object);
|
|
138
|
+
const Jt = t.object.zoom;
|
|
139
|
+
t.object.zoom = Math.max(t.minZoom, Math.min(t.maxZoom, t.object.zoom / j)), t.object.updateProjectionMatrix(), Dt = Jt !== t.object.zoom;
|
|
140
|
+
const Le = new p(I.x, I.y, 0);
|
|
141
|
+
Le.unproject(t.object), t.object.position.sub(Le).add(Yt), t.object.updateMatrixWorld(), nt = e.length();
|
|
142
|
+
} else
|
|
143
|
+
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), t.zoomToCursor = !1;
|
|
144
|
+
nt !== null && (this.screenSpacePanning ? t.target.set(0, 0, -1).transformDirection(t.object.matrix).multiplyScalar(nt).add(t.object.position) : (ne.origin.copy(t.object.position), ne.direction.set(0, 0, -1).transformDirection(t.object.matrix), Math.abs(t.object.up.dot(ne.direction)) < Mn ? o.lookAt(t.target) : (Re.setFromNormalAndCoplanarPoint(t.object.up, t.target), ne.intersectPlane(Re, t.target))));
|
|
145
|
+
} else if (t.object.isOrthographicCamera) {
|
|
146
|
+
const nt = t.object.zoom;
|
|
147
|
+
t.object.zoom = Math.max(t.minZoom, Math.min(t.maxZoom, t.object.zoom / j)), nt !== t.object.zoom && (t.object.updateProjectionMatrix(), Dt = !0);
|
|
148
|
+
}
|
|
149
|
+
return j = 1, Et = !1, Dt || y.distanceToSquared(t.object.position) > n || 8 * (1 - Y.dot(t.object.quaternion)) > n || st.distanceToSquared(t.target) > n ? (t.dispatchEvent(Ye), y.copy(t.object.position), Y.copy(t.object.quaternion), st.copy(t.target), !0) : !1;
|
|
150
|
+
};
|
|
151
|
+
}(), this.dispose = function() {
|
|
152
|
+
t.domElement.removeEventListener("contextmenu", Te), t.domElement.removeEventListener("pointerdown", Me), t.domElement.removeEventListener("pointercancel", Ot), t.domElement.removeEventListener("wheel", Se), t.domElement.removeEventListener("pointermove", ce), t.domElement.removeEventListener("pointerup", Ot), t.domElement.getRootNode().removeEventListener("keydown", xe, { capture: !0 }), t._domElementKeyEvents !== null && (t._domElementKeyEvents.removeEventListener("keydown", he), t._domElementKeyEvents = null);
|
|
153
|
+
};
|
|
154
|
+
const t = this, i = {
|
|
155
|
+
NONE: -1,
|
|
156
|
+
ROTATE: 0,
|
|
157
|
+
DOLLY: 1,
|
|
158
|
+
PAN: 2,
|
|
159
|
+
TOUCH_ROTATE: 3,
|
|
160
|
+
TOUCH_PAN: 4,
|
|
161
|
+
TOUCH_DOLLY_PAN: 5,
|
|
162
|
+
TOUCH_DOLLY_ROTATE: 6
|
|
163
|
+
};
|
|
164
|
+
let l = i.NONE;
|
|
165
|
+
const n = 1e-6, h = new je(), b = new je();
|
|
166
|
+
let j = 1;
|
|
167
|
+
const C = new p(), X = new U(), H = new U(), V = new U(), Z = new U(), x = new U(), T = new U(), _ = new U(), g = new U(), E = new U(), $ = new p(), I = new U();
|
|
168
|
+
let Et = !1;
|
|
169
|
+
const P = [], ct = {};
|
|
170
|
+
let jt = !1;
|
|
171
|
+
function le(e) {
|
|
172
|
+
return e !== null ? 2 * Math.PI / 60 * t.autoRotateSpeed * e : 2 * Math.PI / 60 / 60 * t.autoRotateSpeed;
|
|
173
|
+
}
|
|
174
|
+
function Pt(e) {
|
|
175
|
+
const r = Math.abs(e * 0.01);
|
|
176
|
+
return Math.pow(0.95, t.zoomSpeed * r);
|
|
177
|
+
}
|
|
178
|
+
function ht(e) {
|
|
179
|
+
b.theta -= e;
|
|
180
|
+
}
|
|
181
|
+
function Mt(e) {
|
|
182
|
+
b.phi -= e;
|
|
183
|
+
}
|
|
184
|
+
const N = function() {
|
|
185
|
+
const e = new p();
|
|
186
|
+
return function(u, y) {
|
|
187
|
+
e.setFromMatrixColumn(y, 0), e.multiplyScalar(-u), C.add(e);
|
|
188
|
+
};
|
|
189
|
+
}(), O = function() {
|
|
190
|
+
const e = new p();
|
|
191
|
+
return function(u, y) {
|
|
192
|
+
t.screenSpacePanning === !0 ? e.setFromMatrixColumn(y, 1) : (e.setFromMatrixColumn(y, 0), e.crossVectors(t.object.up, e)), e.multiplyScalar(u), C.add(e);
|
|
193
|
+
};
|
|
194
|
+
}(), W = function() {
|
|
195
|
+
const e = new p();
|
|
196
|
+
return function(u, y) {
|
|
197
|
+
const Y = t.domElement;
|
|
198
|
+
if (t.object.isPerspectiveCamera) {
|
|
199
|
+
const st = t.object.position;
|
|
200
|
+
e.copy(st).sub(t.target);
|
|
201
|
+
let Q = e.length();
|
|
202
|
+
Q *= Math.tan(t.object.fov / 2 * Math.PI / 180), N(2 * u * Q / Y.clientHeight, t.object.matrix), O(2 * y * Q / Y.clientHeight, t.object.matrix);
|
|
203
|
+
} else
|
|
204
|
+
t.object.isOrthographicCamera ? (N(u * (t.object.right - t.object.left) / t.object.zoom / Y.clientWidth, t.object.matrix), O(y * (t.object.top - t.object.bottom) / t.object.zoom / Y.clientHeight, t.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), t.enablePan = !1);
|
|
205
|
+
};
|
|
206
|
+
}();
|
|
207
|
+
function D(e) {
|
|
208
|
+
t.object.isPerspectiveCamera || t.object.isOrthographicCamera ? j /= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), t.enableZoom = !1);
|
|
209
|
+
}
|
|
210
|
+
function J(e) {
|
|
211
|
+
t.object.isPerspectiveCamera || t.object.isOrthographicCamera ? j *= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), t.enableZoom = !1);
|
|
212
|
+
}
|
|
213
|
+
function M(e, r) {
|
|
214
|
+
if (!t.zoomToCursor)
|
|
215
|
+
return;
|
|
216
|
+
Et = !0;
|
|
217
|
+
const u = t.domElement.getBoundingClientRect(), y = e - u.left, Y = r - u.top, st = u.width, Q = u.height;
|
|
218
|
+
I.x = y / st * 2 - 1, I.y = -(Y / Q) * 2 + 1, $.set(I.x, I.y, 1).unproject(t.object).sub(t.object.position).normalize();
|
|
219
|
+
}
|
|
220
|
+
function it(e) {
|
|
221
|
+
return Math.max(t.minDistance, Math.min(t.maxDistance, e));
|
|
222
|
+
}
|
|
223
|
+
function pt(e) {
|
|
224
|
+
X.set(e.clientX, e.clientY);
|
|
225
|
+
}
|
|
226
|
+
function St(e) {
|
|
227
|
+
M(e.clientX, e.clientX), _.set(e.clientX, e.clientY);
|
|
228
|
+
}
|
|
229
|
+
function Vt(e) {
|
|
230
|
+
Z.set(e.clientX, e.clientY);
|
|
231
|
+
}
|
|
232
|
+
function $t(e) {
|
|
233
|
+
H.set(e.clientX, e.clientY), V.subVectors(H, X).multiplyScalar(t.rotateSpeed);
|
|
234
|
+
const r = t.domElement;
|
|
235
|
+
ht(2 * Math.PI * V.x / r.clientHeight), Mt(2 * Math.PI * V.y / r.clientHeight), X.copy(H), t.update();
|
|
236
|
+
}
|
|
237
|
+
function We(e) {
|
|
238
|
+
g.set(e.clientX, e.clientY), E.subVectors(g, _), E.y > 0 ? D(Pt(E.y)) : E.y < 0 && J(Pt(E.y)), _.copy(g), t.update();
|
|
239
|
+
}
|
|
240
|
+
function Ue(e) {
|
|
241
|
+
x.set(e.clientX, e.clientY), T.subVectors(x, Z).multiplyScalar(t.panSpeed), W(T.x, T.y), Z.copy(x), t.update();
|
|
242
|
+
}
|
|
243
|
+
function Ke(e) {
|
|
244
|
+
M(e.clientX, e.clientY), e.deltaY < 0 ? J(Pt(e.deltaY)) : e.deltaY > 0 && D(Pt(e.deltaY)), t.update();
|
|
245
|
+
}
|
|
246
|
+
function Be(e) {
|
|
247
|
+
let r = !1;
|
|
248
|
+
switch (e.code) {
|
|
249
|
+
case t.keys.UP:
|
|
250
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? Mt(2 * Math.PI * t.rotateSpeed / t.domElement.clientHeight) : W(0, t.keyPanSpeed), r = !0;
|
|
251
|
+
break;
|
|
252
|
+
case t.keys.BOTTOM:
|
|
253
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? Mt(-2 * Math.PI * t.rotateSpeed / t.domElement.clientHeight) : W(0, -t.keyPanSpeed), r = !0;
|
|
254
|
+
break;
|
|
255
|
+
case t.keys.LEFT:
|
|
256
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? ht(2 * Math.PI * t.rotateSpeed / t.domElement.clientHeight) : W(t.keyPanSpeed, 0), r = !0;
|
|
257
|
+
break;
|
|
258
|
+
case t.keys.RIGHT:
|
|
259
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? ht(-2 * Math.PI * t.rotateSpeed / t.domElement.clientHeight) : W(-t.keyPanSpeed, 0), r = !0;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
r && (e.preventDefault(), t.update());
|
|
263
|
+
}
|
|
264
|
+
function ye(e) {
|
|
265
|
+
if (P.length === 1)
|
|
266
|
+
X.set(e.pageX, e.pageY);
|
|
267
|
+
else {
|
|
268
|
+
const r = xt(e), u = 0.5 * (e.pageX + r.x), y = 0.5 * (e.pageY + r.y);
|
|
269
|
+
X.set(u, y);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function we(e) {
|
|
273
|
+
if (P.length === 1)
|
|
274
|
+
Z.set(e.pageX, e.pageY);
|
|
275
|
+
else {
|
|
276
|
+
const r = xt(e), u = 0.5 * (e.pageX + r.x), y = 0.5 * (e.pageY + r.y);
|
|
277
|
+
Z.set(u, y);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function be(e) {
|
|
281
|
+
const r = xt(e), u = e.pageX - r.x, y = e.pageY - r.y, Y = Math.sqrt(u * u + y * y);
|
|
282
|
+
_.set(0, Y);
|
|
283
|
+
}
|
|
284
|
+
function Ve(e) {
|
|
285
|
+
t.enableZoom && be(e), t.enablePan && we(e);
|
|
286
|
+
}
|
|
287
|
+
function $e(e) {
|
|
288
|
+
t.enableZoom && be(e), t.enableRotate && ye(e);
|
|
289
|
+
}
|
|
290
|
+
function ge(e) {
|
|
291
|
+
if (P.length == 1)
|
|
292
|
+
H.set(e.pageX, e.pageY);
|
|
293
|
+
else {
|
|
294
|
+
const u = xt(e), y = 0.5 * (e.pageX + u.x), Y = 0.5 * (e.pageY + u.y);
|
|
295
|
+
H.set(y, Y);
|
|
296
|
+
}
|
|
297
|
+
V.subVectors(H, X).multiplyScalar(t.rotateSpeed);
|
|
298
|
+
const r = t.domElement;
|
|
299
|
+
ht(2 * Math.PI * V.x / r.clientHeight), Mt(2 * Math.PI * V.y / r.clientHeight), X.copy(H);
|
|
300
|
+
}
|
|
301
|
+
function Ee(e) {
|
|
302
|
+
if (P.length === 1)
|
|
303
|
+
x.set(e.pageX, e.pageY);
|
|
304
|
+
else {
|
|
305
|
+
const r = xt(e), u = 0.5 * (e.pageX + r.x), y = 0.5 * (e.pageY + r.y);
|
|
306
|
+
x.set(u, y);
|
|
307
|
+
}
|
|
308
|
+
T.subVectors(x, Z).multiplyScalar(t.panSpeed), W(T.x, T.y), Z.copy(x);
|
|
309
|
+
}
|
|
310
|
+
function Pe(e) {
|
|
311
|
+
const r = xt(e), u = e.pageX - r.x, y = e.pageY - r.y, Y = Math.sqrt(u * u + y * y);
|
|
312
|
+
g.set(0, Y), E.set(0, Math.pow(g.y / _.y, t.zoomSpeed)), D(E.y), _.copy(g);
|
|
313
|
+
const st = (e.pageX + r.x) * 0.5, Q = (e.pageY + r.y) * 0.5;
|
|
314
|
+
M(st, Q);
|
|
315
|
+
}
|
|
316
|
+
function Je(e) {
|
|
317
|
+
t.enableZoom && Pe(e), t.enablePan && Ee(e);
|
|
318
|
+
}
|
|
319
|
+
function tn(e) {
|
|
320
|
+
t.enableZoom && Pe(e), t.enableRotate && ge(e);
|
|
321
|
+
}
|
|
322
|
+
function Me(e) {
|
|
323
|
+
t.enabled !== !1 && (P.length === 0 && (t.domElement.setPointerCapture(e.pointerId), t.domElement.addEventListener("pointermove", ce), t.domElement.addEventListener("pointerup", Ot)), !ln(e) && (an(e), e.pointerType === "touch" ? ve(e) : en(e)));
|
|
324
|
+
}
|
|
325
|
+
function ce(e) {
|
|
326
|
+
t.enabled !== !1 && (e.pointerType === "touch" ? sn(e) : nn(e));
|
|
327
|
+
}
|
|
328
|
+
function Ot(e) {
|
|
329
|
+
switch (rn(e), P.length) {
|
|
330
|
+
case 0:
|
|
331
|
+
t.domElement.releasePointerCapture(e.pointerId), t.domElement.removeEventListener("pointermove", ce), t.domElement.removeEventListener("pointerup", Ot), t.dispatchEvent(ke), l = i.NONE;
|
|
332
|
+
break;
|
|
333
|
+
case 1:
|
|
334
|
+
const r = P[0], u = ct[r];
|
|
335
|
+
ve({ pointerId: r, pageX: u.x, pageY: u.y });
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function en(e) {
|
|
340
|
+
let r;
|
|
341
|
+
switch (e.button) {
|
|
342
|
+
case 0:
|
|
343
|
+
r = t.mouseButtons.LEFT;
|
|
344
|
+
break;
|
|
345
|
+
case 1:
|
|
346
|
+
r = t.mouseButtons.MIDDLE;
|
|
347
|
+
break;
|
|
348
|
+
case 2:
|
|
349
|
+
r = t.mouseButtons.RIGHT;
|
|
350
|
+
break;
|
|
351
|
+
default:
|
|
352
|
+
r = -1;
|
|
353
|
+
}
|
|
354
|
+
switch (r) {
|
|
355
|
+
case _t.DOLLY:
|
|
356
|
+
if (t.enableZoom === !1)
|
|
357
|
+
return;
|
|
358
|
+
St(e), l = i.DOLLY;
|
|
359
|
+
break;
|
|
360
|
+
case _t.ROTATE:
|
|
361
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
362
|
+
if (t.enablePan === !1)
|
|
363
|
+
return;
|
|
364
|
+
Vt(e), l = i.PAN;
|
|
365
|
+
} else {
|
|
366
|
+
if (t.enableRotate === !1)
|
|
367
|
+
return;
|
|
368
|
+
pt(e), l = i.ROTATE;
|
|
369
|
+
}
|
|
370
|
+
break;
|
|
371
|
+
case _t.PAN:
|
|
372
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
373
|
+
if (t.enableRotate === !1)
|
|
374
|
+
return;
|
|
375
|
+
pt(e), l = i.ROTATE;
|
|
376
|
+
} else {
|
|
377
|
+
if (t.enablePan === !1)
|
|
378
|
+
return;
|
|
379
|
+
Vt(e), l = i.PAN;
|
|
380
|
+
}
|
|
381
|
+
break;
|
|
382
|
+
default:
|
|
383
|
+
l = i.NONE;
|
|
384
|
+
}
|
|
385
|
+
l !== i.NONE && t.dispatchEvent(de);
|
|
386
|
+
}
|
|
387
|
+
function nn(e) {
|
|
388
|
+
switch (l) {
|
|
389
|
+
case i.ROTATE:
|
|
390
|
+
if (t.enableRotate === !1)
|
|
391
|
+
return;
|
|
392
|
+
$t(e);
|
|
393
|
+
break;
|
|
394
|
+
case i.DOLLY:
|
|
395
|
+
if (t.enableZoom === !1)
|
|
396
|
+
return;
|
|
397
|
+
We(e);
|
|
398
|
+
break;
|
|
399
|
+
case i.PAN:
|
|
400
|
+
if (t.enablePan === !1)
|
|
401
|
+
return;
|
|
402
|
+
Ue(e);
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function Se(e) {
|
|
407
|
+
t.enabled === !1 || t.enableZoom === !1 || l !== i.NONE || (e.preventDefault(), t.dispatchEvent(de), Ke(on(e)), t.dispatchEvent(ke));
|
|
408
|
+
}
|
|
409
|
+
function on(e) {
|
|
410
|
+
const r = e.deltaMode, u = {
|
|
411
|
+
clientX: e.clientX,
|
|
412
|
+
clientY: e.clientY,
|
|
413
|
+
deltaY: e.deltaY
|
|
414
|
+
};
|
|
415
|
+
switch (r) {
|
|
416
|
+
case 1:
|
|
417
|
+
u.deltaY *= 16;
|
|
418
|
+
break;
|
|
419
|
+
case 2:
|
|
420
|
+
u.deltaY *= 100;
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
return e.ctrlKey && !jt && (u.deltaY *= 10), u;
|
|
424
|
+
}
|
|
425
|
+
function xe(e) {
|
|
426
|
+
e.key === "Control" && (jt = !0, t.domElement.getRootNode().addEventListener("keyup", _e, { passive: !0, capture: !0 }));
|
|
427
|
+
}
|
|
428
|
+
function _e(e) {
|
|
429
|
+
e.key === "Control" && (jt = !1, t.domElement.getRootNode().removeEventListener("keyup", _e, { passive: !0, capture: !0 }));
|
|
430
|
+
}
|
|
431
|
+
function he(e) {
|
|
432
|
+
t.enabled === !1 || t.enablePan === !1 || Be(e);
|
|
433
|
+
}
|
|
434
|
+
function ve(e) {
|
|
435
|
+
switch (Ie(e), P.length) {
|
|
436
|
+
case 1:
|
|
437
|
+
switch (t.touches.ONE) {
|
|
438
|
+
case vt.ROTATE:
|
|
439
|
+
if (t.enableRotate === !1)
|
|
440
|
+
return;
|
|
441
|
+
ye(e), l = i.TOUCH_ROTATE;
|
|
442
|
+
break;
|
|
443
|
+
case vt.PAN:
|
|
444
|
+
if (t.enablePan === !1)
|
|
445
|
+
return;
|
|
446
|
+
we(e), l = i.TOUCH_PAN;
|
|
447
|
+
break;
|
|
448
|
+
default:
|
|
449
|
+
l = i.NONE;
|
|
450
|
+
}
|
|
451
|
+
break;
|
|
452
|
+
case 2:
|
|
453
|
+
switch (t.touches.TWO) {
|
|
454
|
+
case vt.DOLLY_PAN:
|
|
455
|
+
if (t.enableZoom === !1 && t.enablePan === !1)
|
|
456
|
+
return;
|
|
457
|
+
Ve(e), l = i.TOUCH_DOLLY_PAN;
|
|
458
|
+
break;
|
|
459
|
+
case vt.DOLLY_ROTATE:
|
|
460
|
+
if (t.enableZoom === !1 && t.enableRotate === !1)
|
|
461
|
+
return;
|
|
462
|
+
$e(e), l = i.TOUCH_DOLLY_ROTATE;
|
|
463
|
+
break;
|
|
464
|
+
default:
|
|
465
|
+
l = i.NONE;
|
|
466
|
+
}
|
|
467
|
+
break;
|
|
468
|
+
default:
|
|
469
|
+
l = i.NONE;
|
|
470
|
+
}
|
|
471
|
+
l !== i.NONE && t.dispatchEvent(de);
|
|
472
|
+
}
|
|
473
|
+
function sn(e) {
|
|
474
|
+
switch (Ie(e), l) {
|
|
475
|
+
case i.TOUCH_ROTATE:
|
|
476
|
+
if (t.enableRotate === !1)
|
|
477
|
+
return;
|
|
478
|
+
ge(e), t.update();
|
|
479
|
+
break;
|
|
480
|
+
case i.TOUCH_PAN:
|
|
481
|
+
if (t.enablePan === !1)
|
|
482
|
+
return;
|
|
483
|
+
Ee(e), t.update();
|
|
484
|
+
break;
|
|
485
|
+
case i.TOUCH_DOLLY_PAN:
|
|
486
|
+
if (t.enableZoom === !1 && t.enablePan === !1)
|
|
487
|
+
return;
|
|
488
|
+
Je(e), t.update();
|
|
489
|
+
break;
|
|
490
|
+
case i.TOUCH_DOLLY_ROTATE:
|
|
491
|
+
if (t.enableZoom === !1 && t.enableRotate === !1)
|
|
492
|
+
return;
|
|
493
|
+
tn(e), t.update();
|
|
494
|
+
break;
|
|
495
|
+
default:
|
|
496
|
+
l = i.NONE;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
function Te(e) {
|
|
500
|
+
t.enabled !== !1 && e.preventDefault();
|
|
501
|
+
}
|
|
502
|
+
function an(e) {
|
|
503
|
+
P.push(e.pointerId);
|
|
504
|
+
}
|
|
505
|
+
function rn(e) {
|
|
506
|
+
delete ct[e.pointerId];
|
|
507
|
+
for (let r = 0; r < P.length; r++)
|
|
508
|
+
if (P[r] == e.pointerId) {
|
|
509
|
+
P.splice(r, 1);
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
function ln(e) {
|
|
514
|
+
for (let r = 0; r < P.length; r++)
|
|
515
|
+
if (P[r] == e.pointerId)
|
|
516
|
+
return !0;
|
|
517
|
+
return !1;
|
|
518
|
+
}
|
|
519
|
+
function Ie(e) {
|
|
520
|
+
let r = ct[e.pointerId];
|
|
521
|
+
r === void 0 && (r = new U(), ct[e.pointerId] = r), r.set(e.pageX, e.pageY);
|
|
522
|
+
}
|
|
523
|
+
function xt(e) {
|
|
524
|
+
const r = e.pointerId === P[0] ? P[1] : P[0];
|
|
525
|
+
return ct[r];
|
|
526
|
+
}
|
|
527
|
+
t.domElement.addEventListener("contextmenu", Te), t.domElement.addEventListener("pointerdown", Me), t.domElement.addEventListener("pointercancel", Ot), t.domElement.addEventListener("wheel", Se, { passive: !1 }), t.domElement.getRootNode().addEventListener("keydown", xe, { passive: !0, capture: !0 }), this.update();
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
const dt = new mn(), A = new p(), rt = new p(), w = new G(), ze = {
|
|
531
|
+
X: new p(1, 0, 0),
|
|
532
|
+
Y: new p(0, 1, 0),
|
|
533
|
+
Z: new p(0, 0, 1)
|
|
534
|
+
}, ue = { type: "change" }, Ce = { type: "mouseDown", mode: null }, Xe = { type: "mouseUp", mode: null }, He = { type: "objectChange" };
|
|
535
|
+
class xn extends fe {
|
|
536
|
+
constructor(o, a) {
|
|
537
|
+
super(), a === void 0 && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'), a = document), this.isTransformControls = !0, this.visible = !1, this.domElement = a, this.domElement.style.touchAction = "none";
|
|
538
|
+
const t = new Ln();
|
|
539
|
+
this._gizmo = t, this.add(t);
|
|
540
|
+
const i = new jn();
|
|
541
|
+
this._plane = i, this.add(i);
|
|
542
|
+
const l = this;
|
|
543
|
+
function n(g, E) {
|
|
544
|
+
let $ = E;
|
|
545
|
+
Object.defineProperty(l, g, {
|
|
546
|
+
get: function() {
|
|
547
|
+
return $ !== void 0 ? $ : E;
|
|
548
|
+
},
|
|
549
|
+
set: function(I) {
|
|
550
|
+
$ !== I && ($ = I, i[g] = I, t[g] = I, l.dispatchEvent({ type: g + "-changed", value: I }), l.dispatchEvent(ue));
|
|
551
|
+
}
|
|
552
|
+
}), l[g] = E, i[g] = E, t[g] = E;
|
|
553
|
+
}
|
|
554
|
+
n("camera", o), n("object", void 0), n("enabled", !0), n("axis", null), n("mode", "translate"), n("translationSnap", null), n("rotationSnap", null), n("scaleSnap", null), n("space", "world"), n("size", 1), n("dragging", !1), n("showX", !0), n("showY", !0), n("showZ", !0);
|
|
555
|
+
const h = new p(), b = new p(), j = new G(), C = new G(), X = new p(), H = new G(), V = new p(), Z = new p(), x = new p(), T = 0, _ = new p();
|
|
556
|
+
n("worldPosition", h), n("worldPositionStart", b), n("worldQuaternion", j), n("worldQuaternionStart", C), n("cameraPosition", X), n("cameraQuaternion", H), n("pointStart", V), n("pointEnd", Z), n("rotationAxis", x), n("rotationAngle", T), n("eye", _), this._offset = new p(), this._startNorm = new p(), this._endNorm = new p(), this._cameraScale = new p(), this._parentPosition = new p(), this._parentQuaternion = new G(), this._parentQuaternionInv = new G(), this._parentScale = new p(), this._worldScaleStart = new p(), this._worldQuaternionInv = new G(), this._worldScale = new p(), this._positionStart = new p(), this._quaternionStart = new G(), this._scaleStart = new p(), this._getPointer = _n.bind(this), this._onPointerDown = Tn.bind(this), this._onPointerHover = vn.bind(this), this._onPointerMove = In.bind(this), this._onPointerUp = An.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
|
|
557
|
+
}
|
|
558
|
+
// updateMatrixWorld updates key transformation variables
|
|
559
|
+
updateMatrixWorld(o) {
|
|
560
|
+
this.object !== void 0 && (this.object.updateMatrixWorld(), this.object.parent === null ? console.error("TransformControls: The attached 3D object must be a part of the scene graph.") : this.object.parent.matrixWorld.decompose(this._parentPosition, this._parentQuaternion, this._parentScale), this.object.matrixWorld.decompose(this.worldPosition, this.worldQuaternion, this._worldScale), this._parentQuaternionInv.copy(this._parentQuaternion).invert(), this._worldQuaternionInv.copy(this.worldQuaternion).invert()), this.camera.updateMatrixWorld(), this.camera.matrixWorld.decompose(this.cameraPosition, this.cameraQuaternion, this._cameraScale), this.camera.isOrthographicCamera ? this.camera.getWorldDirection(this.eye).negate() : this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(), super.updateMatrixWorld(o);
|
|
561
|
+
}
|
|
562
|
+
pointerHover(o) {
|
|
563
|
+
if (this.object === void 0 || this.dragging === !0)
|
|
564
|
+
return;
|
|
565
|
+
o !== null && dt.setFromCamera(o, this.camera);
|
|
566
|
+
const a = me(this._gizmo.picker[this.mode], dt);
|
|
567
|
+
a ? this.axis = a.object.name : this.axis = null;
|
|
568
|
+
}
|
|
569
|
+
pointerDown(o) {
|
|
570
|
+
if (!(this.object === void 0 || this.dragging === !0 || o != null && o.button !== 0) && this.axis !== null) {
|
|
571
|
+
o !== null && dt.setFromCamera(o, this.camera);
|
|
572
|
+
const a = me(this._plane, dt, !0);
|
|
573
|
+
a && (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(a.point).sub(this.worldPositionStart)), this.dragging = !0, Ce.mode = this.mode, this.dispatchEvent(Ce);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
pointerMove(o) {
|
|
577
|
+
const a = this.axis, t = this.mode, i = this.object;
|
|
578
|
+
let l = this.space;
|
|
579
|
+
if (t === "scale" ? l = "local" : (a === "E" || a === "XYZE" || a === "XYZ") && (l = "world"), i === void 0 || a === null || this.dragging === !1 || o !== null && o.button !== -1)
|
|
580
|
+
return;
|
|
581
|
+
o !== null && dt.setFromCamera(o, this.camera);
|
|
582
|
+
const n = me(this._plane, dt, !0);
|
|
583
|
+
if (n) {
|
|
584
|
+
if (this.pointEnd.copy(n.point).sub(this.worldPositionStart), t === "translate")
|
|
585
|
+
this._offset.copy(this.pointEnd).sub(this.pointStart), l === "local" && a !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), a.indexOf("X") === -1 && (this._offset.x = 0), a.indexOf("Y") === -1 && (this._offset.y = 0), a.indexOf("Z") === -1 && (this._offset.z = 0), l === "local" && a !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), i.position.copy(this._offset).add(this._positionStart), this.translationSnap && (l === "local" && (i.position.applyQuaternion(w.copy(this._quaternionStart).invert()), a.search("X") !== -1 && (i.position.x = Math.round(i.position.x / this.translationSnap) * this.translationSnap), a.search("Y") !== -1 && (i.position.y = Math.round(i.position.y / this.translationSnap) * this.translationSnap), a.search("Z") !== -1 && (i.position.z = Math.round(i.position.z / this.translationSnap) * this.translationSnap), i.position.applyQuaternion(this._quaternionStart)), l === "world" && (i.parent && i.position.add(A.setFromMatrixPosition(i.parent.matrixWorld)), a.search("X") !== -1 && (i.position.x = Math.round(i.position.x / this.translationSnap) * this.translationSnap), a.search("Y") !== -1 && (i.position.y = Math.round(i.position.y / this.translationSnap) * this.translationSnap), a.search("Z") !== -1 && (i.position.z = Math.round(i.position.z / this.translationSnap) * this.translationSnap), i.parent && i.position.sub(A.setFromMatrixPosition(i.parent.matrixWorld))));
|
|
586
|
+
else if (t === "scale") {
|
|
587
|
+
if (a.search("XYZ") !== -1) {
|
|
588
|
+
let h = this.pointEnd.length() / this.pointStart.length();
|
|
589
|
+
this.pointEnd.dot(this.pointStart) < 0 && (h *= -1), rt.set(h, h, h);
|
|
590
|
+
} else
|
|
591
|
+
A.copy(this.pointStart), rt.copy(this.pointEnd), A.applyQuaternion(this._worldQuaternionInv), rt.applyQuaternion(this._worldQuaternionInv), rt.divide(A), a.search("X") === -1 && (rt.x = 1), a.search("Y") === -1 && (rt.y = 1), a.search("Z") === -1 && (rt.z = 1);
|
|
592
|
+
i.scale.copy(this._scaleStart).multiply(rt), this.scaleSnap && (a.search("X") !== -1 && (i.scale.x = Math.round(i.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), a.search("Y") !== -1 && (i.scale.y = Math.round(i.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), a.search("Z") !== -1 && (i.scale.z = Math.round(i.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
|
|
593
|
+
} else if (t === "rotate") {
|
|
594
|
+
this._offset.copy(this.pointEnd).sub(this.pointStart);
|
|
595
|
+
const h = 20 / this.worldPosition.distanceTo(A.setFromMatrixPosition(this.camera.matrixWorld));
|
|
596
|
+
let b = !1;
|
|
597
|
+
a === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(A.copy(this.rotationAxis).cross(this.eye)) * h) : (a === "X" || a === "Y" || a === "Z") && (this.rotationAxis.copy(ze[a]), A.copy(ze[a]), l === "local" && A.applyQuaternion(this.worldQuaternion), A.cross(this.eye), A.length() === 0 ? b = !0 : this.rotationAngle = this._offset.dot(A.normalize()) * h), (a === "E" || b) && (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), l === "local" && a !== "E" && a !== "XYZE" ? (i.quaternion.copy(this._quaternionStart), i.quaternion.multiply(w.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), i.quaternion.copy(w.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), i.quaternion.multiply(this._quaternionStart).normalize());
|
|
598
|
+
}
|
|
599
|
+
this.dispatchEvent(ue), this.dispatchEvent(He);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
pointerUp(o) {
|
|
603
|
+
o !== null && o.button !== 0 || (this.dragging && this.axis !== null && (Xe.mode = this.mode, this.dispatchEvent(Xe)), this.dragging = !1, this.axis = null);
|
|
604
|
+
}
|
|
605
|
+
dispose() {
|
|
606
|
+
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.traverse(function(o) {
|
|
607
|
+
o.geometry && o.geometry.dispose(), o.material && o.material.dispose();
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
// Set current object
|
|
611
|
+
attach(o) {
|
|
612
|
+
return this.object = o, this.visible = !0, this;
|
|
613
|
+
}
|
|
614
|
+
// Detach from object
|
|
615
|
+
detach() {
|
|
616
|
+
return this.object = void 0, this.visible = !1, this.axis = null, this;
|
|
617
|
+
}
|
|
618
|
+
reset() {
|
|
619
|
+
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(He), this.pointStart.copy(this.pointEnd));
|
|
620
|
+
}
|
|
621
|
+
getRaycaster() {
|
|
622
|
+
return dt;
|
|
623
|
+
}
|
|
624
|
+
// TODO: deprecate
|
|
625
|
+
getMode() {
|
|
626
|
+
return this.mode;
|
|
627
|
+
}
|
|
628
|
+
setMode(o) {
|
|
629
|
+
this.mode = o;
|
|
630
|
+
}
|
|
631
|
+
setTranslationSnap(o) {
|
|
632
|
+
this.translationSnap = o;
|
|
633
|
+
}
|
|
634
|
+
setRotationSnap(o) {
|
|
635
|
+
this.rotationSnap = o;
|
|
636
|
+
}
|
|
637
|
+
setScaleSnap(o) {
|
|
638
|
+
this.scaleSnap = o;
|
|
639
|
+
}
|
|
640
|
+
setSize(o) {
|
|
641
|
+
this.size = o;
|
|
642
|
+
}
|
|
643
|
+
setSpace(o) {
|
|
644
|
+
this.space = o;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
function _n(d) {
|
|
648
|
+
if (this.domElement.ownerDocument.pointerLockElement)
|
|
649
|
+
return {
|
|
650
|
+
x: 0,
|
|
651
|
+
y: 0,
|
|
652
|
+
button: d.button
|
|
653
|
+
};
|
|
654
|
+
{
|
|
655
|
+
const o = this.domElement.getBoundingClientRect();
|
|
656
|
+
return {
|
|
657
|
+
x: (d.clientX - o.left) / o.width * 2 - 1,
|
|
658
|
+
y: -(d.clientY - o.top) / o.height * 2 + 1,
|
|
659
|
+
button: d.button
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
function vn(d) {
|
|
664
|
+
if (this.enabled)
|
|
665
|
+
switch (d.pointerType) {
|
|
666
|
+
case "mouse":
|
|
667
|
+
case "pen":
|
|
668
|
+
this.pointerHover(this._getPointer(d));
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
function Tn(d) {
|
|
673
|
+
this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(d.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(d)), this.pointerDown(this._getPointer(d)));
|
|
674
|
+
}
|
|
675
|
+
function In(d) {
|
|
676
|
+
this.enabled && this.pointerMove(this._getPointer(d));
|
|
677
|
+
}
|
|
678
|
+
function An(d) {
|
|
679
|
+
this.enabled && (this.domElement.releasePointerCapture(d.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(d)));
|
|
680
|
+
}
|
|
681
|
+
function me(d, o, a) {
|
|
682
|
+
const t = o.intersectObject(d, !0);
|
|
683
|
+
for (let i = 0; i < t.length; i++)
|
|
684
|
+
if (t[i].object.visible || a)
|
|
685
|
+
return t[i];
|
|
686
|
+
return !1;
|
|
687
|
+
}
|
|
688
|
+
const oe = new fn(), f = new p(0, 1, 0), Ze = new p(0, 0, 0), Ne = new Fe(), ie = new G(), re = new G(), B = new p(), Qe = new Fe(), Ct = new p(1, 0, 0), ut = new p(0, 1, 0), Xt = new p(0, 0, 1), se = new p(), Rt = new p(), zt = new p();
|
|
689
|
+
class Ln extends fe {
|
|
690
|
+
constructor() {
|
|
691
|
+
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
692
|
+
const o = new qe({
|
|
693
|
+
depthTest: !1,
|
|
694
|
+
depthWrite: !1,
|
|
695
|
+
fog: !1,
|
|
696
|
+
toneMapped: !1,
|
|
697
|
+
transparent: !0
|
|
698
|
+
}), a = new yn({
|
|
699
|
+
depthTest: !1,
|
|
700
|
+
depthWrite: !1,
|
|
701
|
+
fog: !1,
|
|
702
|
+
toneMapped: !1,
|
|
703
|
+
transparent: !0
|
|
704
|
+
}), t = o.clone();
|
|
705
|
+
t.opacity = 0.15;
|
|
706
|
+
const i = a.clone();
|
|
707
|
+
i.opacity = 0.5;
|
|
708
|
+
const l = o.clone();
|
|
709
|
+
l.color.setHex(16711680);
|
|
710
|
+
const n = o.clone();
|
|
711
|
+
n.color.setHex(65280);
|
|
712
|
+
const h = o.clone();
|
|
713
|
+
h.color.setHex(255);
|
|
714
|
+
const b = o.clone();
|
|
715
|
+
b.color.setHex(16711680), b.opacity = 0.5;
|
|
716
|
+
const j = o.clone();
|
|
717
|
+
j.color.setHex(65280), j.opacity = 0.5;
|
|
718
|
+
const C = o.clone();
|
|
719
|
+
C.color.setHex(255), C.opacity = 0.5;
|
|
720
|
+
const X = o.clone();
|
|
721
|
+
X.opacity = 0.25;
|
|
722
|
+
const H = o.clone();
|
|
723
|
+
H.color.setHex(16776960), H.opacity = 0.25, o.clone().color.setHex(16776960);
|
|
724
|
+
const Z = o.clone();
|
|
725
|
+
Z.color.setHex(7895160);
|
|
726
|
+
const x = new z(0, 0.04, 0.1, 12);
|
|
727
|
+
x.translate(0, 0.05, 0);
|
|
728
|
+
const T = new k(0.08, 0.08, 0.08);
|
|
729
|
+
T.translate(0, 0.04, 0);
|
|
730
|
+
const _ = new Oe();
|
|
731
|
+
_.setAttribute("position", new De([0, 0, 0, 1, 0, 0], 3));
|
|
732
|
+
const g = new z(75e-4, 75e-4, 0.5, 3);
|
|
733
|
+
g.translate(0, 0.25, 0);
|
|
734
|
+
function E(O, W) {
|
|
735
|
+
const D = new kt(O, 75e-4, 3, 64, W * Math.PI * 2);
|
|
736
|
+
return D.rotateY(Math.PI / 2), D.rotateX(Math.PI / 2), D;
|
|
737
|
+
}
|
|
738
|
+
function $() {
|
|
739
|
+
const O = new Oe();
|
|
740
|
+
return O.setAttribute("position", new De([0, 0, 0, 1, 1, 1], 3)), O;
|
|
741
|
+
}
|
|
742
|
+
const I = {
|
|
743
|
+
X: [
|
|
744
|
+
[new c(x, l), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
745
|
+
[new c(x, l), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
|
|
746
|
+
[new c(g, l), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
747
|
+
],
|
|
748
|
+
Y: [
|
|
749
|
+
[new c(x, n), [0, 0.5, 0]],
|
|
750
|
+
[new c(x, n), [0, -0.5, 0], [Math.PI, 0, 0]],
|
|
751
|
+
[new c(g, n)]
|
|
752
|
+
],
|
|
753
|
+
Z: [
|
|
754
|
+
[new c(x, h), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
755
|
+
[new c(x, h), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
|
|
756
|
+
[new c(g, h), null, [Math.PI / 2, 0, 0]]
|
|
757
|
+
],
|
|
758
|
+
XYZ: [
|
|
759
|
+
[new c(new ee(0.1, 0), X.clone()), [0, 0, 0]]
|
|
760
|
+
],
|
|
761
|
+
XY: [
|
|
762
|
+
[new c(new k(0.15, 0.15, 0.01), C.clone()), [0.15, 0.15, 0]]
|
|
763
|
+
],
|
|
764
|
+
YZ: [
|
|
765
|
+
[new c(new k(0.15, 0.15, 0.01), b.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
766
|
+
],
|
|
767
|
+
XZ: [
|
|
768
|
+
[new c(new k(0.15, 0.15, 0.01), j.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
769
|
+
]
|
|
770
|
+
}, Et = {
|
|
771
|
+
X: [
|
|
772
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
773
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
|
|
774
|
+
],
|
|
775
|
+
Y: [
|
|
776
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [0, 0.3, 0]],
|
|
777
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [0, -0.3, 0], [0, 0, Math.PI]]
|
|
778
|
+
],
|
|
779
|
+
Z: [
|
|
780
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
|
|
781
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [0, 0, -0.3], [-Math.PI / 2, 0, 0]]
|
|
782
|
+
],
|
|
783
|
+
XYZ: [
|
|
784
|
+
[new c(new ee(0.2, 0), t)]
|
|
785
|
+
],
|
|
786
|
+
XY: [
|
|
787
|
+
[new c(new k(0.2, 0.2, 0.01), t), [0.15, 0.15, 0]]
|
|
788
|
+
],
|
|
789
|
+
YZ: [
|
|
790
|
+
[new c(new k(0.2, 0.2, 0.01), t), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
791
|
+
],
|
|
792
|
+
XZ: [
|
|
793
|
+
[new c(new k(0.2, 0.2, 0.01), t), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
794
|
+
]
|
|
795
|
+
}, P = {
|
|
796
|
+
START: [
|
|
797
|
+
[new c(new ee(0.01, 2), i), null, null, null, "helper"]
|
|
798
|
+
],
|
|
799
|
+
END: [
|
|
800
|
+
[new c(new ee(0.01, 2), i), null, null, null, "helper"]
|
|
801
|
+
],
|
|
802
|
+
DELTA: [
|
|
803
|
+
[new at($(), i), null, null, null, "helper"]
|
|
804
|
+
],
|
|
805
|
+
X: [
|
|
806
|
+
[new at(_, i.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
807
|
+
],
|
|
808
|
+
Y: [
|
|
809
|
+
[new at(_, i.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
|
|
810
|
+
],
|
|
811
|
+
Z: [
|
|
812
|
+
[new at(_, i.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
|
|
813
|
+
]
|
|
814
|
+
}, ct = {
|
|
815
|
+
XYZE: [
|
|
816
|
+
[new c(E(0.5, 1), Z), null, [0, Math.PI / 2, 0]]
|
|
817
|
+
],
|
|
818
|
+
X: [
|
|
819
|
+
[new c(E(0.5, 0.5), l)]
|
|
820
|
+
],
|
|
821
|
+
Y: [
|
|
822
|
+
[new c(E(0.5, 0.5), n), null, [0, 0, -Math.PI / 2]]
|
|
823
|
+
],
|
|
824
|
+
Z: [
|
|
825
|
+
[new c(E(0.5, 0.5), h), null, [0, Math.PI / 2, 0]]
|
|
826
|
+
],
|
|
827
|
+
E: [
|
|
828
|
+
[new c(E(0.75, 1), H), null, [0, Math.PI / 2, 0]]
|
|
829
|
+
]
|
|
830
|
+
}, jt = {
|
|
831
|
+
AXIS: [
|
|
832
|
+
[new at(_, i.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
833
|
+
]
|
|
834
|
+
}, le = {
|
|
835
|
+
XYZE: [
|
|
836
|
+
[new c(new wn(0.25, 10, 8), t)]
|
|
837
|
+
],
|
|
838
|
+
X: [
|
|
839
|
+
[new c(new kt(0.5, 0.1, 4, 24), t), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]
|
|
840
|
+
],
|
|
841
|
+
Y: [
|
|
842
|
+
[new c(new kt(0.5, 0.1, 4, 24), t), [0, 0, 0], [Math.PI / 2, 0, 0]]
|
|
843
|
+
],
|
|
844
|
+
Z: [
|
|
845
|
+
[new c(new kt(0.5, 0.1, 4, 24), t), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
846
|
+
],
|
|
847
|
+
E: [
|
|
848
|
+
[new c(new kt(0.75, 0.1, 2, 24), t)]
|
|
849
|
+
]
|
|
850
|
+
}, Pt = {
|
|
851
|
+
X: [
|
|
852
|
+
[new c(T, l), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
853
|
+
[new c(g, l), [0, 0, 0], [0, 0, -Math.PI / 2]],
|
|
854
|
+
[new c(T, l), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
|
|
855
|
+
],
|
|
856
|
+
Y: [
|
|
857
|
+
[new c(T, n), [0, 0.5, 0]],
|
|
858
|
+
[new c(g, n)],
|
|
859
|
+
[new c(T, n), [0, -0.5, 0], [0, 0, Math.PI]]
|
|
860
|
+
],
|
|
861
|
+
Z: [
|
|
862
|
+
[new c(T, h), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
863
|
+
[new c(g, h), [0, 0, 0], [Math.PI / 2, 0, 0]],
|
|
864
|
+
[new c(T, h), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
|
|
865
|
+
],
|
|
866
|
+
XY: [
|
|
867
|
+
[new c(new k(0.15, 0.15, 0.01), C), [0.15, 0.15, 0]]
|
|
868
|
+
],
|
|
869
|
+
YZ: [
|
|
870
|
+
[new c(new k(0.15, 0.15, 0.01), b), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
871
|
+
],
|
|
872
|
+
XZ: [
|
|
873
|
+
[new c(new k(0.15, 0.15, 0.01), j), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
874
|
+
],
|
|
875
|
+
XYZ: [
|
|
876
|
+
[new c(new k(0.1, 0.1, 0.1), X.clone())]
|
|
877
|
+
]
|
|
878
|
+
}, ht = {
|
|
879
|
+
X: [
|
|
880
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
881
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
|
|
882
|
+
],
|
|
883
|
+
Y: [
|
|
884
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [0, 0.3, 0]],
|
|
885
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [0, -0.3, 0], [0, 0, Math.PI]]
|
|
886
|
+
],
|
|
887
|
+
Z: [
|
|
888
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [0, 0, 0.3], [Math.PI / 2, 0, 0]],
|
|
889
|
+
[new c(new z(0.2, 0, 0.6, 4), t), [0, 0, -0.3], [-Math.PI / 2, 0, 0]]
|
|
890
|
+
],
|
|
891
|
+
XY: [
|
|
892
|
+
[new c(new k(0.2, 0.2, 0.01), t), [0.15, 0.15, 0]]
|
|
893
|
+
],
|
|
894
|
+
YZ: [
|
|
895
|
+
[new c(new k(0.2, 0.2, 0.01), t), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
896
|
+
],
|
|
897
|
+
XZ: [
|
|
898
|
+
[new c(new k(0.2, 0.2, 0.01), t), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
899
|
+
],
|
|
900
|
+
XYZ: [
|
|
901
|
+
[new c(new k(0.2, 0.2, 0.2), t), [0, 0, 0]]
|
|
902
|
+
]
|
|
903
|
+
}, Mt = {
|
|
904
|
+
X: [
|
|
905
|
+
[new at(_, i.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
906
|
+
],
|
|
907
|
+
Y: [
|
|
908
|
+
[new at(_, i.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]
|
|
909
|
+
],
|
|
910
|
+
Z: [
|
|
911
|
+
[new at(_, i.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
|
|
912
|
+
]
|
|
913
|
+
};
|
|
914
|
+
function N(O) {
|
|
915
|
+
const W = new fe();
|
|
916
|
+
for (const D in O)
|
|
917
|
+
for (let J = O[D].length; J--; ) {
|
|
918
|
+
const M = O[D][J][0].clone(), it = O[D][J][1], pt = O[D][J][2], St = O[D][J][3], Vt = O[D][J][4];
|
|
919
|
+
M.name = D, M.tag = Vt, it && M.position.set(it[0], it[1], it[2]), pt && M.rotation.set(pt[0], pt[1], pt[2]), St && M.scale.set(St[0], St[1], St[2]), M.updateMatrix();
|
|
920
|
+
const $t = M.geometry.clone();
|
|
921
|
+
$t.applyMatrix4(M.matrix), M.geometry = $t, M.renderOrder = 1 / 0, M.position.set(0, 0, 0), M.rotation.set(0, 0, 0), M.scale.set(1, 1, 1), W.add(M);
|
|
922
|
+
}
|
|
923
|
+
return W;
|
|
924
|
+
}
|
|
925
|
+
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = N(I)), this.add(this.gizmo.rotate = N(ct)), this.add(this.gizmo.scale = N(Pt)), this.add(this.picker.translate = N(Et)), this.add(this.picker.rotate = N(le)), this.add(this.picker.scale = N(ht)), this.add(this.helper.translate = N(P)), this.add(this.helper.rotate = N(jt)), this.add(this.helper.scale = N(Mt)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
|
|
926
|
+
}
|
|
927
|
+
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
928
|
+
updateMatrixWorld(o) {
|
|
929
|
+
const t = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion : re;
|
|
930
|
+
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";
|
|
931
|
+
let i = [];
|
|
932
|
+
i = i.concat(this.picker[this.mode].children), i = i.concat(this.gizmo[this.mode].children), i = i.concat(this.helper[this.mode].children);
|
|
933
|
+
for (let l = 0; l < i.length; l++) {
|
|
934
|
+
const n = i[l];
|
|
935
|
+
n.visible = !0, n.rotation.set(0, 0, 0), n.position.copy(this.worldPosition);
|
|
936
|
+
let h;
|
|
937
|
+
if (this.camera.isOrthographicCamera ? h = (this.camera.top - this.camera.bottom) / this.camera.zoom : h = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), n.scale.set(1, 1, 1).multiplyScalar(h * this.size / 4), n.tag === "helper") {
|
|
938
|
+
n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (w.setFromEuler(oe.set(0, 0, 0)), n.quaternion.copy(t).multiply(w), Math.abs(f.copy(Ct).applyQuaternion(t).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Y" && (w.setFromEuler(oe.set(0, 0, Math.PI / 2)), n.quaternion.copy(t).multiply(w), Math.abs(f.copy(ut).applyQuaternion(t).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Z" && (w.setFromEuler(oe.set(0, Math.PI / 2, 0)), n.quaternion.copy(t).multiply(w), Math.abs(f.copy(Xt).applyQuaternion(t).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "XYZE" && (w.setFromEuler(oe.set(0, Math.PI / 2, 0)), f.copy(this.rotationAxis), n.quaternion.setFromRotationMatrix(Ne.lookAt(Ze, f, ut)), n.quaternion.multiply(w), n.visible = this.dragging), this.axis === "E" && (n.visible = !1)) : n.name === "START" ? (n.position.copy(this.worldPositionStart), n.visible = this.dragging) : n.name === "END" ? (n.position.copy(this.worldPosition), n.visible = this.dragging) : n.name === "DELTA" ? (n.position.copy(this.worldPositionStart), n.quaternion.copy(this.worldQuaternionStart), A.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), A.applyQuaternion(this.worldQuaternionStart.clone().invert()), n.scale.copy(A), n.visible = this.dragging) : (n.quaternion.copy(t), this.dragging ? n.position.copy(this.worldPositionStart) : n.position.copy(this.worldPosition), this.axis && (n.visible = this.axis.search(n.name) !== -1));
|
|
939
|
+
continue;
|
|
940
|
+
}
|
|
941
|
+
n.quaternion.copy(t), this.mode === "translate" || this.mode === "scale" ? (n.name === "X" && Math.abs(f.copy(Ct).applyQuaternion(t).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Y" && Math.abs(f.copy(ut).applyQuaternion(t).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Z" && Math.abs(f.copy(Xt).applyQuaternion(t).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XY" && Math.abs(f.copy(Xt).applyQuaternion(t).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "YZ" && Math.abs(f.copy(Ct).applyQuaternion(t).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XZ" && Math.abs(f.copy(ut).applyQuaternion(t).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1)) : this.mode === "rotate" && (ie.copy(t), f.copy(this.eye).applyQuaternion(w.copy(t).invert()), n.name.search("E") !== -1 && n.quaternion.setFromRotationMatrix(Ne.lookAt(this.eye, Ze, ut)), n.name === "X" && (w.setFromAxisAngle(Ct, Math.atan2(-f.y, f.z)), w.multiplyQuaternions(ie, w), n.quaternion.copy(w)), n.name === "Y" && (w.setFromAxisAngle(ut, Math.atan2(f.x, f.z)), w.multiplyQuaternions(ie, w), n.quaternion.copy(w)), n.name === "Z" && (w.setFromAxisAngle(Xt, Math.atan2(f.y, f.x)), w.multiplyQuaternions(ie, w), n.quaternion.copy(w))), n.visible = n.visible && (n.name.indexOf("X") === -1 || this.showX), n.visible = n.visible && (n.name.indexOf("Y") === -1 || this.showY), n.visible = n.visible && (n.name.indexOf("Z") === -1 || this.showZ), n.visible = n.visible && (n.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), n.material._color = n.material._color || n.material.color.clone(), n.material._opacity = n.material._opacity || n.material.opacity, n.material.color.copy(n.material._color), n.material.opacity = n.material._opacity, this.enabled && this.axis && (n.name === this.axis || this.axis.split("").some(function(b) {
|
|
942
|
+
return n.name === b;
|
|
943
|
+
})) && (n.material.color.setHex(16776960), n.material.opacity = 1);
|
|
944
|
+
}
|
|
945
|
+
super.updateMatrixWorld(o);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
class jn extends c {
|
|
949
|
+
constructor() {
|
|
950
|
+
super(
|
|
951
|
+
new bn(1e5, 1e5, 2, 2),
|
|
952
|
+
new qe({ visible: !1, wireframe: !0, side: gn, transparent: !0, opacity: 0.1, toneMapped: !1 })
|
|
953
|
+
), this.isTransformControlsPlane = !0, this.type = "TransformControlsPlane";
|
|
954
|
+
}
|
|
955
|
+
updateMatrixWorld(o) {
|
|
956
|
+
let a = this.space;
|
|
957
|
+
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (a = "local"), se.copy(Ct).applyQuaternion(a === "local" ? this.worldQuaternion : re), Rt.copy(ut).applyQuaternion(a === "local" ? this.worldQuaternion : re), zt.copy(Xt).applyQuaternion(a === "local" ? this.worldQuaternion : re), f.copy(Rt), this.mode) {
|
|
958
|
+
case "translate":
|
|
959
|
+
case "scale":
|
|
960
|
+
switch (this.axis) {
|
|
961
|
+
case "X":
|
|
962
|
+
f.copy(this.eye).cross(se), B.copy(se).cross(f);
|
|
963
|
+
break;
|
|
964
|
+
case "Y":
|
|
965
|
+
f.copy(this.eye).cross(Rt), B.copy(Rt).cross(f);
|
|
966
|
+
break;
|
|
967
|
+
case "Z":
|
|
968
|
+
f.copy(this.eye).cross(zt), B.copy(zt).cross(f);
|
|
969
|
+
break;
|
|
970
|
+
case "XY":
|
|
971
|
+
B.copy(zt);
|
|
972
|
+
break;
|
|
973
|
+
case "YZ":
|
|
974
|
+
B.copy(se);
|
|
975
|
+
break;
|
|
976
|
+
case "XZ":
|
|
977
|
+
f.copy(zt), B.copy(Rt);
|
|
978
|
+
break;
|
|
979
|
+
case "XYZ":
|
|
980
|
+
case "E":
|
|
981
|
+
B.set(0, 0, 0);
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
984
|
+
break;
|
|
985
|
+
case "rotate":
|
|
986
|
+
default:
|
|
987
|
+
B.set(0, 0, 0);
|
|
988
|
+
}
|
|
989
|
+
B.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (Qe.lookAt(A.set(0, 0, 0), B, f), this.quaternion.setFromRotationMatrix(Qe)), super.updateMatrixWorld(o);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
var q, wt;
|
|
993
|
+
class On {
|
|
994
|
+
constructor() {
|
|
995
|
+
m(this, q, void 0);
|
|
996
|
+
m(this, wt, void 0);
|
|
997
|
+
S(this, q, new Sn(L.camera, L.webglRenderer.domElement)), S(this, wt, new ot([0, 0, 0], {
|
|
998
|
+
passport: {
|
|
999
|
+
name: "Controls.OrbitControls.Target",
|
|
1000
|
+
manager: {
|
|
1001
|
+
type: "number",
|
|
1002
|
+
step: 1e-4,
|
|
1003
|
+
ease: 10
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}));
|
|
1007
|
+
let o = !0;
|
|
1008
|
+
s(this, wt).subscribe((a) => {
|
|
1009
|
+
s(this, q).target.set(...a.current), o && s(this, q).update();
|
|
1010
|
+
}), s(this, q).addEventListener("change", () => {
|
|
1011
|
+
o = !1, s(this, wt).current = [
|
|
1012
|
+
s(this, q).target.x,
|
|
1013
|
+
s(this, q).target.y,
|
|
1014
|
+
s(this, q).target.z
|
|
1015
|
+
], o = !0;
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
get controls() {
|
|
1019
|
+
return s(this, q);
|
|
1020
|
+
}
|
|
1021
|
+
destroy() {
|
|
1022
|
+
s(this, q).dispose(), s(this, wt).close();
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
q = new WeakMap(), wt = new WeakMap();
|
|
1026
|
+
var R, Zt, Nt, Qt, Ft, qt, Gt, Wt;
|
|
1027
|
+
class Dn {
|
|
1028
|
+
constructor() {
|
|
1029
|
+
m(this, R, null);
|
|
1030
|
+
m(this, Zt, new ot(L.camera.far, {
|
|
1031
|
+
passport: {
|
|
1032
|
+
name: "Helpers.Grid.Size",
|
|
1033
|
+
manager: {
|
|
1034
|
+
type: "number",
|
|
1035
|
+
step: 1
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
}));
|
|
1039
|
+
m(this, Nt, new ot(100, {
|
|
1040
|
+
passport: {
|
|
1041
|
+
name: "Helpers.Grid.Divisions",
|
|
1042
|
+
manager: {
|
|
1043
|
+
type: "number"
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
}));
|
|
1047
|
+
m(this, Qt, new ot("#0000ff", {
|
|
1048
|
+
passport: {
|
|
1049
|
+
name: "Helpers.Grid.Color 1",
|
|
1050
|
+
manager: {
|
|
1051
|
+
type: "color"
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
}));
|
|
1055
|
+
m(this, Ft, new ot("#808080", {
|
|
1056
|
+
passport: {
|
|
1057
|
+
name: "Helpers.Grid.Color 2",
|
|
1058
|
+
manager: {
|
|
1059
|
+
type: "color"
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}));
|
|
1063
|
+
m(this, qt, new ot(!1, {
|
|
1064
|
+
passport: {
|
|
1065
|
+
name: "Helpers.Grid.Vertical",
|
|
1066
|
+
manager: {
|
|
1067
|
+
type: "boolean"
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}));
|
|
1071
|
+
m(this, Gt, void 0);
|
|
1072
|
+
m(this, Wt, (o) => {
|
|
1073
|
+
o.key === "g" && (s(this, R).visible = !s(this, R).visible);
|
|
1074
|
+
});
|
|
1075
|
+
S(this, Gt, new Pn(
|
|
1076
|
+
[s(this, Zt), s(this, Nt), s(this, Qt), s(this, Ft), s(this, qt)],
|
|
1077
|
+
() => {
|
|
1078
|
+
s(this, R) && (L.view.remove(s(this, R)), s(this, R).dispose()), S(this, R, new En(
|
|
1079
|
+
s(this, Zt).current,
|
|
1080
|
+
s(this, Nt).current,
|
|
1081
|
+
s(this, Qt).current,
|
|
1082
|
+
s(this, Ft).current
|
|
1083
|
+
)), s(this, R).rotation.x = s(this, qt).current ? Math.PI / 2 : 0, L.view.add(s(this, R));
|
|
1084
|
+
}
|
|
1085
|
+
)), addEventListener("keydown", s(this, Wt));
|
|
1086
|
+
}
|
|
1087
|
+
get helper() {
|
|
1088
|
+
return s(this, R);
|
|
1089
|
+
}
|
|
1090
|
+
destroy() {
|
|
1091
|
+
s(this, Gt).close(), s(this, R) && (L.view.remove(s(this, R)), s(this, R).dispose()), removeEventListener("keydown", s(this, Wt));
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
R = new WeakMap(), Zt = new WeakMap(), Nt = new WeakMap(), Qt = new WeakMap(), Ft = new WeakMap(), qt = new WeakMap(), Gt = new WeakMap(), Wt = new WeakMap();
|
|
1095
|
+
var v, K, lt, bt, Ut, It, Kt;
|
|
1096
|
+
class Yn {
|
|
1097
|
+
constructor() {
|
|
1098
|
+
m(this, v, void 0);
|
|
1099
|
+
m(this, K, []);
|
|
1100
|
+
m(this, lt, null);
|
|
1101
|
+
m(this, bt, (o) => {
|
|
1102
|
+
o.child.name && !s(this, K).find((a) => a.object3d === o.child) && (s(this, K).push(new Ge(o.child)), L.raycaster.add(o.child), o.child.addEventListener("pointerDown", s(this, It)), o.child.addEventListener("childadded", s(this, bt)));
|
|
1103
|
+
});
|
|
1104
|
+
m(this, Ut, (o) => {
|
|
1105
|
+
const a = s(this, K).find(
|
|
1106
|
+
(t) => t.object3d === o.child
|
|
1107
|
+
);
|
|
1108
|
+
a && (a.destroy(), L.raycaster.remove(o.child), a.object3d.removeEventListener(
|
|
1109
|
+
"pointerDown",
|
|
1110
|
+
s(this, It)
|
|
1111
|
+
), o.child.removeEventListener("childadded", s(this, bt)), S(this, K, s(this, K).filter(
|
|
1112
|
+
(t) => t !== a
|
|
1113
|
+
)));
|
|
1114
|
+
});
|
|
1115
|
+
m(this, It, (o) => {
|
|
1116
|
+
S(this, lt, s(this, K).find((a) => a.object3d === o.object) || null), s(this, lt) && s(this, v).attach(s(this, lt).object3d);
|
|
1117
|
+
});
|
|
1118
|
+
m(this, Kt, (o) => {
|
|
1119
|
+
o.key === "t" ? s(this, v).setMode("translate") : o.key === "r" ? s(this, v).setMode("rotate") : o.key === "s" ? s(this, v).setMode("scale") : o.key === "Escape" ? s(this, v).detach() : o.key === "+" || o.key === "=" ? s(this, v).setSize(s(this, v).size + 0.1) : (o.key === "-" || o.key === "_") && s(this, v).setSize(s(this, v).size - 0.1);
|
|
1120
|
+
});
|
|
1121
|
+
S(this, v, new xn(
|
|
1122
|
+
L.camera,
|
|
1123
|
+
L.webglRenderer.domElement
|
|
1124
|
+
)), s(this, v).addEventListener("objectChange", (o) => {
|
|
1125
|
+
s(this, lt) && s(this, lt).save();
|
|
1126
|
+
}), L.view.add(s(this, v)), L.scene.addEventListener("childadded", s(this, bt)), L.scene.addEventListener("childremoved", s(this, Ut)), window.addEventListener("keydown", s(this, Kt));
|
|
1127
|
+
}
|
|
1128
|
+
get controls() {
|
|
1129
|
+
return s(this, v);
|
|
1130
|
+
}
|
|
1131
|
+
destroy() {
|
|
1132
|
+
L.scene.removeEventListener("childadded", s(this, bt)), L.scene.removeEventListener("childremoved", s(this, Ut)), window.removeEventListener("keydown", s(this, Kt)), s(this, v).dispose(), s(this, K).forEach((o) => {
|
|
1133
|
+
o.destroy(), o.object3d.removeEventListener(
|
|
1134
|
+
"pointerDown",
|
|
1135
|
+
s(this, It)
|
|
1136
|
+
);
|
|
1137
|
+
}), S(this, K, []);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
v = new WeakMap(), K = new WeakMap(), lt = new WeakMap(), bt = new WeakMap(), Ut = new WeakMap(), It = new WeakMap(), Kt = new WeakMap();
|
|
1141
|
+
var Bt, At, gt, Lt;
|
|
1142
|
+
class Nn {
|
|
1143
|
+
constructor() {
|
|
1144
|
+
m(this, Bt, void 0);
|
|
1145
|
+
m(this, At, void 0);
|
|
1146
|
+
m(this, gt, void 0);
|
|
1147
|
+
m(this, Lt, void 0);
|
|
1148
|
+
S(this, Bt, new Dn()), S(this, At, new Ge(L.camera)), S(this, gt, new On()), s(this, gt).controls.addEventListener("change", () => {
|
|
1149
|
+
s(this, At).save();
|
|
1150
|
+
}), S(this, Lt, new Yn()), s(this, Lt).controls.addEventListener(
|
|
1151
|
+
"dragging-changed",
|
|
1152
|
+
(o) => {
|
|
1153
|
+
s(this, gt).controls.enabled = !o.value;
|
|
1154
|
+
}
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
destroy() {
|
|
1158
|
+
s(this, Bt).destroy(), s(this, At).destroy(), s(this, gt).destroy(), s(this, Lt).destroy();
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
Bt = new WeakMap(), At = new WeakMap(), gt = new WeakMap(), Lt = new WeakMap();
|
|
1162
|
+
export {
|
|
1163
|
+
Nn as En3Controls,
|
|
1164
|
+
Ge as En3Object3dManager
|
|
1165
|
+
};
|