@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.
Files changed (66) hide show
  1. package/dist/{ThreeEditor-CTkjs-SY.js → ThreeEditor-CB5dBR7Q.js} +1 -1
  2. package/dist/core/Application.js +77 -0
  3. package/dist/core/remote/BaseRemote.js +33 -0
  4. package/dist/core/remote/RemoteTheatre.js +253 -0
  5. package/dist/core/remote/RemoteThree.js +442 -0
  6. package/dist/core/types.js +7 -0
  7. package/dist/editor/Editor.js +12 -0
  8. package/dist/editor/HermesApp.js +24 -0
  9. package/dist/editor/ThreeEditor.js +22 -0
  10. package/dist/editor/components/Draggable.js +40 -0
  11. package/dist/editor/components/DraggableItem.js +25 -0
  12. package/dist/editor/components/Dropdown.js +32 -0
  13. package/dist/editor/components/DropdownItem.js +50 -0
  14. package/dist/editor/components/NavButton.js +7 -0
  15. package/dist/editor/components/content.js +4 -0
  16. package/dist/editor/components/icons/CloseIcon.js +9 -0
  17. package/dist/editor/components/icons/DragIcon.js +12 -0
  18. package/dist/editor/multiView/CameraWindow.js +64 -0
  19. package/dist/editor/multiView/DepthNodeMaterial.js +12 -0
  20. package/dist/editor/multiView/InfiniteGridHelper.js +31 -0
  21. package/dist/editor/multiView/InfiniteGridHelperGPU.js +31 -0
  22. package/dist/editor/multiView/InfiniteGridMaterial.js +137 -0
  23. package/dist/editor/multiView/InfiniteGridNodeMaterial.js +63 -0
  24. package/dist/editor/multiView/MultiView.js +890 -0
  25. package/dist/editor/multiView/Toggle.js +25 -0
  26. package/dist/editor/multiView/UVMaterial.js +60 -0
  27. package/dist/editor/multiView/UVNodeMaterial.js +10 -0
  28. package/dist/editor/sidePanel/Accordion.js +56 -0
  29. package/dist/editor/sidePanel/ChildObject.js +78 -0
  30. package/dist/editor/sidePanel/ContainerObject.js +11 -0
  31. package/dist/editor/sidePanel/DebugData.js +133 -0
  32. package/dist/editor/sidePanel/SidePanel.js +91 -0
  33. package/dist/editor/sidePanel/inspector/InspectGrid3.js +82 -0
  34. package/dist/editor/sidePanel/inspector/InspectGrid4.js +58 -0
  35. package/dist/editor/sidePanel/inspector/InspectImage.js +100 -0
  36. package/dist/editor/sidePanel/inspector/InspectNumber.js +76 -0
  37. package/dist/editor/sidePanel/inspector/InspectVector2.js +154 -0
  38. package/dist/editor/sidePanel/inspector/Inspector.js +95 -0
  39. package/dist/editor/sidePanel/inspector/InspectorField.js +128 -0
  40. package/dist/editor/sidePanel/inspector/InspectorGroup.js +110 -0
  41. package/dist/editor/sidePanel/inspector/utils/DragNumber.js +27 -0
  42. package/dist/editor/sidePanel/inspector/utils/InspectAnimation.js +99 -0
  43. package/dist/editor/sidePanel/inspector/utils/InspectCamera.js +91 -0
  44. package/dist/editor/sidePanel/inspector/utils/InspectLight.js +85 -0
  45. package/dist/editor/sidePanel/inspector/utils/InspectMaterial.js +861 -0
  46. package/dist/editor/sidePanel/inspector/utils/InspectTransform.js +93 -0
  47. package/dist/editor/sidePanel/utils.js +259 -0
  48. package/dist/editor/tools/Transform.js +77 -0
  49. package/dist/editor/tools/splineEditor/Spline.js +348 -0
  50. package/dist/editor/tools/splineEditor/index.js +193 -0
  51. package/dist/editor/utils.js +27 -0
  52. package/dist/hermes.cjs.js +8 -30
  53. package/dist/{index-BpKOzCuX.js → index-DepTXu6T.js} +454 -454
  54. package/dist/index.html +1 -1
  55. package/dist/index.js +125 -0
  56. package/dist/utils/ImageSequenceCapturer.js +148 -0
  57. package/dist/utils/detectSettings.js +46 -0
  58. package/dist/utils/math.js +68 -0
  59. package/dist/utils/post.js +206 -0
  60. package/dist/utils/theatre.js +316 -0
  61. package/dist/utils/three.js +199 -0
  62. package/dist/webworkers/EventHandling.js +115 -0
  63. package/dist/webworkers/ProxyManager.js +76 -0
  64. package/package.json +13 -7
  65. package/dist/.vite/manifest.json +0 -12
  66. package/dist/hermes.es.js +0 -8077
