@wandelbots/wandelbots-js-react-components 6.3.0 → 6.4.0-pr.chore-playground-tool-steps.664.4537d63
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 +323 -120
- package/dist/3d.cjs +1 -1
- package/dist/3d.d.ts +5 -3
- package/dist/3d.js +24 -23
- package/dist/CurrentPoseBar/index.cjs +1 -0
- package/dist/CurrentPoseBar/index.d.ts +2 -0
- package/dist/CurrentPoseBar/index.js +5 -0
- package/dist/JoggingButtons/index.cjs +1 -0
- package/dist/JoggingButtons/index.d.ts +3 -0
- package/dist/JoggingButtons/index.js +5 -0
- package/dist/JoggingGizmo/index.cjs +1 -0
- package/dist/JoggingGizmo/index.d.ts +4 -0
- package/dist/JoggingGizmo/index.js +7 -0
- package/dist/JoggingJointSlider/index.cjs +1 -0
- package/dist/JoggingJointSlider/index.d.ts +2 -0
- package/dist/JoggingJointSlider/index.js +5 -0
- package/dist/RobotControlPanel/index.cjs +1 -0
- package/dist/RobotControlPanel/index.d.ts +2 -0
- package/dist/RobotControlPanel/index.js +5 -0
- package/dist/RobotHeader/index.cjs +1 -0
- package/dist/RobotHeader/index.d.ts +4 -0
- package/dist/RobotHeader/index.js +5 -0
- package/dist/SafetyBar/index.cjs +1 -1
- package/dist/SafetyBar/index.js +1 -1
- package/dist/chunks/CurrentPoseBar-CyHUWmjM.cjs +1 -0
- package/dist/chunks/CurrentPoseBar-zTZi68tY.js +505 -0
- package/dist/chunks/JoggingButtons-CXaozFVz.js +108 -0
- package/dist/chunks/JoggingButtons-CbL-5LMK.cjs +1 -0
- package/dist/chunks/JoggingGizmo-DGbFLWgT.cjs +1 -0
- package/dist/chunks/JoggingGizmo-SuS9MmL7.js +810 -0
- package/dist/chunks/JoggingGizmoOrientation-dzned4f4.cjs +1 -0
- package/dist/chunks/JoggingGizmoOrientation-x_crT_64.js +14 -0
- package/dist/chunks/JoggingJointSlider-CZ-k6XCa.js +406 -0
- package/dist/chunks/JoggingJointSlider-R3_A9Ppj.cjs +1 -0
- package/dist/chunks/Robot-D0ZqUCn3.cjs +1 -0
- package/dist/chunks/Robot-UoykZeYH.js +1272 -0
- package/dist/chunks/RobotControlPanel-BnMfmO41.js +822 -0
- package/dist/chunks/RobotControlPanel-BuDGcxPR.cjs +1 -0
- package/dist/chunks/RobotHeader-BZci9ahT.js +244 -0
- package/dist/chunks/RobotHeader-CqK0700U.cjs +1 -0
- package/dist/chunks/SafetyBar-Bbg-o8h9.cjs +1 -0
- package/dist/chunks/{SafetyBar-Cy9DiXp9.js → SafetyBar-Cuak4ffd.js} +11 -10
- package/dist/chunks/SmallSelect-BdD9uLKK.js +52 -0
- package/dist/chunks/SmallSelect-Dcsd7_6_.cjs +1 -0
- package/dist/chunks/TrajectoryExecutionStore-DPqfDcfn.js +3398 -0
- package/dist/chunks/TrajectoryExecutionStore-DV6mLEx9.cjs +3 -0
- package/dist/chunks/converters-C8I_A_tA.cjs +1 -0
- package/dist/chunks/converters-DpNB_WNQ.js +39 -0
- package/dist/chunks/externalizeComponent-BdxGBLIv.cjs +2 -0
- package/dist/chunks/externalizeComponent-_w2d1_pz.js +283 -0
- package/dist/chunks/holdSafety-BtoZ5We3.cjs +1 -0
- package/dist/chunks/holdSafety-Di1GZAWg.js +37 -0
- package/dist/chunks/joggingColors-CuT5u0H8.js +135 -0
- package/dist/chunks/joggingColors-ZDc_2UCp.cjs +1 -0
- package/dist/chunks/useEveryFrame-G_-ma1nC.js +142 -0
- package/dist/chunks/useEveryFrame-dmPPTKtT.cjs +1 -0
- package/dist/chunks/useSmoothedMotionState-COMJRcOt.js +214 -0
- package/dist/chunks/useSmoothedMotionState-Con0E5Bx.cjs +1 -0
- package/dist/components/AppHeader.d.ts +1 -1
- package/dist/components/currentPoseBar/CurrentPoseBar.d.ts +48 -0
- package/dist/components/currentPoseBar/OrientationFormatPopover.d.ts +19 -0
- package/dist/components/currentPoseBar/StreamStatus.d.ts +10 -0
- package/dist/components/currentPoseBar/orientation.d.ts +34 -0
- package/dist/components/currentPoseBar/poseValues.d.ts +15 -0
- package/dist/components/jogging/JoggingButtons.d.ts +16 -0
- package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +1 -1
- package/dist/components/jogging/JoggingJointTab.d.ts +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts +6 -3
- package/dist/components/jogging/JoggingStore.d.ts +96 -19
- package/dist/components/jogging/gizmo/JoggingGizmo.d.ts +43 -0
- package/dist/components/jogging/gizmo/JoggingGizmoOrientation.d.ts +26 -0
- package/dist/components/jogging/gizmo/RotationHandles.d.ts +7 -0
- package/dist/components/jogging/gizmo/RotationScene.d.ts +6 -0
- package/dist/components/jogging/gizmo/TranslationHandles.d.ts +6 -0
- package/dist/components/jogging/gizmo/TranslationScene.d.ts +6 -0
- package/dist/components/jogging/gizmo/arcGrabAreas.d.ts +58 -0
- package/dist/components/jogging/gizmo/arcs.d.ts +54 -0
- package/dist/components/jogging/gizmo/arrows.d.ts +63 -0
- package/dist/components/jogging/gizmo/gizmoShared.d.ts +125 -0
- package/dist/components/jogging/gizmo/gizmoView.d.ts +42 -0
- package/dist/components/jogging/gizmo/useGizmoTurn.d.ts +11 -0
- package/dist/components/jogging/holdSafety.d.ts +44 -0
- package/dist/components/jogging/jogError.d.ts +9 -0
- package/dist/components/jogging/jogHandle.d.ts +23 -0
- package/dist/components/jogging/joggingColors.d.ts +24 -0
- package/dist/components/jogging/joggingVelocity.d.ts +21 -0
- package/dist/components/jogging/joint/JoggingJointSlider.d.ts +52 -0
- package/dist/components/jogging/joint/JointSliderTrack.d.ts +27 -0
- package/dist/components/jogging/joint/jointJog.d.ts +55 -0
- package/dist/components/jogging/joint/useJointJogHold.d.ts +48 -0
- package/dist/components/jogging/useHold.d.ts +38 -0
- package/dist/components/jogging/useJogControls.d.ts +45 -0
- package/dist/components/robotControl/CartesianJogTab.d.ts +21 -0
- package/dist/components/robotControl/HoldToMoveButton.d.ts +25 -0
- package/dist/components/robotControl/JogArea.d.ts +22 -0
- package/dist/components/robotControl/JogModeToggle.d.ts +8 -0
- package/dist/components/robotControl/JointJogTab.d.ts +11 -0
- package/dist/components/robotControl/MoveToTab.d.ts +18 -0
- package/dist/components/robotControl/PanelSelect.d.ts +13 -0
- package/dist/components/robotControl/PoseField.d.ts +21 -0
- package/dist/components/robotControl/RobotControlPanel.d.ts +212 -0
- package/dist/components/robotControl/Section.d.ts +5 -0
- package/dist/components/robotControl/SmallSelect.d.ts +15 -0
- package/dist/components/robotControl/VelocityRow.d.ts +14 -0
- package/dist/components/robotControl/atPose.d.ts +8 -0
- package/dist/components/robotControl/poseText.d.ts +15 -0
- package/dist/components/robotControl/units.d.ts +16 -0
- package/dist/components/robotControl/useCopyText.d.ts +12 -0
- package/dist/components/robotControl/useEveryFrame.d.ts +6 -0
- package/dist/components/robotHeader/ActivationSwitch.d.ts +7 -0
- package/dist/components/robotHeader/AppNavigation.d.ts +15 -0
- package/dist/components/robotHeader/RobotHeader.d.ts +42 -0
- package/dist/components/robots/GenericRobot.d.ts +2 -1
- package/dist/components/robots/LinearAxis.d.ts +1 -1
- package/dist/components/robots/LinearAxisAnimator.d.ts +11 -2
- package/dist/components/robots/Robot.d.ts +1 -1
- package/dist/components/robots/robotModelLogic.d.ts +11 -9
- package/dist/components/utils/hooks.d.ts +1 -6
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +13 -18
- package/dist/core.js +37 -51
- package/dist/index.cjs +1 -1
- package/dist/index.js +58 -71
- package/dist/lib/ConnectedMotionGroup.d.ts +5 -7
- package/dist/lib/JoggerConnection.d.ts +137 -27
- package/dist/lib/MotionStreamConnection.d.ts +15 -6
- package/dist/lib/Pose3.d.ts +22 -0
- package/dist/lib/PoseTransformer.d.ts +25 -0
- package/dist/lib/TrajectoryExecutionStore.d.ts +129 -0
- package/dist/lib/connectionLogger.d.ts +9 -0
- package/dist/lib/incrementalCartesianMotion.d.ts +40 -0
- package/dist/lib/motionStateUpdate.d.ts +27 -0
- package/dist/lib/novaConnection.d.ts +23 -0
- package/dist/lib/planErrorTranslation.d.ts +8 -0
- package/dist/lib/rotation.d.ts +12 -0
- package/package.json +31 -66
- package/dist/Setup.d.ts +0 -11
- package/dist/chunks/MotionGroupVisualizer-DshWR1wY.js +0 -1653
- package/dist/chunks/MotionGroupVisualizer-eD7yFEcF.cjs +0 -1
- package/dist/chunks/SafetyBar-DPrv_OQA.cjs +0 -1
- package/dist/chunks/externalizeComponent-EDymnaGR.js +0 -268
- package/dist/chunks/externalizeComponent-OO4jcrz5.cjs +0 -2
- package/dist/chunks/theming-DfSy4-Ic.cjs +0 -4
- package/dist/chunks/theming-mF9Rt8SS.js +0 -5542
- package/dist/chunks/useSmoothedMotionState-DyDgSVYX.js +0 -478
- package/dist/chunks/useSmoothedMotionState-VYxEIyfr.cjs +0 -1
- package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +0 -11
- package/dist/components/AdornedTextField.d.ts +0 -7
- package/dist/components/CopyableText.d.ts +0 -6
- package/dist/components/CycleTimer/CycleTimer.d.ts +0 -3
- package/dist/components/CycleTimer/DefaultVariant.d.ts +0 -9
- package/dist/components/CycleTimer/SmallVariant.d.ts +0 -10
- package/dist/components/CycleTimer/index.d.ts +0 -27
- package/dist/components/CycleTimer/types.d.ts +0 -49
- package/dist/components/CycleTimer/useAnimations.d.ts +0 -14
- package/dist/components/CycleTimer/useTimerLogic.d.ts +0 -24
- package/dist/components/CycleTimer/utils.d.ts +0 -21
- package/dist/components/CycleTimer.d.ts +0 -3
- package/dist/components/DataGrid.d.ts +0 -66
- package/dist/components/LogPanel.d.ts +0 -38
- package/dist/components/LogStore.d.ts +0 -12
- package/dist/components/LogViewer.d.ts +0 -46
- package/dist/components/ProgramControl.d.ts +0 -55
- package/dist/components/ProgramStateIndicator.d.ts +0 -26
- package/dist/components/RobotCard.d.ts +0 -98
- package/dist/components/RobotListItem.d.ts +0 -34
- package/dist/components/RobotSetupReadinessIndicator.d.ts +0 -37
- package/dist/components/SelectableFab.d.ts +0 -7
- package/dist/components/TabBar.d.ts +0 -45
- package/dist/components/ThemeSelect.d.ts +0 -6
- package/dist/components/Timer/Timer.d.ts +0 -3
- package/dist/components/Timer/TimerDefaultVariant.d.ts +0 -9
- package/dist/components/Timer/TimerSmallVariant.d.ts +0 -10
- package/dist/components/Timer/index.d.ts +0 -19
- package/dist/components/Timer/types.d.ts +0 -35
- package/dist/components/Timer/useTimerAnimations.d.ts +0 -10
- package/dist/components/Timer/useTimerLogic.d.ts +0 -19
- package/dist/components/Timer/utils.d.ts +0 -17
- package/dist/components/Timer.d.ts +0 -3
- package/dist/components/TransparentOverlay.d.ts +0 -4
- package/dist/components/jogging/JoggingFreedriveTab.d.ts +0 -1
- package/dist/components/jogging/PoseCartesianValues.d.ts +0 -9
- package/dist/components/jogging/PoseJointValues.d.ts +0 -8
- package/dist/components/robots/AxisConfig.d.ts +0 -2
- package/dist/components/robots/manufacturerHomePositions.d.ts +0 -20
- package/dist/icons/DropdownArrowIcon.d.ts +0 -2
- package/dist/icons/index.d.ts +0 -12
- package/dist/lib/novaCompat.d.ts +0 -16
- package/dist/themes/createDarkTheme.d.ts +0 -7
- package/dist/themes/themeTypes.d.ts +0 -40
- package/dist/themes/theming.d.ts +0 -24
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
import { jsxs as w, jsx as g, Fragment as bt } from "react/jsx-runtime";
|
|
2
|
+
import T from "@mui/material/Box";
|
|
3
|
+
import { useThree as Mt, useFrame as At, Canvas as wt } from "@react-three/fiber";
|
|
4
|
+
import { Fragment as St, useRef as L, useEffect as k, useMemo as D, useState as et } from "react";
|
|
5
|
+
import { Vector3 as A, Quaternion as v, Matrix4 as ot } from "three";
|
|
6
|
+
import { e as Et } from "./externalizeComponent-_w2d1_pz.js";
|
|
7
|
+
import { c as vt, i as Rt, J as _, a as F, u as Tt } from "./joggingColors-CuT5u0H8.js";
|
|
8
|
+
import { alpha as U, useTheme as rt } from "@mui/material/styles";
|
|
9
|
+
const st = new A(0, 1, 0), I = 0.26, at = 0.1, _t = { x: "X", y: "Y", z: "Z" };
|
|
10
|
+
function G(t) {
|
|
11
|
+
var n;
|
|
12
|
+
return ((n = vt[_t[t]].buttonBackgroundColor) == null ? void 0 : n.default) ?? "currentColor";
|
|
13
|
+
}
|
|
14
|
+
const Ot = 200;
|
|
15
|
+
function H(t) {
|
|
16
|
+
const n = t / Ot;
|
|
17
|
+
return {
|
|
18
|
+
/** Room around the gizmo for the labels, arrowheads and grab bars */
|
|
19
|
+
marginPx: 30 * n,
|
|
20
|
+
/** Thickness of a handle's grab bar, which shows as its halo */
|
|
21
|
+
gripPx: 30 * n,
|
|
22
|
+
grab: {
|
|
23
|
+
// The center, where all axes cross, belongs to no handle
|
|
24
|
+
innerPx: 10 * n,
|
|
25
|
+
// The arrowhead is the obvious thing to grab, so the bar reaches past it
|
|
26
|
+
beyondTipPx: 10 * n,
|
|
27
|
+
// Shorter, an arrow points within about 13° of the line of sight: its
|
|
28
|
+
// two halves can no longer be told apart
|
|
29
|
+
minTipPx: 16 * n
|
|
30
|
+
},
|
|
31
|
+
/** The axis labels, which stay readable on a small gizmo */
|
|
32
|
+
labelFontPx: Math.max(10, 13 * n)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function It(t, n, e) {
|
|
36
|
+
return Math.max(1, Math.min(t, n) / 2 - e);
|
|
37
|
+
}
|
|
38
|
+
function Pt(t, n) {
|
|
39
|
+
const { gripPx: e, grab: l } = H(t);
|
|
40
|
+
return { radiusPx: n, gripPx: e, headLength: I, ...l };
|
|
41
|
+
}
|
|
42
|
+
function Ft(t, n) {
|
|
43
|
+
const { gripPx: e, grab: l } = H(t);
|
|
44
|
+
return {
|
|
45
|
+
radiusPx: n,
|
|
46
|
+
gripPx: e,
|
|
47
|
+
beyondTipPx: l.beyondTipPx,
|
|
48
|
+
headLength: I
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function O(t, n) {
|
|
52
|
+
return (e) => {
|
|
53
|
+
e ? t.current.set(n, e) : t.current.delete(n);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
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)}`, B = "polygon(0 0, 0 0, 0 0)";
|
|
57
|
+
function pt(t, {
|
|
58
|
+
isPressed: n,
|
|
59
|
+
hovered: e,
|
|
60
|
+
disabled: l
|
|
61
|
+
}) {
|
|
62
|
+
const s = n(t), r = !l && (s || Rt(e, t));
|
|
63
|
+
return { pressed: s, lit: r };
|
|
64
|
+
}
|
|
65
|
+
function dt(t, { pressed: n, lit: e }) {
|
|
66
|
+
return n ? U(t, 0.25) : e ? U(t, 0.12) : "transparent";
|
|
67
|
+
}
|
|
68
|
+
function ft(t, { onHover: n, handlersFor: e }) {
|
|
69
|
+
return {
|
|
70
|
+
onPointerEnter: () => n(t),
|
|
71
|
+
onPointerLeave: () => n(null),
|
|
72
|
+
...e(t)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const J = (t) => ({
|
|
76
|
+
cursor: t ? "default" : "pointer",
|
|
77
|
+
touchAction: "none",
|
|
78
|
+
userSelect: "none"
|
|
79
|
+
}), mt = (t) => `2px solid ${t.palette.primary.main}`, j = {
|
|
80
|
+
x: new A(1, 0, 0),
|
|
81
|
+
y: new A(0, 1, 0),
|
|
82
|
+
z: new A(0, 0, 1)
|
|
83
|
+
};
|
|
84
|
+
function $t(t, n, e = new v()) {
|
|
85
|
+
return e.copy(t).invert().multiply(n);
|
|
86
|
+
}
|
|
87
|
+
const Nt = new v().setFromRotationMatrix(
|
|
88
|
+
new ot().makeBasis(
|
|
89
|
+
new A(1, 0, 0),
|
|
90
|
+
new A(0, 0, -1),
|
|
91
|
+
new A(0, 1, 0)
|
|
92
|
+
)
|
|
93
|
+
), W = new v(), zt = new v();
|
|
94
|
+
function Gt(t) {
|
|
95
|
+
return t.up.z > 0.5 ? zt : Nt;
|
|
96
|
+
}
|
|
97
|
+
function mn(t, n = new v()) {
|
|
98
|
+
return t.getWorldQuaternion(W), $t(W, Gt(t), n);
|
|
99
|
+
}
|
|
100
|
+
function Lt(t, n, e = new v()) {
|
|
101
|
+
return e.copy(t).multiply(n);
|
|
102
|
+
}
|
|
103
|
+
const Ht = 1e-8;
|
|
104
|
+
function K(t, n) {
|
|
105
|
+
return t ? Math.abs(t.dot(n)) < 1 - Ht : !0;
|
|
106
|
+
}
|
|
107
|
+
function Ct(t) {
|
|
108
|
+
const { disabled: n, label: e, overlay: l, size: s } = t, r = rt(), { gripPx: a } = H(s);
|
|
109
|
+
return _.flatMap(
|
|
110
|
+
(u) => F.map((o) => {
|
|
111
|
+
const i = { axis: u, direction: o }, f = pt(i, t), c = ft(i, t);
|
|
112
|
+
return /* @__PURE__ */ w(St, { children: [
|
|
113
|
+
/* @__PURE__ */ g(
|
|
114
|
+
T,
|
|
115
|
+
{
|
|
116
|
+
component: "span",
|
|
117
|
+
"aria-hidden": !0,
|
|
118
|
+
ref: O(l, ut(i)),
|
|
119
|
+
sx: {
|
|
120
|
+
// Cut to the band along the arc by RotationScene
|
|
121
|
+
position: "absolute",
|
|
122
|
+
inset: 0,
|
|
123
|
+
clipPath: B,
|
|
124
|
+
pointerEvents: "none",
|
|
125
|
+
background: dt(G(u), f)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
it.map((h) => /* @__PURE__ */ g(
|
|
130
|
+
T,
|
|
131
|
+
{
|
|
132
|
+
component: "span",
|
|
133
|
+
"aria-hidden": !0,
|
|
134
|
+
ref: O(l, lt(i, h)),
|
|
135
|
+
...c,
|
|
136
|
+
sx: {
|
|
137
|
+
// Covers the gizmo, cut to its half of the band by
|
|
138
|
+
// RotationScene, every frame the gizmo turns
|
|
139
|
+
position: "absolute",
|
|
140
|
+
inset: 0,
|
|
141
|
+
clipPath: B,
|
|
142
|
+
...J(n)
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
h
|
|
146
|
+
)),
|
|
147
|
+
/* @__PURE__ */ g(
|
|
148
|
+
T,
|
|
149
|
+
{
|
|
150
|
+
component: "button",
|
|
151
|
+
type: "button",
|
|
152
|
+
ref: O(l, R(i)),
|
|
153
|
+
disabled: n,
|
|
154
|
+
"aria-label": e(i),
|
|
155
|
+
"aria-pressed": f.pressed,
|
|
156
|
+
...c,
|
|
157
|
+
sx: {
|
|
158
|
+
// Placed on the arrowhead by RotationScene. It shows nothing
|
|
159
|
+
// itself: the band's highlight covers the arrowhead
|
|
160
|
+
position: "absolute",
|
|
161
|
+
width: a,
|
|
162
|
+
height: a,
|
|
163
|
+
transform: "translate(-50%, -50%)",
|
|
164
|
+
padding: 0,
|
|
165
|
+
border: "none",
|
|
166
|
+
borderRadius: "50%",
|
|
167
|
+
background: "transparent",
|
|
168
|
+
// Around the arrowhead only where the arc has no band; else
|
|
169
|
+
// the ring below goes around the whole band
|
|
170
|
+
"&:focus-visible": { outline: mt(r) },
|
|
171
|
+
"&[data-band='shown']:focus-visible": { outline: "none" },
|
|
172
|
+
...J(n)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
/* @__PURE__ */ g(
|
|
177
|
+
T,
|
|
178
|
+
{
|
|
179
|
+
component: "svg",
|
|
180
|
+
"aria-hidden": !0,
|
|
181
|
+
sx: {
|
|
182
|
+
position: "absolute",
|
|
183
|
+
left: 0,
|
|
184
|
+
top: 0,
|
|
185
|
+
width: s,
|
|
186
|
+
height: s,
|
|
187
|
+
overflow: "visible",
|
|
188
|
+
pointerEvents: "none",
|
|
189
|
+
display: "none",
|
|
190
|
+
zIndex: 100,
|
|
191
|
+
"button[data-band='shown']:focus-visible + &": {
|
|
192
|
+
display: "block"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
children: /* @__PURE__ */ g(
|
|
196
|
+
"path",
|
|
197
|
+
{
|
|
198
|
+
ref: O(l, ht(i)),
|
|
199
|
+
fill: "none",
|
|
200
|
+
stroke: r.palette.primary.main,
|
|
201
|
+
strokeWidth: 2,
|
|
202
|
+
strokeLinejoin: "round"
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
] }, R(i));
|
|
208
|
+
})
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
const P = 0.8, X = 0.45, yt = 2.25, gt = {
|
|
212
|
+
x: [new A(0, 1, 0), new A(0, 0, 1)],
|
|
213
|
+
y: [new A(-1, 0, 0), new A(0, 0, 1)],
|
|
214
|
+
z: [new A(1, 0, 0), new A(0, 1, 0)]
|
|
215
|
+
};
|
|
216
|
+
function q(t) {
|
|
217
|
+
const n = t === "+" ? X : X + Math.PI, e = n + yt;
|
|
218
|
+
return { start: n, end: e, head: t === "+" ? e : n };
|
|
219
|
+
}
|
|
220
|
+
const kt = new A(), z = new A(), Bt = new A();
|
|
221
|
+
function Dt(t, n = 24) {
|
|
222
|
+
const e = [];
|
|
223
|
+
for (const l of _) {
|
|
224
|
+
const [s, r] = gt[l], a = (o) => kt.copy(s).multiplyScalar(Math.cos(o) * P).addScaledVector(r, Math.sin(o) * P).applyQuaternion(t), u = Math.abs(
|
|
225
|
+
Bt.copy(j[l]).applyQuaternion(t).z
|
|
226
|
+
);
|
|
227
|
+
for (const o of F) {
|
|
228
|
+
const { start: i, end: f, head: c } = q(o), h = [];
|
|
229
|
+
for (let M = 0; M <= n; M++) {
|
|
230
|
+
const S = a(i + (f - i) * M / n);
|
|
231
|
+
h.push({ x: S.x + 0, y: -S.y + 0, depth: S.z });
|
|
232
|
+
}
|
|
233
|
+
const y = a(c), p = { x: y.x + 0, y: -y.y + 0, depth: y.z }, d = o === "+" ? 1 : -1;
|
|
234
|
+
z.copy(s).multiplyScalar(-Math.sin(c) * d).addScaledVector(r, Math.cos(c) * d).applyQuaternion(t);
|
|
235
|
+
const m = Math.hypot(z.x, z.y), x = m > 1e-9 ? z.x / m : 0, b = m > 1e-9 ? -z.y / m : 0;
|
|
236
|
+
e.push({
|
|
237
|
+
axis: l,
|
|
238
|
+
direction: o,
|
|
239
|
+
points: h,
|
|
240
|
+
head: { ...p, dx: x + 0, dy: b + 0 },
|
|
241
|
+
openness: u
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return e;
|
|
246
|
+
}
|
|
247
|
+
function jt(t, n, e) {
|
|
248
|
+
let l = { distance: Number.POSITIVE_INFINITY, depth: 0 };
|
|
249
|
+
for (let s = 1; s < t.length; s++) {
|
|
250
|
+
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
|
+
1,
|
|
252
|
+
Math.max(
|
|
253
|
+
0,
|
|
254
|
+
((n - r.x) * (a.x - r.x) + (e - r.y) * (a.y - r.y)) / u
|
|
255
|
+
)
|
|
256
|
+
), i = Math.hypot(
|
|
257
|
+
n - (r.x + o * (a.x - r.x)),
|
|
258
|
+
e - (r.y + o * (a.y - r.y))
|
|
259
|
+
);
|
|
260
|
+
i < l.distance && (l = { distance: i, depth: r.depth + o * (a.depth - r.depth) });
|
|
261
|
+
}
|
|
262
|
+
return l;
|
|
263
|
+
}
|
|
264
|
+
function Jt(t, n) {
|
|
265
|
+
const e = t.length, l = t.map(() => new Array(e).fill(!1));
|
|
266
|
+
for (let o = 0; o < e; o++)
|
|
267
|
+
for (let i = o + 1; i < e; i++) {
|
|
268
|
+
if (t[o].arc === t[i].arc) continue;
|
|
269
|
+
let f = 0;
|
|
270
|
+
for (const c of t[o].line) {
|
|
271
|
+
const h = jt(t[i].line, c.x, c.y);
|
|
272
|
+
h.distance < n && (f += c.depth - h.depth);
|
|
273
|
+
}
|
|
274
|
+
f > 0 ? l[o][i] = !0 : f < 0 && (l[i][o] = !0);
|
|
275
|
+
}
|
|
276
|
+
const s = t.map(
|
|
277
|
+
({ line: o }) => o.reduce((i, f) => i + f.depth, 0) / o.length
|
|
278
|
+
), r = (o, i) => s[o] - s[i], a = new Array(e).fill(0), u = new Set(t.keys());
|
|
279
|
+
for (let o = 1; u.size > 0; o++) {
|
|
280
|
+
const i = [...u], f = i.filter((h) => !i.some((y) => l[h][y])), c = (f.length > 0 ? f : i).sort(r)[0];
|
|
281
|
+
a[c] = o, u.delete(c);
|
|
282
|
+
}
|
|
283
|
+
return a;
|
|
284
|
+
}
|
|
285
|
+
const Q = 8;
|
|
286
|
+
function V(t, n) {
|
|
287
|
+
const e = [...t];
|
|
288
|
+
if (n >= 0) {
|
|
289
|
+
const s = e[e.length - 1], r = e[e.length - 2], a = Math.hypot(s.x - r.x, s.y - r.y) || 1;
|
|
290
|
+
return e.push({
|
|
291
|
+
x: s.x + (s.x - r.x) / a * n,
|
|
292
|
+
y: s.y + (s.y - r.y) / a * n,
|
|
293
|
+
depth: s.depth
|
|
294
|
+
}), e;
|
|
295
|
+
}
|
|
296
|
+
let l = -n;
|
|
297
|
+
for (; e.length > 2; ) {
|
|
298
|
+
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 > l) {
|
|
300
|
+
const u = l / a;
|
|
301
|
+
return e[e.length - 1] = {
|
|
302
|
+
x: s.x + (r.x - s.x) * u,
|
|
303
|
+
y: s.y + (r.y - s.y) * u,
|
|
304
|
+
depth: s.depth + (r.depth - s.depth) * u
|
|
305
|
+
}, e;
|
|
306
|
+
}
|
|
307
|
+
l -= a, e.pop();
|
|
308
|
+
}
|
|
309
|
+
return e;
|
|
310
|
+
}
|
|
311
|
+
const Y = (t, n) => V([...t].reverse(), n).reverse();
|
|
312
|
+
function Vt(t, n) {
|
|
313
|
+
const e = n / 2, l = [], s = [], r = [];
|
|
314
|
+
let a = { x: 0, y: 0 };
|
|
315
|
+
for (const [o, i] of t.entries()) {
|
|
316
|
+
const f = t[Math.max(0, o - 1)], c = t[Math.min(t.length - 1, o + 1)], h = c.x - f.x, y = c.y - f.y, p = Math.hypot(h, y);
|
|
317
|
+
p > 1e-9 && (a = { x: -y / p, y: h / p }), r.push(a), l.push({ x: i.x + a.x * e, y: i.y + a.y * e }), s.push({ x: i.x - a.x * e, y: i.y - a.y * e });
|
|
318
|
+
}
|
|
319
|
+
const u = (o, i) => {
|
|
320
|
+
const f = r[o], c = { x: f.y, y: -f.x }, h = i ? 1 : -1;
|
|
321
|
+
return Array.from({ length: Q - 1 }, (y, p) => {
|
|
322
|
+
const d = Math.PI * (p + 1) / Q, m = Math.cos(d) * h, x = Math.sin(d) * h;
|
|
323
|
+
return {
|
|
324
|
+
x: t[o].x + (f.x * m + c.x * x) * e,
|
|
325
|
+
y: t[o].y + (f.y * m + c.y * x) * e
|
|
326
|
+
};
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
return (o, i) => [
|
|
330
|
+
...l.slice(o, i + 1),
|
|
331
|
+
...i === t.length - 1 ? u(i, !0) : [],
|
|
332
|
+
...s.slice(o, i + 1).reverse(),
|
|
333
|
+
...o === 0 ? u(o, !1) : []
|
|
334
|
+
];
|
|
335
|
+
}
|
|
336
|
+
function qt(t, n) {
|
|
337
|
+
return [
|
|
338
|
+
{ from: 0, to: Math.min(t - 1, n + 1) },
|
|
339
|
+
{ from: Math.max(0, n - 1), to: t - 1 }
|
|
340
|
+
];
|
|
341
|
+
}
|
|
342
|
+
function Ut(t, { radiusPx: n, gripPx: e, beyondTipPx: l, headLength: s }) {
|
|
343
|
+
const r = e / 2, a = s / 2 * n + l - r, u = l - r, o = t.map((p) => {
|
|
344
|
+
const d = p.points.map((b) => ({
|
|
345
|
+
x: b.x * n,
|
|
346
|
+
y: b.y * n,
|
|
347
|
+
depth: b.depth
|
|
348
|
+
})), m = d[d.length >> 1], x = p.direction === "+" ? Y(V(d, a), u) : V(Y(d, a), u);
|
|
349
|
+
return { line: x, middle: x.indexOf(m) };
|
|
350
|
+
}), i = o.map(({ line: p }) => p), f = t.map(
|
|
351
|
+
(p) => 2 * P * n * p.openness >= e
|
|
352
|
+
), c = i.flatMap(
|
|
353
|
+
(p, d) => f[d] ? qt(p.length, o[d].middle).map(({ from: m, to: x }) => ({
|
|
354
|
+
arc: d,
|
|
355
|
+
from: m,
|
|
356
|
+
to: x,
|
|
357
|
+
line: p.slice(m, x + 1)
|
|
358
|
+
})) : []
|
|
359
|
+
), h = Jt(c, e), y = t.map((p, d) => d).sort((p, d) => t[p].head.depth - t[d].head.depth);
|
|
360
|
+
return t.map((p, d) => {
|
|
361
|
+
if (!f[d]) return null;
|
|
362
|
+
const m = Vt(i[d], e), x = c.flatMap(
|
|
363
|
+
(b, M) => b.arc === d ? [{ ...b, layer: h[M] }] : []
|
|
364
|
+
);
|
|
365
|
+
return {
|
|
366
|
+
band: m(0, i[d].length - 1),
|
|
367
|
+
halves: x.map(({ from: b, to: M, layer: S }) => ({
|
|
368
|
+
polygon: m(b, M),
|
|
369
|
+
layer: S
|
|
370
|
+
})),
|
|
371
|
+
head: { x: p.head.x * n, y: p.head.y * n },
|
|
372
|
+
headLayer: c.length + 1 + y.indexOf(d)
|
|
373
|
+
};
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
function xt(t, n, e, l) {
|
|
377
|
+
const s = L(null), r = Mt((a) => a.invalidate);
|
|
378
|
+
k(() => {
|
|
379
|
+
s.current = null, r();
|
|
380
|
+
}, [l, r]), k(() => {
|
|
381
|
+
let a = requestAnimationFrame(function u() {
|
|
382
|
+
const o = t.current;
|
|
383
|
+
o && K(s.current, o) && r(), a = requestAnimationFrame(u);
|
|
384
|
+
});
|
|
385
|
+
return () => cancelAnimationFrame(a);
|
|
386
|
+
}, [t, r]), At(() => {
|
|
387
|
+
const a = t.current;
|
|
388
|
+
!a || !n.current || K(s.current, a) && (n.current.quaternion.copy(a), e(a) && (s.current = a.clone()));
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
const Z = 0.03;
|
|
392
|
+
function Wt({
|
|
393
|
+
orientation: t,
|
|
394
|
+
lit: n,
|
|
395
|
+
disabled: e,
|
|
396
|
+
size: l,
|
|
397
|
+
radius: s,
|
|
398
|
+
overlay: r
|
|
399
|
+
}) {
|
|
400
|
+
const a = L(null), u = l / 2, o = (c) => `${(u + c).toFixed(2)}px`, i = (c) => `polygon(${c.map((h) => `${o(h.x)} ${o(h.y)}`).join(", ")})`, f = (c) => `M${c.map((h) => `${(u + h.x).toFixed(2)} ${(u + h.y).toFixed(2)}`).join("L")}Z`;
|
|
401
|
+
return xt(
|
|
402
|
+
t,
|
|
403
|
+
a,
|
|
404
|
+
(c) => {
|
|
405
|
+
let h = !0;
|
|
406
|
+
const y = Dt(c), p = Ut(y, Ft(l, s));
|
|
407
|
+
for (const [d, m] of y.entries()) {
|
|
408
|
+
const x = r.current.get(R(m)), b = r.current.get(ut(m)), M = r.current.get(ht(m)), S = it.map(
|
|
409
|
+
($) => r.current.get(lt(m, $))
|
|
410
|
+
);
|
|
411
|
+
if (!x || !b || !M || S.some(($) => !$)) {
|
|
412
|
+
h = !1;
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
const E = p[d];
|
|
416
|
+
x.style.left = o(m.head.x * s), x.style.top = o(m.head.y * s), x.style.zIndex = E ? String(E.headLayer) : "0", x.style.pointerEvents = E ? "" : "none", x.dataset.band = E ? "shown" : "none", b.style.clipPath = E ? i(E.band) : B, M.setAttribute("d", E ? f(E.band) : "");
|
|
417
|
+
for (const [$, C] of S.entries()) {
|
|
418
|
+
if (!C) continue;
|
|
419
|
+
const N = E == null ? void 0 : E.halves[$];
|
|
420
|
+
C.style.clipPath = N ? i(N.polygon) : B, C.style.zIndex = N ? String(N.layer) : "0", C.style.pointerEvents = N ? "" : "none";
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return h;
|
|
424
|
+
},
|
|
425
|
+
`${l}:${s}`
|
|
426
|
+
), /* @__PURE__ */ w("group", { ref: a, children: [
|
|
427
|
+
/* @__PURE__ */ w("mesh", { children: [
|
|
428
|
+
/* @__PURE__ */ g("sphereGeometry", { args: [0.07, 16, 16] }),
|
|
429
|
+
/* @__PURE__ */ g("meshBasicMaterial", { color: "#c4c8d0" })
|
|
430
|
+
] }),
|
|
431
|
+
_.map((c) => /* @__PURE__ */ g(
|
|
432
|
+
Kt,
|
|
433
|
+
{
|
|
434
|
+
axis: c,
|
|
435
|
+
color: G(c),
|
|
436
|
+
lit: (n == null ? void 0 : n.axis) === c ? n.direction : null,
|
|
437
|
+
disabled: e
|
|
438
|
+
},
|
|
439
|
+
c
|
|
440
|
+
))
|
|
441
|
+
] });
|
|
442
|
+
}
|
|
443
|
+
function Kt({
|
|
444
|
+
axis: t,
|
|
445
|
+
color: n,
|
|
446
|
+
lit: e,
|
|
447
|
+
disabled: l
|
|
448
|
+
}) {
|
|
449
|
+
const s = D(() => {
|
|
450
|
+
const [r, a] = gt[t];
|
|
451
|
+
return new v().setFromRotationMatrix(
|
|
452
|
+
new ot().makeBasis(r, a, j[t])
|
|
453
|
+
);
|
|
454
|
+
}, [t]);
|
|
455
|
+
return /* @__PURE__ */ g("group", { quaternion: s, children: F.map((r) => {
|
|
456
|
+
const a = e === r, u = a ? 1 : l ? 0.35 : 0.8, o = a ? Z * 1.5 : Z;
|
|
457
|
+
return /* @__PURE__ */ w("group", { children: [
|
|
458
|
+
/* @__PURE__ */ w("mesh", { rotation: [0, 0, q(r).start], children: [
|
|
459
|
+
/* @__PURE__ */ g("torusGeometry", { args: [P, o, 12, 48, yt] }),
|
|
460
|
+
/* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: u })
|
|
461
|
+
] }),
|
|
462
|
+
/* @__PURE__ */ g(
|
|
463
|
+
Xt,
|
|
464
|
+
{
|
|
465
|
+
direction: r,
|
|
466
|
+
color: n,
|
|
467
|
+
opacity: u,
|
|
468
|
+
lit: a
|
|
469
|
+
}
|
|
470
|
+
)
|
|
471
|
+
] }, r);
|
|
472
|
+
}) });
|
|
473
|
+
}
|
|
474
|
+
function Xt({
|
|
475
|
+
direction: t,
|
|
476
|
+
color: n,
|
|
477
|
+
opacity: e,
|
|
478
|
+
lit: l
|
|
479
|
+
}) {
|
|
480
|
+
const { position: s, rotation: r } = D(() => {
|
|
481
|
+
const { head: a } = q(t), u = t === "+" ? 1 : -1;
|
|
482
|
+
return {
|
|
483
|
+
position: new A(
|
|
484
|
+
Math.cos(a) * P,
|
|
485
|
+
Math.sin(a) * P,
|
|
486
|
+
0
|
|
487
|
+
),
|
|
488
|
+
rotation: new v().setFromUnitVectors(
|
|
489
|
+
st,
|
|
490
|
+
new A(-Math.sin(a) * u, Math.cos(a) * u, 0)
|
|
491
|
+
)
|
|
492
|
+
};
|
|
493
|
+
}, [t]);
|
|
494
|
+
return /* @__PURE__ */ w("mesh", { position: s, quaternion: r, scale: l ? 1.2 : 1, children: [
|
|
495
|
+
/* @__PURE__ */ g("coneGeometry", { args: [at, I, 20] }),
|
|
496
|
+
/* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: e })
|
|
497
|
+
] });
|
|
498
|
+
}
|
|
499
|
+
function Qt(t) {
|
|
500
|
+
const { disabled: n, label: e, overlay: l, size: s } = t, r = rt(), { gripPx: a, labelFontPx: u } = H(s);
|
|
501
|
+
return /* @__PURE__ */ w(bt, { children: [
|
|
502
|
+
_.map((o) => /* @__PURE__ */ g(
|
|
503
|
+
T,
|
|
504
|
+
{
|
|
505
|
+
component: "span",
|
|
506
|
+
"aria-hidden": !0,
|
|
507
|
+
ref: O(l, ct(o)),
|
|
508
|
+
sx: {
|
|
509
|
+
position: "absolute",
|
|
510
|
+
transform: "translate(-50%, -50%)",
|
|
511
|
+
pointerEvents: "none",
|
|
512
|
+
fontSize: u,
|
|
513
|
+
color: G(o),
|
|
514
|
+
opacity: n ? 0.4 : 1
|
|
515
|
+
},
|
|
516
|
+
children: o.toUpperCase()
|
|
517
|
+
},
|
|
518
|
+
o
|
|
519
|
+
)),
|
|
520
|
+
_.flatMap(
|
|
521
|
+
(o) => F.map((i) => {
|
|
522
|
+
const f = { axis: o, direction: i }, c = pt(f, t);
|
|
523
|
+
return /* @__PURE__ */ g(
|
|
524
|
+
T,
|
|
525
|
+
{
|
|
526
|
+
component: "button",
|
|
527
|
+
type: "button",
|
|
528
|
+
ref: O(l, R(f)),
|
|
529
|
+
disabled: n,
|
|
530
|
+
"aria-label": e(f),
|
|
531
|
+
"aria-pressed": c.pressed,
|
|
532
|
+
...ft(f, t),
|
|
533
|
+
sx: {
|
|
534
|
+
// Placed, sized and turned along its half of the axis by
|
|
535
|
+
// TranslationScene, every frame the gizmo turns
|
|
536
|
+
position: "absolute",
|
|
537
|
+
height: a,
|
|
538
|
+
transformOrigin: "0 50%",
|
|
539
|
+
padding: 0,
|
|
540
|
+
borderRadius: `${a / 2}px`,
|
|
541
|
+
border: "none",
|
|
542
|
+
background: dt(G(o), c),
|
|
543
|
+
"&:focus-visible": { outline: mt(r) },
|
|
544
|
+
...J(n)
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
R(f)
|
|
548
|
+
);
|
|
549
|
+
})
|
|
550
|
+
)
|
|
551
|
+
] });
|
|
552
|
+
}
|
|
553
|
+
function Yt(t) {
|
|
554
|
+
const n = [];
|
|
555
|
+
for (const e of _)
|
|
556
|
+
for (const l of F) {
|
|
557
|
+
const s = j[e].clone().multiplyScalar(l === "+" ? 1 : -1).applyQuaternion(t);
|
|
558
|
+
n.push({
|
|
559
|
+
axis: e,
|
|
560
|
+
direction: l,
|
|
561
|
+
x: s.x + 0,
|
|
562
|
+
y: -s.y + 0,
|
|
563
|
+
depth: s.z
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
return n;
|
|
567
|
+
}
|
|
568
|
+
function Zt(t, n) {
|
|
569
|
+
const { radiusPx: e, gripPx: l, innerPx: s, beyondTipPx: r, minTipPx: a, headLength: u } = n, o = t.map((c) => {
|
|
570
|
+
const h = Math.hypot(c.x, c.y) * e;
|
|
571
|
+
return {
|
|
572
|
+
tip: h,
|
|
573
|
+
angle: Math.atan2(c.y, c.x),
|
|
574
|
+
start: s,
|
|
575
|
+
end: h + r,
|
|
576
|
+
depth: c.depth,
|
|
577
|
+
grabbed: h >= a
|
|
578
|
+
};
|
|
579
|
+
});
|
|
580
|
+
for (const [c, h] of o.entries())
|
|
581
|
+
for (const y of o.slice(c + 1)) {
|
|
582
|
+
if (!h.grabbed || !y.grabbed) continue;
|
|
583
|
+
const [p, d] = h.tip <= y.tip ? [h, y] : [y, h], m = h.angle - y.angle, x = p.tip * Math.abs(Math.sin(m));
|
|
584
|
+
if (Math.cos(m) <= 0 || x >= l) continue;
|
|
585
|
+
const b = d.tip * (1 - u);
|
|
586
|
+
if (p.tip > b) {
|
|
587
|
+
const M = h.depth < y.depth ? h : y;
|
|
588
|
+
M.grabbed = !1;
|
|
589
|
+
} else {
|
|
590
|
+
const M = (p.tip + b) / 2;
|
|
591
|
+
p.end = Math.min(p.end, M), d.start = Math.max(d.start, M);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
const i = o.map((c, h) => h);
|
|
595
|
+
i.sort((c, h) => o[c].depth - o[h].depth);
|
|
596
|
+
const f = new Map(i.map((c, h) => [c, h + 1]));
|
|
597
|
+
return o.map((c, h) => !c.grabbed || c.end <= c.start ? null : {
|
|
598
|
+
x: Math.cos(c.angle) * c.start,
|
|
599
|
+
y: Math.sin(c.angle) * c.start,
|
|
600
|
+
length: c.end - c.start,
|
|
601
|
+
angle: c.angle,
|
|
602
|
+
layer: f.get(h) ?? 0
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
const tt = 0.035, nt = 1.28;
|
|
606
|
+
function tn({
|
|
607
|
+
orientation: t,
|
|
608
|
+
lit: n,
|
|
609
|
+
disabled: e,
|
|
610
|
+
size: l,
|
|
611
|
+
radius: s,
|
|
612
|
+
overlay: r
|
|
613
|
+
}) {
|
|
614
|
+
const a = L(null), u = l / 2;
|
|
615
|
+
return xt(
|
|
616
|
+
t,
|
|
617
|
+
a,
|
|
618
|
+
(o) => {
|
|
619
|
+
let i = !0;
|
|
620
|
+
const f = Yt(o), c = Zt(f, Pt(l, s));
|
|
621
|
+
for (const [h, y] of f.entries()) {
|
|
622
|
+
const p = r.current.get(R(y)), d = c[h];
|
|
623
|
+
if (p ? d ? (p.style.left = `${u + d.x}px`, p.style.top = `${u + d.y}px`, p.style.width = `${d.length}px`, p.style.transform = `translateY(-50%) rotate(${d.angle}rad)`, p.style.zIndex = String(d.layer), p.style.pointerEvents = "") : p.style.pointerEvents = "none" : i = !1, y.direction !== "+") continue;
|
|
624
|
+
const m = r.current.get(ct(y.axis));
|
|
625
|
+
m ? (m.style.left = `${u + y.x * s * nt}px`, m.style.top = `${u + y.y * s * nt}px`) : i = !1;
|
|
626
|
+
}
|
|
627
|
+
return i;
|
|
628
|
+
},
|
|
629
|
+
`${l}:${s}`
|
|
630
|
+
), /* @__PURE__ */ w("group", { ref: a, children: [
|
|
631
|
+
/* @__PURE__ */ w("mesh", { children: [
|
|
632
|
+
/* @__PURE__ */ g("sphereGeometry", { args: [0.07, 16, 16] }),
|
|
633
|
+
/* @__PURE__ */ g("meshBasicMaterial", { color: "#c4c8d0" })
|
|
634
|
+
] }),
|
|
635
|
+
_.map((o) => /* @__PURE__ */ g(
|
|
636
|
+
nn,
|
|
637
|
+
{
|
|
638
|
+
axis: o,
|
|
639
|
+
color: G(o),
|
|
640
|
+
lit: (n == null ? void 0 : n.axis) === o ? n.direction : null,
|
|
641
|
+
disabled: e
|
|
642
|
+
},
|
|
643
|
+
o
|
|
644
|
+
))
|
|
645
|
+
] });
|
|
646
|
+
}
|
|
647
|
+
function nn({
|
|
648
|
+
axis: t,
|
|
649
|
+
color: n,
|
|
650
|
+
lit: e,
|
|
651
|
+
disabled: l
|
|
652
|
+
}) {
|
|
653
|
+
const s = D(
|
|
654
|
+
() => new v().setFromUnitVectors(st, j[t]),
|
|
655
|
+
[t]
|
|
656
|
+
), r = 1 - I;
|
|
657
|
+
return /* @__PURE__ */ g("group", { quaternion: s, children: F.map((a) => {
|
|
658
|
+
const u = e === a, o = u ? 1 : l ? 0.35 : 0.8, i = u ? tt * 1.5 : tt;
|
|
659
|
+
return (
|
|
660
|
+
// The minus half is the plus half turned around
|
|
661
|
+
/* @__PURE__ */ w(
|
|
662
|
+
"group",
|
|
663
|
+
{
|
|
664
|
+
rotation: [a === "+" ? 0 : Math.PI, 0, 0],
|
|
665
|
+
children: [
|
|
666
|
+
/* @__PURE__ */ w("mesh", { position: [0, r / 2, 0], children: [
|
|
667
|
+
/* @__PURE__ */ g(
|
|
668
|
+
"cylinderGeometry",
|
|
669
|
+
{
|
|
670
|
+
args: [i, i, r, 12]
|
|
671
|
+
}
|
|
672
|
+
),
|
|
673
|
+
/* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: o })
|
|
674
|
+
] }),
|
|
675
|
+
/* @__PURE__ */ w(
|
|
676
|
+
"mesh",
|
|
677
|
+
{
|
|
678
|
+
position: [0, 1 - I / 2, 0],
|
|
679
|
+
scale: u ? 1.2 : 1,
|
|
680
|
+
children: [
|
|
681
|
+
/* @__PURE__ */ g("coneGeometry", { args: [at, I, 20] }),
|
|
682
|
+
/* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: o })
|
|
683
|
+
]
|
|
684
|
+
}
|
|
685
|
+
)
|
|
686
|
+
]
|
|
687
|
+
},
|
|
688
|
+
a
|
|
689
|
+
)
|
|
690
|
+
);
|
|
691
|
+
}) });
|
|
692
|
+
}
|
|
693
|
+
const en = new v();
|
|
694
|
+
function on(t, n = en) {
|
|
695
|
+
const e = L(n);
|
|
696
|
+
return e.current = n, D(() => {
|
|
697
|
+
const l = new v();
|
|
698
|
+
return {
|
|
699
|
+
get current() {
|
|
700
|
+
const s = t.current;
|
|
701
|
+
if (!s) return null;
|
|
702
|
+
const r = e.current;
|
|
703
|
+
return Lt(s, typeof r == "function" ? r() : r, l);
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
}, [t]);
|
|
707
|
+
}
|
|
708
|
+
const rn = 3e3;
|
|
709
|
+
function sn(t) {
|
|
710
|
+
const [n, e] = et(() => t.current !== null);
|
|
711
|
+
return k(() => {
|
|
712
|
+
if (n) return;
|
|
713
|
+
let l = requestAnimationFrame(function r() {
|
|
714
|
+
t.current !== null ? e(!0) : l = requestAnimationFrame(r);
|
|
715
|
+
});
|
|
716
|
+
const s = setTimeout(() => {
|
|
717
|
+
t.current === null && console.warn(
|
|
718
|
+
"JoggingGizmo has no orientation, so it stays disabled. Put a JoggingGizmoOrientation with the same ref into the app's 3D scene."
|
|
719
|
+
);
|
|
720
|
+
}, rn);
|
|
721
|
+
return () => {
|
|
722
|
+
cancelAnimationFrame(l), clearTimeout(s);
|
|
723
|
+
};
|
|
724
|
+
}, [n, t]), n;
|
|
725
|
+
}
|
|
726
|
+
const yn = Et(
|
|
727
|
+
({
|
|
728
|
+
orientation: t,
|
|
729
|
+
frameQuaternion: n,
|
|
730
|
+
motion: e = "translate",
|
|
731
|
+
onJogStart: l,
|
|
732
|
+
onJogStop: s,
|
|
733
|
+
activeHandle: r,
|
|
734
|
+
disabled: a = !1,
|
|
735
|
+
size: u = 200
|
|
736
|
+
}) => {
|
|
737
|
+
const o = sn(t), i = a || !o, f = on(t, n), { held: c, handlersFor: h, label: y, isPressed: p } = Tt({
|
|
738
|
+
motion: e,
|
|
739
|
+
onJogStart: l,
|
|
740
|
+
onJogStop: s,
|
|
741
|
+
activeHandle: r,
|
|
742
|
+
disabled: i
|
|
743
|
+
}), [d, m] = et(null);
|
|
744
|
+
k(() => m(null), [e]);
|
|
745
|
+
const x = e === "rotate" ? Wt : tn, b = e === "rotate" ? Ct : Qt, M = L(/* @__PURE__ */ new Map()), S = It(u, u, H(u).marginPx);
|
|
746
|
+
return /* @__PURE__ */ w(
|
|
747
|
+
T,
|
|
748
|
+
{
|
|
749
|
+
"data-testid": "jogging-gizmo",
|
|
750
|
+
sx: {
|
|
751
|
+
position: "relative",
|
|
752
|
+
width: u,
|
|
753
|
+
height: u,
|
|
754
|
+
flexShrink: 0,
|
|
755
|
+
// Keeps the z-indexes of the handles inside the gizmo: without it,
|
|
756
|
+
// they would lie over the app's own elements that cover the gizmo
|
|
757
|
+
// (e.g. a sticky header), and a press there would jog
|
|
758
|
+
isolation: "isolate"
|
|
759
|
+
},
|
|
760
|
+
children: [
|
|
761
|
+
/* @__PURE__ */ g(
|
|
762
|
+
wt,
|
|
763
|
+
{
|
|
764
|
+
orthographic: !0,
|
|
765
|
+
flat: !0,
|
|
766
|
+
frameloop: "demand",
|
|
767
|
+
camera: {
|
|
768
|
+
position: [0, 0, 10],
|
|
769
|
+
up: [0, 1, 0],
|
|
770
|
+
zoom: S,
|
|
771
|
+
near: 0.1,
|
|
772
|
+
far: 100
|
|
773
|
+
},
|
|
774
|
+
gl: { alpha: !0, antialias: !0 },
|
|
775
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none" },
|
|
776
|
+
children: /* @__PURE__ */ g(
|
|
777
|
+
x,
|
|
778
|
+
{
|
|
779
|
+
orientation: f,
|
|
780
|
+
lit: c ?? r ?? d,
|
|
781
|
+
disabled: i,
|
|
782
|
+
size: u,
|
|
783
|
+
radius: S,
|
|
784
|
+
overlay: M
|
|
785
|
+
}
|
|
786
|
+
)
|
|
787
|
+
}
|
|
788
|
+
),
|
|
789
|
+
/* @__PURE__ */ g(
|
|
790
|
+
b,
|
|
791
|
+
{
|
|
792
|
+
isPressed: p,
|
|
793
|
+
hovered: d,
|
|
794
|
+
disabled: i,
|
|
795
|
+
size: u,
|
|
796
|
+
onHover: m,
|
|
797
|
+
handlersFor: h,
|
|
798
|
+
label: y,
|
|
799
|
+
overlay: M
|
|
800
|
+
}
|
|
801
|
+
)
|
|
802
|
+
]
|
|
803
|
+
}
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
);
|
|
807
|
+
export {
|
|
808
|
+
yn as J,
|
|
809
|
+
mn as n
|
|
810
|
+
};
|