@tomorrowevening/hermes 0.1.39 → 0.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ThreeEditor-CTkjs-SY.js → ThreeEditor-CB5dBR7Q.js} +1 -1
- package/dist/core/Application.js +77 -0
- package/dist/core/remote/BaseRemote.js +33 -0
- package/dist/core/remote/RemoteTheatre.js +253 -0
- package/dist/core/remote/RemoteThree.js +442 -0
- package/dist/core/types.js +7 -0
- package/dist/editor/Editor.js +12 -0
- package/dist/editor/HermesApp.js +24 -0
- package/dist/editor/ThreeEditor.js +22 -0
- package/dist/editor/components/Draggable.js +40 -0
- package/dist/editor/components/DraggableItem.js +25 -0
- package/dist/editor/components/Dropdown.js +32 -0
- package/dist/editor/components/DropdownItem.js +50 -0
- package/dist/editor/components/NavButton.js +7 -0
- package/dist/editor/components/content.js +4 -0
- package/dist/editor/components/icons/CloseIcon.js +9 -0
- package/dist/editor/components/icons/DragIcon.js +12 -0
- package/dist/editor/multiView/CameraWindow.js +64 -0
- package/dist/editor/multiView/DepthNodeMaterial.js +12 -0
- package/dist/editor/multiView/InfiniteGridHelper.js +31 -0
- package/dist/editor/multiView/InfiniteGridHelperGPU.js +31 -0
- package/dist/editor/multiView/InfiniteGridMaterial.js +137 -0
- package/dist/editor/multiView/InfiniteGridNodeMaterial.js +63 -0
- package/dist/editor/multiView/MultiView.js +890 -0
- package/dist/editor/multiView/Toggle.js +25 -0
- package/dist/editor/multiView/UVMaterial.js +60 -0
- package/dist/editor/multiView/UVNodeMaterial.js +10 -0
- package/dist/editor/sidePanel/Accordion.js +56 -0
- package/dist/editor/sidePanel/ChildObject.js +78 -0
- package/dist/editor/sidePanel/ContainerObject.js +11 -0
- package/dist/editor/sidePanel/DebugData.js +133 -0
- package/dist/editor/sidePanel/SidePanel.js +91 -0
- package/dist/editor/sidePanel/inspector/InspectGrid3.js +82 -0
- package/dist/editor/sidePanel/inspector/InspectGrid4.js +58 -0
- package/dist/editor/sidePanel/inspector/InspectImage.js +100 -0
- package/dist/editor/sidePanel/inspector/InspectNumber.js +76 -0
- package/dist/editor/sidePanel/inspector/InspectVector2.js +154 -0
- package/dist/editor/sidePanel/inspector/Inspector.js +95 -0
- package/dist/editor/sidePanel/inspector/InspectorField.js +128 -0
- package/dist/editor/sidePanel/inspector/InspectorGroup.js +110 -0
- package/dist/editor/sidePanel/inspector/utils/DragNumber.js +27 -0
- package/dist/editor/sidePanel/inspector/utils/InspectAnimation.js +99 -0
- package/dist/editor/sidePanel/inspector/utils/InspectCamera.js +91 -0
- package/dist/editor/sidePanel/inspector/utils/InspectLight.js +85 -0
- package/dist/editor/sidePanel/inspector/utils/InspectMaterial.js +861 -0
- package/dist/editor/sidePanel/inspector/utils/InspectTransform.js +93 -0
- package/dist/editor/sidePanel/utils.js +259 -0
- package/dist/editor/tools/Transform.js +77 -0
- package/dist/editor/tools/splineEditor/Spline.js +348 -0
- package/dist/editor/tools/splineEditor/index.js +193 -0
- package/dist/editor/utils.js +27 -0
- package/dist/hermes.cjs.js +8 -30
- package/dist/{index-BpKOzCuX.js → index-DepTXu6T.js} +454 -454
- package/dist/index.html +1 -1
- package/dist/index.js +125 -0
- package/dist/utils/ImageSequenceCapturer.js +148 -0
- package/dist/utils/detectSettings.js +46 -0
- package/dist/utils/math.js +68 -0
- package/dist/utils/post.js +206 -0
- package/dist/utils/theatre.js +316 -0
- package/dist/utils/three.js +199 -0
- package/dist/webworkers/EventHandling.js +115 -0
- package/dist/webworkers/ProxyManager.js +76 -0
- package/package.json +13 -7
- package/dist/.vite/manifest.json +0 -12
- package/dist/hermes.es.js +0 -8077
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { Matrix4 as l, Vector3 as a, Euler as d } from "three";
|
|
3
|
+
import { Component as c } from "react";
|
|
4
|
+
import m from "../InspectorGroup.js";
|
|
5
|
+
import { setItemProps as u } from "../../utils.js";
|
|
6
|
+
import n from "../../../multiView/MultiView.js";
|
|
7
|
+
import { roundTo as i } from "../../../../utils/math.js";
|
|
8
|
+
class r extends c {
|
|
9
|
+
static instance;
|
|
10
|
+
matrix = new l();
|
|
11
|
+
position = new a();
|
|
12
|
+
rotation = new d();
|
|
13
|
+
scale = new a();
|
|
14
|
+
open = !1;
|
|
15
|
+
constructor(t) {
|
|
16
|
+
super(t);
|
|
17
|
+
const e = localStorage.getItem(this.expandedName), o = e !== null ? e === "open" : !1;
|
|
18
|
+
this.open = o, this.saveExpanded(), this.state = {
|
|
19
|
+
lastUpdated: 0,
|
|
20
|
+
expanded: o
|
|
21
|
+
}, this.matrix.elements = t.object.matrix, t.object.uuid.length > 0 && (this.position.setFromMatrixPosition(this.matrix), this.rotation.setFromRotationMatrix(this.matrix), this.scale.setFromMatrixScale(this.matrix)), r.instance = this;
|
|
22
|
+
}
|
|
23
|
+
update() {
|
|
24
|
+
if (n.instance) {
|
|
25
|
+
const t = n.instance.selectedItem;
|
|
26
|
+
if (t === void 0) return;
|
|
27
|
+
this.position.x = i(t.position.x, 3), this.position.y = i(t.position.y, 3), this.position.z = i(t.position.z, 3), this.rotation.copy(t.rotation), this.scale.x = i(t.scale.x, 3), this.scale.y = i(t.scale.y, 3), this.scale.z = i(t.scale.z, 3), this.setState({ lastUpdated: Date.now() });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
return /* @__PURE__ */ h(
|
|
32
|
+
m,
|
|
33
|
+
{
|
|
34
|
+
three: this.props.three,
|
|
35
|
+
title: "Transform",
|
|
36
|
+
expanded: this.open,
|
|
37
|
+
items: [
|
|
38
|
+
{
|
|
39
|
+
title: "Position",
|
|
40
|
+
prop: "position",
|
|
41
|
+
type: "grid3",
|
|
42
|
+
step: 0.1,
|
|
43
|
+
value: this.position,
|
|
44
|
+
onChange: this.updateTransform
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: "Rotation",
|
|
48
|
+
prop: "rotation",
|
|
49
|
+
type: "euler",
|
|
50
|
+
value: this.rotation,
|
|
51
|
+
onChange: this.updateTransform
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
title: "Scale",
|
|
55
|
+
prop: "scale",
|
|
56
|
+
type: "grid3",
|
|
57
|
+
value: this.scale,
|
|
58
|
+
onChange: this.updateTransform
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
title: "Visible",
|
|
62
|
+
prop: "visible",
|
|
63
|
+
type: "boolean",
|
|
64
|
+
value: this.props.object.visible,
|
|
65
|
+
onChange: this.updateTransform
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
onToggle: (t) => {
|
|
69
|
+
this.open = t, this.saveExpanded();
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
this.state.lastUpdated
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
updateTransform = (t, e) => {
|
|
76
|
+
const o = t === "rotation" ? { x: e._x, y: e._y, z: e._z } : e;
|
|
77
|
+
this.props.three.updateObject(this.props.object.uuid, t, o);
|
|
78
|
+
const s = this.props.three.getScene(this.props.object.uuid);
|
|
79
|
+
if (s) {
|
|
80
|
+
const p = s.getObjectByProperty("uuid", this.props.object.uuid);
|
|
81
|
+
u(p, t, o);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
saveExpanded() {
|
|
85
|
+
localStorage.setItem(this.expandedName, this.open ? "open" : "closed");
|
|
86
|
+
}
|
|
87
|
+
get expandedName() {
|
|
88
|
+
return `${this.props.three.name}_transform`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
r as InspectTransform
|
|
93
|
+
};
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { Texture as p, RepeatWrapping as c } from "three";
|
|
2
|
+
import { ExportTexture as f } from "../../utils/three.js";
|
|
3
|
+
function w(e) {
|
|
4
|
+
if (e.name === "cameras")
|
|
5
|
+
return "camera";
|
|
6
|
+
if (e.name === "interactive")
|
|
7
|
+
return "interactive";
|
|
8
|
+
if (e.name === "lights")
|
|
9
|
+
return "light";
|
|
10
|
+
if (e.name === "ui")
|
|
11
|
+
return "ui";
|
|
12
|
+
if (e.name === "utils")
|
|
13
|
+
return "utils";
|
|
14
|
+
const s = e.type;
|
|
15
|
+
return s.search("Helper") > -1 ? "icon_utils" : s.search("Camera") > -1 ? "camera" : s.search("Light") > -1 ? "light" : "obj3D";
|
|
16
|
+
}
|
|
17
|
+
function m(e) {
|
|
18
|
+
const s = {
|
|
19
|
+
name: e.name,
|
|
20
|
+
type: e.type,
|
|
21
|
+
uuid: e.uuid,
|
|
22
|
+
children: []
|
|
23
|
+
};
|
|
24
|
+
return e.children.forEach((r) => {
|
|
25
|
+
s.children.push(m(r));
|
|
26
|
+
}), s;
|
|
27
|
+
}
|
|
28
|
+
function u(e) {
|
|
29
|
+
return {
|
|
30
|
+
src: e.image?.src ?? "",
|
|
31
|
+
offset: [e.offset.x, e.offset.y],
|
|
32
|
+
repeat: [e.repeat.x, e.repeat.y]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const l = { src: "", offset: [0, 0], repeat: [1, 1] };
|
|
36
|
+
function d(e) {
|
|
37
|
+
const s = {};
|
|
38
|
+
for (const r in e) {
|
|
39
|
+
const t = e[r];
|
|
40
|
+
if (t !== null && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "value")) {
|
|
41
|
+
const i = t.value;
|
|
42
|
+
i == null ? s[r] = { value: l } : i.isTexture ? s[r] = { value: u(i) } : s[r] = { value: i };
|
|
43
|
+
} else
|
|
44
|
+
t == null ? s[r] = l : t.isTexture ? s[r] = u(t) : s[r] = t;
|
|
45
|
+
}
|
|
46
|
+
return s;
|
|
47
|
+
}
|
|
48
|
+
function h(e) {
|
|
49
|
+
switch (e) {
|
|
50
|
+
case "blendSrcAlpha":
|
|
51
|
+
case "blendDstAlpha":
|
|
52
|
+
case "blendEquationAlpha":
|
|
53
|
+
case "clippingPlanes":
|
|
54
|
+
case "shadowSide":
|
|
55
|
+
case "precision":
|
|
56
|
+
return !0;
|
|
57
|
+
}
|
|
58
|
+
return !1;
|
|
59
|
+
}
|
|
60
|
+
function o(e) {
|
|
61
|
+
const s = {};
|
|
62
|
+
for (const r in e) {
|
|
63
|
+
if (r.substring(0, 1) === "_" || r.substring(0, 2) === "is" || h(r)) continue;
|
|
64
|
+
const t = typeof e[r], n = e[r];
|
|
65
|
+
switch (t) {
|
|
66
|
+
case "boolean":
|
|
67
|
+
case "number":
|
|
68
|
+
case "string":
|
|
69
|
+
s[r] = n;
|
|
70
|
+
break;
|
|
71
|
+
case "object":
|
|
72
|
+
if (n !== null)
|
|
73
|
+
if (n.isTexture)
|
|
74
|
+
s[r] = {
|
|
75
|
+
src: f.renderToBlob(n),
|
|
76
|
+
offset: [n.offset.x, n.offset.y],
|
|
77
|
+
repeat: [n.repeat.x, n.repeat.y]
|
|
78
|
+
};
|
|
79
|
+
else if (n.isUniformNode) {
|
|
80
|
+
const i = n.value;
|
|
81
|
+
s[r] = {
|
|
82
|
+
__isUniform: !0,
|
|
83
|
+
value: i?.isTexture ? { src: f.renderToBlob(i), offset: [i.offset.x, i.offset.y], repeat: [i.repeat.x, i.repeat.y] } : i
|
|
84
|
+
};
|
|
85
|
+
} else r === "uniforms" ? s[r] = d(n) : r.search("Node") > -1 || (s[r] = n);
|
|
86
|
+
else
|
|
87
|
+
r === "glslVersion" ? s[r] = "" : r.search("Node") > -1 || (s[r] = {
|
|
88
|
+
src: "",
|
|
89
|
+
offset: [0, 0],
|
|
90
|
+
repeat: [1, 1]
|
|
91
|
+
});
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return e.anisotropy !== void 0 && (s.anisotropy = e.anisotropy), e.clearcoat !== void 0 && (s.clearcoat = e.clearcoat), e.iridescence !== void 0 && (s.iridescence = e.iridescence), e.dispersion !== void 0 && (s.dispersion = e.dispersion), e.sheen !== void 0 && (s.sheen = e.sheen), e.transmission !== void 0 && (s.transmission = e.transmission), e.transmission !== void 0 && (s.transmission = e.transmission), s;
|
|
96
|
+
}
|
|
97
|
+
function x(e) {
|
|
98
|
+
e.updateMatrix();
|
|
99
|
+
const s = {
|
|
100
|
+
name: e.name,
|
|
101
|
+
type: e.type,
|
|
102
|
+
uuid: e.uuid,
|
|
103
|
+
visible: e.visible,
|
|
104
|
+
matrix: e.matrix.elements,
|
|
105
|
+
animations: [],
|
|
106
|
+
material: void 0,
|
|
107
|
+
perspectiveCameraInfo: void 0,
|
|
108
|
+
orthographicCameraInfo: void 0,
|
|
109
|
+
lightInfo: void 0,
|
|
110
|
+
children: []
|
|
111
|
+
};
|
|
112
|
+
e.animations.forEach((t) => {
|
|
113
|
+
s.animations.push({
|
|
114
|
+
name: t.name,
|
|
115
|
+
duration: t.duration,
|
|
116
|
+
blendMode: t.blendMode
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
const r = e.type.toLowerCase();
|
|
120
|
+
if (r.search("mesh") > -1) {
|
|
121
|
+
const t = e;
|
|
122
|
+
if (Array.isArray(t.material)) {
|
|
123
|
+
const n = [];
|
|
124
|
+
t.material.forEach((i) => {
|
|
125
|
+
n.push(o(i));
|
|
126
|
+
}), s.material = n;
|
|
127
|
+
} else
|
|
128
|
+
s.material = o(t.material);
|
|
129
|
+
} else if (r.search("points") > -1) {
|
|
130
|
+
const t = e;
|
|
131
|
+
if (Array.isArray(t.material)) {
|
|
132
|
+
const n = [];
|
|
133
|
+
t.material.forEach((i) => {
|
|
134
|
+
n.push(o(i));
|
|
135
|
+
}), s.material = n;
|
|
136
|
+
} else
|
|
137
|
+
s.material = o(t.material);
|
|
138
|
+
} else if (r.search("line") > -1) {
|
|
139
|
+
const t = e;
|
|
140
|
+
if (Array.isArray(t.material)) {
|
|
141
|
+
const n = [];
|
|
142
|
+
t.material.forEach((i) => {
|
|
143
|
+
n.push(o(i));
|
|
144
|
+
}), s.material = n;
|
|
145
|
+
} else
|
|
146
|
+
s.material = o(t.material);
|
|
147
|
+
} else r.search("camera") > -1 ? e.type === "PerspectiveCamera" ? s.perspectiveCameraInfo = {
|
|
148
|
+
fov: e.fov,
|
|
149
|
+
zoom: e.zoom,
|
|
150
|
+
near: e.near,
|
|
151
|
+
far: e.far,
|
|
152
|
+
focus: e.focus,
|
|
153
|
+
aspect: e.aspect,
|
|
154
|
+
filmGauge: e.filmGauge,
|
|
155
|
+
filmOffset: e.filmOffset
|
|
156
|
+
} : e.type === "OrthographicCamera" && (s.orthographicCameraInfo = {
|
|
157
|
+
zoom: e.zoom,
|
|
158
|
+
near: e.near,
|
|
159
|
+
far: e.far,
|
|
160
|
+
left: e.left,
|
|
161
|
+
right: e.right,
|
|
162
|
+
top: e.top,
|
|
163
|
+
bottom: e.bottom
|
|
164
|
+
}) : r.search("light") > -1 && (s.lightInfo = {
|
|
165
|
+
color: e.color,
|
|
166
|
+
intensity: e.intensity,
|
|
167
|
+
decay: e.decay,
|
|
168
|
+
distance: e.distance,
|
|
169
|
+
angle: e.angle,
|
|
170
|
+
penumbra: e.penumbra,
|
|
171
|
+
groundColor: e.groundColor,
|
|
172
|
+
width: e.width,
|
|
173
|
+
height: e.height
|
|
174
|
+
});
|
|
175
|
+
return s;
|
|
176
|
+
}
|
|
177
|
+
function T(e, s) {
|
|
178
|
+
const r = s.split(".");
|
|
179
|
+
switch (r.length) {
|
|
180
|
+
case 1:
|
|
181
|
+
return e[r[0]];
|
|
182
|
+
case 2:
|
|
183
|
+
return e[r[0]][r[1]];
|
|
184
|
+
case 3:
|
|
185
|
+
return e[r[0]][r[1]][r[2]];
|
|
186
|
+
case 4:
|
|
187
|
+
return e[r[0]][r[1]][r[2]][r[3]];
|
|
188
|
+
case 5:
|
|
189
|
+
return e[r[0]][r[1]][r[2]][r[3]][r[4]];
|
|
190
|
+
case 6:
|
|
191
|
+
return e[r[0]][r[1]][r[2]][r[3]][r[4]][r[5]];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function y(e, s) {
|
|
195
|
+
for (const r in s) e[r] = s[r];
|
|
196
|
+
}
|
|
197
|
+
function k(e, s, r) {
|
|
198
|
+
if (e === void 0) {
|
|
199
|
+
console.log(`Hermes - Can't set props: ${s}`, r);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const t = s.split("."), n = t.length;
|
|
203
|
+
if (typeof r != "object")
|
|
204
|
+
switch (n) {
|
|
205
|
+
case 1:
|
|
206
|
+
e[t[0]] = r;
|
|
207
|
+
break;
|
|
208
|
+
case 2:
|
|
209
|
+
e[t[0]][t[1]] = r;
|
|
210
|
+
break;
|
|
211
|
+
case 3:
|
|
212
|
+
e[t[0]][t[1]][t[2]] = r;
|
|
213
|
+
break;
|
|
214
|
+
case 4:
|
|
215
|
+
e[t[0]][t[1]][t[2]][t[3]] = r;
|
|
216
|
+
break;
|
|
217
|
+
case 5:
|
|
218
|
+
e[t[0]][t[1]][t[2]][t[3]][t[4]] = r;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
let a;
|
|
223
|
+
switch (n) {
|
|
224
|
+
case 1:
|
|
225
|
+
a = e[t[0]];
|
|
226
|
+
break;
|
|
227
|
+
case 2:
|
|
228
|
+
a = e[t[0]][t[1]];
|
|
229
|
+
break;
|
|
230
|
+
case 3:
|
|
231
|
+
a = e[t[0]][t[1]][t[2]];
|
|
232
|
+
break;
|
|
233
|
+
case 4:
|
|
234
|
+
a = e[t[0]][t[1]][t[2]][t[3]];
|
|
235
|
+
break;
|
|
236
|
+
case 5:
|
|
237
|
+
a = e[t[0]][t[1]][t[2]][t[3]][t[4]];
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
a != null ? y(a, r) : console.log(`Hermes - Can't set props because target isn't found: ${s}`, r);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function C(e) {
|
|
244
|
+
return new Promise((s, r) => {
|
|
245
|
+
const t = new Image();
|
|
246
|
+
t.onload = () => {
|
|
247
|
+
const n = new p(t);
|
|
248
|
+
n.wrapS = c, n.wrapT = c, n.needsUpdate = !0, s(n);
|
|
249
|
+
}, t.onerror = r, t.src = e;
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
export {
|
|
253
|
+
w as determineIcon,
|
|
254
|
+
T as getSubItem,
|
|
255
|
+
k as setItemProps,
|
|
256
|
+
x as stripObject,
|
|
257
|
+
m as stripScene,
|
|
258
|
+
C as textureFromSrc
|
|
259
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { EventDispatcher as r } from "three";
|
|
2
|
+
import { TransformControls as a } from "three/examples/jsm/controls/TransformControls.js";
|
|
3
|
+
import { ToolEvents as c } from "../../core/remote/RemoteThree.js";
|
|
4
|
+
import l from "../multiView/MultiView.js";
|
|
5
|
+
import { dispose as n } from "../../utils/three.js";
|
|
6
|
+
class s extends r {
|
|
7
|
+
static DRAG_START = "Transform::dragStart";
|
|
8
|
+
static DRAG_END = "Transform::dragEnd";
|
|
9
|
+
static _instance;
|
|
10
|
+
three;
|
|
11
|
+
activeCamera;
|
|
12
|
+
controls = /* @__PURE__ */ new Map();
|
|
13
|
+
visibility = /* @__PURE__ */ new Map();
|
|
14
|
+
setApp(t) {
|
|
15
|
+
this.three = t, this.three.addEventListener(c.SET_SCENE, this.setScene);
|
|
16
|
+
}
|
|
17
|
+
clear() {
|
|
18
|
+
for (const t of this.controls.values()) {
|
|
19
|
+
t.detach(), t.disconnect();
|
|
20
|
+
const e = t.getHelper();
|
|
21
|
+
n(e);
|
|
22
|
+
}
|
|
23
|
+
this.controls = /* @__PURE__ */ new Map(), this.visibility = /* @__PURE__ */ new Map();
|
|
24
|
+
}
|
|
25
|
+
add(t) {
|
|
26
|
+
let e = this.controls.get(t);
|
|
27
|
+
if (e === void 0) {
|
|
28
|
+
const i = document.querySelector(".clickable");
|
|
29
|
+
e = new a(this.activeCamera, i), e.getHelper().name = t, e.setSize(0.5), e.setSpace("local"), this.controls.set(t, e), this.visibility.set(t, !0), e.addEventListener("mouseDown", () => {
|
|
30
|
+
this.dispatchEvent({ type: s.DRAG_START });
|
|
31
|
+
}), e.addEventListener("mouseUp", () => {
|
|
32
|
+
this.dispatchEvent({ type: s.DRAG_END });
|
|
33
|
+
}), e.addEventListener("dragging-changed", (o) => {
|
|
34
|
+
l.instance?.toggleOrbitControls(o.value);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return e;
|
|
38
|
+
}
|
|
39
|
+
get(t) {
|
|
40
|
+
return this.controls.get(t);
|
|
41
|
+
}
|
|
42
|
+
remove(t) {
|
|
43
|
+
const e = this.get(t);
|
|
44
|
+
return e === void 0 ? !1 : (e.detach(), e.disconnect(), n(e.getHelper()), this.controls.delete(t), !0);
|
|
45
|
+
}
|
|
46
|
+
enabled(t) {
|
|
47
|
+
this.controls.forEach((e) => {
|
|
48
|
+
e.enabled = t;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
updateCamera(t, e) {
|
|
52
|
+
this.activeCamera = t, this.controls.forEach((i) => {
|
|
53
|
+
i.camera !== t && (i.camera = t, t.getWorldPosition(i.cameraPosition), t.getWorldQuaternion(i.cameraQuaternion)), i.domElement !== e && (i.disconnect(), i.domElement = e, i.connect(e));
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
show() {
|
|
57
|
+
this.controls.forEach((t) => {
|
|
58
|
+
const e = t.getHelper(), i = this.visibility.get(e.name);
|
|
59
|
+
i !== void 0 && (e.visible = i);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
hide() {
|
|
63
|
+
this.controls.forEach((t) => {
|
|
64
|
+
const e = t.getHelper();
|
|
65
|
+
this.visibility.set(e.name, e.visible), e.visible = !1;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
setScene = () => {
|
|
69
|
+
this.clear();
|
|
70
|
+
};
|
|
71
|
+
static get instance() {
|
|
72
|
+
return s._instance || (s._instance = new s()), s._instance;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
s as default
|
|
77
|
+
};
|