@@ -0,0 +1,348 @@
1
+ import { Object3D as d, CatmullRomCurve3 as p, MeshBasicMaterial as g, Color as P, LineBasicMaterial as y, Line as _, BufferGeometry as u, Mesh as m, SphereGeometry as S, Raycaster as w, BoxGeometry as C, Vector3 as b, Vector2 as x } from "three/webgpu";
2
+ import { lerp as a } from "three/src/math/MathUtils.js";
3
+ import o from "../../multiView/MultiView.js";
4
+ import f from "../Transform.js";
5
+ import { copyToClipboard as k } from "../../utils.js";
6
+ import { roundTo as h } from "../../../utils/math.js";
7
+ import { dispose as v } from "../../../utils/three.js";
8
+ const M = new C(), l = new x();
9
+ class B extends d {
10
+ curve = new p();
11
+ line;
12
+ draggable;
13
+ curvePos;
14
+ // Variables
15
+ tension = 0.5;
16
+ closed = !1;
17
+ subdivide = 50;
18
+ curveType;
19
+ offset = 1;
20
+ lineMaterial;
21
+ _camera;
22
+ _curvePercentage = 0;
23
+ _draggableScale = 10;
24
+ _transform;
25
+ raycaster;
26
+ draggedMat = new g();
27
+ parentGroup;
28
+ group;
29
+ constructor(e, t) {
30
+ const i = new P(a(0.5, 1, Math.random()), a(0.5, 1, Math.random()), a(0.5, 1, Math.random()));
31
+ super(), this.name = e, this.lineMaterial = new y({ color: i }), this.line = new _(new u(), this.lineMaterial), this.line.name = "line", this.line.visible = !1, this.add(this.line), this._camera = t, this.curveType = "catmullrom", this.draggedMat.color = i, this.draggable = new d(), this.draggable.name = "draggablePoints", this.add(this.draggable), this.curvePos = new m(new S(1.5), new g({ color: i })), this.curvePos.name = "curvePos", this.curvePos.scale.setScalar(this._draggableScale), this.curvePos.visible = !1, this.add(this.curvePos), this.raycaster = new w(), this.raycaster.params.Line.threshold = 3, this.enable();
32
+ }
33
+ enable() {
34
+ document.addEventListener("pointerdown", this.onMouseClick);
35
+ }
36
+ disable() {
37
+ document.removeEventListener("pointerdown", this.onMouseClick);
38
+ }
39
+ dispose = () => {
40
+ this._transform && (this._transform.removeEventListener("objectChange", this.updateSpline), f.instance.remove(this.name)), this.disable(), this.parentGroup.removeGroup(this.name);
41
+ };
42
+ hideTransform = () => {
43
+ this._transform?.detach();
44
+ };
45
+ exportSpline = () => {
46
+ const e = [];
47
+ this.draggable.children.forEach((t) => {
48
+ e.push([
49
+ h(t.position.x, 3),
50
+ h(t.position.y, 3),
51
+ h(t.position.z, 3)
52
+ ]);
53
+ }), k({
54
+ name: this.name,
55
+ points: e,
56
+ tension: this.tension,
57
+ closed: this.closed,
58
+ subdivide: this.subdivide,
59
+ type: this.curveType
60
+ }), console.log("Spline copied!");
61
+ };
62
+ showPoints = (e = !0) => {
63
+ this.draggable.visible = e;
64
+ };
65
+ // Modifiers
66
+ addPoints = (e = []) => {
67
+ if (e.length > 0) {
68
+ const t = e.length - 1;
69
+ for (let i = 0; i < t; i++)
70
+ this.addPoint(e[i], !1);
71
+ this.addPoint(e[t]);
72
+ }
73
+ };
74
+ addPoint = (e, t = !0) => {
75
+ const i = this.draggable.children.length, r = new m(M, this.draggedMat);
76
+ r.name = `point_${i}`, r.position.copy(e), r.scale.setScalar(this._draggableScale), this.draggable.add(r), this._transform?.attach(r);
77
+ const n = this.points.length > 1;
78
+ return n && t && this.updateSpline(), this.line.visible = n, this.updateCurrentPoint(), r;
79
+ };
80
+ addNextPt = () => {
81
+ const e = this.draggable.children.length, t = e > 1 ? this.draggable.children[e - 1].position.clone() : new b(), i = this.addPoint(t);
82
+ this.updateField(i.position);
83
+ };
84
+ removePoint = (e) => {
85
+ if (this._transform?.object === e) {
86
+ this._transform?.detach();
87
+ const t = this.draggable.children[this.draggable.children.length - 1];
88
+ this._transform?.attach(t), this.updateField(t.position);
89
+ }
90
+ v(e), this.updateSpline();
91
+ };
92
+ removePointAt = (e) => {
93
+ const t = this.draggable.children[e];
94
+ this.removePoint(t);
95
+ };
96
+ removeSelectedPt = () => {
97
+ this._transform?.object !== void 0 && this.removePoint(this._transform?.object);
98
+ };
99
+ updateLastPoint(e) {
100
+ const t = this.draggable.children.length;
101
+ t > 0 && (this.draggable.children[t - 1].position.copy(e), this.updateSpline());
102
+ }
103
+ updateSpline = () => {
104
+ this.points.length < 2 || (this.curve = new p(this.points, this.closed, this.curveType, this.tension), this.line.geometry.dispose(), this.line.geometry = new u().setFromPoints(this.curve.getPoints(this.subdivide)), this.curvePos.position.copy(this.getPointAt(this._curvePercentage)));
105
+ };
106
+ updateField(e) {
107
+ this.group.current?.setField("Current Point", e);
108
+ }
109
+ // Handlers
110
+ onMouseClick = (e) => {
111
+ if (!o.instance || !o.instance.currentWindow || this._transform && !this._transform.getHelper().visible) return;
112
+ const i = o.instance.currentWindow.current.getBoundingClientRect();
113
+ l.x = (e.clientX - i.x) / i.width * 2 - 1, l.y = -((e.clientY - i.y) / i.height) * 2 + 1, this.raycaster.setFromCamera(l, this.camera);
114
+ const r = this.raycaster.intersectObjects(this.draggable.children, !1);
115
+ if (r.length > 0) {
116
+ const n = r[0].object;
117
+ n !== this._transform?.object && (this._transform?.attach(n), this.updateField(n.position));
118
+ }
119
+ };
120
+ // Getters
121
+ getPointAt(e) {
122
+ return this.curve.points.length > 1 ? this.curve.getPointAt(e) : this.curve.points.length === 1 ? this.curve.points[0] : new b();
123
+ }
124
+ getTangentAt(e) {
125
+ return this.curve.getTangentAt(e);
126
+ }
127
+ get points() {
128
+ const e = [];
129
+ return this.draggable.children.forEach((t) => {
130
+ e.push(t.position);
131
+ }), e;
132
+ }
133
+ get total() {
134
+ return this.draggable.children.length;
135
+ }
136
+ get draggableScale() {
137
+ return this._draggableScale;
138
+ }
139
+ set draggableScale(e) {
140
+ this._draggableScale = e, this.draggable.children.forEach((t) => t.scale.setScalar(e)), this.curvePos.scale.setScalar(e);
141
+ }
142
+ get camera() {
143
+ return this._camera;
144
+ }
145
+ set camera(e) {
146
+ this._camera = e, this._transform !== void 0 && (this._transform.camera = e);
147
+ }
148
+ get curvePercentage() {
149
+ return this._curvePercentage;
150
+ }
151
+ set curvePercentage(e) {
152
+ this._curvePercentage = e, this.curvePos.position.copy(this.getPointAt(e));
153
+ }
154
+ // Debug
155
+ updateCurrentPoint() {
156
+ if (this._transform?.object && this.group) {
157
+ const e = this._transform?.object;
158
+ e.name.search("point") > -1 && this.updateField(e.position);
159
+ }
160
+ }
161
+ onUpdateTransform = () => {
162
+ this.updateCurrentPoint(), this.updateSpline();
163
+ };
164
+ initDebug(e, t) {
165
+ const i = this.draggable.children;
166
+ this.visible = t, this.parentGroup = e, this._transform = f.instance.add(this.name), this._transform.camera = this._camera, this._transform.addEventListener("objectChange", this.onUpdateTransform), i.length > 0 && this._transform.attach(i[i.length - 1]), o.instance?.helpersContainer.add(this._transform.getHelper());
167
+ const r = i.length > 0 ? i[i.length - 1].position : { x: 0, y: 0, z: 0 };
168
+ this.group = e.addGroup({
169
+ title: this.name,
170
+ expanded: t,
171
+ items: [
172
+ {
173
+ prop: "Closed",
174
+ type: "boolean",
175
+ value: this.closed
176
+ },
177
+ {
178
+ prop: "Visible",
179
+ type: "boolean",
180
+ value: this.visible
181
+ },
182
+ {
183
+ prop: "Show Position",
184
+ type: "boolean",
185
+ value: this.curvePos.visible
186
+ },
187
+ {
188
+ prop: "Show Points",
189
+ type: "boolean",
190
+ value: this.draggable.visible
191
+ },
192
+ {
193
+ prop: "Color",
194
+ type: "color",
195
+ value: `#${this.draggedMat.color.getHexString()}`
196
+ },
197
+ {
198
+ prop: "Curve",
199
+ type: "option",
200
+ options: [
201
+ {
202
+ title: "Catmullrom",
203
+ value: "catmullrom"
204
+ },
205
+ {
206
+ title: "Centripetal",
207
+ value: "centripetal"
208
+ },
209
+ {
210
+ title: "Chordal",
211
+ value: "chordal"
212
+ }
213
+ ]
214
+ },
215
+ {
216
+ prop: "Draggable Scale",
217
+ type: "range",
218
+ min: 0.01,
219
+ max: 100,
220
+ step: 0.01,
221
+ value: this._draggableScale
222
+ },
223
+ {
224
+ prop: "Subdivide",
225
+ type: "range",
226
+ min: 1,
227
+ max: 1e3,
228
+ step: 1,
229
+ value: this.subdivide
230
+ },
231
+ {
232
+ prop: "Tension",
233
+ type: "range",
234
+ min: 0,
235
+ max: 1,
236
+ step: 0.01,
237
+ value: this.tension
238
+ },
239
+ {
240
+ prop: "New Pt Offset",
241
+ type: "range",
242
+ min: 0,
243
+ max: 10,
244
+ value: this.offset
245
+ },
246
+ {
247
+ prop: "Curve At",
248
+ type: "range",
249
+ min: 0,
250
+ max: 1,
251
+ step: 0.01,
252
+ value: 0
253
+ },
254
+ {
255
+ prop: "Toggle Transform",
256
+ type: "button"
257
+ },
258
+ {
259
+ prop: "Add Point",
260
+ type: "button"
261
+ },
262
+ {
263
+ prop: "Remove Point",
264
+ type: "button"
265
+ },
266
+ {
267
+ prop: "Export",
268
+ type: "button"
269
+ },
270
+ {
271
+ prop: "Delete",
272
+ type: "button"
273
+ },
274
+ {
275
+ prop: "Current Point",
276
+ type: "grid3",
277
+ value: r
278
+ }
279
+ ],
280
+ onUpdate: (n, s) => {
281
+ switch (n) {
282
+ case "Closed":
283
+ this.closed = s, this.updateSpline();
284
+ break;
285
+ case "Visible":
286
+ this.visible = s;
287
+ break;
288
+ case "Color":
289
+ this.lineMaterial.color.setStyle(s), this.draggedMat.color.setStyle(s);
290
+ break;
291
+ case "Curve":
292
+ this.curveType = s, this.updateSpline();
293
+ break;
294
+ case "Draggable Scale":
295
+ this.draggableScale = s;
296
+ break;
297
+ case "Subdivide":
298
+ this.subdivide = s, this.updateSpline();
299
+ break;
300
+ case "Tension":
301
+ this.tension = s, this.updateSpline();
302
+ break;
303
+ case "New Pt Offset":
304
+ this.offset = s;
305
+ break;
306
+ case "Curve At":
307
+ this.curvePos.position.copy(this.getPointAt(s));
308
+ break;
309
+ case "Show Position":
310
+ this.curvePos.visible = s;
311
+ break;
312
+ case "Show Points":
313
+ this.draggable.visible = s;
314
+ break;
315
+ case "Toggle Transform":
316
+ this._transform && (this._transform.getHelper().visible = !this._transform.getHelper().visible);
317
+ break;
318
+ case "Add Point":
319
+ this.addNextPt();
320
+ break;
321
+ case "Remove Point":
322
+ this.removeSelectedPt();
323
+ break;
324
+ case "Export":
325
+ this.exportSpline();
326
+ break;
327
+ case "Delete":
328
+ this.parent.currentSpline = null, v(this);
329
+ break;
330
+ case "Current Point":
331
+ if (this.group.current && this._transform?.object) {
332
+ const c = this._transform?.object;
333
+ c.name.search("point") > -1 && (c.position.copy(s), this.updateSpline());
334
+ }
335
+ break;
336
+ }
337
+ }
338
+ }), this.draggable.children.forEach((n) => {
339
+ this.debugPoint(n);
340
+ });
341
+ }
342
+ debugPoint = (e) => {
343
+ e.name, e.visible = this.draggable.visible;
344
+ };
345
+ }
346
+ export {
347
+ B as default
348
+ };
@@ -0,0 +1,193 @@
1
+ import { Object3D as M, Vector3 as m, Raycaster as P, Vector2 as x } from "three";
2
+ import w from "./Spline.js";
3
+ import D from "../../sidePanel/DebugData.js";
4
+ import g from "../../multiView/MultiView.js";
5
+ import { ToolEvents as C } from "../../../core/remote/RemoteThree.js";
6
+ let S = 0;
7
+ class N extends M {
8
+ defaultScale = 10;
9
+ currentSpline = null;
10
+ _camera;
11
+ group = null;
12
+ three;
13
+ splineDataText = "";
14
+ constructor(e, t) {
15
+ super(), this.name = "Spline Editor", this._camera = e, this.three = t, this.three.addEventListener(C.ADD_SPLINE, this.onAddSpline);
16
+ }
17
+ initDebug() {
18
+ this.group = D.addEditorGroup({
19
+ title: this.name,
20
+ items: [
21
+ {
22
+ type: "field",
23
+ prop: "Spline Data",
24
+ value: "",
25
+ disabled: !1
26
+ },
27
+ {
28
+ type: "button",
29
+ prop: "Import Spline"
30
+ },
31
+ {
32
+ type: "button",
33
+ prop: "New Spline"
34
+ },
35
+ {
36
+ type: "boolean",
37
+ prop: "Show Points",
38
+ value: !0
39
+ },
40
+ {
41
+ type: "boolean",
42
+ prop: "Draw Mode",
43
+ value: !1
44
+ },
45
+ {
46
+ type: "boolean",
47
+ prop: "Visible",
48
+ value: this.visible
49
+ },
50
+ {
51
+ type: "range",
52
+ prop: "Default Scale",
53
+ min: 0,
54
+ max: 50,
55
+ step: 0.01,
56
+ value: this.defaultScale
57
+ }
58
+ ],
59
+ onUpdate: (e, t) => {
60
+ switch (e) {
61
+ case "New Spline":
62
+ this.createSpline();
63
+ break;
64
+ case "Spline Data":
65
+ this.splineDataText = t;
66
+ break;
67
+ case "Import Spline":
68
+ this.createSplineFromJSON(JSON.parse(this.splineDataText));
69
+ break;
70
+ case "Show Points":
71
+ this.showPoints(t);
72
+ break;
73
+ case "Visible":
74
+ this.visible = t;
75
+ break;
76
+ case "Default Scale":
77
+ this.defaultScale = t;
78
+ break;
79
+ case "Draw Mode":
80
+ t ? this.enableClickToDraw() : this.disableClickToDraw();
81
+ break;
82
+ }
83
+ }
84
+ });
85
+ }
86
+ dispose() {
87
+ this.three.removeEventListener(C.ADD_SPLINE, this.onAddSpline), D.removeEditorGroup(this.name);
88
+ }
89
+ addSpline(e, t) {
90
+ e.draggableScale = this.defaultScale, e.hideTransform(), this.group?.current !== null && e.initDebug(this.group.current, t), this.add(e), this.currentSpline = e;
91
+ }
92
+ createSpline = (e = []) => {
93
+ const t = `Spline ${S + 1}`, i = new w(t, this._camera);
94
+ return i.addPoints(e), this.addSpline(i, !0), S++, i;
95
+ };
96
+ createSplineFromArray = (e) => {
97
+ const t = [];
98
+ return e.forEach((i) => {
99
+ t.push(new m(i[0], i[1], i[2]));
100
+ }), this.createSpline(t);
101
+ };
102
+ createSplineFromCatmullRom = (e) => this.createSpline(e.points);
103
+ createSplineFromJSON = (e) => {
104
+ const t = [];
105
+ e.points.forEach((n) => {
106
+ t.push(new m(n[0], n[1], n[2]));
107
+ });
108
+ const i = new w(e.name, this._camera);
109
+ return i.closed = e.closed, i.subdivide = e.subdivide, i.tension = e.tension, i.type = e.type, i.addPoints(t), i.updateSpline(), this.addSpline(i, !1), i;
110
+ };
111
+ showPoints = (e = !0) => {
112
+ this.children.forEach((t) => {
113
+ t.showPoints(e);
114
+ });
115
+ };
116
+ onAddSpline = (e) => {
117
+ const t = JSON.parse(e.value), i = t.name !== void 0 ? t.name : `Spline ${S + 1}`, n = new w(i, this.camera);
118
+ t.tension !== void 0 && (n.tension = t.tension), t.closed !== void 0 && (n.closed = t.closed), t.subdivide !== void 0 && (n.subdivide = t.subdivide), t.type !== void 0 && (n.curveType = t.type);
119
+ const s = [];
120
+ t.points.forEach((r) => {
121
+ s.push(new m(r[0], r[1], r[2]));
122
+ }), n.addPoints(s), this.addSpline(n, !1), S++;
123
+ };
124
+ isMouseDown = !1;
125
+ enableClickToDraw() {
126
+ document.querySelectorAll(".clickable").forEach((e) => {
127
+ e.addEventListener("mousedown", this.onClickCanvas), e.addEventListener("mousemove", this.onMouseMove), e.addEventListener("mouseup", this.onMouseUp);
128
+ });
129
+ }
130
+ disableClickToDraw() {
131
+ document.querySelectorAll(".clickable").forEach((e) => {
132
+ e.removeEventListener("mousedown", this.onClickCanvas), e.removeEventListener("mousemove", this.onMouseMove), e.removeEventListener("mouseup", this.onMouseUp);
133
+ });
134
+ }
135
+ onClickCanvas = (e) => {
136
+ if (e.button !== 0) return;
137
+ if (this._camera.type !== "OrthographicCamera") {
138
+ console.warn("Spline Editor - 3D Camera not supported in Draw Mode");
139
+ return;
140
+ }
141
+ const i = e.target.getBoundingClientRect(), n = (e.clientX - i.left) / i.width * 2 - 1, s = -((e.clientY - i.top) / i.height) * 2 + 1;
142
+ if (g.instance) {
143
+ const o = new P();
144
+ o.setFromCamera(new x(n, s), this._camera);
145
+ const c = o.intersectObjects(g.instance.helpersContainer.children, !0);
146
+ for (let l = 0; l < c.length; l++) {
147
+ const a = c[l];
148
+ if (!(a.object.isLine || a.object.isTransformControlsPlane) && a.object.isObject3D)
149
+ return;
150
+ }
151
+ }
152
+ this.currentSpline === null && (this.currentSpline = this.createSpline());
153
+ const r = this.mouseToSplinePos(n, s, i.width, i.height);
154
+ this.currentSpline?.addPoint(r), this.isMouseDown = !0;
155
+ };
156
+ onMouseMove = (e) => {
157
+ if (!this.isMouseDown) return;
158
+ const i = e.target.getBoundingClientRect(), n = (e.clientX - i.left) / i.width * 2 - 1, s = -((e.clientY - i.top) / i.height) * 2 + 1, r = this.mouseToSplinePos(n, s, i.width, i.height);
159
+ this.currentSpline?.updateLastPoint(r), this.currentSpline?.updateField(r);
160
+ };
161
+ onMouseUp = () => {
162
+ this.isMouseDown = !1;
163
+ };
164
+ mouseToSplinePos(e, t, i, n) {
165
+ const s = new m(), r = Math.PI / 2, o = this._camera, c = o.zoom, l = o.rotation.x === -6123233995736766e-32 && o.rotation.y === 0 && o.rotation.z === 0, a = o.rotation.x === -Math.PI && o.rotation.y === 12246467991473532e-32 && o.rotation.z === Math.PI, E = o.rotation.x === -6162975822039155e-48 && o.rotation.y === -r && o.rotation.z === 0, v = o.rotation.x === -6162975822039155e-48 && o.rotation.y === r && o.rotation.z === 0, y = o.rotation.x === -1.5707953264174506 && o.rotation.y === 0 && o.rotation.z === 0, k = o.rotation.x === 1.5707953264174506 && o.rotation.y === 0 && o.rotation.z === 0;
166
+ let p = e, d = t;
167
+ a || v ? p *= -1 : y && (d *= -1);
168
+ const f = i / 2 / c, b = n / 2 / c;
169
+ if (this.currentSpline === null && (this.currentSpline = this.createSpline()), l || a) {
170
+ const h = p * f + o.position.x, u = d * b + o.position.y;
171
+ s.set(h, u, 0);
172
+ } else if (E || v) {
173
+ const h = p * f + o.position.z, u = d * b + o.position.y;
174
+ s.set(0, u, h);
175
+ } else if (y || k) {
176
+ const h = p * f + o.position.x, u = d * b + o.position.z;
177
+ s.set(h, 0, u);
178
+ }
179
+ return s;
180
+ }
181
+ get camera() {
182
+ return this._camera;
183
+ }
184
+ set camera(e) {
185
+ this._camera = e, this.children.forEach((t) => {
186
+ const i = t;
187
+ i.camera = e;
188
+ });
189
+ }
190
+ }
191
+ export {
192
+ N as default
193
+ };
@@ -0,0 +1,27 @@
1
+ function d(t) {
2
+ return t.substring(0, 1).toUpperCase() + t.substring(1);
3
+ }
4
+ function g(t) {
5
+ const n = JSON.stringify(t);
6
+ return navigator.clipboard.writeText(n), n;
7
+ }
8
+ function h() {
9
+ return Math.round(Math.random() * 1e6).toString();
10
+ }
11
+ function p(t) {
12
+ return t.r !== void 0 && t.g !== void 0 && t.b !== void 0;
13
+ }
14
+ function f(t) {
15
+ const n = Math.round(t.r * 255), e = Math.round(t.g * 255), i = Math.round(t.b * 255), r = (a) => {
16
+ const o = a.toString(16);
17
+ return o.length === 1 ? "0" + o : o;
18
+ }, c = r(n), u = r(e), s = r(i);
19
+ return "#" + c + u + s;
20
+ }
21
+ export {
22
+ d as capitalize,
23
+ f as colorToHex,
24
+ g as copyToClipboard,
25
+ p as isColor,
26
+ h as randomID
27
+ };