@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.5d2eede → 6.4.0-pr.revamp.667.853b1ff
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/README.md +56 -5
- package/dist/3d.cjs +1 -1
- package/dist/3d.d.ts +12 -1
- package/dist/3d.js +43 -24
- package/dist/CurrentPose/index.cjs +1 -0
- package/dist/CurrentPose/index.d.ts +3 -0
- package/dist/CurrentPose/index.js +9 -0
- package/dist/CurrentPoseBar/index.cjs +1 -1
- package/dist/CurrentPoseBar/index.js +1 -1
- package/dist/JoggingButtons/index.cjs +1 -1
- package/dist/JoggingButtons/index.js +1 -1
- package/dist/JoggingGizmo/index.cjs +1 -1
- package/dist/JoggingGizmo/index.d.ts +1 -0
- package/dist/JoggingGizmo/index.js +2 -2
- package/dist/JoggingJointSlider/index.cjs +1 -1
- package/dist/JoggingJointSlider/index.js +1 -1
- package/dist/RobotControl/index.cjs +1 -0
- package/dist/RobotControl/index.d.ts +3 -0
- package/dist/RobotControl/index.js +9 -0
- package/dist/RobotControlPanel/index.cjs +1 -1
- package/dist/RobotControlPanel/index.js +1 -1
- package/dist/RobotHeader/index.cjs +1 -1
- package/dist/RobotHeader/index.d.ts +4 -0
- package/dist/RobotHeader/index.js +8 -3
- package/dist/RobotScene/index.cjs +1 -0
- package/dist/RobotScene/index.d.ts +5 -0
- package/dist/RobotScene/index.js +11 -0
- package/dist/RobotView/index.cjs +1 -0
- package/dist/RobotView/index.d.ts +4 -0
- package/dist/RobotView/index.js +9 -0
- package/dist/SafetyBar/index.cjs +1 -1
- package/dist/SafetyBar/index.d.ts +1 -0
- package/dist/SafetyBar/index.js +4 -3
- package/dist/chunks/CurrentPose-DQ-FaAnr.js +52 -0
- package/dist/chunks/CurrentPose-fWc6ySnk.cjs +1 -0
- package/dist/chunks/{CurrentPoseBar-zTZi68tY.js → CurrentPoseBar-B3-XLeu2.js} +2 -2
- package/dist/chunks/{CurrentPoseBar-CyHUWmjM.cjs → CurrentPoseBar-CSHQ26mR.cjs} +1 -1
- package/dist/chunks/{JoggingButtons-CXaozFVz.js → JoggingButtons-D4S2oJGt.js} +1 -1
- package/dist/chunks/{JoggingButtons-CbL-5LMK.cjs → JoggingButtons-nXLqJLIr.cjs} +1 -1
- package/dist/chunks/{JoggingGizmo-SuS9MmL7.js → JoggingGizmo-9wEBSe1P.js} +301 -280
- package/dist/chunks/JoggingGizmo-BJ3wDpAJ.cjs +1 -0
- package/dist/chunks/{JoggingGizmoOrientation-dzned4f4.cjs → JoggingGizmoOrientation-D9VS6nag.cjs} +1 -1
- package/dist/chunks/{JoggingGizmoOrientation-x_crT_64.js → JoggingGizmoOrientation-DYeHwowd.js} +1 -1
- package/dist/chunks/{JoggingJointSlider-R3_A9Ppj.cjs → JoggingJointSlider-D7AsxkrT.cjs} +1 -1
- package/dist/chunks/{JoggingJointSlider-CZ-k6XCa.js → JoggingJointSlider-DQneQhXH.js} +1 -1
- package/dist/chunks/Pose3-B_fLR-Wv.js +80 -0
- package/dist/chunks/Pose3-Ch4xVeXV.cjs +1 -0
- package/dist/chunks/PoseTransformer-dP4nzrPG.cjs +1 -0
- package/dist/chunks/PoseTransformer-tafab65c.js +454 -0
- package/dist/chunks/Robot-DEJXhv-D.cjs +1 -0
- package/dist/chunks/Robot-IG0yo_YD.js +428 -0
- package/dist/chunks/RobotControl-0tL4CY3m.cjs +1 -0
- package/dist/chunks/RobotControl-C59I0tMh.js +317 -0
- package/dist/chunks/RobotControlPanel-BXUgib6Z.cjs +1 -0
- package/dist/chunks/{RobotControlPanel-BiLexAWI.js → RobotControlPanel-BzqLtecA.js} +264 -262
- package/dist/chunks/RobotScene-BS77SUtN.js +1230 -0
- package/dist/chunks/RobotScene-BjctJ5z1.cjs +1 -0
- package/dist/chunks/RobotSessionProvider--AekyPqD.cjs +1 -0
- package/dist/chunks/RobotSessionProvider-TVaKGzqa.js +25 -0
- package/dist/chunks/RobotView-BlV3MdCy.cjs +1 -0
- package/dist/chunks/RobotView-CGvHcO7j.js +158 -0
- package/dist/chunks/{converters-DAr6IQbG.js → converters-D9KpJ2HD.js} +2 -2
- package/dist/chunks/coordSystemLabel-BThpFG9n.cjs +1 -0
- package/dist/chunks/coordSystemLabel-Bfy9MUsV.js +6 -0
- package/dist/chunks/externalizeComponent-BW1UV6Gh.cjs +2 -0
- package/dist/chunks/{externalizeComponent-_w2d1_pz.js → externalizeComponent-TgclPxwg.js} +34 -10
- package/dist/chunks/{TrajectoryExecutionStore-DYVukgCz.js → loadRobotSession-BrXLZLOr.js} +1987 -1202
- package/dist/chunks/loadRobotSession-D84myCwy.cjs +3 -0
- package/dist/chunks/robotActivationOf-BCKyEgny.cjs +1 -0
- package/dist/chunks/robotActivationOf-DUbbBf7J.js +480 -0
- package/dist/chunks/{SafetyBar-RkN0I1Cb.js → robotSafetyOf-BGSW_Ql3.js} +45 -35
- package/dist/chunks/{SafetyBar-BVk-SH_0.cjs → robotSafetyOf-Y4NuRInk.cjs} +1 -1
- package/dist/chunks/useEveryFrame-CHxg25f4.cjs +1 -0
- package/dist/chunks/useEveryFrame-DAuNawGP.js +155 -0
- package/dist/chunks/useWebGLRenderer-BozrbZz-.js +45 -0
- package/dist/chunks/useWebGLRenderer-CtddVDDb.cjs +1 -0
- package/dist/components/connectionWarning/ConnectionWarning.d.ts +21 -0
- package/dist/components/connectionWarning/connectionWarningOf.d.ts +11 -0
- package/dist/components/connectionWarning/timeAgo.d.ts +5 -0
- package/dist/components/currentPoseBar/CurrentPose.d.ts +23 -0
- package/dist/components/currentPoseBar/useCurrentPoseProps.d.ts +16 -0
- package/dist/components/jogging/coordSystemLabel.d.ts +7 -0
- package/dist/components/jogging/gizmo/JoggingGizmo.d.ts +8 -1
- package/dist/components/robotControl/JogArea.d.ts +5 -2
- package/dist/components/robotControl/RobotControl.d.ts +23 -0
- package/dist/components/robotControl/poseText.d.ts +21 -5
- package/dist/components/robotControl/useRobotControlProps.d.ts +28 -0
- package/dist/components/robotHeader/robotActivationOf.d.ts +8 -0
- package/dist/components/robotHeader/robotSafetyOf.d.ts +11 -0
- package/dist/components/robotScene/JoggingAxes.d.ts +38 -0
- package/dist/components/robotScene/RobotScene.d.ts +28 -0
- package/dist/components/robotScene/RobotSceneView.d.ts +53 -0
- package/dist/components/robotScene/useRobotSceneProps.d.ts +18 -0
- package/dist/components/robotSession/RobotSessionProvider.d.ts +13 -0
- package/dist/components/robotView/RobotCanvas.d.ts +42 -0
- package/dist/components/robotView/RobotView.d.ts +23 -0
- package/dist/components/robotView/WebGLUnavailable.d.ts +5 -0
- package/dist/components/robots/DHRobot.d.ts +1 -1
- package/dist/components/robots/GenericRobot.d.ts +16 -1
- package/dist/components/robots/LinearAxis.d.ts +12 -11
- package/dist/components/robots/LinearAxisAnimator.d.ts +1 -1
- package/dist/components/robots/Robot.d.ts +26 -9
- package/dist/components/robots/SupportedLinearAxis.d.ts +16 -3
- package/dist/components/robots/SupportedRobot.d.ts +21 -3
- package/dist/components/robots/ghostStyle.d.ts +21 -0
- package/dist/components/robots/modelRotation.d.ts +14 -0
- package/dist/components/robots/robotModelLogic.d.ts +138 -6
- package/dist/components/robots/robotModelSource.d.ts +51 -0
- package/dist/components/utils/useWebGLRenderer.d.ts +32 -0
- package/dist/components/utils/webglSupport.d.ts +11 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +17 -0
- package/dist/core.js +68 -39
- package/dist/index.cjs +1 -1
- package/dist/index.js +116 -68
- package/dist/lib/ConnectedMotionGroup.d.ts +5 -1
- package/dist/lib/controllerStateSource.d.ts +6 -4
- package/dist/lib/motionGroupModelResources.d.ts +1 -0
- package/dist/lib/nats/natsControllerStateSource.d.ts +27 -0
- package/dist/lib/robotSession/RobotActivation.d.ts +59 -0
- package/dist/lib/robotSession/RobotDescription.d.ts +84 -0
- package/dist/lib/robotSession/RobotLiveState.d.ts +56 -0
- package/dist/lib/robotSession/RobotLoadProgress.d.ts +72 -0
- package/dist/lib/robotSession/RobotSafety.d.ts +59 -0
- package/dist/lib/robotSession/RobotSession.d.ts +84 -0
- package/dist/lib/robotSession/RobotTargetPose.d.ts +78 -0
- package/dist/lib/robotSession/loadRobotResources.d.ts +46 -0
- package/dist/lib/robotSession/loadRobotSession.d.ts +81 -0
- package/dist/lib/robotSession/robotPose.d.ts +28 -0
- package/dist/nats.cjs +1 -0
- package/dist/nats.d.ts +4 -0
- package/dist/nats.js +131 -0
- package/package.json +11 -1
- package/dist/chunks/JoggingGizmo-DGbFLWgT.cjs +0 -1
- package/dist/chunks/Pose3-DIyg-aZA.cjs +0 -1
- package/dist/chunks/Pose3-pocKPrHN.js +0 -292
- package/dist/chunks/Robot-B3vKEVXP.cjs +0 -1
- package/dist/chunks/Robot-DXhaz1tq.js +0 -1272
- package/dist/chunks/RobotControlPanel-BXtBHEe9.cjs +0 -1
- package/dist/chunks/RobotHeader-DDmDkUoV.js +0 -244
- package/dist/chunks/RobotHeader-Daft80jq.cjs +0 -1
- package/dist/chunks/TrajectoryExecutionStore-CKfEoKo8.cjs +0 -3
- package/dist/chunks/externalizeComponent-BdxGBLIv.cjs +0 -2
- package/dist/chunks/useEveryFrame-G_-ma1nC.js +0 -142
- package/dist/chunks/useEveryFrame-dmPPTKtT.cjs +0 -1
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { jsxs as S, jsx as g, Fragment as bt } from "react/jsx-runtime";
|
|
2
|
+
import _ from "@mui/material/Box";
|
|
3
|
+
import Mt from "@mui/material/Typography";
|
|
4
|
+
import { useThree as At, useFrame as wt, Canvas as St } from "@react-three/fiber";
|
|
5
|
+
import { Fragment as Et, useRef as C, useEffect as k, useMemo as B, useState as et } from "react";
|
|
6
|
+
import { useTranslation as vt } from "react-i18next";
|
|
5
7
|
import { Vector3 as A, Quaternion as v, Matrix4 as ot } from "three";
|
|
6
|
-
import { e as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { e as Rt } from "./externalizeComponent-TgclPxwg.js";
|
|
9
|
+
import { u as Tt } from "./useWebGLRenderer-BozrbZz-.js";
|
|
10
|
+
import { c as _t, i as It, J as P, a as G, u as Ot } from "./joggingColors-CuT5u0H8.js";
|
|
11
|
+
import { alpha as q, useTheme as rt } from "@mui/material/styles";
|
|
12
|
+
const st = new A(0, 1, 0), $ = 0.26, at = 0.1, Pt = { x: "X", y: "Y", z: "Z" };
|
|
13
|
+
function z(t) {
|
|
11
14
|
var n;
|
|
12
|
-
return ((n =
|
|
15
|
+
return ((n = _t[Pt[t]].buttonBackgroundColor) == null ? void 0 : n.default) ?? "currentColor";
|
|
13
16
|
}
|
|
14
|
-
const
|
|
17
|
+
const Ft = 200;
|
|
15
18
|
function H(t) {
|
|
16
|
-
const n = t /
|
|
19
|
+
const n = t / Ft;
|
|
17
20
|
return {
|
|
18
21
|
/** Room around the gizmo for the labels, arrowheads and grab bars */
|
|
19
22
|
marginPx: 30 * n,
|
|
@@ -32,38 +35,38 @@ function H(t) {
|
|
|
32
35
|
labelFontPx: Math.max(10, 13 * n)
|
|
33
36
|
};
|
|
34
37
|
}
|
|
35
|
-
function
|
|
38
|
+
function $t(t, n, e) {
|
|
36
39
|
return Math.max(1, Math.min(t, n) / 2 - e);
|
|
37
40
|
}
|
|
38
|
-
function
|
|
39
|
-
const { gripPx: e, grab:
|
|
40
|
-
return { radiusPx: n, gripPx: e, headLength:
|
|
41
|
+
function Nt(t, n) {
|
|
42
|
+
const { gripPx: e, grab: i } = H(t);
|
|
43
|
+
return { radiusPx: n, gripPx: e, headLength: $, ...i };
|
|
41
44
|
}
|
|
42
|
-
function
|
|
43
|
-
const { gripPx: e, grab:
|
|
45
|
+
function Gt(t, n) {
|
|
46
|
+
const { gripPx: e, grab: i } = H(t);
|
|
44
47
|
return {
|
|
45
48
|
radiusPx: n,
|
|
46
49
|
gripPx: e,
|
|
47
|
-
beyondTipPx:
|
|
48
|
-
headLength:
|
|
50
|
+
beyondTipPx: i.beyondTipPx,
|
|
51
|
+
headLength: $
|
|
49
52
|
};
|
|
50
53
|
}
|
|
51
|
-
function
|
|
54
|
+
function F(t, n) {
|
|
52
55
|
return (e) => {
|
|
53
56
|
e ? t.current.set(n, e) : t.current.delete(n);
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
|
-
const R = (t) => `${t.axis}${t.direction}`, ct = (t) => `label:${t}`, it = [0, 1], lt = (t, n) => `half:${R(t)}:${n}`, ut = (t) => `halo:${R(t)}`, ht = (t) => `focus:${R(t)}`,
|
|
59
|
+
const R = (t) => `${t.axis}${t.direction}`, ct = (t) => `label:${t}`, it = [0, 1], lt = (t, n) => `half:${R(t)}:${n}`, ut = (t) => `halo:${R(t)}`, ht = (t) => `focus:${R(t)}`, j = "polygon(0 0, 0 0, 0 0)";
|
|
57
60
|
function pt(t, {
|
|
58
61
|
isPressed: n,
|
|
59
62
|
hovered: e,
|
|
60
|
-
disabled:
|
|
63
|
+
disabled: i
|
|
61
64
|
}) {
|
|
62
|
-
const s = n(t), r = !
|
|
65
|
+
const s = n(t), r = !i && (s || It(e, t));
|
|
63
66
|
return { pressed: s, lit: r };
|
|
64
67
|
}
|
|
65
68
|
function dt(t, { pressed: n, lit: e }) {
|
|
66
|
-
return n ?
|
|
69
|
+
return n ? q(t, 0.25) : e ? q(t, 0.12) : "transparent";
|
|
67
70
|
}
|
|
68
71
|
function ft(t, { onHover: n, handlersFor: e }) {
|
|
69
72
|
return {
|
|
@@ -76,83 +79,83 @@ const J = (t) => ({
|
|
|
76
79
|
cursor: t ? "default" : "pointer",
|
|
77
80
|
touchAction: "none",
|
|
78
81
|
userSelect: "none"
|
|
79
|
-
}), mt = (t) => `2px solid ${t.palette.primary.main}`,
|
|
82
|
+
}), mt = (t) => `2px solid ${t.palette.primary.main}`, D = {
|
|
80
83
|
x: new A(1, 0, 0),
|
|
81
84
|
y: new A(0, 1, 0),
|
|
82
85
|
z: new A(0, 0, 1)
|
|
83
86
|
};
|
|
84
|
-
function
|
|
87
|
+
function Lt(t, n, e = new v()) {
|
|
85
88
|
return e.copy(t).invert().multiply(n);
|
|
86
89
|
}
|
|
87
|
-
const
|
|
90
|
+
const zt = new v().setFromRotationMatrix(
|
|
88
91
|
new ot().makeBasis(
|
|
89
92
|
new A(1, 0, 0),
|
|
90
93
|
new A(0, 0, -1),
|
|
91
94
|
new A(0, 1, 0)
|
|
92
95
|
)
|
|
93
|
-
), W = new v(),
|
|
94
|
-
function
|
|
95
|
-
return t.up.z > 0.5 ?
|
|
96
|
+
), W = new v(), Ct = new v();
|
|
97
|
+
function Ht(t) {
|
|
98
|
+
return t.up.z > 0.5 ? Ct : zt;
|
|
96
99
|
}
|
|
97
|
-
function
|
|
98
|
-
return t.getWorldQuaternion(W),
|
|
100
|
+
function An(t, n = new v()) {
|
|
101
|
+
return t.getWorldQuaternion(W), Lt(W, Ht(t), n);
|
|
99
102
|
}
|
|
100
|
-
function
|
|
103
|
+
function kt(t, n, e = new v()) {
|
|
101
104
|
return e.copy(t).multiply(n);
|
|
102
105
|
}
|
|
103
|
-
const
|
|
106
|
+
const jt = 1e-8;
|
|
104
107
|
function K(t, n) {
|
|
105
|
-
return t ? Math.abs(t.dot(n)) < 1 -
|
|
106
|
-
}
|
|
107
|
-
function
|
|
108
|
-
const { disabled: n, label: e, overlay:
|
|
109
|
-
return
|
|
110
|
-
(u) =>
|
|
111
|
-
const
|
|
112
|
-
return /* @__PURE__ */
|
|
108
|
+
return t ? Math.abs(t.dot(n)) < 1 - jt : !0;
|
|
109
|
+
}
|
|
110
|
+
function Bt(t) {
|
|
111
|
+
const { disabled: n, label: e, overlay: i, size: s } = t, r = rt(), { gripPx: a } = H(s);
|
|
112
|
+
return P.flatMap(
|
|
113
|
+
(u) => G.map((o) => {
|
|
114
|
+
const l = { axis: u, direction: o }, d = pt(l, t), c = ft(l, t);
|
|
115
|
+
return /* @__PURE__ */ S(Et, { children: [
|
|
113
116
|
/* @__PURE__ */ g(
|
|
114
|
-
|
|
117
|
+
_,
|
|
115
118
|
{
|
|
116
119
|
component: "span",
|
|
117
120
|
"aria-hidden": !0,
|
|
118
|
-
ref:
|
|
121
|
+
ref: F(i, ut(l)),
|
|
119
122
|
sx: {
|
|
120
123
|
// Cut to the band along the arc by RotationScene
|
|
121
124
|
position: "absolute",
|
|
122
125
|
inset: 0,
|
|
123
|
-
clipPath:
|
|
126
|
+
clipPath: j,
|
|
124
127
|
pointerEvents: "none",
|
|
125
|
-
background: dt(
|
|
128
|
+
background: dt(z(u), d)
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
131
|
),
|
|
129
132
|
it.map((h) => /* @__PURE__ */ g(
|
|
130
|
-
|
|
133
|
+
_,
|
|
131
134
|
{
|
|
132
135
|
component: "span",
|
|
133
136
|
"aria-hidden": !0,
|
|
134
|
-
ref:
|
|
137
|
+
ref: F(i, lt(l, h)),
|
|
135
138
|
...c,
|
|
136
139
|
sx: {
|
|
137
140
|
// Covers the gizmo, cut to its half of the band by
|
|
138
141
|
// RotationScene, every frame the gizmo turns
|
|
139
142
|
position: "absolute",
|
|
140
143
|
inset: 0,
|
|
141
|
-
clipPath:
|
|
144
|
+
clipPath: j,
|
|
142
145
|
...J(n)
|
|
143
146
|
}
|
|
144
147
|
},
|
|
145
148
|
h
|
|
146
149
|
)),
|
|
147
150
|
/* @__PURE__ */ g(
|
|
148
|
-
|
|
151
|
+
_,
|
|
149
152
|
{
|
|
150
153
|
component: "button",
|
|
151
154
|
type: "button",
|
|
152
|
-
ref:
|
|
155
|
+
ref: F(i, R(l)),
|
|
153
156
|
disabled: n,
|
|
154
|
-
"aria-label": e(
|
|
155
|
-
"aria-pressed":
|
|
157
|
+
"aria-label": e(l),
|
|
158
|
+
"aria-pressed": d.pressed,
|
|
156
159
|
...c,
|
|
157
160
|
sx: {
|
|
158
161
|
// Placed on the arrowhead by RotationScene. It shows nothing
|
|
@@ -174,7 +177,7 @@ function Ct(t) {
|
|
|
174
177
|
}
|
|
175
178
|
),
|
|
176
179
|
/* @__PURE__ */ g(
|
|
177
|
-
|
|
180
|
+
_,
|
|
178
181
|
{
|
|
179
182
|
component: "svg",
|
|
180
183
|
"aria-hidden": !0,
|
|
@@ -195,7 +198,7 @@ function Ct(t) {
|
|
|
195
198
|
children: /* @__PURE__ */ g(
|
|
196
199
|
"path",
|
|
197
200
|
{
|
|
198
|
-
ref:
|
|
201
|
+
ref: F(i, ht(l)),
|
|
199
202
|
fill: "none",
|
|
200
203
|
stroke: r.palette.primary.main,
|
|
201
204
|
strokeWidth: 2,
|
|
@@ -204,37 +207,37 @@ function Ct(t) {
|
|
|
204
207
|
)
|
|
205
208
|
}
|
|
206
209
|
)
|
|
207
|
-
] }, R(
|
|
210
|
+
] }, R(l));
|
|
208
211
|
})
|
|
209
212
|
);
|
|
210
213
|
}
|
|
211
|
-
const
|
|
214
|
+
const N = 0.8, X = 0.45, yt = 2.25, gt = {
|
|
212
215
|
x: [new A(0, 1, 0), new A(0, 0, 1)],
|
|
213
216
|
y: [new A(-1, 0, 0), new A(0, 0, 1)],
|
|
214
217
|
z: [new A(1, 0, 0), new A(0, 1, 0)]
|
|
215
218
|
};
|
|
216
|
-
function
|
|
219
|
+
function V(t) {
|
|
217
220
|
const n = t === "+" ? X : X + Math.PI, e = n + yt;
|
|
218
221
|
return { start: n, end: e, head: t === "+" ? e : n };
|
|
219
222
|
}
|
|
220
|
-
const
|
|
221
|
-
function
|
|
223
|
+
const Dt = new A(), L = new A(), Jt = new A();
|
|
224
|
+
function Ut(t, n = 24) {
|
|
222
225
|
const e = [];
|
|
223
|
-
for (const
|
|
224
|
-
const [s, r] = gt[
|
|
225
|
-
|
|
226
|
+
for (const i of P) {
|
|
227
|
+
const [s, r] = gt[i], a = (o) => Dt.copy(s).multiplyScalar(Math.cos(o) * N).addScaledVector(r, Math.sin(o) * N).applyQuaternion(t), u = Math.abs(
|
|
228
|
+
Jt.copy(D[i]).applyQuaternion(t).z
|
|
226
229
|
);
|
|
227
|
-
for (const o of
|
|
228
|
-
const { start:
|
|
230
|
+
for (const o of G) {
|
|
231
|
+
const { start: l, end: d, head: c } = V(o), h = [];
|
|
229
232
|
for (let M = 0; M <= n; M++) {
|
|
230
|
-
const
|
|
231
|
-
h.push({ x:
|
|
233
|
+
const E = a(l + (d - l) * M / n);
|
|
234
|
+
h.push({ x: E.x + 0, y: -E.y + 0, depth: E.z });
|
|
232
235
|
}
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
const
|
|
236
|
+
const m = a(c), p = { x: m.x + 0, y: -m.y + 0, depth: m.z }, f = o === "+" ? 1 : -1;
|
|
237
|
+
L.copy(s).multiplyScalar(-Math.sin(c) * f).addScaledVector(r, Math.cos(c) * f).applyQuaternion(t);
|
|
238
|
+
const y = Math.hypot(L.x, L.y), x = y > 1e-9 ? L.x / y : 0, b = y > 1e-9 ? -L.y / y : 0;
|
|
236
239
|
e.push({
|
|
237
|
-
axis:
|
|
240
|
+
axis: i,
|
|
238
241
|
direction: o,
|
|
239
242
|
points: h,
|
|
240
243
|
head: { ...p, dx: x + 0, dy: b + 0 },
|
|
@@ -244,8 +247,8 @@ function Dt(t, n = 24) {
|
|
|
244
247
|
}
|
|
245
248
|
return e;
|
|
246
249
|
}
|
|
247
|
-
function
|
|
248
|
-
let
|
|
250
|
+
function Vt(t, n, e) {
|
|
251
|
+
let i = { distance: Number.POSITIVE_INFINITY, depth: 0 };
|
|
249
252
|
for (let s = 1; s < t.length; s++) {
|
|
250
253
|
const r = t[s - 1], a = t[s], u = (a.x - r.x) ** 2 + (a.y - r.y) ** 2, o = u === 0 ? 0 : Math.min(
|
|
251
254
|
1,
|
|
@@ -253,37 +256,37 @@ function jt(t, n, e) {
|
|
|
253
256
|
0,
|
|
254
257
|
((n - r.x) * (a.x - r.x) + (e - r.y) * (a.y - r.y)) / u
|
|
255
258
|
)
|
|
256
|
-
),
|
|
259
|
+
), l = Math.hypot(
|
|
257
260
|
n - (r.x + o * (a.x - r.x)),
|
|
258
261
|
e - (r.y + o * (a.y - r.y))
|
|
259
262
|
);
|
|
260
|
-
|
|
263
|
+
l < i.distance && (i = { distance: l, depth: r.depth + o * (a.depth - r.depth) });
|
|
261
264
|
}
|
|
262
|
-
return
|
|
265
|
+
return i;
|
|
263
266
|
}
|
|
264
|
-
function
|
|
265
|
-
const e = t.length,
|
|
267
|
+
function qt(t, n) {
|
|
268
|
+
const e = t.length, i = t.map(() => new Array(e).fill(!1));
|
|
266
269
|
for (let o = 0; o < e; o++)
|
|
267
|
-
for (let
|
|
268
|
-
if (t[o].arc === t[
|
|
269
|
-
let
|
|
270
|
+
for (let l = o + 1; l < e; l++) {
|
|
271
|
+
if (t[o].arc === t[l].arc) continue;
|
|
272
|
+
let d = 0;
|
|
270
273
|
for (const c of t[o].line) {
|
|
271
|
-
const h =
|
|
272
|
-
h.distance < n && (
|
|
274
|
+
const h = Vt(t[l].line, c.x, c.y);
|
|
275
|
+
h.distance < n && (d += c.depth - h.depth);
|
|
273
276
|
}
|
|
274
|
-
|
|
277
|
+
d > 0 ? i[o][l] = !0 : d < 0 && (i[l][o] = !0);
|
|
275
278
|
}
|
|
276
279
|
const s = t.map(
|
|
277
|
-
({ line: o }) => o.reduce((
|
|
278
|
-
), r = (o,
|
|
280
|
+
({ line: o }) => o.reduce((l, d) => l + d.depth, 0) / o.length
|
|
281
|
+
), r = (o, l) => s[o] - s[l], a = new Array(e).fill(0), u = new Set(t.keys());
|
|
279
282
|
for (let o = 1; u.size > 0; o++) {
|
|
280
|
-
const
|
|
283
|
+
const l = [...u], d = l.filter((h) => !l.some((m) => i[h][m])), c = (d.length > 0 ? d : l).sort(r)[0];
|
|
281
284
|
a[c] = o, u.delete(c);
|
|
282
285
|
}
|
|
283
286
|
return a;
|
|
284
287
|
}
|
|
285
288
|
const Q = 8;
|
|
286
|
-
function
|
|
289
|
+
function U(t, n) {
|
|
287
290
|
const e = [...t];
|
|
288
291
|
if (n >= 0) {
|
|
289
292
|
const s = e[e.length - 1], r = e[e.length - 2], a = Math.hypot(s.x - r.x, s.y - r.y) || 1;
|
|
@@ -293,146 +296,146 @@ function V(t, n) {
|
|
|
293
296
|
depth: s.depth
|
|
294
297
|
}), e;
|
|
295
298
|
}
|
|
296
|
-
let
|
|
299
|
+
let i = -n;
|
|
297
300
|
for (; e.length > 2; ) {
|
|
298
301
|
const s = e[e.length - 1], r = e[e.length - 2], a = Math.hypot(s.x - r.x, s.y - r.y);
|
|
299
|
-
if (a >
|
|
300
|
-
const u =
|
|
302
|
+
if (a > i) {
|
|
303
|
+
const u = i / a;
|
|
301
304
|
return e[e.length - 1] = {
|
|
302
305
|
x: s.x + (r.x - s.x) * u,
|
|
303
306
|
y: s.y + (r.y - s.y) * u,
|
|
304
307
|
depth: s.depth + (r.depth - s.depth) * u
|
|
305
308
|
}, e;
|
|
306
309
|
}
|
|
307
|
-
|
|
310
|
+
i -= a, e.pop();
|
|
308
311
|
}
|
|
309
312
|
return e;
|
|
310
313
|
}
|
|
311
|
-
const Y = (t, n) =>
|
|
312
|
-
function
|
|
313
|
-
const e = n / 2,
|
|
314
|
+
const Y = (t, n) => U([...t].reverse(), n).reverse();
|
|
315
|
+
function Wt(t, n) {
|
|
316
|
+
const e = n / 2, i = [], s = [], r = [];
|
|
314
317
|
let a = { x: 0, y: 0 };
|
|
315
|
-
for (const [o,
|
|
316
|
-
const
|
|
317
|
-
p > 1e-9 && (a = { x: -
|
|
318
|
+
for (const [o, l] of t.entries()) {
|
|
319
|
+
const d = t[Math.max(0, o - 1)], c = t[Math.min(t.length - 1, o + 1)], h = c.x - d.x, m = c.y - d.y, p = Math.hypot(h, m);
|
|
320
|
+
p > 1e-9 && (a = { x: -m / p, y: h / p }), r.push(a), i.push({ x: l.x + a.x * e, y: l.y + a.y * e }), s.push({ x: l.x - a.x * e, y: l.y - a.y * e });
|
|
318
321
|
}
|
|
319
|
-
const u = (o,
|
|
320
|
-
const
|
|
321
|
-
return Array.from({ length: Q - 1 }, (
|
|
322
|
-
const
|
|
322
|
+
const u = (o, l) => {
|
|
323
|
+
const d = r[o], c = { x: d.y, y: -d.x }, h = l ? 1 : -1;
|
|
324
|
+
return Array.from({ length: Q - 1 }, (m, p) => {
|
|
325
|
+
const f = Math.PI * (p + 1) / Q, y = Math.cos(f) * h, x = Math.sin(f) * h;
|
|
323
326
|
return {
|
|
324
|
-
x: t[o].x + (
|
|
325
|
-
y: t[o].y + (
|
|
327
|
+
x: t[o].x + (d.x * y + c.x * x) * e,
|
|
328
|
+
y: t[o].y + (d.y * y + c.y * x) * e
|
|
326
329
|
};
|
|
327
330
|
});
|
|
328
331
|
};
|
|
329
|
-
return (o,
|
|
330
|
-
...
|
|
331
|
-
...
|
|
332
|
-
...s.slice(o,
|
|
332
|
+
return (o, l) => [
|
|
333
|
+
...i.slice(o, l + 1),
|
|
334
|
+
...l === t.length - 1 ? u(l, !0) : [],
|
|
335
|
+
...s.slice(o, l + 1).reverse(),
|
|
333
336
|
...o === 0 ? u(o, !1) : []
|
|
334
337
|
];
|
|
335
338
|
}
|
|
336
|
-
function
|
|
339
|
+
function Kt(t, n) {
|
|
337
340
|
return [
|
|
338
341
|
{ from: 0, to: Math.min(t - 1, n + 1) },
|
|
339
342
|
{ from: Math.max(0, n - 1), to: t - 1 }
|
|
340
343
|
];
|
|
341
344
|
}
|
|
342
|
-
function
|
|
343
|
-
const r = e / 2, a = s / 2 * n +
|
|
344
|
-
const
|
|
345
|
+
function Xt(t, { radiusPx: n, gripPx: e, beyondTipPx: i, headLength: s }) {
|
|
346
|
+
const r = e / 2, a = s / 2 * n + i - r, u = i - r, o = t.map((p) => {
|
|
347
|
+
const f = p.points.map((b) => ({
|
|
345
348
|
x: b.x * n,
|
|
346
349
|
y: b.y * n,
|
|
347
350
|
depth: b.depth
|
|
348
|
-
})),
|
|
349
|
-
return { line: x, middle: x.indexOf(
|
|
350
|
-
}),
|
|
351
|
-
(p) => 2 *
|
|
352
|
-
), c =
|
|
353
|
-
(p,
|
|
354
|
-
arc:
|
|
355
|
-
from:
|
|
351
|
+
})), y = f[f.length >> 1], x = p.direction === "+" ? Y(U(f, a), u) : U(Y(f, a), u);
|
|
352
|
+
return { line: x, middle: x.indexOf(y) };
|
|
353
|
+
}), l = o.map(({ line: p }) => p), d = t.map(
|
|
354
|
+
(p) => 2 * N * n * p.openness >= e
|
|
355
|
+
), c = l.flatMap(
|
|
356
|
+
(p, f) => d[f] ? Kt(p.length, o[f].middle).map(({ from: y, to: x }) => ({
|
|
357
|
+
arc: f,
|
|
358
|
+
from: y,
|
|
356
359
|
to: x,
|
|
357
|
-
line: p.slice(
|
|
360
|
+
line: p.slice(y, x + 1)
|
|
358
361
|
})) : []
|
|
359
|
-
), h =
|
|
360
|
-
return t.map((p,
|
|
361
|
-
if (!f
|
|
362
|
-
const
|
|
363
|
-
(b, M) => b.arc ===
|
|
362
|
+
), h = qt(c, e), m = t.map((p, f) => f).sort((p, f) => t[p].head.depth - t[f].head.depth);
|
|
363
|
+
return t.map((p, f) => {
|
|
364
|
+
if (!d[f]) return null;
|
|
365
|
+
const y = Wt(l[f], e), x = c.flatMap(
|
|
366
|
+
(b, M) => b.arc === f ? [{ ...b, layer: h[M] }] : []
|
|
364
367
|
);
|
|
365
368
|
return {
|
|
366
|
-
band:
|
|
367
|
-
halves: x.map(({ from: b, to: M, layer:
|
|
368
|
-
polygon:
|
|
369
|
-
layer:
|
|
369
|
+
band: y(0, l[f].length - 1),
|
|
370
|
+
halves: x.map(({ from: b, to: M, layer: E }) => ({
|
|
371
|
+
polygon: y(b, M),
|
|
372
|
+
layer: E
|
|
370
373
|
})),
|
|
371
374
|
head: { x: p.head.x * n, y: p.head.y * n },
|
|
372
|
-
headLayer: c.length + 1 +
|
|
375
|
+
headLayer: c.length + 1 + m.indexOf(f)
|
|
373
376
|
};
|
|
374
377
|
});
|
|
375
378
|
}
|
|
376
|
-
function xt(t, n, e,
|
|
377
|
-
const s =
|
|
379
|
+
function xt(t, n, e, i) {
|
|
380
|
+
const s = C(null), r = At((a) => a.invalidate);
|
|
378
381
|
k(() => {
|
|
379
382
|
s.current = null, r();
|
|
380
|
-
}, [
|
|
383
|
+
}, [i, r]), k(() => {
|
|
381
384
|
let a = requestAnimationFrame(function u() {
|
|
382
385
|
const o = t.current;
|
|
383
386
|
o && K(s.current, o) && r(), a = requestAnimationFrame(u);
|
|
384
387
|
});
|
|
385
388
|
return () => cancelAnimationFrame(a);
|
|
386
|
-
}, [t, r]),
|
|
389
|
+
}, [t, r]), wt(() => {
|
|
387
390
|
const a = t.current;
|
|
388
391
|
!a || !n.current || K(s.current, a) && (n.current.quaternion.copy(a), e(a) && (s.current = a.clone()));
|
|
389
392
|
});
|
|
390
393
|
}
|
|
391
394
|
const Z = 0.03;
|
|
392
|
-
function
|
|
395
|
+
function Qt({
|
|
393
396
|
orientation: t,
|
|
394
397
|
lit: n,
|
|
395
398
|
disabled: e,
|
|
396
|
-
size:
|
|
399
|
+
size: i,
|
|
397
400
|
radius: s,
|
|
398
401
|
overlay: r
|
|
399
402
|
}) {
|
|
400
|
-
const a =
|
|
403
|
+
const a = C(null), u = i / 2, o = (c) => `${(u + c).toFixed(2)}px`, l = (c) => `polygon(${c.map((h) => `${o(h.x)} ${o(h.y)}`).join(", ")})`, d = (c) => `M${c.map((h) => `${(u + h.x).toFixed(2)} ${(u + h.y).toFixed(2)}`).join("L")}Z`;
|
|
401
404
|
return xt(
|
|
402
405
|
t,
|
|
403
406
|
a,
|
|
404
407
|
(c) => {
|
|
405
408
|
let h = !0;
|
|
406
|
-
const
|
|
407
|
-
for (const [
|
|
408
|
-
const x = r.current.get(R(
|
|
409
|
-
(
|
|
409
|
+
const m = Ut(c), p = Xt(m, Gt(i, s));
|
|
410
|
+
for (const [f, y] of m.entries()) {
|
|
411
|
+
const x = r.current.get(R(y)), b = r.current.get(ut(y)), M = r.current.get(ht(y)), E = it.map(
|
|
412
|
+
(I) => r.current.get(lt(y, I))
|
|
410
413
|
);
|
|
411
|
-
if (!x || !b || !M ||
|
|
414
|
+
if (!x || !b || !M || E.some((I) => !I)) {
|
|
412
415
|
h = !1;
|
|
413
416
|
continue;
|
|
414
417
|
}
|
|
415
|
-
const
|
|
416
|
-
x.style.left = o(
|
|
417
|
-
for (const [
|
|
418
|
-
if (!
|
|
419
|
-
const
|
|
420
|
-
|
|
418
|
+
const w = p[f];
|
|
419
|
+
x.style.left = o(y.head.x * s), x.style.top = o(y.head.y * s), x.style.zIndex = w ? String(w.headLayer) : "0", x.style.pointerEvents = w ? "" : "none", x.dataset.band = w ? "shown" : "none", b.style.clipPath = w ? l(w.band) : j, M.setAttribute("d", w ? d(w.band) : "");
|
|
420
|
+
for (const [I, O] of E.entries()) {
|
|
421
|
+
if (!O) continue;
|
|
422
|
+
const T = w == null ? void 0 : w.halves[I];
|
|
423
|
+
O.style.clipPath = T ? l(T.polygon) : j, O.style.zIndex = T ? String(T.layer) : "0", O.style.pointerEvents = T ? "" : "none";
|
|
421
424
|
}
|
|
422
425
|
}
|
|
423
426
|
return h;
|
|
424
427
|
},
|
|
425
|
-
`${
|
|
426
|
-
), /* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
+
`${i}:${s}`
|
|
429
|
+
), /* @__PURE__ */ S("group", { ref: a, children: [
|
|
430
|
+
/* @__PURE__ */ S("mesh", { children: [
|
|
428
431
|
/* @__PURE__ */ g("sphereGeometry", { args: [0.07, 16, 16] }),
|
|
429
432
|
/* @__PURE__ */ g("meshBasicMaterial", { color: "#c4c8d0" })
|
|
430
433
|
] }),
|
|
431
|
-
|
|
432
|
-
|
|
434
|
+
P.map((c) => /* @__PURE__ */ g(
|
|
435
|
+
Yt,
|
|
433
436
|
{
|
|
434
437
|
axis: c,
|
|
435
|
-
color:
|
|
438
|
+
color: z(c),
|
|
436
439
|
lit: (n == null ? void 0 : n.axis) === c ? n.direction : null,
|
|
437
440
|
disabled: e
|
|
438
441
|
},
|
|
@@ -440,27 +443,27 @@ function Wt({
|
|
|
440
443
|
))
|
|
441
444
|
] });
|
|
442
445
|
}
|
|
443
|
-
function
|
|
446
|
+
function Yt({
|
|
444
447
|
axis: t,
|
|
445
448
|
color: n,
|
|
446
449
|
lit: e,
|
|
447
|
-
disabled:
|
|
450
|
+
disabled: i
|
|
448
451
|
}) {
|
|
449
|
-
const s =
|
|
452
|
+
const s = B(() => {
|
|
450
453
|
const [r, a] = gt[t];
|
|
451
454
|
return new v().setFromRotationMatrix(
|
|
452
|
-
new ot().makeBasis(r, a,
|
|
455
|
+
new ot().makeBasis(r, a, D[t])
|
|
453
456
|
);
|
|
454
457
|
}, [t]);
|
|
455
|
-
return /* @__PURE__ */ g("group", { quaternion: s, children:
|
|
456
|
-
const a = e === r, u = a ? 1 :
|
|
457
|
-
return /* @__PURE__ */
|
|
458
|
-
/* @__PURE__ */
|
|
459
|
-
/* @__PURE__ */ g("torusGeometry", { args: [
|
|
458
|
+
return /* @__PURE__ */ g("group", { quaternion: s, children: G.map((r) => {
|
|
459
|
+
const a = e === r, u = a ? 1 : i ? 0.35 : 0.8, o = a ? Z * 1.5 : Z;
|
|
460
|
+
return /* @__PURE__ */ S("group", { children: [
|
|
461
|
+
/* @__PURE__ */ S("mesh", { rotation: [0, 0, V(r).start], children: [
|
|
462
|
+
/* @__PURE__ */ g("torusGeometry", { args: [N, o, 12, 48, yt] }),
|
|
460
463
|
/* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: u })
|
|
461
464
|
] }),
|
|
462
465
|
/* @__PURE__ */ g(
|
|
463
|
-
|
|
466
|
+
Zt,
|
|
464
467
|
{
|
|
465
468
|
direction: r,
|
|
466
469
|
color: n,
|
|
@@ -471,18 +474,18 @@ function Kt({
|
|
|
471
474
|
] }, r);
|
|
472
475
|
}) });
|
|
473
476
|
}
|
|
474
|
-
function
|
|
477
|
+
function Zt({
|
|
475
478
|
direction: t,
|
|
476
479
|
color: n,
|
|
477
480
|
opacity: e,
|
|
478
|
-
lit:
|
|
481
|
+
lit: i
|
|
479
482
|
}) {
|
|
480
|
-
const { position: s, rotation: r } =
|
|
481
|
-
const { head: a } =
|
|
483
|
+
const { position: s, rotation: r } = B(() => {
|
|
484
|
+
const { head: a } = V(t), u = t === "+" ? 1 : -1;
|
|
482
485
|
return {
|
|
483
486
|
position: new A(
|
|
484
|
-
Math.cos(a) *
|
|
485
|
-
Math.sin(a) *
|
|
487
|
+
Math.cos(a) * N,
|
|
488
|
+
Math.sin(a) * N,
|
|
486
489
|
0
|
|
487
490
|
),
|
|
488
491
|
rotation: new v().setFromUnitVectors(
|
|
@@ -491,45 +494,45 @@ function Xt({
|
|
|
491
494
|
)
|
|
492
495
|
};
|
|
493
496
|
}, [t]);
|
|
494
|
-
return /* @__PURE__ */
|
|
495
|
-
/* @__PURE__ */ g("coneGeometry", { args: [at,
|
|
497
|
+
return /* @__PURE__ */ S("mesh", { position: s, quaternion: r, scale: i ? 1.2 : 1, children: [
|
|
498
|
+
/* @__PURE__ */ g("coneGeometry", { args: [at, $, 20] }),
|
|
496
499
|
/* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: e })
|
|
497
500
|
] });
|
|
498
501
|
}
|
|
499
|
-
function
|
|
500
|
-
const { disabled: n, label: e, overlay:
|
|
501
|
-
return /* @__PURE__ */
|
|
502
|
-
|
|
503
|
-
|
|
502
|
+
function tn(t) {
|
|
503
|
+
const { disabled: n, label: e, overlay: i, size: s } = t, r = rt(), { gripPx: a, labelFontPx: u } = H(s);
|
|
504
|
+
return /* @__PURE__ */ S(bt, { children: [
|
|
505
|
+
P.map((o) => /* @__PURE__ */ g(
|
|
506
|
+
_,
|
|
504
507
|
{
|
|
505
508
|
component: "span",
|
|
506
509
|
"aria-hidden": !0,
|
|
507
|
-
ref:
|
|
510
|
+
ref: F(i, ct(o)),
|
|
508
511
|
sx: {
|
|
509
512
|
position: "absolute",
|
|
510
513
|
transform: "translate(-50%, -50%)",
|
|
511
514
|
pointerEvents: "none",
|
|
512
515
|
fontSize: u,
|
|
513
|
-
color:
|
|
516
|
+
color: z(o),
|
|
514
517
|
opacity: n ? 0.4 : 1
|
|
515
518
|
},
|
|
516
519
|
children: o.toUpperCase()
|
|
517
520
|
},
|
|
518
521
|
o
|
|
519
522
|
)),
|
|
520
|
-
|
|
521
|
-
(o) =>
|
|
522
|
-
const
|
|
523
|
+
P.flatMap(
|
|
524
|
+
(o) => G.map((l) => {
|
|
525
|
+
const d = { axis: o, direction: l }, c = pt(d, t);
|
|
523
526
|
return /* @__PURE__ */ g(
|
|
524
|
-
|
|
527
|
+
_,
|
|
525
528
|
{
|
|
526
529
|
component: "button",
|
|
527
530
|
type: "button",
|
|
528
|
-
ref:
|
|
531
|
+
ref: F(i, R(d)),
|
|
529
532
|
disabled: n,
|
|
530
|
-
"aria-label": e(
|
|
533
|
+
"aria-label": e(d),
|
|
531
534
|
"aria-pressed": c.pressed,
|
|
532
|
-
...ft(
|
|
535
|
+
...ft(d, t),
|
|
533
536
|
sx: {
|
|
534
537
|
// Placed, sized and turned along its half of the axis by
|
|
535
538
|
// TranslationScene, every frame the gizmo turns
|
|
@@ -539,25 +542,25 @@ function Qt(t) {
|
|
|
539
542
|
padding: 0,
|
|
540
543
|
borderRadius: `${a / 2}px`,
|
|
541
544
|
border: "none",
|
|
542
|
-
background: dt(
|
|
545
|
+
background: dt(z(o), c),
|
|
543
546
|
"&:focus-visible": { outline: mt(r) },
|
|
544
547
|
...J(n)
|
|
545
548
|
}
|
|
546
549
|
},
|
|
547
|
-
R(
|
|
550
|
+
R(d)
|
|
548
551
|
);
|
|
549
552
|
})
|
|
550
553
|
)
|
|
551
554
|
] });
|
|
552
555
|
}
|
|
553
|
-
function
|
|
556
|
+
function nn(t) {
|
|
554
557
|
const n = [];
|
|
555
|
-
for (const e of
|
|
556
|
-
for (const
|
|
557
|
-
const s =
|
|
558
|
+
for (const e of P)
|
|
559
|
+
for (const i of G) {
|
|
560
|
+
const s = D[e].clone().multiplyScalar(i === "+" ? 1 : -1).applyQuaternion(t);
|
|
558
561
|
n.push({
|
|
559
562
|
axis: e,
|
|
560
|
-
direction:
|
|
563
|
+
direction: i,
|
|
561
564
|
x: s.x + 0,
|
|
562
565
|
y: -s.y + 0,
|
|
563
566
|
depth: s.z
|
|
@@ -565,8 +568,8 @@ function Yt(t) {
|
|
|
565
568
|
}
|
|
566
569
|
return n;
|
|
567
570
|
}
|
|
568
|
-
function
|
|
569
|
-
const { radiusPx: e, gripPx:
|
|
571
|
+
function en(t, n) {
|
|
572
|
+
const { radiusPx: e, gripPx: i, innerPx: s, beyondTipPx: r, minTipPx: a, headLength: u } = n, o = t.map((c) => {
|
|
570
573
|
const h = Math.hypot(c.x, c.y) * e;
|
|
571
574
|
return {
|
|
572
575
|
tip: h,
|
|
@@ -578,65 +581,65 @@ function Zt(t, n) {
|
|
|
578
581
|
};
|
|
579
582
|
});
|
|
580
583
|
for (const [c, h] of o.entries())
|
|
581
|
-
for (const
|
|
582
|
-
if (!h.grabbed || !
|
|
583
|
-
const [p,
|
|
584
|
-
if (Math.cos(
|
|
585
|
-
const b =
|
|
584
|
+
for (const m of o.slice(c + 1)) {
|
|
585
|
+
if (!h.grabbed || !m.grabbed) continue;
|
|
586
|
+
const [p, f] = h.tip <= m.tip ? [h, m] : [m, h], y = h.angle - m.angle, x = p.tip * Math.abs(Math.sin(y));
|
|
587
|
+
if (Math.cos(y) <= 0 || x >= i) continue;
|
|
588
|
+
const b = f.tip * (1 - u);
|
|
586
589
|
if (p.tip > b) {
|
|
587
|
-
const M = h.depth <
|
|
590
|
+
const M = h.depth < m.depth ? h : m;
|
|
588
591
|
M.grabbed = !1;
|
|
589
592
|
} else {
|
|
590
593
|
const M = (p.tip + b) / 2;
|
|
591
|
-
p.end = Math.min(p.end, M),
|
|
594
|
+
p.end = Math.min(p.end, M), f.start = Math.max(f.start, M);
|
|
592
595
|
}
|
|
593
596
|
}
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
const
|
|
597
|
+
const l = o.map((c, h) => h);
|
|
598
|
+
l.sort((c, h) => o[c].depth - o[h].depth);
|
|
599
|
+
const d = new Map(l.map((c, h) => [c, h + 1]));
|
|
597
600
|
return o.map((c, h) => !c.grabbed || c.end <= c.start ? null : {
|
|
598
601
|
x: Math.cos(c.angle) * c.start,
|
|
599
602
|
y: Math.sin(c.angle) * c.start,
|
|
600
603
|
length: c.end - c.start,
|
|
601
604
|
angle: c.angle,
|
|
602
|
-
layer:
|
|
605
|
+
layer: d.get(h) ?? 0
|
|
603
606
|
});
|
|
604
607
|
}
|
|
605
608
|
const tt = 0.035, nt = 1.28;
|
|
606
|
-
function
|
|
609
|
+
function on({
|
|
607
610
|
orientation: t,
|
|
608
611
|
lit: n,
|
|
609
612
|
disabled: e,
|
|
610
|
-
size:
|
|
613
|
+
size: i,
|
|
611
614
|
radius: s,
|
|
612
615
|
overlay: r
|
|
613
616
|
}) {
|
|
614
|
-
const a =
|
|
617
|
+
const a = C(null), u = i / 2;
|
|
615
618
|
return xt(
|
|
616
619
|
t,
|
|
617
620
|
a,
|
|
618
621
|
(o) => {
|
|
619
|
-
let
|
|
620
|
-
const
|
|
621
|
-
for (const [h,
|
|
622
|
-
const p = r.current.get(R(
|
|
623
|
-
if (p ?
|
|
624
|
-
const
|
|
625
|
-
|
|
622
|
+
let l = !0;
|
|
623
|
+
const d = nn(o), c = en(d, Nt(i, s));
|
|
624
|
+
for (const [h, m] of d.entries()) {
|
|
625
|
+
const p = r.current.get(R(m)), f = c[h];
|
|
626
|
+
if (p ? f ? (p.style.left = `${u + f.x}px`, p.style.top = `${u + f.y}px`, p.style.width = `${f.length}px`, p.style.transform = `translateY(-50%) rotate(${f.angle}rad)`, p.style.zIndex = String(f.layer), p.style.pointerEvents = "") : p.style.pointerEvents = "none" : l = !1, m.direction !== "+") continue;
|
|
627
|
+
const y = r.current.get(ct(m.axis));
|
|
628
|
+
y ? (y.style.left = `${u + m.x * s * nt}px`, y.style.top = `${u + m.y * s * nt}px`) : l = !1;
|
|
626
629
|
}
|
|
627
|
-
return
|
|
630
|
+
return l;
|
|
628
631
|
},
|
|
629
|
-
`${
|
|
630
|
-
), /* @__PURE__ */
|
|
631
|
-
/* @__PURE__ */
|
|
632
|
+
`${i}:${s}`
|
|
633
|
+
), /* @__PURE__ */ S("group", { ref: a, children: [
|
|
634
|
+
/* @__PURE__ */ S("mesh", { children: [
|
|
632
635
|
/* @__PURE__ */ g("sphereGeometry", { args: [0.07, 16, 16] }),
|
|
633
636
|
/* @__PURE__ */ g("meshBasicMaterial", { color: "#c4c8d0" })
|
|
634
637
|
] }),
|
|
635
|
-
|
|
636
|
-
|
|
638
|
+
P.map((o) => /* @__PURE__ */ g(
|
|
639
|
+
rn,
|
|
637
640
|
{
|
|
638
641
|
axis: o,
|
|
639
|
-
color:
|
|
642
|
+
color: z(o),
|
|
640
643
|
lit: (n == null ? void 0 : n.axis) === o ? n.direction : null,
|
|
641
644
|
disabled: e
|
|
642
645
|
},
|
|
@@ -644,41 +647,41 @@ function tn({
|
|
|
644
647
|
))
|
|
645
648
|
] });
|
|
646
649
|
}
|
|
647
|
-
function
|
|
650
|
+
function rn({
|
|
648
651
|
axis: t,
|
|
649
652
|
color: n,
|
|
650
653
|
lit: e,
|
|
651
|
-
disabled:
|
|
654
|
+
disabled: i
|
|
652
655
|
}) {
|
|
653
|
-
const s =
|
|
654
|
-
() => new v().setFromUnitVectors(st,
|
|
656
|
+
const s = B(
|
|
657
|
+
() => new v().setFromUnitVectors(st, D[t]),
|
|
655
658
|
[t]
|
|
656
|
-
), r = 1 -
|
|
657
|
-
return /* @__PURE__ */ g("group", { quaternion: s, children:
|
|
658
|
-
const u = e === a, o = u ? 1 :
|
|
659
|
+
), r = 1 - $;
|
|
660
|
+
return /* @__PURE__ */ g("group", { quaternion: s, children: G.map((a) => {
|
|
661
|
+
const u = e === a, o = u ? 1 : i ? 0.35 : 0.8, l = u ? tt * 1.5 : tt;
|
|
659
662
|
return (
|
|
660
663
|
// The minus half is the plus half turned around
|
|
661
|
-
/* @__PURE__ */
|
|
664
|
+
/* @__PURE__ */ S(
|
|
662
665
|
"group",
|
|
663
666
|
{
|
|
664
667
|
rotation: [a === "+" ? 0 : Math.PI, 0, 0],
|
|
665
668
|
children: [
|
|
666
|
-
/* @__PURE__ */
|
|
669
|
+
/* @__PURE__ */ S("mesh", { position: [0, r / 2, 0], children: [
|
|
667
670
|
/* @__PURE__ */ g(
|
|
668
671
|
"cylinderGeometry",
|
|
669
672
|
{
|
|
670
|
-
args: [
|
|
673
|
+
args: [l, l, r, 12]
|
|
671
674
|
}
|
|
672
675
|
),
|
|
673
676
|
/* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: o })
|
|
674
677
|
] }),
|
|
675
|
-
/* @__PURE__ */
|
|
678
|
+
/* @__PURE__ */ S(
|
|
676
679
|
"mesh",
|
|
677
680
|
{
|
|
678
|
-
position: [0, 1 -
|
|
681
|
+
position: [0, 1 - $ / 2, 0],
|
|
679
682
|
scale: u ? 1.2 : 1,
|
|
680
683
|
children: [
|
|
681
|
-
/* @__PURE__ */ g("coneGeometry", { args: [at,
|
|
684
|
+
/* @__PURE__ */ g("coneGeometry", { args: [at, $, 20] }),
|
|
682
685
|
/* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: o })
|
|
683
686
|
]
|
|
684
687
|
}
|
|
@@ -690,61 +693,79 @@ function nn({
|
|
|
690
693
|
);
|
|
691
694
|
}) });
|
|
692
695
|
}
|
|
693
|
-
const
|
|
694
|
-
function
|
|
695
|
-
const e =
|
|
696
|
-
return e.current = n,
|
|
697
|
-
const
|
|
696
|
+
const sn = new v();
|
|
697
|
+
function an(t, n = sn) {
|
|
698
|
+
const e = C(n);
|
|
699
|
+
return e.current = n, B(() => {
|
|
700
|
+
const i = new v();
|
|
698
701
|
return {
|
|
699
702
|
get current() {
|
|
700
703
|
const s = t.current;
|
|
701
704
|
if (!s) return null;
|
|
702
705
|
const r = e.current;
|
|
703
|
-
return
|
|
706
|
+
return kt(s, typeof r == "function" ? r() : r, i);
|
|
704
707
|
}
|
|
705
708
|
};
|
|
706
709
|
}, [t]);
|
|
707
710
|
}
|
|
708
|
-
const
|
|
709
|
-
function
|
|
711
|
+
const cn = 3e3;
|
|
712
|
+
function ln(t) {
|
|
710
713
|
const [n, e] = et(() => t.current !== null);
|
|
711
714
|
return k(() => {
|
|
712
715
|
if (n) return;
|
|
713
|
-
let
|
|
714
|
-
t.current !== null ? e(!0) :
|
|
716
|
+
let i = requestAnimationFrame(function r() {
|
|
717
|
+
t.current !== null ? e(!0) : i = requestAnimationFrame(r);
|
|
715
718
|
});
|
|
716
719
|
const s = setTimeout(() => {
|
|
717
720
|
t.current === null && console.warn(
|
|
718
721
|
"JoggingGizmo has no orientation, so it stays disabled. Put a JoggingGizmoOrientation with the same ref into the app's 3D scene."
|
|
719
722
|
);
|
|
720
|
-
},
|
|
723
|
+
}, cn);
|
|
721
724
|
return () => {
|
|
722
|
-
cancelAnimationFrame(
|
|
725
|
+
cancelAnimationFrame(i), clearTimeout(s);
|
|
723
726
|
};
|
|
724
727
|
}, [n, t]), n;
|
|
725
728
|
}
|
|
726
|
-
const
|
|
729
|
+
const wn = Rt(
|
|
727
730
|
({
|
|
728
731
|
orientation: t,
|
|
729
732
|
frameQuaternion: n,
|
|
730
733
|
motion: e = "translate",
|
|
731
|
-
onJogStart:
|
|
734
|
+
onJogStart: i,
|
|
732
735
|
onJogStop: s,
|
|
733
736
|
activeHandle: r,
|
|
734
737
|
disabled: a = !1,
|
|
735
|
-
size: u = 200
|
|
738
|
+
size: u = 200,
|
|
739
|
+
onWebGLUnavailable: o
|
|
736
740
|
}) => {
|
|
737
|
-
const
|
|
741
|
+
const { t: l } = vt(), { unavailable: d, makeRenderer: c } = Tt({
|
|
742
|
+
onWebGLUnavailable: o
|
|
743
|
+
}), h = ln(t), m = a || !h, p = an(t, n), { held: f, handlersFor: y, label: x, isPressed: b } = Ot({
|
|
738
744
|
motion: e,
|
|
739
|
-
onJogStart:
|
|
745
|
+
onJogStart: i,
|
|
740
746
|
onJogStop: s,
|
|
741
747
|
activeHandle: r,
|
|
742
|
-
disabled:
|
|
743
|
-
}), [
|
|
744
|
-
k(() =>
|
|
745
|
-
const
|
|
746
|
-
return /* @__PURE__ */
|
|
747
|
-
|
|
748
|
+
disabled: m
|
|
749
|
+
}), [M, E] = et(null);
|
|
750
|
+
k(() => E(null), [e]);
|
|
751
|
+
const w = e === "rotate" ? Qt : on, I = e === "rotate" ? Bt : tn, O = C(/* @__PURE__ */ new Map()), T = $t(u, u, H(u).marginPx);
|
|
752
|
+
return d ? /* @__PURE__ */ g(
|
|
753
|
+
_,
|
|
754
|
+
{
|
|
755
|
+
"data-testid": "jogging-gizmo-unavailable",
|
|
756
|
+
sx: {
|
|
757
|
+
width: u,
|
|
758
|
+
height: u,
|
|
759
|
+
flexShrink: 0,
|
|
760
|
+
display: "flex",
|
|
761
|
+
alignItems: "center",
|
|
762
|
+
justifyContent: "center",
|
|
763
|
+
textAlign: "center"
|
|
764
|
+
},
|
|
765
|
+
children: /* @__PURE__ */ g(Mt, { variant: "body2", color: "text.secondary", children: l("JoggingGizmo.WebGLUnavailable.lb") })
|
|
766
|
+
}
|
|
767
|
+
) : /* @__PURE__ */ S(
|
|
768
|
+
_,
|
|
748
769
|
{
|
|
749
770
|
"data-testid": "jogging-gizmo",
|
|
750
771
|
sx: {
|
|
@@ -759,7 +780,7 @@ const yn = Et(
|
|
|
759
780
|
},
|
|
760
781
|
children: [
|
|
761
782
|
/* @__PURE__ */ g(
|
|
762
|
-
|
|
783
|
+
St,
|
|
763
784
|
{
|
|
764
785
|
orthographic: !0,
|
|
765
786
|
flat: !0,
|
|
@@ -767,36 +788,36 @@ const yn = Et(
|
|
|
767
788
|
camera: {
|
|
768
789
|
position: [0, 0, 10],
|
|
769
790
|
up: [0, 1, 0],
|
|
770
|
-
zoom:
|
|
791
|
+
zoom: T,
|
|
771
792
|
near: 0.1,
|
|
772
793
|
far: 100
|
|
773
794
|
},
|
|
774
|
-
gl:
|
|
795
|
+
gl: c,
|
|
775
796
|
style: { position: "absolute", inset: 0, pointerEvents: "none" },
|
|
776
797
|
children: /* @__PURE__ */ g(
|
|
777
|
-
|
|
798
|
+
w,
|
|
778
799
|
{
|
|
779
|
-
orientation:
|
|
780
|
-
lit:
|
|
781
|
-
disabled:
|
|
800
|
+
orientation: p,
|
|
801
|
+
lit: f ?? r ?? M,
|
|
802
|
+
disabled: m,
|
|
782
803
|
size: u,
|
|
783
|
-
radius:
|
|
784
|
-
overlay:
|
|
804
|
+
radius: T,
|
|
805
|
+
overlay: O
|
|
785
806
|
}
|
|
786
807
|
)
|
|
787
808
|
}
|
|
788
809
|
),
|
|
789
810
|
/* @__PURE__ */ g(
|
|
790
|
-
|
|
811
|
+
I,
|
|
791
812
|
{
|
|
792
|
-
isPressed:
|
|
793
|
-
hovered:
|
|
794
|
-
disabled:
|
|
813
|
+
isPressed: b,
|
|
814
|
+
hovered: M,
|
|
815
|
+
disabled: m,
|
|
795
816
|
size: u,
|
|
796
|
-
onHover:
|
|
797
|
-
handlersFor:
|
|
798
|
-
label:
|
|
799
|
-
overlay:
|
|
817
|
+
onHover: E,
|
|
818
|
+
handlersFor: y,
|
|
819
|
+
label: x,
|
|
820
|
+
overlay: O
|
|
800
821
|
}
|
|
801
822
|
)
|
|
802
823
|
]
|
|
@@ -805,6 +826,6 @@ const yn = Et(
|
|
|
805
826
|
}
|
|
806
827
|
);
|
|
807
828
|
export {
|
|
808
|
-
|
|
809
|
-
|
|
829
|
+
wn as J,
|
|
830
|
+
An as n
|
|
810
831
|
};
|