@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.4e5a9e6 → 6.4.0-pr.revamp.667.6038f41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d.cjs +1 -1
- package/dist/3d.js +5 -5
- package/dist/CurrentPose/index.cjs +1 -1
- package/dist/CurrentPose/index.js +1 -1
- 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.js +2 -2
- package/dist/JoggingJointSlider/index.cjs +1 -1
- package/dist/JoggingJointSlider/index.js +1 -1
- package/dist/RobotControl/index.cjs +1 -1
- package/dist/RobotControl/index.js +1 -1
- 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 +2 -0
- package/dist/RobotHeader/index.js +6 -4
- package/dist/SafetyBar/index.cjs +1 -1
- package/dist/SafetyBar/index.js +1 -1
- package/dist/chunks/{CurrentPose-BIPvpQLG.cjs → CurrentPose-BStpfgEJ.cjs} +1 -1
- package/dist/chunks/{CurrentPose-DYKoKD2D.js → CurrentPose-UJbSKPRp.js} +2 -2
- package/dist/chunks/{CurrentPoseBar-Cb_Pk2jp.js → CurrentPoseBar-BmsPnLVP.js} +1 -1
- package/dist/chunks/{CurrentPoseBar-CAEEifBY.cjs → CurrentPoseBar-ZUhFaVdM.cjs} +1 -1
- package/dist/chunks/{JoggingButtons-DC0jII72.cjs → JoggingButtons-9nBrKbUa.cjs} +1 -1
- package/dist/chunks/{JoggingButtons-DluWqNuO.js → JoggingButtons-I_Y70pg8.js} +1 -1
- package/dist/chunks/{JoggingGizmo-Hy42DAQU.js → JoggingGizmo-DBpDIbzl.js} +1 -1
- package/dist/chunks/{JoggingGizmo-DT7iX5Ka.cjs → JoggingGizmo-DtWw6KWg.cjs} +1 -1
- package/dist/chunks/{JoggingGizmoOrientation-l2slmUE_.cjs → JoggingGizmoOrientation-BwkW76fE.cjs} +1 -1
- package/dist/chunks/{JoggingGizmoOrientation-Bba8HLQJ.js → JoggingGizmoOrientation-DU97IUWq.js} +1 -1
- package/dist/chunks/{JoggingJointSlider-C0lI_9W5.cjs → JoggingJointSlider-DHBB7MwU.cjs} +1 -1
- package/dist/chunks/{JoggingJointSlider-DePZ3JHW.js → JoggingJointSlider-DeMqm9Jh.js} +1 -1
- package/dist/chunks/{RobotControl-C1JzXIAa.js → RobotControl-BDcNKq32.js} +2 -2
- package/dist/chunks/{RobotControl-ku4CNQCb.cjs → RobotControl-DXbcloVq.cjs} +1 -1
- package/dist/chunks/{RobotControlPanel-Cy5LwU1h.js → RobotControlPanel-CzhYCBAm.js} +4 -4
- package/dist/chunks/{RobotControlPanel-B4u3D3yO.cjs → RobotControlPanel-DHQga5uu.cjs} +1 -1
- package/dist/chunks/{externalizeComponent-CSzPVfuG.js → externalizeComponent-CPAVvPKk.js} +8 -2
- package/dist/chunks/externalizeComponent-CkWiNBu0.cjs +2 -0
- package/dist/chunks/{loadRobotSession-cQNeaBOf.cjs → loadRobotSession-68wS5Tn1.cjs} +1 -1
- package/dist/chunks/{loadRobotSession-DVkuHA-V.js → loadRobotSession-C1g2yivF.js} +3 -3
- package/dist/chunks/robotActivationOf-DXC0E2DS.cjs +1 -0
- package/dist/chunks/robotActivationOf-E1GLe_69.js +477 -0
- package/dist/chunks/{robotModelSource-D7VR89r_.cjs → robotModelSource-BCX1Jrrd.cjs} +1 -1
- package/dist/chunks/{robotModelSource-C2Mi0LtR.js → robotModelSource-C57_9QYT.js} +1 -1
- package/dist/chunks/{robotSafetyOf-Cb4qlwd_.cjs → robotSafetyOf-CwfVV9__.cjs} +1 -1
- package/dist/chunks/{robotSafetyOf-Dr5Q4rCp.js → robotSafetyOf-P4RgO2LQ.js} +1 -1
- 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/core.cjs +1 -1
- package/dist/core.d.ts +2 -0
- package/dist/core.js +46 -44
- package/dist/index.cjs +1 -1
- package/dist/index.js +52 -50
- package/package.json +1 -1
- package/dist/chunks/externalizeComponent-Bl23ayrr.cjs +0 -2
- package/dist/chunks/robotActivationOf-DUHukd46.js +0 -371
- package/dist/chunks/robotActivationOf-DeJsI4H5.cjs +0 -1
package/dist/3d.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/robotModelSource-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/robotModelSource-BCX1Jrrd.cjs"),n=require("./chunks/JoggingGizmo-DtWw6KWg.cjs"),i=require("./chunks/JoggingGizmoOrientation-BwkW76fE.cjs"),a=require("./chunks/RobotControlPanel-DHQga5uu.cjs"),t=require("./chunks/RobotControl-DXbcloVq.cjs"),r=require("./chunks/useSmoothedMotionState-Con0E5Bx.cjs"),e=require("./chunks/Pose3-Ch4xVeXV.cjs");exports.CollisionSceneRenderer=o.CollisionSceneRenderer;exports.JointLimitGizmo=o.JointLimitGizmo;exports.LinearAxis=o.LinearAxis;exports.MotionGroupVisualizer=o.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=o.MotionGroupVisualizerExact;exports.PresetEnvironment=o.PresetEnvironment;exports.Robot=o.Robot;exports.SafetyZonesRenderer=o.SafetyZonesRenderer;exports.SupportedLinearAxis=o.SupportedLinearAxis;exports.SupportedLinearAxisExact=o.SupportedLinearAxisExact;exports.SupportedRobot=o.SupportedRobot;exports.SupportedRobotExact=o.SupportedRobotExact;exports.TrajectoryRenderer=o.TrajectoryRenderer;exports.defaultGetModel=o.defaultGetModel;exports.robotModelOf=o.robotModelOf;exports.JoggingGizmo=n.JoggingGizmo;exports.JoggingGizmoOrientation=i.JoggingGizmoOrientation;exports.RobotControlPanel=a.RobotControlPanel;exports.RobotControl=t.RobotControl;exports.useRobotControlProps=t.useRobotControlProps;exports.ValueInterpolator=r.ValueInterpolator;exports.useSmoothedMotionState=r.useSmoothedMotionState;exports.Pose3=e.Pose3;exports.parseRotationToQuaternion=e.parseRotationToQuaternion;exports.quaternionToRotationVector=e.quaternionToRotationVector;
|
package/dist/3d.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as t, J as a, L as r, M as s, a as n, P as i, R as p, S as u, b as R, c as l, d as m, e as x, T as d, f, r as S } from "./chunks/robotModelSource-
|
|
2
|
-
import { J as c } from "./chunks/JoggingGizmo-
|
|
3
|
-
import { J as G } from "./chunks/JoggingGizmoOrientation-
|
|
4
|
-
import { R as M } from "./chunks/RobotControlPanel-
|
|
5
|
-
import { R as z, u as C } from "./chunks/RobotControl-
|
|
1
|
+
import { C as t, J as a, L as r, M as s, a as n, P as i, R as p, S as u, b as R, c as l, d as m, e as x, T as d, f, r as S } from "./chunks/robotModelSource-C57_9QYT.js";
|
|
2
|
+
import { J as c } from "./chunks/JoggingGizmo-DBpDIbzl.js";
|
|
3
|
+
import { J as G } from "./chunks/JoggingGizmoOrientation-DU97IUWq.js";
|
|
4
|
+
import { R as M } from "./chunks/RobotControlPanel-CzhYCBAm.js";
|
|
5
|
+
import { R as z, u as C } from "./chunks/RobotControl-BDcNKq32.js";
|
|
6
6
|
import { V, a as E } from "./chunks/useSmoothedMotionState-COMJRcOt.js";
|
|
7
7
|
import { P as A, p as q, q as y } from "./chunks/Pose3-B_fLR-Wv.js";
|
|
8
8
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPose-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPose-BStpfgEJ.cjs"),o=require("../chunks/coordSystemLabel-BJKeaGA3.cjs");exports.CurrentPose=e.CurrentPose;exports.default=e.CurrentPose;exports.useCurrentPoseProps=e.useCurrentPoseProps;exports.RobotSessionProvider=o.RobotSessionProvider;exports.useRobotSession=o.useRobotSession;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPoseBar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPoseBar-ZUhFaVdM.cjs");exports.CurrentPoseBar=e.CurrentPoseBar;exports.default=e.CurrentPoseBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../chunks/JoggingButtons-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../chunks/JoggingButtons-9nBrKbUa.cjs");exports.JoggingButtons=t.JoggingButtons;exports.default=t.JoggingButtons;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../chunks/JoggingGizmo-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../chunks/JoggingGizmo-DtWw6KWg.cjs"),o=require("../chunks/JoggingGizmoOrientation-BwkW76fE.cjs");exports.JoggingGizmo=i.JoggingGizmo;exports.default=i.JoggingGizmo;exports.JoggingGizmoOrientation=o.JoggingGizmoOrientation;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as i, J as a } from "../chunks/JoggingGizmo-
|
|
2
|
-
import { J as t } from "../chunks/JoggingGizmoOrientation-
|
|
1
|
+
import { J as i, J as a } from "../chunks/JoggingGizmo-DBpDIbzl.js";
|
|
2
|
+
import { J as t } from "../chunks/JoggingGizmoOrientation-DU97IUWq.js";
|
|
3
3
|
export {
|
|
4
4
|
i as JoggingGizmo,
|
|
5
5
|
t as JoggingGizmoOrientation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/JoggingJointSlider-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/JoggingJointSlider-DHBB7MwU.cjs");exports.JoggingJointSlider=e.JoggingJointSlider;exports.default=e.JoggingJointSlider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControl-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControl-DXbcloVq.cjs"),e=require("../chunks/coordSystemLabel-BJKeaGA3.cjs");exports.RobotControl=o.RobotControl;exports.default=o.RobotControl;exports.useRobotControlProps=o.useRobotControlProps;exports.RobotSessionProvider=e.RobotSessionProvider;exports.useRobotSession=e.useRobotSession;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControlPanel-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControlPanel-DHQga5uu.cjs");exports.RobotControlPanel=o.RobotControlPanel;exports.default=o.RobotControlPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/robotActivationOf-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/robotActivationOf-DXC0E2DS.cjs"),t=require("../chunks/robotSafetyOf-CwfVV9__.cjs");exports.ConnectionWarning=o.ConnectionWarning;exports.RobotHeader=o.RobotHeader;exports.connectionWarningOf=o.connectionWarningOf;exports.default=o.RobotHeader;exports.robotActivationOf=o.robotActivationOf;exports.robotSafetyOf=t.robotSafetyOf;
|
|
@@ -4,3 +4,5 @@ export { RobotHeader, RobotHeader as default, type RobotHeaderActivation, type R
|
|
|
4
4
|
export { robotActivationOf } from "../components/robotHeader/robotActivationOf";
|
|
5
5
|
export { robotSafetyOf } from "../components/robotHeader/robotSafetyOf";
|
|
6
6
|
export type { SafetyBarProps } from "../SafetyBar/SafetyBar";
|
|
7
|
+
export { type ConnectionQuality, ConnectionWarning, type ConnectionWarningProps, } from "../components/connectionWarning/ConnectionWarning";
|
|
8
|
+
export { connectionWarningOf } from "../components/connectionWarning/connectionWarningOf";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { a as r,
|
|
2
|
-
import { r as s } from "../chunks/robotSafetyOf-
|
|
1
|
+
import { C as n, a as r, c as t, a as e, r as f } from "../chunks/robotActivationOf-E1GLe_69.js";
|
|
2
|
+
import { r as s } from "../chunks/robotSafetyOf-P4RgO2LQ.js";
|
|
3
3
|
export {
|
|
4
|
+
n as ConnectionWarning,
|
|
4
5
|
r as RobotHeader,
|
|
5
|
-
t as
|
|
6
|
-
e as
|
|
6
|
+
t as connectionWarningOf,
|
|
7
|
+
e as default,
|
|
8
|
+
f as robotActivationOf,
|
|
7
9
|
s as robotSafetyOf
|
|
8
10
|
};
|
package/dist/SafetyBar/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/robotSafetyOf-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/robotSafetyOf-CwfVV9__.cjs");exports.SafetyBar=e.SafetyBar;exports.default=e.SafetyBar;exports.robotSafetyOf=e.robotSafetyOf;
|
package/dist/SafetyBar/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const S=require("react/jsx-runtime"),b=require("mobx-react-lite"),m=require("./coordSystemLabel-BJKeaGA3.cjs"),f=require("./CurrentPoseBar-
|
|
1
|
+
"use strict";const S=require("react/jsx-runtime"),b=require("mobx-react-lite"),m=require("./coordSystemLabel-BJKeaGA3.cjs"),f=require("./CurrentPoseBar-ZUhFaVdM.cjs"),p=require("react"),q=require("react-i18next"),x=require("./externalizeComponent-CkWiNBu0.cjs");function g(s){var u,d,l;const e=s.jogging,{t:r}=q.useTranslation(void 0,{i18n:x.i18n}),[o,n]=p.useState(e.selectedTcpId),[i,C]=p.useState(e.selectedCoordSystemId),c=e.tcpsById[o]?o:e.selectedTcpId,a=e.coordSystemsById[i]?i:e.selectedCoordSystemId,y=(l=(d=(u=e.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:u.details)==null?void 0:d.state)==null?void 0:l.kind,I=e.lastJogErrorTranslationKey?r(e.lastJogErrorTranslationKey):e.lastJogError;function P(){const t=e.tcpPoseIn(c,a);return!(t!=null&&t.position)||!t.orientation?null:{position:t.position,orientation:t.orientation}}return{getCurrentPose:P,tcp:e.tcps.length>0?{options:e.tcps.map(t=>({id:t.id,label:t.id})),value:c,onChange:n}:void 0,frame:{options:e.coordSystems.map(t=>({id:t.coordinate_system,label:m.coordSystemLabel(e,t)})),value:a,onChange:C},state:y,error:I}}const T=b.observer(function({session:e,...r}){const o=m.useRobotSessionOf(e),n=g(o);return S.jsx(f.CurrentPoseBar,{...n,...r})});exports.CurrentPose=T;exports.useCurrentPoseProps=g;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as y } from "react/jsx-runtime";
|
|
2
2
|
import { observer as I } from "mobx-react-lite";
|
|
3
3
|
import { c as S, a as P } from "./coordSystemLabel-C1jfhEh5.js";
|
|
4
|
-
import { C as b } from "./CurrentPoseBar-
|
|
4
|
+
import { C as b } from "./CurrentPoseBar-BmsPnLVP.js";
|
|
5
5
|
import { useState as l } from "react";
|
|
6
6
|
import { useTranslation as T } from "react-i18next";
|
|
7
|
-
import { i as v } from "./externalizeComponent-
|
|
7
|
+
import { i as v } from "./externalizeComponent-CPAVvPKk.js";
|
|
8
8
|
function h(n) {
|
|
9
9
|
var d, p, m;
|
|
10
10
|
const o = n.jogging, { t: r } = T(void 0, { i18n: v }), [e, s] = l(o.selectedTcpId), [i, u] = l(o.selectedCoordSystemId), a = o.tcpsById[e] ? e : o.selectedTcpId, c = o.coordSystemsById[i] ? i : o.selectedCoordSystemId, f = (m = (p = (d = o.jogger.motionStream.rapidlyChangingMotionState.execute) == null ? void 0 : d.details) == null ? void 0 : p.state) == null ? void 0 : m.kind, g = o.lastJogErrorTranslationKey ? r(o.lastJogErrorTranslationKey) : o.lastJogError;
|
|
@@ -8,7 +8,7 @@ import { ContentCopyFilled as tn } from "@wandelbots/icons/ContentCopyFilled";
|
|
|
8
8
|
import { Settings as on } from "@wandelbots/icons/Settings";
|
|
9
9
|
import { memo as rn, useId as K, useRef as $, useState as j, useCallback as T } from "react";
|
|
10
10
|
import { useTranslation as U } from "react-i18next";
|
|
11
|
-
import { e as an } from "./externalizeComponent-
|
|
11
|
+
import { e as an } from "./externalizeComponent-CPAVvPKk.js";
|
|
12
12
|
import { P as B, c as sn, u as ln, b as cn } from "./useEveryFrame-DAuNawGP.js";
|
|
13
13
|
import { S as un } from "./SmallSelect-BdD9uLKK.js";
|
|
14
14
|
import pn from "@mui/material/ListSubheader";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),$=require("@mui/material/Divider"),Z=require("@mui/material/IconButton"),b=require("@mui/material/Stack"),G=require("@mui/material/Tooltip"),R=require("@mui/material/Typography"),J=require("@wandelbots/icons/ContentCopyFilled"),H=require("@wandelbots/icons/Settings"),d=require("react"),F=require("react-i18next"),K=require("./externalizeComponent-
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),$=require("@mui/material/Divider"),Z=require("@mui/material/IconButton"),b=require("@mui/material/Stack"),G=require("@mui/material/Tooltip"),R=require("@mui/material/Typography"),J=require("@wandelbots/icons/ContentCopyFilled"),H=require("@wandelbots/icons/Settings"),d=require("react"),F=require("react-i18next"),K=require("./externalizeComponent-CkWiNBu0.cjs"),y=require("./useEveryFrame-CHxg25f4.cjs"),ee=require("./SmallSelect-Dcsd7_6_.cjs"),ne=require("@mui/material/ListSubheader"),te=require("@mui/material/MenuItem"),re=require("@mui/material/Popover"),oe=require("@wandelbots/mui"),ie=require("@mui/material/Box"),D=["XYZ","XZY","YXZ","YZX","ZXY","ZYX","XYX","XZX","YXY","YZY","ZXZ","ZYZ"],ae=[...D.map(e=>`EULER_ANGLES_INTRINSIC_${e}`),...D.map(e=>`EULER_ANGLES_EXTRINSIC_${e}`)];function N(e){const n=e.slice(e.lastIndexOf("_")+1);return{intrinsic:e.includes("_INTRINSIC_"),axes:[...n]}}function z([e,n,r]){const o=Math.hypot(e,n,r);if(o<1e-12)return[0,0,0,1];const c=Math.sin(o/2)/o;return[e*c,n*c,r*c,Math.cos(o/2)]}const U={X:0,Y:1,Z:2};function se(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function le(e,n){const{intrinsic:r,axes:o}=N(n),c=r?[...o].reverse():o,i=U[c[0]],s=U[c[1]],p=c[0]===c[2],a=p?3-i-s:U[c[2]],x=(i-s)*(s-a)*(a-i)/2,q=Math.hypot(...e)||1,[L,A,I,m]=e.map(V=>V/q),S=[L,A,I],j=S[i]??0,f=S[s]??0,v=(S[a]??0)*x,[T,g,O,_]=p?[m,j,f,v]:[m-f,j+v,f+m,v-j];let C=2*Math.atan2(Math.hypot(O,_),Math.hypot(T,g));const E=Math.atan2(g,T),P=Math.atan2(_,O);let l,u;const h=1e-7;return Math.abs(C)<=h?(l=2*E,u=0):Math.abs(C-Math.PI)<=h?(l=-2*P,u=0):(l=E-P,u=E+P),p||(u*=x,C-=Math.PI/2),(r?[u,C,l]:[l,C,u]).map(se)}function X({children:e}){return t.jsx(ne,{children:e})}X.muiSkipListHighlight=!0;function ce({value:e,onChange:n}){const{t:r}=F.useTranslation(),o=d.useId(),c=s=>{const{intrinsic:p,axes:a}=N(s);return r(p?"CurrentPose.EulerConvention.Intrinsic.lb":"CurrentPose.EulerConvention.Extrinsic.lb",{axes:a.join("")})},i=s=>ae.filter(p=>N(p).intrinsic===s).map(p=>t.jsx(te,{value:p,children:N(p).axes.join("")},p));return t.jsxs(oe.AdornedSelect,{label:r("CurrentPose.EulerConvention.lb"),labelId:o,value:e,renderValue:s=>c(s),onChange:s=>n(s.target.value),children:[t.jsx(X,{children:r("CurrentPose.EulerConvention.Intrinsic.hlb")}),i(!0),t.jsx(X,{children:r("CurrentPose.EulerConvention.Extrinsic.hlb")}),i(!1)]})}const ue=d.memo(pe,(e,n)=>e.anchor===n.anchor&&e.open===n.open&&e.onClose===n.onClose&&e.onChange===n.onChange&&e.format.type===n.format.type&&e.format.angleUnit===n.format.angleUnit&&e.format.eulerConvention===n.format.eulerConvention);function pe({anchor:e,open:n,onClose:r,format:o,onChange:c}){const{t:i}=F.useTranslation(),s=i("CurrentPose.OrientationFormat.ti"),p=a=>c({...o,...a});return t.jsxs(re,{open:n,anchorEl:e,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":s,sx:a=>{var x;return{width:"264px",padding:"16px",display:"flex",flexDirection:"column",gap:"16px",borderRadius:"10px",border:`1px solid ${a.palette.divider}`,background:(x=a.palette.backgroundPaperElevation)==null?void 0:x[2],backgroundImage:"none",boxShadow:a.shadows[16]}}}},children:[t.jsx(R,{variant:"subtitle2",color:"text.primary",children:s}),t.jsx($,{}),t.jsxs(b,{sx:{gap:"8px"},children:[t.jsx(y.PanelSelect,{label:i("CurrentPose.Format.lb"),options:[{id:"rotationVector",label:i("CurrentPose.Format.RotationVector.lb")},{id:"eulerAngles",label:i("CurrentPose.Format.EulerAngles.lb")},{id:"quaternion",label:i("CurrentPose.Format.Quaternion.lb")}],value:o.type,onChange:a=>p({type:a}),disabled:!1}),o.type!=="quaternion"&&t.jsx(y.PanelSelect,{label:i("CurrentPose.AngleUnit.lb"),options:[{id:"rad",label:i("CurrentPose.AngleUnit.Radians.lb")},{id:"deg",label:i("CurrentPose.AngleUnit.Degrees.lb")}],value:o.angleUnit,onChange:a=>p({angleUnit:a}),disabled:!1}),o.type==="eulerAngles"&&t.jsx(ce,{value:o.eulerConvention,onChange:a=>p({eulerConvention:a})})]})]})}const de={type:"rotationVector",angleUnit:"rad",eulerConvention:"EULER_ANGLES_EXTRINSIC_XYZ"};function w(e,n){const r=e.toFixed(n);return Number(r)===0?0 .toFixed(n):r}function B(e,n){return n==="deg"?`${w(e*180/Math.PI,1)}°`:`${w(e,3)} rad`}function xe(e){switch(e.type){case"quaternion":return["Qx","Qy","Qz","Qw"];case"eulerAngles":return N(e.eulerConvention).axes.map(n=>`R${n.toLowerCase()}`);default:return["Rx","Ry","Rz"]}}function he(e,n){switch(n.type){case"quaternion":return z(e).map(r=>w(r,3));case"eulerAngles":return le(z(e),n.eulerConvention).map(r=>B(r,n.angleUnit));default:return e.map(r=>B(r,n.angleUnit))}}function ge(e,n){const r=["x","y","z"].map((i,s)=>({label:i.toUpperCase(),value:e?w(e.position[s]??0,1):"–",kind:i})),o=e?he(e.orientation,n):null,c=xe(n).map((i,s)=>({label:i,value:(o==null?void 0:o[s])??"–",kind:"orientation"}));return[...r,...c]}const Ce={KIND_UNKNOWN:"success.main",RUNNING:"info.main",PAUSED_NEAR_COLLISION:"warning.main",PAUSED_NEAR_JOINT_LIMIT:"warning.main",PAUSED_NEAR_SINGULARITY:"warning.main"};function be({state:e,error:n}){const{t:r}=F.useTranslation(),o=e??"KIND_UNKNOWN",c=n||r(`Jogging.StreamStateSection.${o}.lb`),i=n?"error.main":Ce[o]??"text.secondary";return t.jsx(G,{title:n?c:"",placement:"top-end",children:t.jsxs(b,{direction:"row","data-testid":n?"JOG_ERROR":o,sx:{gap:"5px",alignItems:"center",minWidth:0},children:[t.jsx(ie,{sx:{width:"6px",height:"6px",borderRadius:"50%",flexShrink:0,bgcolor:i}}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{color:i,letterSpacing:"0.17px"},children:c})]})})}const k={letterSpacing:"0.17px"},me={x:"error.main",y:"success.main",z:"info.main",orientation:"grey.600"};function Q({children:e,id:n}){return t.jsx(R,{id:n,variant:"caption",color:"text.secondary",noWrap:!0,sx:k,children:e})}function W({label:e,...n}){const r=d.useId();return t.jsxs(b,{direction:"row",sx:{gap:"8px",alignItems:"center"},children:[t.jsx(Q,{id:r,children:e}),t.jsx(ee.SmallSelect,{labelId:r,width:"172px",...n})]})}const M=()=>t.jsx($,{orientation:"vertical",flexItem:!1,sx:{height:"16px"}}),ve=K.externalizeComponent(({getCurrentPose:e,tcp:n,frame:r,state:o,error:c,orientationFormat:i,onOrientationFormatChange:s,sx:p})=>{const{t:a}=F.useTranslation(),x=d.useRef(null),[q,L]=d.useState(de),A=i??q,[I,m]=d.useState(null),{copied:S,copy:j}=y.useCopyText(),f=y.useEveryFrame(()=>JSON.stringify(e()),!0),v=JSON.parse(f),T=ge(v,A),g=d.useRef({tcp:n,frame:r,onOrientationFormatChange:s});g.current={tcp:n,frame:r,onOrientationFormatChange:s};const O=d.useCallback(l=>{var u;return(u=g.current.tcp)==null?void 0:u.onChange(l)},[]),_=d.useCallback(l=>{var u;return(u=g.current.frame)==null?void 0:u.onChange(l)},[]),C=d.useCallback(l=>{var u,h;L(l),(h=(u=g.current).onOrientationFormatChange)==null||h.call(u,l)},[]),E=d.useCallback(()=>m(null),[]);function P(){const l=e();l&&j(y.poseToText(l))}return t.jsxs(b,{ref:x,direction:"row","data-testid":"current-pose-bar",sx:[l=>{var u;return{alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"8px 16px",minHeight:"54px",boxSizing:"border-box",borderRadius:"10px",border:`1px solid ${l.palette.divider}`,background:(u=l.palette.backgroundPaperElevation)==null?void 0:u[2],boxShadow:l.shadows[16]}},...Array.isArray(p)?p:[p]],children:[t.jsxs(b,{direction:"row",sx:{gap:"12px",alignItems:"center",minWidth:0},children:[t.jsx(Q,{children:a("CurrentPose.Title.lb")}),t.jsx(Z,{"aria-label":a("CurrentPose.OrientationFormat.ti"),"aria-haspopup":"dialog","aria-expanded":I!==null,onClick:()=>m(x.current),sx:{padding:"3px",margin:"-3px",color:"text.secondary"},children:t.jsx(H.Settings,{})}),n&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("RobotControl.Tcp.lb"),options:n.options,value:n.value,onChange:O})]}),r&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("CurrentPose.RelativeTo.lb"),options:r.options,value:r.value,onChange:_})]}),t.jsx(M,{}),t.jsx(b,{direction:"row","data-testid":"current-pose-values",sx:{gap:"12px",alignItems:"center",minWidth:0,overflow:"hidden"},children:T.map(({label:l,value:u,kind:h},Y)=>t.jsxs(b,{direction:"row",sx:{gap:h==="orientation"?"1px":"2px"},children:[t.jsx(R,{variant:"caption",sx:{...k,color:me[h]},children:l}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{...k,color:"text.secondary",fontVariantNumeric:"tabular-nums"},children:u})]},Y))}),t.jsx(G,{title:a("CurrentPose.Copied.lb"),open:S,disableHoverListener:!0,placement:"top",children:t.jsx("span",{children:t.jsx(Z,{"aria-label":a("CurrentPose.Copy.bt"),onClick:P,disabled:!v,sx:{width:"30px",height:"30px",padding:"5px",borderRadius:"10px",color:"text.secondary","& svg":{width:"20px",height:"20px"}},children:t.jsx(J.ContentCopyFilled,{})})})})]}),t.jsx(be,{state:o,error:c}),t.jsx(ue,{anchor:I,open:I!==null,onClose:E,format:A,onChange:C})]})});exports.CurrentPoseBar=ve;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("react/jsx-runtime"),j=require("@mui/material/Box"),d=require("@mui/material/Button"),x=require("@mui/material/Stack"),l=require("@mui/material/styles"),m=require("@mui/material/Typography"),q=require("@wandelbots/icons/Rotation"),f=require("@wandelbots/mui"),I=require("./externalizeComponent-
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),j=require("@mui/material/Box"),d=require("@mui/material/Button"),x=require("@mui/material/Stack"),l=require("@mui/material/styles"),m=require("@mui/material/Typography"),q=require("@wandelbots/icons/Rotation"),f=require("@wandelbots/mui"),I=require("./externalizeComponent-CkWiNBu0.cjs"),t=require("./joggingColors-ZDc_2UCp.cjs");function y({axis:e,motion:n,disabled:i}){const r=t.jogAxisColors[e];return o.jsx(j,{"aria-hidden":!0,sx:{opacity:i?.4:1,width:30,height:30,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1,backgroundColor:l.alpha(r,.15),border:`1px solid ${l.alpha(r,.4)}`},children:o.jsx(m,{variant:"caption",sx:{color:r},children:n==="rotate"?`R${e}`:e.toUpperCase()})})}function R(e){return o.jsx(q.Rotation,{style:e.direction==="-"?{transform:"scaleX(-1)"}:void 0})}const v=I.externalizeComponent(e=>{const{motion:n="translate",disabled:i=!1}=e,{handlersFor:r,label:C,isPressed:b}=t.useJogControls(e);return o.jsx(x,{"data-testid":"jogging-buttons",sx:{gap:"16px",width:280,maxWidth:"100%"},children:t.JOG_AXES.map(a=>o.jsxs(x,{direction:"row",sx:{alignItems:"center",gap:"16px"},children:[o.jsx(y,{axis:a,motion:n,disabled:i}),t.JOG_DIRECTIONS.map(c=>{const s={axis:a,direction:c},u=b(s),g=n==="rotate"?R(s):void 0,h=t.jogAxisColors[a],p={backgroundColor:l.alpha(h,.25),borderColor:l.alpha(h,.4)};return o.jsx(f.SecondaryButton,{size:"large",disabled:i,"aria-label":C(s),"aria-pressed":u,startIcon:c==="-"?g:void 0,endIcon:c==="+"?g:void 0,...r(s),sx:{flex:1,touchAction:"none",userSelect:"none","& svg":{width:24,height:24},[`& .${d.buttonClasses.startIcon}`]:{marginLeft:"-6px"},[`& .${d.buttonClasses.endIcon}`]:{marginRight:"-6px"},...u&&{...p,[`&.${d.buttonClasses.disabled}`]:p}},children:t.jogHandleName(s,n)},c)})]},a))})});exports.JoggingButtons=v;
|
|
@@ -6,7 +6,7 @@ import { alpha as d } from "@mui/material/styles";
|
|
|
6
6
|
import I from "@mui/material/Typography";
|
|
7
7
|
import { Rotation as j } from "@wandelbots/icons/Rotation";
|
|
8
8
|
import { SecondaryButton as y } from "@wandelbots/mui";
|
|
9
|
-
import { e as v } from "./externalizeComponent-
|
|
9
|
+
import { e as v } from "./externalizeComponent-CPAVvPKk.js";
|
|
10
10
|
import { u as J, J as S, a as k, j as u, b as R } from "./joggingColors-CuT5u0H8.js";
|
|
11
11
|
function $({
|
|
12
12
|
axis: o,
|
|
@@ -3,7 +3,7 @@ import T from "@mui/material/Box";
|
|
|
3
3
|
import { useThree as Mt, useFrame as At, Canvas as wt } from "@react-three/fiber";
|
|
4
4
|
import { Fragment as St, useRef as L, useEffect as k, useMemo as D, useState as et } from "react";
|
|
5
5
|
import { Vector3 as A, Quaternion as v, Matrix4 as ot } from "three";
|
|
6
|
-
import { e as Et } from "./externalizeComponent-
|
|
6
|
+
import { e as Et } from "./externalizeComponent-CPAVvPKk.js";
|
|
7
7
|
import { c as vt, i as Rt, J as _, a as F, u as Tt } from "./joggingColors-CuT5u0H8.js";
|
|
8
8
|
import { alpha as U, useTheme as rt } from "@mui/material/styles";
|
|
9
9
|
const st = new A(0, 1, 0), I = 0.26, at = 0.1, _t = { x: "X", y: "Y", z: "Z" };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const d=require("react/jsx-runtime"),R=require("@mui/material/Box"),z=require("@react-three/fiber"),M=require("react"),g=require("three"),pt=require("./externalizeComponent-Bl23ayrr.cjs"),E=require("./joggingColors-ZDc_2UCp.cjs"),$=require("@mui/material/styles"),Y=new g.Vector3(0,1,0),I=.26,Z=.1,dt={x:"X",y:"Y",z:"Z"};function V(t){var e;return((e=E.cartesianAxisColors[dt[t]].buttonBackgroundColor)==null?void 0:e.default)??"currentColor"}const ft=200;function F(t){const e=t/ft;return{marginPx:30*e,gripPx:30*e,grab:{innerPx:10*e,beyondTipPx:10*e,minTipPx:16*e},labelFontPx:Math.max(10,13*e)}}function xt(t,e,n){return Math.max(1,Math.min(t,e)/2-n)}function yt(t,e){const{gripPx:n,grab:l}=F(t);return{radiusPx:e,gripPx:n,headLength:I,...l}}function gt(t,e){const{gripPx:n,grab:l}=F(t);return{radiusPx:e,gripPx:n,beyondTipPx:l.beyondTipPx,headLength:I}}function _(t,e){return n=>{n?t.current.set(e,n):t.current.delete(e)}}const O=t=>`${t.axis}${t.direction}`,tt=t=>`label:${t}`,et=[0,1],nt=(t,e)=>`half:${O(t)}:${e}`,ot=t=>`halo:${O(t)}`,st=t=>`focus:${O(t)}`,C="polygon(0 0, 0 0, 0 0)";function rt(t,{isPressed:e,hovered:n,disabled:l}){const r=e(t),s=!l&&(r||E.isSameJogHandle(n,t));return{pressed:r,lit:s}}function at(t,{pressed:e,lit:n}){return e?$.alpha(t,.25):n?$.alpha(t,.12):"transparent"}function ct(t,{onHover:e,handlersFor:n}){return{onPointerEnter:()=>e(t),onPointerLeave:()=>e(null),...n(t)}}const q=t=>({cursor:t?"default":"pointer",touchAction:"none",userSelect:"none"}),it=t=>`2px solid ${t.palette.primary.main}`,J={x:new g.Vector3(1,0,0),y:new g.Vector3(0,1,0),z:new g.Vector3(0,0,1)};function mt(t,e,n=new g.Quaternion){return n.copy(t).invert().multiply(e)}const bt=new g.Quaternion().setFromRotationMatrix(new g.Matrix4().makeBasis(new g.Vector3(1,0,0),new g.Vector3(0,0,-1),new g.Vector3(0,1,0))),L=new g.Quaternion,St=new g.Quaternion;function At(t){return t.up.z>.5?St:bt}function Mt(t,e=new g.Quaternion){return t.getWorldQuaternion(L),mt(L,At(t),e)}function Et(t,e,n=new g.Quaternion){return n.copy(t).multiply(e)}const wt=1e-8;function B(t,e){return t?Math.abs(t.dot(e))<1-wt:!0}function jt(t){const{disabled:e,label:n,overlay:l,size:r}=t,s=$.useTheme(),{gripPx:a}=F(r);return E.JOG_AXES.flatMap(u=>E.JOG_DIRECTIONS.map(o=>{const i={axis:u,direction:o},x=rt(i,t),c=ct(i,t);return d.jsxs(M.Fragment,{children:[d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,ot(i)),sx:{position:"absolute",inset:0,clipPath:C,pointerEvents:"none",background:at(V(u),x)}}),et.map(h=>d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,nt(i,h)),...c,sx:{position:"absolute",inset:0,clipPath:C,...q(e)}},h)),d.jsx(R,{component:"button",type:"button",ref:_(l,O(i)),disabled:e,"aria-label":n(i),"aria-pressed":x.pressed,...c,sx:{position:"absolute",width:a,height:a,transform:"translate(-50%, -50%)",padding:0,border:"none",borderRadius:"50%",background:"transparent","&:focus-visible":{outline:it(s)},"&[data-band='shown']:focus-visible":{outline:"none"},...q(e)}}),d.jsx(R,{component:"svg","aria-hidden":!0,sx:{position:"absolute",left:0,top:0,width:r,height:r,overflow:"visible",pointerEvents:"none",display:"none",zIndex:100,"button[data-band='shown']:focus-visible + &":{display:"block"}},children:d.jsx("path",{ref:_(l,st(i)),fill:"none",stroke:s.palette.primary.main,strokeWidth:2,strokeLinejoin:"round"})})]},O(i))}))}const T=.8,Q=.45,lt=2.25,ut={x:[new g.Vector3(0,1,0),new g.Vector3(0,0,1)],y:[new g.Vector3(-1,0,0),new g.Vector3(0,0,1)],z:[new g.Vector3(1,0,0),new g.Vector3(0,1,0)]};function H(t){const e=t==="+"?Q:Q+Math.PI,n=e+lt;return{start:e,end:n,head:t==="+"?n:e}}const Ot=new g.Vector3,P=new g.Vector3,Rt=new g.Vector3;function _t(t,e=24){const n=[];for(const l of E.JOG_AXES){const[r,s]=ut[l],a=o=>Ot.copy(r).multiplyScalar(Math.cos(o)*T).addScaledVector(s,Math.sin(o)*T).applyQuaternion(t),u=Math.abs(Rt.copy(J[l]).applyQuaternion(t).z);for(const o of E.JOG_DIRECTIONS){const{start:i,end:x,head:c}=H(o),h=[];for(let A=0;A<=e;A++){const w=a(i+(x-i)*A/e);h.push({x:w.x+0,y:-w.y+0,depth:w.z})}const m=a(c),p={x:m.x+0,y:-m.y+0,depth:m.z},f=o==="+"?1:-1;P.copy(r).multiplyScalar(-Math.sin(c)*f).addScaledVector(s,Math.cos(c)*f).applyQuaternion(t);const y=Math.hypot(P.x,P.y),b=y>1e-9?P.x/y:0,S=y>1e-9?-P.y/y:0;n.push({axis:l,direction:o,points:h,head:{...p,dx:b+0,dy:S+0},openness:u})}}return n}function It(t,e,n){let l={distance:Number.POSITIVE_INFINITY,depth:0};for(let r=1;r<t.length;r++){const s=t[r-1],a=t[r],u=(a.x-s.x)**2+(a.y-s.y)**2,o=u===0?0:Math.min(1,Math.max(0,((e-s.x)*(a.x-s.x)+(n-s.y)*(a.y-s.y))/u)),i=Math.hypot(e-(s.x+o*(a.x-s.x)),n-(s.y+o*(a.y-s.y)));i<l.distance&&(l={distance:i,depth:s.depth+o*(a.depth-s.depth)})}return l}function Tt(t,e){const n=t.length,l=t.map(()=>new Array(n).fill(!1));for(let o=0;o<n;o++)for(let i=o+1;i<n;i++){if(t[o].arc===t[i].arc)continue;let x=0;for(const c of t[o].line){const h=It(t[i].line,c.x,c.y);h.distance<e&&(x+=c.depth-h.depth)}x>0?l[o][i]=!0:x<0&&(l[i][o]=!0)}const r=t.map(({line:o})=>o.reduce((i,x)=>i+x.depth,0)/o.length),s=(o,i)=>r[o]-r[i],a=new Array(n).fill(0),u=new Set(t.keys());for(let o=1;u.size>0;o++){const i=[...u],x=i.filter(h=>!i.some(m=>l[h][m])),c=(x.length>0?x:i).sort(s)[0];a[c]=o,u.delete(c)}return a}const k=8;function D(t,e){const n=[...t];if(e>=0){const r=n[n.length-1],s=n[n.length-2],a=Math.hypot(r.x-s.x,r.y-s.y)||1;return n.push({x:r.x+(r.x-s.x)/a*e,y:r.y+(r.y-s.y)/a*e,depth:r.depth}),n}let l=-e;for(;n.length>2;){const r=n[n.length-1],s=n[n.length-2],a=Math.hypot(r.x-s.x,r.y-s.y);if(a>l){const u=l/a;return n[n.length-1]={x:r.x+(s.x-r.x)*u,y:r.y+(s.y-r.y)*u,depth:r.depth+(s.depth-r.depth)*u},n}l-=a,n.pop()}return n}const X=(t,e)=>D([...t].reverse(),e).reverse();function vt(t,e){const n=e/2,l=[],r=[],s=[];let a={x:0,y:0};for(const[o,i]of t.entries()){const x=t[Math.max(0,o-1)],c=t[Math.min(t.length-1,o+1)],h=c.x-x.x,m=c.y-x.y,p=Math.hypot(h,m);p>1e-9&&(a={x:-m/p,y:h/p}),s.push(a),l.push({x:i.x+a.x*n,y:i.y+a.y*n}),r.push({x:i.x-a.x*n,y:i.y-a.y*n})}const u=(o,i)=>{const x=s[o],c={x:x.y,y:-x.x},h=i?1:-1;return Array.from({length:k-1},(m,p)=>{const f=Math.PI*(p+1)/k,y=Math.cos(f)*h,b=Math.sin(f)*h;return{x:t[o].x+(x.x*y+c.x*b)*n,y:t[o].y+(x.y*y+c.y*b)*n}})};return(o,i)=>[...l.slice(o,i+1),...i===t.length-1?u(i,!0):[],...r.slice(o,i+1).reverse(),...o===0?u(o,!1):[]]}function Gt(t,e){return[{from:0,to:Math.min(t-1,e+1)},{from:Math.max(0,e-1),to:t-1}]}function Pt(t,{radiusPx:e,gripPx:n,beyondTipPx:l,headLength:r}){const s=n/2,a=r/2*e+l-s,u=l-s,o=t.map(p=>{const f=p.points.map(S=>({x:S.x*e,y:S.y*e,depth:S.depth})),y=f[f.length>>1],b=p.direction==="+"?X(D(f,a),u):D(X(f,a),u);return{line:b,middle:b.indexOf(y)}}),i=o.map(({line:p})=>p),x=t.map(p=>2*T*e*p.openness>=n),c=i.flatMap((p,f)=>x[f]?Gt(p.length,o[f].middle).map(({from:y,to:b})=>({arc:f,from:y,to:b,line:p.slice(y,b+1)})):[]),h=Tt(c,n),m=t.map((p,f)=>f).sort((p,f)=>t[p].head.depth-t[f].head.depth);return t.map((p,f)=>{if(!x[f])return null;const y=vt(i[f],n),b=c.flatMap((S,A)=>S.arc===f?[{...S,layer:h[A]}]:[]);return{band:y(0,i[f].length-1),halves:b.map(({from:S,to:A,layer:w})=>({polygon:y(S,A),layer:w})),head:{x:p.head.x*e,y:p.head.y*e},headLayer:c.length+1+m.indexOf(f)}})}function ht(t,e,n,l){const r=M.useRef(null),s=z.useThree(a=>a.invalidate);M.useEffect(()=>{r.current=null,s()},[l,s]),M.useEffect(()=>{let a=requestAnimationFrame(function u(){const o=t.current;o&&B(r.current,o)&&s(),a=requestAnimationFrame(u)});return()=>cancelAnimationFrame(a)},[t,s]),z.useFrame(()=>{const a=t.current;!a||!e.current||B(r.current,a)&&(e.current.quaternion.copy(a),n(a)&&(r.current=a.clone()))})}const U=.03;function Vt({orientation:t,lit:e,disabled:n,size:l,radius:r,overlay:s}){const a=M.useRef(null),u=l/2,o=c=>`${(u+c).toFixed(2)}px`,i=c=>`polygon(${c.map(h=>`${o(h.x)} ${o(h.y)}`).join(", ")})`,x=c=>`M${c.map(h=>`${(u+h.x).toFixed(2)} ${(u+h.y).toFixed(2)}`).join("L")}Z`;return ht(t,a,c=>{let h=!0;const m=_t(c),p=Pt(m,gt(l,r));for(const[f,y]of m.entries()){const b=s.current.get(O(y)),S=s.current.get(ot(y)),A=s.current.get(st(y)),w=et.map(v=>s.current.get(nt(y,v)));if(!b||!S||!A||w.some(v=>!v)){h=!1;continue}const j=p[f];b.style.left=o(y.head.x*r),b.style.top=o(y.head.y*r),b.style.zIndex=j?String(j.headLayer):"0",b.style.pointerEvents=j?"":"none",b.dataset.band=j?"shown":"none",S.style.clipPath=j?i(j.band):C,A.setAttribute("d",j?x(j.band):"");for(const[v,N]of w.entries()){if(!N)continue;const G=j==null?void 0:j.halves[v];N.style.clipPath=G?i(G.polygon):C,N.style.zIndex=G?String(G.layer):"0",N.style.pointerEvents=G?"":"none"}}return h},`${l}:${r}`),d.jsxs("group",{ref:a,children:[d.jsxs("mesh",{children:[d.jsx("sphereGeometry",{args:[.07,16,16]}),d.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(c=>d.jsx(Ft,{axis:c,color:V(c),lit:(e==null?void 0:e.axis)===c?e.direction:null,disabled:n},c))]})}function Ft({axis:t,color:e,lit:n,disabled:l}){const r=M.useMemo(()=>{const[s,a]=ut[t];return new g.Quaternion().setFromRotationMatrix(new g.Matrix4().makeBasis(s,a,J[t]))},[t]);return d.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(s=>{const a=n===s,u=a?1:l?.35:.8,o=a?U*1.5:U;return d.jsxs("group",{children:[d.jsxs("mesh",{rotation:[0,0,H(s).start],children:[d.jsx("torusGeometry",{args:[T,o,12,48,lt]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:u})]}),d.jsx(Nt,{direction:s,color:e,opacity:u,lit:a})]},s)})})}function Nt({direction:t,color:e,opacity:n,lit:l}){const{position:r,rotation:s}=M.useMemo(()=>{const{head:a}=H(t),u=t==="+"?1:-1;return{position:new g.Vector3(Math.cos(a)*T,Math.sin(a)*T,0),rotation:new g.Quaternion().setFromUnitVectors(Y,new g.Vector3(-Math.sin(a)*u,Math.cos(a)*u,0))}},[t]);return d.jsxs("mesh",{position:r,quaternion:s,scale:l?1.2:1,children:[d.jsx("coneGeometry",{args:[Z,I,20]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:n})]})}function $t(t){const{disabled:e,label:n,overlay:l,size:r}=t,s=$.useTheme(),{gripPx:a,labelFontPx:u}=F(r);return d.jsxs(d.Fragment,{children:[E.JOG_AXES.map(o=>d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,tt(o)),sx:{position:"absolute",transform:"translate(-50%, -50%)",pointerEvents:"none",fontSize:u,color:V(o),opacity:e?.4:1},children:o.toUpperCase()},o)),E.JOG_AXES.flatMap(o=>E.JOG_DIRECTIONS.map(i=>{const x={axis:o,direction:i},c=rt(x,t);return d.jsx(R,{component:"button",type:"button",ref:_(l,O(x)),disabled:e,"aria-label":n(x),"aria-pressed":c.pressed,...ct(x,t),sx:{position:"absolute",height:a,transformOrigin:"0 50%",padding:0,borderRadius:`${a/2}px`,border:"none",background:at(V(o),c),"&:focus-visible":{outline:it(s)},...q(e)}},O(x))}))]})}function Ct(t){const e=[];for(const n of E.JOG_AXES)for(const l of E.JOG_DIRECTIONS){const r=J[n].clone().multiplyScalar(l==="+"?1:-1).applyQuaternion(t);e.push({axis:n,direction:l,x:r.x+0,y:-r.y+0,depth:r.z})}return e}function Jt(t,e){const{radiusPx:n,gripPx:l,innerPx:r,beyondTipPx:s,minTipPx:a,headLength:u}=e,o=t.map(c=>{const h=Math.hypot(c.x,c.y)*n;return{tip:h,angle:Math.atan2(c.y,c.x),start:r,end:h+s,depth:c.depth,grabbed:h>=a}});for(const[c,h]of o.entries())for(const m of o.slice(c+1)){if(!h.grabbed||!m.grabbed)continue;const[p,f]=h.tip<=m.tip?[h,m]:[m,h],y=h.angle-m.angle,b=p.tip*Math.abs(Math.sin(y));if(Math.cos(y)<=0||b>=l)continue;const S=f.tip*(1-u);if(p.tip>S){const A=h.depth<m.depth?h:m;A.grabbed=!1}else{const A=(p.tip+S)/2;p.end=Math.min(p.end,A),f.start=Math.max(f.start,A)}}const i=o.map((c,h)=>h);i.sort((c,h)=>o[c].depth-o[h].depth);const x=new Map(i.map((c,h)=>[c,h+1]));return o.map((c,h)=>!c.grabbed||c.end<=c.start?null:{x:Math.cos(c.angle)*c.start,y:Math.sin(c.angle)*c.start,length:c.end-c.start,angle:c.angle,layer:x.get(h)??0})}const W=.035,K=1.28;function zt({orientation:t,lit:e,disabled:n,size:l,radius:r,overlay:s}){const a=M.useRef(null),u=l/2;return ht(t,a,o=>{let i=!0;const x=Ct(o),c=Jt(x,yt(l,r));for(const[h,m]of x.entries()){const p=s.current.get(O(m)),f=c[h];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":i=!1,m.direction!=="+")continue;const y=s.current.get(tt(m.axis));y?(y.style.left=`${u+m.x*r*K}px`,y.style.top=`${u+m.y*r*K}px`):i=!1}return i},`${l}:${r}`),d.jsxs("group",{ref:a,children:[d.jsxs("mesh",{children:[d.jsx("sphereGeometry",{args:[.07,16,16]}),d.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(o=>d.jsx(qt,{axis:o,color:V(o),lit:(e==null?void 0:e.axis)===o?e.direction:null,disabled:n},o))]})}function qt({axis:t,color:e,lit:n,disabled:l}){const r=M.useMemo(()=>new g.Quaternion().setFromUnitVectors(Y,J[t]),[t]),s=1-I;return d.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(a=>{const u=n===a,o=u?1:l?.35:.8,i=u?W*1.5:W;return d.jsxs("group",{rotation:[a==="+"?0:Math.PI,0,0],children:[d.jsxs("mesh",{position:[0,s/2,0],children:[d.jsx("cylinderGeometry",{args:[i,i,s,12]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]}),d.jsxs("mesh",{position:[0,1-I/2,0],scale:u?1.2:1,children:[d.jsx("coneGeometry",{args:[Z,I,20]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]})]},a)})})}const Dt=new g.Quaternion;function Ht(t,e=Dt){const n=M.useRef(e);return n.current=e,M.useMemo(()=>{const l=new g.Quaternion;return{get current(){const r=t.current;if(!r)return null;const s=n.current;return Et(r,typeof s=="function"?s():s,l)}}},[t])}const Lt=3e3;function Bt(t){const[e,n]=M.useState(()=>t.current!==null);return M.useEffect(()=>{if(e)return;let l=requestAnimationFrame(function s(){t.current!==null?n(!0):l=requestAnimationFrame(s)});const r=setTimeout(()=>{t.current===null&&console.warn("JoggingGizmo has no orientation, so it stays disabled. Put a JoggingGizmoOrientation with the same ref into the app's 3D scene.")},Lt);return()=>{cancelAnimationFrame(l),clearTimeout(r)}},[e,t]),e}const Qt=pt.externalizeComponent(({orientation:t,frameQuaternion:e,motion:n="translate",onJogStart:l,onJogStop:r,activeHandle:s,disabled:a=!1,size:u=200})=>{const o=Bt(t),i=a||!o,x=Ht(t,e),{held:c,handlersFor:h,label:m,isPressed:p}=E.useJogControls({motion:n,onJogStart:l,onJogStop:r,activeHandle:s,disabled:i}),[f,y]=M.useState(null);M.useEffect(()=>y(null),[n]);const b=n==="rotate"?Vt:zt,S=n==="rotate"?jt:$t,A=M.useRef(new Map),w=xt(u,u,F(u).marginPx);return d.jsxs(R,{"data-testid":"jogging-gizmo",sx:{position:"relative",width:u,height:u,flexShrink:0,isolation:"isolate"},children:[d.jsx(z.Canvas,{orthographic:!0,flat:!0,frameloop:"demand",camera:{position:[0,0,10],up:[0,1,0],zoom:w,near:.1,far:100},gl:{alpha:!0,antialias:!0},style:{position:"absolute",inset:0,pointerEvents:"none"},children:d.jsx(b,{orientation:x,lit:c??s??f,disabled:i,size:u,radius:w,overlay:A})}),d.jsx(S,{isPressed:p,hovered:f,disabled:i,size:u,onHover:y,handlersFor:h,label:m,overlay:A})]})});exports.JoggingGizmo=Qt;exports.novaAxesSeenBy=Mt;
|
|
1
|
+
"use strict";const d=require("react/jsx-runtime"),R=require("@mui/material/Box"),z=require("@react-three/fiber"),M=require("react"),g=require("three"),pt=require("./externalizeComponent-CkWiNBu0.cjs"),E=require("./joggingColors-ZDc_2UCp.cjs"),$=require("@mui/material/styles"),Y=new g.Vector3(0,1,0),I=.26,Z=.1,dt={x:"X",y:"Y",z:"Z"};function V(t){var e;return((e=E.cartesianAxisColors[dt[t]].buttonBackgroundColor)==null?void 0:e.default)??"currentColor"}const ft=200;function F(t){const e=t/ft;return{marginPx:30*e,gripPx:30*e,grab:{innerPx:10*e,beyondTipPx:10*e,minTipPx:16*e},labelFontPx:Math.max(10,13*e)}}function xt(t,e,n){return Math.max(1,Math.min(t,e)/2-n)}function yt(t,e){const{gripPx:n,grab:l}=F(t);return{radiusPx:e,gripPx:n,headLength:I,...l}}function gt(t,e){const{gripPx:n,grab:l}=F(t);return{radiusPx:e,gripPx:n,beyondTipPx:l.beyondTipPx,headLength:I}}function _(t,e){return n=>{n?t.current.set(e,n):t.current.delete(e)}}const O=t=>`${t.axis}${t.direction}`,tt=t=>`label:${t}`,et=[0,1],nt=(t,e)=>`half:${O(t)}:${e}`,ot=t=>`halo:${O(t)}`,st=t=>`focus:${O(t)}`,C="polygon(0 0, 0 0, 0 0)";function rt(t,{isPressed:e,hovered:n,disabled:l}){const r=e(t),s=!l&&(r||E.isSameJogHandle(n,t));return{pressed:r,lit:s}}function at(t,{pressed:e,lit:n}){return e?$.alpha(t,.25):n?$.alpha(t,.12):"transparent"}function ct(t,{onHover:e,handlersFor:n}){return{onPointerEnter:()=>e(t),onPointerLeave:()=>e(null),...n(t)}}const q=t=>({cursor:t?"default":"pointer",touchAction:"none",userSelect:"none"}),it=t=>`2px solid ${t.palette.primary.main}`,J={x:new g.Vector3(1,0,0),y:new g.Vector3(0,1,0),z:new g.Vector3(0,0,1)};function mt(t,e,n=new g.Quaternion){return n.copy(t).invert().multiply(e)}const bt=new g.Quaternion().setFromRotationMatrix(new g.Matrix4().makeBasis(new g.Vector3(1,0,0),new g.Vector3(0,0,-1),new g.Vector3(0,1,0))),L=new g.Quaternion,St=new g.Quaternion;function At(t){return t.up.z>.5?St:bt}function Mt(t,e=new g.Quaternion){return t.getWorldQuaternion(L),mt(L,At(t),e)}function Et(t,e,n=new g.Quaternion){return n.copy(t).multiply(e)}const wt=1e-8;function B(t,e){return t?Math.abs(t.dot(e))<1-wt:!0}function jt(t){const{disabled:e,label:n,overlay:l,size:r}=t,s=$.useTheme(),{gripPx:a}=F(r);return E.JOG_AXES.flatMap(u=>E.JOG_DIRECTIONS.map(o=>{const i={axis:u,direction:o},x=rt(i,t),c=ct(i,t);return d.jsxs(M.Fragment,{children:[d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,ot(i)),sx:{position:"absolute",inset:0,clipPath:C,pointerEvents:"none",background:at(V(u),x)}}),et.map(h=>d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,nt(i,h)),...c,sx:{position:"absolute",inset:0,clipPath:C,...q(e)}},h)),d.jsx(R,{component:"button",type:"button",ref:_(l,O(i)),disabled:e,"aria-label":n(i),"aria-pressed":x.pressed,...c,sx:{position:"absolute",width:a,height:a,transform:"translate(-50%, -50%)",padding:0,border:"none",borderRadius:"50%",background:"transparent","&:focus-visible":{outline:it(s)},"&[data-band='shown']:focus-visible":{outline:"none"},...q(e)}}),d.jsx(R,{component:"svg","aria-hidden":!0,sx:{position:"absolute",left:0,top:0,width:r,height:r,overflow:"visible",pointerEvents:"none",display:"none",zIndex:100,"button[data-band='shown']:focus-visible + &":{display:"block"}},children:d.jsx("path",{ref:_(l,st(i)),fill:"none",stroke:s.palette.primary.main,strokeWidth:2,strokeLinejoin:"round"})})]},O(i))}))}const T=.8,Q=.45,lt=2.25,ut={x:[new g.Vector3(0,1,0),new g.Vector3(0,0,1)],y:[new g.Vector3(-1,0,0),new g.Vector3(0,0,1)],z:[new g.Vector3(1,0,0),new g.Vector3(0,1,0)]};function H(t){const e=t==="+"?Q:Q+Math.PI,n=e+lt;return{start:e,end:n,head:t==="+"?n:e}}const Ot=new g.Vector3,P=new g.Vector3,Rt=new g.Vector3;function _t(t,e=24){const n=[];for(const l of E.JOG_AXES){const[r,s]=ut[l],a=o=>Ot.copy(r).multiplyScalar(Math.cos(o)*T).addScaledVector(s,Math.sin(o)*T).applyQuaternion(t),u=Math.abs(Rt.copy(J[l]).applyQuaternion(t).z);for(const o of E.JOG_DIRECTIONS){const{start:i,end:x,head:c}=H(o),h=[];for(let A=0;A<=e;A++){const w=a(i+(x-i)*A/e);h.push({x:w.x+0,y:-w.y+0,depth:w.z})}const m=a(c),p={x:m.x+0,y:-m.y+0,depth:m.z},f=o==="+"?1:-1;P.copy(r).multiplyScalar(-Math.sin(c)*f).addScaledVector(s,Math.cos(c)*f).applyQuaternion(t);const y=Math.hypot(P.x,P.y),b=y>1e-9?P.x/y:0,S=y>1e-9?-P.y/y:0;n.push({axis:l,direction:o,points:h,head:{...p,dx:b+0,dy:S+0},openness:u})}}return n}function It(t,e,n){let l={distance:Number.POSITIVE_INFINITY,depth:0};for(let r=1;r<t.length;r++){const s=t[r-1],a=t[r],u=(a.x-s.x)**2+(a.y-s.y)**2,o=u===0?0:Math.min(1,Math.max(0,((e-s.x)*(a.x-s.x)+(n-s.y)*(a.y-s.y))/u)),i=Math.hypot(e-(s.x+o*(a.x-s.x)),n-(s.y+o*(a.y-s.y)));i<l.distance&&(l={distance:i,depth:s.depth+o*(a.depth-s.depth)})}return l}function Tt(t,e){const n=t.length,l=t.map(()=>new Array(n).fill(!1));for(let o=0;o<n;o++)for(let i=o+1;i<n;i++){if(t[o].arc===t[i].arc)continue;let x=0;for(const c of t[o].line){const h=It(t[i].line,c.x,c.y);h.distance<e&&(x+=c.depth-h.depth)}x>0?l[o][i]=!0:x<0&&(l[i][o]=!0)}const r=t.map(({line:o})=>o.reduce((i,x)=>i+x.depth,0)/o.length),s=(o,i)=>r[o]-r[i],a=new Array(n).fill(0),u=new Set(t.keys());for(let o=1;u.size>0;o++){const i=[...u],x=i.filter(h=>!i.some(m=>l[h][m])),c=(x.length>0?x:i).sort(s)[0];a[c]=o,u.delete(c)}return a}const k=8;function D(t,e){const n=[...t];if(e>=0){const r=n[n.length-1],s=n[n.length-2],a=Math.hypot(r.x-s.x,r.y-s.y)||1;return n.push({x:r.x+(r.x-s.x)/a*e,y:r.y+(r.y-s.y)/a*e,depth:r.depth}),n}let l=-e;for(;n.length>2;){const r=n[n.length-1],s=n[n.length-2],a=Math.hypot(r.x-s.x,r.y-s.y);if(a>l){const u=l/a;return n[n.length-1]={x:r.x+(s.x-r.x)*u,y:r.y+(s.y-r.y)*u,depth:r.depth+(s.depth-r.depth)*u},n}l-=a,n.pop()}return n}const X=(t,e)=>D([...t].reverse(),e).reverse();function vt(t,e){const n=e/2,l=[],r=[],s=[];let a={x:0,y:0};for(const[o,i]of t.entries()){const x=t[Math.max(0,o-1)],c=t[Math.min(t.length-1,o+1)],h=c.x-x.x,m=c.y-x.y,p=Math.hypot(h,m);p>1e-9&&(a={x:-m/p,y:h/p}),s.push(a),l.push({x:i.x+a.x*n,y:i.y+a.y*n}),r.push({x:i.x-a.x*n,y:i.y-a.y*n})}const u=(o,i)=>{const x=s[o],c={x:x.y,y:-x.x},h=i?1:-1;return Array.from({length:k-1},(m,p)=>{const f=Math.PI*(p+1)/k,y=Math.cos(f)*h,b=Math.sin(f)*h;return{x:t[o].x+(x.x*y+c.x*b)*n,y:t[o].y+(x.y*y+c.y*b)*n}})};return(o,i)=>[...l.slice(o,i+1),...i===t.length-1?u(i,!0):[],...r.slice(o,i+1).reverse(),...o===0?u(o,!1):[]]}function Gt(t,e){return[{from:0,to:Math.min(t-1,e+1)},{from:Math.max(0,e-1),to:t-1}]}function Pt(t,{radiusPx:e,gripPx:n,beyondTipPx:l,headLength:r}){const s=n/2,a=r/2*e+l-s,u=l-s,o=t.map(p=>{const f=p.points.map(S=>({x:S.x*e,y:S.y*e,depth:S.depth})),y=f[f.length>>1],b=p.direction==="+"?X(D(f,a),u):D(X(f,a),u);return{line:b,middle:b.indexOf(y)}}),i=o.map(({line:p})=>p),x=t.map(p=>2*T*e*p.openness>=n),c=i.flatMap((p,f)=>x[f]?Gt(p.length,o[f].middle).map(({from:y,to:b})=>({arc:f,from:y,to:b,line:p.slice(y,b+1)})):[]),h=Tt(c,n),m=t.map((p,f)=>f).sort((p,f)=>t[p].head.depth-t[f].head.depth);return t.map((p,f)=>{if(!x[f])return null;const y=vt(i[f],n),b=c.flatMap((S,A)=>S.arc===f?[{...S,layer:h[A]}]:[]);return{band:y(0,i[f].length-1),halves:b.map(({from:S,to:A,layer:w})=>({polygon:y(S,A),layer:w})),head:{x:p.head.x*e,y:p.head.y*e},headLayer:c.length+1+m.indexOf(f)}})}function ht(t,e,n,l){const r=M.useRef(null),s=z.useThree(a=>a.invalidate);M.useEffect(()=>{r.current=null,s()},[l,s]),M.useEffect(()=>{let a=requestAnimationFrame(function u(){const o=t.current;o&&B(r.current,o)&&s(),a=requestAnimationFrame(u)});return()=>cancelAnimationFrame(a)},[t,s]),z.useFrame(()=>{const a=t.current;!a||!e.current||B(r.current,a)&&(e.current.quaternion.copy(a),n(a)&&(r.current=a.clone()))})}const U=.03;function Vt({orientation:t,lit:e,disabled:n,size:l,radius:r,overlay:s}){const a=M.useRef(null),u=l/2,o=c=>`${(u+c).toFixed(2)}px`,i=c=>`polygon(${c.map(h=>`${o(h.x)} ${o(h.y)}`).join(", ")})`,x=c=>`M${c.map(h=>`${(u+h.x).toFixed(2)} ${(u+h.y).toFixed(2)}`).join("L")}Z`;return ht(t,a,c=>{let h=!0;const m=_t(c),p=Pt(m,gt(l,r));for(const[f,y]of m.entries()){const b=s.current.get(O(y)),S=s.current.get(ot(y)),A=s.current.get(st(y)),w=et.map(v=>s.current.get(nt(y,v)));if(!b||!S||!A||w.some(v=>!v)){h=!1;continue}const j=p[f];b.style.left=o(y.head.x*r),b.style.top=o(y.head.y*r),b.style.zIndex=j?String(j.headLayer):"0",b.style.pointerEvents=j?"":"none",b.dataset.band=j?"shown":"none",S.style.clipPath=j?i(j.band):C,A.setAttribute("d",j?x(j.band):"");for(const[v,N]of w.entries()){if(!N)continue;const G=j==null?void 0:j.halves[v];N.style.clipPath=G?i(G.polygon):C,N.style.zIndex=G?String(G.layer):"0",N.style.pointerEvents=G?"":"none"}}return h},`${l}:${r}`),d.jsxs("group",{ref:a,children:[d.jsxs("mesh",{children:[d.jsx("sphereGeometry",{args:[.07,16,16]}),d.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(c=>d.jsx(Ft,{axis:c,color:V(c),lit:(e==null?void 0:e.axis)===c?e.direction:null,disabled:n},c))]})}function Ft({axis:t,color:e,lit:n,disabled:l}){const r=M.useMemo(()=>{const[s,a]=ut[t];return new g.Quaternion().setFromRotationMatrix(new g.Matrix4().makeBasis(s,a,J[t]))},[t]);return d.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(s=>{const a=n===s,u=a?1:l?.35:.8,o=a?U*1.5:U;return d.jsxs("group",{children:[d.jsxs("mesh",{rotation:[0,0,H(s).start],children:[d.jsx("torusGeometry",{args:[T,o,12,48,lt]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:u})]}),d.jsx(Nt,{direction:s,color:e,opacity:u,lit:a})]},s)})})}function Nt({direction:t,color:e,opacity:n,lit:l}){const{position:r,rotation:s}=M.useMemo(()=>{const{head:a}=H(t),u=t==="+"?1:-1;return{position:new g.Vector3(Math.cos(a)*T,Math.sin(a)*T,0),rotation:new g.Quaternion().setFromUnitVectors(Y,new g.Vector3(-Math.sin(a)*u,Math.cos(a)*u,0))}},[t]);return d.jsxs("mesh",{position:r,quaternion:s,scale:l?1.2:1,children:[d.jsx("coneGeometry",{args:[Z,I,20]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:n})]})}function $t(t){const{disabled:e,label:n,overlay:l,size:r}=t,s=$.useTheme(),{gripPx:a,labelFontPx:u}=F(r);return d.jsxs(d.Fragment,{children:[E.JOG_AXES.map(o=>d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,tt(o)),sx:{position:"absolute",transform:"translate(-50%, -50%)",pointerEvents:"none",fontSize:u,color:V(o),opacity:e?.4:1},children:o.toUpperCase()},o)),E.JOG_AXES.flatMap(o=>E.JOG_DIRECTIONS.map(i=>{const x={axis:o,direction:i},c=rt(x,t);return d.jsx(R,{component:"button",type:"button",ref:_(l,O(x)),disabled:e,"aria-label":n(x),"aria-pressed":c.pressed,...ct(x,t),sx:{position:"absolute",height:a,transformOrigin:"0 50%",padding:0,borderRadius:`${a/2}px`,border:"none",background:at(V(o),c),"&:focus-visible":{outline:it(s)},...q(e)}},O(x))}))]})}function Ct(t){const e=[];for(const n of E.JOG_AXES)for(const l of E.JOG_DIRECTIONS){const r=J[n].clone().multiplyScalar(l==="+"?1:-1).applyQuaternion(t);e.push({axis:n,direction:l,x:r.x+0,y:-r.y+0,depth:r.z})}return e}function Jt(t,e){const{radiusPx:n,gripPx:l,innerPx:r,beyondTipPx:s,minTipPx:a,headLength:u}=e,o=t.map(c=>{const h=Math.hypot(c.x,c.y)*n;return{tip:h,angle:Math.atan2(c.y,c.x),start:r,end:h+s,depth:c.depth,grabbed:h>=a}});for(const[c,h]of o.entries())for(const m of o.slice(c+1)){if(!h.grabbed||!m.grabbed)continue;const[p,f]=h.tip<=m.tip?[h,m]:[m,h],y=h.angle-m.angle,b=p.tip*Math.abs(Math.sin(y));if(Math.cos(y)<=0||b>=l)continue;const S=f.tip*(1-u);if(p.tip>S){const A=h.depth<m.depth?h:m;A.grabbed=!1}else{const A=(p.tip+S)/2;p.end=Math.min(p.end,A),f.start=Math.max(f.start,A)}}const i=o.map((c,h)=>h);i.sort((c,h)=>o[c].depth-o[h].depth);const x=new Map(i.map((c,h)=>[c,h+1]));return o.map((c,h)=>!c.grabbed||c.end<=c.start?null:{x:Math.cos(c.angle)*c.start,y:Math.sin(c.angle)*c.start,length:c.end-c.start,angle:c.angle,layer:x.get(h)??0})}const W=.035,K=1.28;function zt({orientation:t,lit:e,disabled:n,size:l,radius:r,overlay:s}){const a=M.useRef(null),u=l/2;return ht(t,a,o=>{let i=!0;const x=Ct(o),c=Jt(x,yt(l,r));for(const[h,m]of x.entries()){const p=s.current.get(O(m)),f=c[h];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":i=!1,m.direction!=="+")continue;const y=s.current.get(tt(m.axis));y?(y.style.left=`${u+m.x*r*K}px`,y.style.top=`${u+m.y*r*K}px`):i=!1}return i},`${l}:${r}`),d.jsxs("group",{ref:a,children:[d.jsxs("mesh",{children:[d.jsx("sphereGeometry",{args:[.07,16,16]}),d.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(o=>d.jsx(qt,{axis:o,color:V(o),lit:(e==null?void 0:e.axis)===o?e.direction:null,disabled:n},o))]})}function qt({axis:t,color:e,lit:n,disabled:l}){const r=M.useMemo(()=>new g.Quaternion().setFromUnitVectors(Y,J[t]),[t]),s=1-I;return d.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(a=>{const u=n===a,o=u?1:l?.35:.8,i=u?W*1.5:W;return d.jsxs("group",{rotation:[a==="+"?0:Math.PI,0,0],children:[d.jsxs("mesh",{position:[0,s/2,0],children:[d.jsx("cylinderGeometry",{args:[i,i,s,12]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]}),d.jsxs("mesh",{position:[0,1-I/2,0],scale:u?1.2:1,children:[d.jsx("coneGeometry",{args:[Z,I,20]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]})]},a)})})}const Dt=new g.Quaternion;function Ht(t,e=Dt){const n=M.useRef(e);return n.current=e,M.useMemo(()=>{const l=new g.Quaternion;return{get current(){const r=t.current;if(!r)return null;const s=n.current;return Et(r,typeof s=="function"?s():s,l)}}},[t])}const Lt=3e3;function Bt(t){const[e,n]=M.useState(()=>t.current!==null);return M.useEffect(()=>{if(e)return;let l=requestAnimationFrame(function s(){t.current!==null?n(!0):l=requestAnimationFrame(s)});const r=setTimeout(()=>{t.current===null&&console.warn("JoggingGizmo has no orientation, so it stays disabled. Put a JoggingGizmoOrientation with the same ref into the app's 3D scene.")},Lt);return()=>{cancelAnimationFrame(l),clearTimeout(r)}},[e,t]),e}const Qt=pt.externalizeComponent(({orientation:t,frameQuaternion:e,motion:n="translate",onJogStart:l,onJogStop:r,activeHandle:s,disabled:a=!1,size:u=200})=>{const o=Bt(t),i=a||!o,x=Ht(t,e),{held:c,handlersFor:h,label:m,isPressed:p}=E.useJogControls({motion:n,onJogStart:l,onJogStop:r,activeHandle:s,disabled:i}),[f,y]=M.useState(null);M.useEffect(()=>y(null),[n]);const b=n==="rotate"?Vt:zt,S=n==="rotate"?jt:$t,A=M.useRef(new Map),w=xt(u,u,F(u).marginPx);return d.jsxs(R,{"data-testid":"jogging-gizmo",sx:{position:"relative",width:u,height:u,flexShrink:0,isolation:"isolate"},children:[d.jsx(z.Canvas,{orthographic:!0,flat:!0,frameloop:"demand",camera:{position:[0,0,10],up:[0,1,0],zoom:w,near:.1,far:100},gl:{alpha:!0,antialias:!0},style:{position:"absolute",inset:0,pointerEvents:"none"},children:d.jsx(b,{orientation:x,lit:c??s??f,disabled:i,size:u,radius:w,overlay:A})}),d.jsx(S,{isPressed:p,hovered:f,disabled:i,size:u,onHover:y,handlersFor:h,label:m,overlay:A})]})});exports.JoggingGizmo=Qt;exports.novaAxesSeenBy=Mt;
|
package/dist/chunks/{JoggingGizmoOrientation-l2slmUE_.cjs → JoggingGizmoOrientation-BwkW76fE.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("@react-three/fiber"),o=require("three"),t=require("./JoggingGizmo-
|
|
1
|
+
"use strict";const n=require("@react-three/fiber"),o=require("three"),t=require("./JoggingGizmo-DtWw6KWg.cjs");function u({target:e}){const r=n.useThree(i=>i.camera);return n.useFrame(()=>{e.current=t.novaAxesSeenBy(r,e.current??new o.Quaternion)}),null}exports.JoggingGizmoOrientation=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const u=require("react/jsx-runtime"),w=require("@mui/material/Box"),P=require("@mui/material/Stack"),J=require("@mui/material/styles"),z=require("@mui/material/Typography"),h=require("react"),tt=require("./externalizeComponent-
|
|
1
|
+
"use strict";const u=require("react/jsx-runtime"),w=require("@mui/material/Box"),P=require("@mui/material/Stack"),J=require("@mui/material/styles"),z=require("@mui/material/Typography"),h=require("react"),tt=require("./externalizeComponent-CkWiNBu0.cjs"),S=require("./holdSafety-BtoZ5We3.cjs"),I=2*Math.PI;function nt({min:t,max:n,linear:o},f){const s=t!==void 0,c=n!==void 0;if(s&&c&&n>t)return{min:t,max:n};if(o)return null;if(s&&!c)return{min:t,max:t+I};if(c&&!s)return{min:n-I,max:n};const b=Math.round(f/I)*I;return{min:b-Math.PI,max:b+Math.PI}}function G(t,n){return Math.min(1,Math.max(0,(t-n.min)/(n.max-n.min)))}function et(t,n){const o=Math.min(1,Math.max(0,t));return n.min+o*(n.max-n.min)}function ot(t){return t.min>0||t.max<0?null:G(0,t)}function O(t,n,o){return Math.abs(n-t)<=o?null:n>t?"+":"-"}function rt(t,n,o){return o==="+"?t>=n:t<=n}function it(t,n){return t?"mm":n}const L={deg:{shown:t=>t*180/Math.PI,decimals:1,limitDecimals:0,suffix:"°"},rad:{shown:t=>t,decimals:3,limitDecimals:2,suffix:" rad"},mm:{shown:t=>t,decimals:1,limitDecimals:0,suffix:" mm"}};function W(t,n){const o=t.toFixed(n);return Number(o)===0?0 .toFixed(n):o}function v(t,n){return L[n].shown(t)}function st(t,n){const{shown:o,decimals:f,suffix:s}=L[n];return`${W(o(t),f)}${s}`}function K(t,n){const{shown:o,limitDecimals:f,suffix:s}=L[n],c=10**f,b=o(t),d=Math.sign(b)*Math.round(Math.abs(b)*c)/c;return`${d>0?"+":""}${W(d,f)}${s}`}const N=16,U=4;function V({railRef:t,at:n,goalAt:o,held:f,zeroAt:s,limits:c,disabled:b}){const d=J.useTheme(),x=d.palette.primary.main,l=`0 0 0 8px ${J.alpha(x,.16)}`;return u.jsxs(u.Fragment,{children:[u.jsxs(w,{ref:t,sx:{position:"absolute",left:0,right:0,top:"50%",height:U,transform:"translateY(-50%)"},children:[u.jsx(w,{sx:{position:"absolute",inset:0,borderRadius:U/2,backgroundColor:J.alpha(x,.38)}}),n!==null&&o!==null&&u.jsx(w,{sx:{position:"absolute",top:0,bottom:0,borderRadius:U/2,backgroundColor:x},style:{left:`${Math.min(n,o)*100}%`,width:`${Math.abs(o-n)*100}%`,opacity:f?1:.5}}),s!==null&&u.jsx(w,{"aria-hidden":!0,sx:{position:"absolute",top:"50%",width:2,height:12,transform:"translate(-50%, -50%)",borderRadius:1,backgroundColor:"text.secondary"},style:{left:`${s*100}%`}}),n!==null&&u.jsx(w,{sx:{position:"absolute",top:"50%",boxSizing:"border-box",width:N,height:N,transform:"translate(-50%, -50%)",borderRadius:"50%",border:`3px solid ${x}`,backgroundColor:"background.paper",boxShadow:f?l:d.shadows[2],transition:"box-shadow 150ms","&:hover":b?{}:{boxShadow:l}},style:{left:`${n*100}%`}})]}),c&&u.jsx(P,{direction:"row",sx:{position:"absolute",left:0,right:0,top:30,justifyContent:"space-between"},children:[c.min,c.max].map((k,j)=>u.jsx(z,{variant:"caption",color:"text.secondary",sx:{fontSize:10,lineHeight:"14px"},children:k},j))})]})}function ut({value:t,onJogStart:n,onJogStop:o,disabled:f}){const s=h.useRef(null),[c,b]=h.useState(null),d=h.useCallback(e=>{s.current=e,b(e)},[]),x=h.useRef({value:t,onJogStart:n,onJogStop:o});x.current={value:t,onJogStart:n,onJogStop:o};const l=h.useCallback((e,m,g)=>{const y=O(x.current.value,m,g);d({...e,goal:m,direction:y,settledAt:y?null:e.settledAt}),e.direction&&e.direction!==y&&x.current.onJogStop(),y&&y!==e.direction&&x.current.onJogStart(y)},[d]),k=h.useCallback(()=>s.current!==null,[]),j=h.useCallback((e,m,g)=>f||s.current?!1:(l({goal:e,direction:null,settledAt:null,by:g},e,m),!0),[f,l]),M=h.useCallback((e,m)=>{const g=s.current;if(g){if(g.direction===null&&g.settledAt!==null&&Math.abs(e-g.settledAt)<=m){d({...g,goal:e});return}l(g,e,m)}},[l,d]),C=h.useCallback(()=>{const e=s.current;e&&(d(null),e.direction&&x.current.onJogStop())},[d]),D=h.useCallback(()=>{var e;return((e=s.current)==null?void 0:e.by)??null},[]),$=h.useCallback(e=>{const m=s.current;m&&e(m.by)&&C()},[C]);return h.useEffect(()=>{const e=s.current;e!=null&&e.direction&&rt(t,e.goal,e.direction)&&(d({...e,direction:null,settledAt:e.goal}),x.current.onJogStop())},[t,d]),S.useEndHoldWhenUnattended(c!==null,f,C),{hold:c,isHolding:k,heldBy:D,begin:j,moveGoal:M,end:C,endIfHeldBy:$}}function lt(t){return t==="mouse"||t==="pen"?1:4}function at(t){return t==="ArrowRight"||t==="ArrowUp"?"+":t==="ArrowLeft"||t==="ArrowDown"?"-":null}const ct=tt.externalizeComponent(({label:t,name:n,value:o,min:f,max:s,linear:c=!1,angleUnit:b="deg",onJogStart:d,onJogStop:x,disabled:l=!1})=>{const k=J.useTheme(),j=h.useRef(null),{hold:M,isHolding:C,heldBy:D,begin:$,moveGoal:e,end:m,endIfHeldBy:g}=ut({value:o,onJogStart:d,onJogStop:x,disabled:l}),[y,q]=h.useState(null);h.useEffect(()=>{l&&q(null)},[l]);const a=nt({min:f,max:s,linear:c},o),R=it(c,b),B=r=>st(r,R);function E({clientX:r,pointerType:i}){if(!a||!j.current)return null;const p=j.current.getBoundingClientRect();return p.width<=0?null:{goal:et((r-p.left)/p.width,a),deadband:lt(i)/p.width*(a.max-a.min)}}function Y(r){var p,H;if(!S.startsPointerHold(r)||l||C())return;const i=E(r);if(i){try{(H=(p=r.currentTarget).setPointerCapture)==null||H.call(p,r.pointerId)}catch{}$(i.goal,i.deadband,{pointer:r.pointerId})}}function Z(r){const i=E(r);q(l?null:(i==null?void 0:i.goal)??null);const p=D();if(!(!p||!("pointer"in p)||p.pointer!==r.pointerId)){if(S.primaryReleased(r)){m();return}i&&e(i.goal,i.deadband)}}function T(r){g(i=>"pointer"in i&&i.pointer===r.pointerId)}function _(r){const i=at(r.key);if(i&&r.preventDefault(),C()){S.endsHold(r)&&m();return}if(!i||!S.startsKeyHold(r)||l||!a)return;const p=i==="+"?a.max:a.min,H=(a.max-a.min)*1e-4;O(o,p,H)===i&&$(p,H,{key:r.key})}function Q(r){g(i=>"key"in i&&i.key===r.key)}const A=(M==null?void 0:M.goal)??y,X=a&&{min:K(a.min,R),max:K(a.max,R)},F=u.jsxs(P,{direction:"row",sx:{justifyContent:"space-between",gap:1,mb:"-4px"},children:[u.jsxs(z,{variant:"body2",noWrap:!0,children:[t,n&&u.jsx(w,{component:"span",sx:{color:"text.secondary"},children:` - ${n}`})]}),u.jsxs(z,{variant:"body2",sx:{fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[B(o),a&&A!==null&&u.jsx(w,{component:"span",sx:{color:"text.secondary"},children:` / ${B(A)}`})]})]});return a?u.jsxs(P,{"data-testid":"jogging-joint-slider",children:[F,u.jsx(w,{role:"slider",tabIndex:l?-1:0,"aria-label":n?`${t} ${n}`:t,"aria-valuemin":v(a.min,R),"aria-valuemax":v(a.max,R),"aria-valuenow":v(o,R),"aria-valuetext":B(o),"aria-disabled":l||void 0,onPointerDown:Y,onPointerMove:Z,onPointerLeave:()=>q(null),onPointerUp:T,onPointerCancel:T,onLostPointerCapture:T,onKeyDown:_,onKeyUp:Q,onBlur:m,onContextMenu:S.preventContextMenu,sx:{position:"relative",height:44,borderRadius:1,opacity:l?.5:1,cursor:l?"default":"pointer",touchAction:"none",userSelect:"none",outline:"none","&:focus-visible":{outline:`2px solid ${k.palette.primary.main}`,outlineOffset:"2px"}},children:u.jsx(V,{railRef:j,at:G(o,a),goalAt:A===null?null:G(A,a),held:M!==null,zeroAt:ot(a),limits:X??void 0,disabled:l})})]}):u.jsxs(P,{"data-testid":"jogging-joint-slider",children:[F,u.jsx(w,{"aria-hidden":!0,sx:{position:"relative",height:44},children:u.jsx(V,{at:null,goalAt:null,held:!1,zeroAt:null,disabled:!0})})]})});exports.JoggingJointSlider=ct;
|
|
@@ -4,7 +4,7 @@ import J from "@mui/material/Stack";
|
|
|
4
4
|
import { useTheme as Y, alpha as N } from "@mui/material/styles";
|
|
5
5
|
import G from "@mui/material/Typography";
|
|
6
6
|
import { useRef as L, useState as Z, useCallback as y, useEffect as _ } from "react";
|
|
7
|
-
import { e as it } from "./externalizeComponent-
|
|
7
|
+
import { e as it } from "./externalizeComponent-CPAVvPKk.js";
|
|
8
8
|
import { u as st, p as at, b as lt, a as ut, e as ct, s as dt } from "./holdSafety-Di1GZAWg.js";
|
|
9
9
|
const k = 2 * Math.PI;
|
|
10
10
|
function ft({ min: t, max: n, linear: r }, d) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as G } from "react/jsx-runtime";
|
|
2
2
|
import { observer as W } from "mobx-react-lite";
|
|
3
3
|
import { c as _, a as Y } from "./coordSystemLabel-C1jfhEh5.js";
|
|
4
|
-
import { R as $ } from "./RobotControlPanel-
|
|
4
|
+
import { R as $ } from "./RobotControlPanel-CzhYCBAm.js";
|
|
5
5
|
import { degreesToRadians as c, radiansToDegrees as H } from "@wandelbots/nova-js";
|
|
6
6
|
import { JointTypeEnum as Z } from "@wandelbots/nova-js/v2";
|
|
7
7
|
import { runInAction as tt, when as et } from "mobx";
|
|
8
8
|
import { useEffect as ot, useState as nt, useRef as P, useMemo as rt } from "react";
|
|
9
9
|
import { useTranslation as at } from "react-i18next";
|
|
10
10
|
import { Quaternion as it } from "three";
|
|
11
|
-
import { i as ct } from "./externalizeComponent-
|
|
11
|
+
import { i as ct } from "./externalizeComponent-CPAVvPKk.js";
|
|
12
12
|
import { P as st, p as D } from "./Pose3-B_fLR-Wv.js";
|
|
13
13
|
import { u as lt } from "./useEveryFrame-DAuNawGP.js";
|
|
14
14
|
const E = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const W=require("react/jsx-runtime"),Y=require("mobx-react-lite"),V=require("./coordSystemLabel-BJKeaGA3.cjs"),$=require("./RobotControlPanel-
|
|
1
|
+
"use strict";const W=require("react/jsx-runtime"),Y=require("mobx-react-lite"),V=require("./coordSystemLabel-BJKeaGA3.cjs"),$=require("./RobotControlPanel-DHQga5uu.cjs"),s=require("@wandelbots/nova-js"),Z=require("@wandelbots/nova-js/v2"),q=require("mobx"),y=require("react"),ee=require("react-i18next"),te=require("three"),oe=require("./externalizeComponent-CkWiNBu0.cjs"),M=require("./Pose3-Ch4xVeXV.cjs"),ne=require("./useEveryFrame-CHxg25f4.cjs"),D=["Base","Shoulder","Elbow","Forearm","Wrist","Flange"],b="selected-tcp",I="coordinate-system:",F=a=>Math.round(s.radiansToDegrees(a)*1e6)/1e6;function re(a){const c=ne.useEveryFrame(()=>a.jogger.motionStream.rapidlyChangingMotionState.joint_position.join(" "),!0);return y.useMemo(()=>c?c.split(" ").map(Number):[],[c])}function x(a,c={}){var _;const{disabled:f=!1,gizmoOrientation:R}=c,{t:T}=ee.useTranslation(void 0,{i18n:oe.i18n}),e=a.jogging,{trajectory:i,targetPose:S}=a,w=re(e),m=e.jointType===Z.JointTypeEnum.PrismaticJoint,d=(_=e.motionGroupDescription.operation_limits.auto_limits)==null?void 0:_.joints,J=i.trajectoryState==="moving"||i.trajectoryState==="stopping",E=f||J;y.useEffect(()=>{E?e.lock("external"):e.unlock("external")},[e,E]);const[k,L]=y.useState(!1),A=k?"moveTo":e.currentTab.id==="joint"?"joint":e.selectedCartesianMotionType;function N(t){L(t==="moveTo"),q.runInAction(()=>{e.selectedTabId=t==="joint"?"joint":"cartesian"}),(t==="translate"||t==="rotate")&&e.setSelectedCartesianMotionType(t)}const Q=e.selectedIncrementId==="continuous"?"continuous":"increment",C=y.useRef(e.activeDiscreteIncrement??e.discreteIncrementOptions[0]);e.activeDiscreteIncrement&&(C.current=e.activeDiscreteIncrement);const j=C.current,u=y.useRef(0);async function z(t,o,n){const r=++u.current;e.isLocked||(await e.activate(),r===u.current&&(t==="translate"?await e.jogger.translateTCP({axis:o,direction:n,velocityMmPerSec:e.translationVelocityMmPerSec}):await e.jogger.rotateTCP({axis:o,direction:n,velocityRadsPerSec:e.rotationVelocityRadsPerSec})))}async function B(t,o){const n=++u.current;await e.activate(),n===u.current&&await e.jogger.rotateJoints({joint:t,direction:o,velocityUnit:m?"mm/s":"rad/s",velocityValue:m?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec})}async function O(){const t=++u.current;await e.jogger.stop(),t===u.current&&await e.deactivate()}async function U(t,o,n,r){const g=e.discreteIncrementOptions.find(p=>t==="translate"?Math.abs(p.mm-r)<1e-9:Math.abs(s.degreesToRadians(p.degrees)-r)<1e-9);!g||e.isLocked||await e.withMotionLock(async()=>{try{const h=(await e.activate()).motionStream.rapidlyChangingMotionState;if(!h.tcp_pose)return;e.setCurrentIncrementJog({axis:o,direction:n}),await e.jogger.runIncrementalCartesianMotion({currentTcpPose:h.tcp_pose,currentJoints:h.joint_position,velocityInRelevantUnits:t==="translate"?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec,axis:o,direction:n,motion:t==="translate"?{type:"translate",distanceMm:g.mm}:{type:"rotate",distanceRads:s.degreesToRadians(g.degrees)}})}finally{e.setCurrentIncrementJog(null),await e.deactivate()}})}function K(){if(e.selectedOrientation==="tool"){const o=a.state.rapidlyChangingMotionState.flange_pose,n=o?M.Pose3.fromPose(o).quaternion.clone():new te.Quaternion,r=e.selectedTcpId?a.description.tcpOffsetsById[e.selectedTcpId]:void 0;return r!=null&&r.pose.orientation&&n.multiply(M.parseRotationToQuaternion(r.pose.orientation,"ROTATION_VECTOR")),n}const t=e.jogCoordSystem;return M.parseRotationToQuaternion(t.orientation??[1,0,0,0],t.orientation_type??"QUATERNION")}function l(t){a.reportError({kind:"jog",message:t instanceof Error?t.message:String(t),cause:t})}const P=y.useRef(!1);function X(t){if(!t){S.resetToLive();return}S.setDraft(`(${[...t.position,...t.orientation].join(", ")})`),S.confirmEdit()}function G(){i.trajectoryState==="planned"&&i.plannedTrajectory&&(P.current=!0,i.start())}async function H(){P.current&&(P.current=!1,await q.when(()=>i.trajectoryState!=="planned",{timeout:2e3}).catch(()=>{}),i.trajectoryState==="moving"&&await i.pause())}const v=S.staged;return{disabled:f,jogDisabled:J||e.blocked,cartesian:e.canJogCartesian,tab:A,onTabChange:N,jogMode:Q,onJogModeChange:t=>{var o;return e.setSelectedIncrementId(t==="continuous"?"continuous":((o=C.current)==null?void 0:o.id)??"continuous")},gizmoOrientation:R,gizmoFrameQuaternion:K,tcp:e.tcps.length>0?{options:e.tcps.map(t=>({id:t.id,label:t.id})),value:e.selectedTcpId,onChange:t=>{e.requestTcpChange(t).catch(l)}}:void 0,jogFrame:{options:[{id:b,label:T("Jogging.MoveRelativeTo.SelectedTcp.dd")},...e.coordSystems.map(t=>({id:I+t.coordinate_system,label:V.coordSystemLabel(e,t)}))],value:e.selectedOrientation==="tool"?b:I+e.jogCoordSystemId,onChange:t=>t===b?e.setMoveRelativeToSelectedTcp():e.setMoveRelativeToCoordSystem(t.slice(I.length))},velocity:{translate:{value:e.translationVelocityMmPerSec,min:e.minTranslationVelocityMmPerSec,max:e.maxTranslationVelocityMmPerSec},rotate:{value:e.rotationVelocityRadsPerSec,min:s.degreesToRadians(e.minRotationVelocityDegPerSec),max:s.degreesToRadians(e.maxRotationVelocityDegPerSec)}},onVelocityChange:(t,o)=>t==="rotate"?e.setVelocityFromSlider(F(o),!0):e.setVelocityFromSlider(o,!1),onJogStart:(t,o,n)=>{z(t,o,n).catch(l)},onJogStop:()=>{O().catch(l)},increments:{steps:{translate:e.discreteIncrementOptions.map(t=>t.mm),rotate:e.discreteIncrementOptions.map(t=>s.degreesToRadians(t.degrees))},onStep:(t,o,n,r)=>{U(t,o,n,r).catch(l)},running:e.incrementJogInProgress,step:j&&{translate:j.mm,rotate:s.degreesToRadians(j.degrees)},onStepChange:(t,o)=>{const n=e.discreteIncrementOptions.find(r=>t==="translate"?r.mm===o:Math.abs(s.degreesToRadians(r.degrees)-o)<1e-9);n&&e.setSelectedIncrementId(n.id)}},joints:{joints:w.map((t,o)=>{var n,r,g,p;return{value:t,min:(r=(n=d==null?void 0:d[o])==null?void 0:n.position)==null?void 0:r.lower_limit,max:(p=(g=d==null?void 0:d[o])==null?void 0:g.position)==null?void 0:p.upper_limit,name:w.length===D.length&&!m?D[o]:void 0}}),linear:m,velocity:m?{value:e.translationVelocityMmPerSec,min:e.minTranslationVelocityMmPerSec,max:e.maxTranslationVelocityMmPerSec}:{value:e.rotationVelocityRadsPerSec,min:s.degreesToRadians(e.minRotationVelocityDegPerSec),max:s.degreesToRadians(e.maxRotationVelocityDegPerSec)},onVelocityChange:t=>m?e.setVelocityFromSlider(t,!1):e.setVelocityFromSlider(F(t),!0),onJogStart:(t,o)=>{B(t,o).catch(l)},onJogStop:()=>{O().catch(l)}},moveTo:{getCurrentPose:()=>{const t=a.state.displayedTcpPose;return!(t!=null&&t.position)||!t.orientation?null:{position:t.position,orientation:t.orientation}},frame:{options:e.coordSystems.map(t=>({id:t.coordinate_system,label:V.coordSystemLabel(e,t)})),value:e.selectedCoordSystemId,onChange:t=>e.setSelectedCoordSystemId(t)},onTargetChange:X,state:S.confirming?"planning":i.trajectoryState,error:v!=null&&v.errorKey?T(v.errorKey):null,onMoveStart:G,onMoveStop:()=>{H().catch(l)}}}}const ae=Y.observer(function({session:c,disabled:f,gizmoOrientation:R,...T}){const e=V.useRobotSessionOf(c),i=x(e,{disabled:f,gizmoOrientation:R});return W.jsx($.RobotControlPanel,{...i,...T})});exports.RobotControl=ae;exports.useRobotControlProps=x;
|
|
@@ -7,19 +7,19 @@ import H from "@mui/material/Typography";
|
|
|
7
7
|
import { CloseFilled as j } from "@wandelbots/icons/CloseFilled";
|
|
8
8
|
import { useId as ot, useRef as S, useState as P, useEffect as V } from "react";
|
|
9
9
|
import { useTranslation as J } from "react-i18next";
|
|
10
|
-
import { e as nt } from "./externalizeComponent-
|
|
10
|
+
import { e as nt } from "./externalizeComponent-CPAVvPKk.js";
|
|
11
11
|
import _ from "@mui/material/Divider";
|
|
12
12
|
import F from "@mui/material/Tooltip";
|
|
13
13
|
import { Jog as et } from "@wandelbots/icons/Jog";
|
|
14
14
|
import { ViewModuleFilled as rt } from "@wandelbots/icons/ViewModuleFilled";
|
|
15
|
-
import { J as lt } from "./JoggingGizmo-
|
|
16
|
-
import { J as at } from "./JoggingButtons-
|
|
15
|
+
import { J as lt } from "./JoggingGizmo-DBpDIbzl.js";
|
|
16
|
+
import { J as at } from "./JoggingButtons-I_Y70pg8.js";
|
|
17
17
|
import { styled as it } from "@mui/material/styles";
|
|
18
18
|
import K from "@mui/material/ToggleButton";
|
|
19
19
|
import ct from "@mui/material/ToggleButtonGroup";
|
|
20
20
|
import { P as X, I as st, c as ut, u as Q, b as q, a as pt } from "./useEveryFrame-DAuNawGP.js";
|
|
21
21
|
import dt from "@mui/material/Slider";
|
|
22
|
-
import { J as ft } from "./JoggingJointSlider-
|
|
22
|
+
import { J as ft } from "./JoggingJointSlider-DeMqm9Jh.js";
|
|
23
23
|
import { Undo as bt } from "@wandelbots/icons/Undo";
|
|
24
24
|
import { PrimaryButton as gt, AdornedTextField as ht, RoundedIconButton as B } from "@wandelbots/mui";
|
|
25
25
|
import { NorthEastFilled as mt } from "@wandelbots/icons/NorthEastFilled";
|