@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.96fdf15 → 6.4.0-pr.revamp.667.adaa917
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 +7 -7
- 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.js +2 -2
- package/dist/RobotScene/index.cjs +1 -1
- package/dist/RobotScene/index.js +1 -1
- package/dist/RobotView/index.cjs +1 -1
- package/dist/RobotView/index.js +1 -1
- package/dist/SafetyBar/index.cjs +1 -1
- package/dist/SafetyBar/index.js +1 -1
- package/dist/chunks/{CurrentPose-DW2uqL-R.js → CurrentPose-DQ-FaAnr.js} +2 -2
- package/dist/chunks/{CurrentPose-dHc4WUET.cjs → CurrentPose-fWc6ySnk.cjs} +1 -1
- package/dist/chunks/{CurrentPoseBar-CMgxSmIo.js → CurrentPoseBar-B3-XLeu2.js} +1 -1
- package/dist/chunks/{CurrentPoseBar-BeSHwgig.cjs → CurrentPoseBar-CSHQ26mR.cjs} +1 -1
- package/dist/chunks/{JoggingButtons-BJX63dBt.js → JoggingButtons-D4S2oJGt.js} +1 -1
- package/dist/chunks/{JoggingButtons-DYRL_wre.cjs → JoggingButtons-nXLqJLIr.cjs} +1 -1
- package/dist/chunks/{JoggingGizmo-CDdItWpT.js → JoggingGizmo-9wEBSe1P.js} +1 -1
- package/dist/chunks/{JoggingGizmo-DCrl2K-_.cjs → JoggingGizmo-BJ3wDpAJ.cjs} +1 -1
- package/dist/chunks/{JoggingGizmoOrientation-DwGhxKo3.cjs → JoggingGizmoOrientation-D9VS6nag.cjs} +1 -1
- package/dist/chunks/{JoggingGizmoOrientation-BeD7eJ9t.js → JoggingGizmoOrientation-DYeHwowd.js} +1 -1
- package/dist/chunks/{JoggingJointSlider-CDiha2Yt.cjs → JoggingJointSlider-D7AsxkrT.cjs} +1 -1
- package/dist/chunks/{JoggingJointSlider-BVFjEQjw.js → JoggingJointSlider-DQneQhXH.js} +1 -1
- package/dist/chunks/{Robot-CA2P_Sgf.cjs → Robot-DEJXhv-D.cjs} +1 -1
- package/dist/chunks/{Robot-BCPv4zBP.js → Robot-IG0yo_YD.js} +1 -1
- package/dist/chunks/RobotControl-0tL4CY3m.cjs +1 -0
- package/dist/chunks/RobotControl-C59I0tMh.js +317 -0
- package/dist/chunks/{RobotControlPanel-Ci0S6gMq.cjs → RobotControlPanel-BXUgib6Z.cjs} +1 -1
- package/dist/chunks/{RobotControlPanel-DFz_c0p9.js → RobotControlPanel-BzqLtecA.js} +4 -4
- package/dist/chunks/{RobotScene-BvFIq4fY.js → RobotScene-BS77SUtN.js} +1 -1
- package/dist/chunks/{RobotScene-CfVWmw96.cjs → RobotScene-BjctJ5z1.cjs} +1 -1
- package/dist/chunks/{RobotView-CDsmQESS.cjs → RobotView-BlV3MdCy.cjs} +1 -1
- package/dist/chunks/{RobotView-CoQ63Yli.js → RobotView-CGvHcO7j.js} +2 -2
- package/dist/chunks/externalizeComponent-BW1UV6Gh.cjs +2 -0
- package/dist/chunks/{externalizeComponent-BiXWFiD7.js → externalizeComponent-TgclPxwg.js} +16 -8
- package/dist/chunks/{loadRobotSession-qBnF6wdH.cjs → loadRobotSession-Bg0R0p8D.cjs} +1 -1
- package/dist/chunks/{loadRobotSession-BVHaTArk.js → loadRobotSession-CA9NInkt.js} +3 -3
- package/dist/chunks/{robotActivationOf-BA4cAhGx.js → robotActivationOf-BKUn_piZ.js} +2 -2
- package/dist/chunks/{robotActivationOf-BkIEg_Wq.cjs → robotActivationOf-jrHDUzfW.cjs} +1 -1
- package/dist/chunks/{robotSafetyOf-99L9ww63.js → robotSafetyOf-BGSW_Ql3.js} +1 -1
- package/dist/chunks/{robotSafetyOf-BJj1VuJI.cjs → robotSafetyOf-Y4NuRInk.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +8 -8
- package/dist/index.cjs +1 -1
- package/dist/index.js +15 -15
- package/package.json +1 -1
- package/dist/chunks/RobotControl-BoDDKYfx.cjs +0 -1
- package/dist/chunks/RobotControl-CaEwd0li.js +0 -286
- package/dist/chunks/externalizeComponent-DZTBO-WF.cjs +0 -2
package/dist/3d.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/Robot-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/Robot-DEJXhv-D.cjs"),o=require("./chunks/RobotScene-BjctJ5z1.cjs"),a=require("./chunks/JoggingGizmo-BJ3wDpAJ.cjs"),s=require("./chunks/JoggingGizmoOrientation-D9VS6nag.cjs"),u=require("./chunks/RobotControlPanel-BXUgib6Z.cjs"),r=require("./chunks/RobotControl-0tL4CY3m.cjs"),n=require("./chunks/RobotView-BlV3MdCy.cjs"),i=require("./chunks/PoseTransformer-dP4nzrPG.cjs"),t=require("./chunks/Pose3-Ch4xVeXV.cjs");exports.CollisionSceneRenderer=e.CollisionSceneRenderer;exports.JointLimitGizmo=e.JointLimitGizmo;exports.LinearAxis=e.LinearAxis;exports.Robot=e.Robot;exports.TrajectoryRenderer=e.TrajectoryRenderer;exports.FLANGE_NODE_SUFFIX=o.FLANGE_NODE_SUFFIX;exports.JOINT_NODE_NAME=o.JOINT_NODE_NAME;exports.JOINT_REST_SUFFIX=o.JOINT_REST_SUFFIX;exports.JoggingAxes=o.JoggingAxes;exports.MODEL_ROTATION=o.MODEL_ROTATION;exports.MotionGroupVisualizer=o.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=o.MotionGroupVisualizerExact;exports.PresetEnvironment=o.PresetEnvironment;exports.RobotScene=o.RobotScene;exports.RobotSceneView=o.RobotSceneView;exports.SafetyZonesRenderer=o.SafetyZonesRenderer;exports.SupportedLinearAxis=o.SupportedLinearAxis;exports.SupportedLinearAxisExact=o.SupportedLinearAxisExact;exports.SupportedRobot=o.SupportedRobot;exports.SupportedRobotExact=o.SupportedRobotExact;exports.defaultGetModel=o.defaultGetModel;exports.jointIndexOf=o.jointIndexOf;exports.revokeAllModelUrls=o.revokeAllModelUrls;exports.robotModelOf=o.robotModelOf;exports.useRobotSceneProps=o.useRobotSceneProps;exports.JoggingGizmo=a.JoggingGizmo;exports.JoggingGizmoOrientation=s.JoggingGizmoOrientation;exports.RobotControlPanel=u.RobotControlPanel;exports.RobotControl=r.RobotControl;exports.useRobotControlProps=r.useRobotControlProps;exports.RobotCanvas=n.RobotCanvas;exports.RobotView=n.RobotView;exports.ValueInterpolator=i.ValueInterpolator;exports.useSmoothedMotionState=i.useSmoothedMotionState;exports.Pose3=t.Pose3;exports.parseRotationToQuaternion=t.parseRotationToQuaternion;exports.quaternionToRotationVector=t.quaternionToRotationVector;
|
package/dist/3d.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { C as a, J as t, L as r, R as s, T as n } from "./chunks/Robot-
|
|
2
|
-
import { F as p, J as R, a as l, b as u, M as x, c as m, d as S, P as d, R as f, e as b, S as c, f as g, g as E, h as J, i as O, j as M, k as T, r as A, l as G, u as I } from "./chunks/RobotScene-
|
|
3
|
-
import { J as N } from "./chunks/JoggingGizmo-
|
|
4
|
-
import { J as V } from "./chunks/JoggingGizmoOrientation-
|
|
5
|
-
import { R as C } from "./chunks/RobotControlPanel-
|
|
6
|
-
import { R as z, u as j } from "./chunks/RobotControl-
|
|
7
|
-
import { R as D, a as U } from "./chunks/RobotView-
|
|
1
|
+
import { C as a, J as t, L as r, R as s, T as n } from "./chunks/Robot-IG0yo_YD.js";
|
|
2
|
+
import { F as p, J as R, a as l, b as u, M as x, c as m, d as S, P as d, R as f, e as b, S as c, f as g, g as E, h as J, i as O, j as M, k as T, r as A, l as G, u as I } from "./chunks/RobotScene-BS77SUtN.js";
|
|
3
|
+
import { J as N } from "./chunks/JoggingGizmo-9wEBSe1P.js";
|
|
4
|
+
import { J as V } from "./chunks/JoggingGizmoOrientation-DYeHwowd.js";
|
|
5
|
+
import { R as C } from "./chunks/RobotControlPanel-BzqLtecA.js";
|
|
6
|
+
import { R as z, u as j } from "./chunks/RobotControl-C59I0tMh.js";
|
|
7
|
+
import { R as D, a as U } from "./chunks/RobotView-CGvHcO7j.js";
|
|
8
8
|
import { V as k, a as q } from "./chunks/PoseTransformer-tafab65c.js";
|
|
9
9
|
import { P as y, p as X, q as Q } from "./chunks/Pose3-B_fLR-Wv.js";
|
|
10
10
|
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-fWc6ySnk.cjs"),o=require("../chunks/RobotSessionProvider--AekyPqD.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-CSHQ26mR.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-nXLqJLIr.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-BJ3wDpAJ.cjs"),o=require("../chunks/JoggingGizmoOrientation-D9VS6nag.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-9wEBSe1P.js";
|
|
2
|
+
import { J as t } from "../chunks/JoggingGizmoOrientation-DYeHwowd.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-D7AsxkrT.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-0tL4CY3m.cjs"),e=require("../chunks/RobotSessionProvider--AekyPqD.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-BXUgib6Z.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-jrHDUzfW.cjs"),t=require("../chunks/robotSafetyOf-Y4NuRInk.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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as n, a as r, c as t, a as e, r as f } from "../chunks/robotActivationOf-
|
|
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-BKUn_piZ.js";
|
|
2
|
+
import { r as s } from "../chunks/robotSafetyOf-BGSW_Ql3.js";
|
|
3
3
|
export {
|
|
4
4
|
n as ConnectionWarning,
|
|
5
5
|
r as RobotHeader,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/RobotScene-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/RobotScene-BjctJ5z1.cjs"),o=require("../chunks/RobotSessionProvider--AekyPqD.cjs");exports.JoggingAxes=e.JoggingAxes;exports.RobotScene=e.RobotScene;exports.RobotSceneView=e.RobotSceneView;exports.default=e.RobotScene;exports.useRobotSceneProps=e.useRobotSceneProps;exports.RobotSessionProvider=o.RobotSessionProvider;exports.useRobotSession=o.useRobotSession;
|
package/dist/RobotScene/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as s, R as a, e as t, R, u as r } from "../chunks/RobotScene-
|
|
1
|
+
import { b as s, R as a, e as t, R, u as r } from "../chunks/RobotScene-BS77SUtN.js";
|
|
2
2
|
import { R as n, u as i } from "../chunks/RobotSessionProvider-TVaKGzqa.js";
|
|
3
3
|
export {
|
|
4
4
|
s as JoggingAxes,
|
package/dist/RobotView/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotView-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotView-BlV3MdCy.cjs"),e=require("../chunks/RobotSessionProvider--AekyPqD.cjs");exports.RobotCanvas=o.RobotCanvas;exports.RobotView=o.RobotView;exports.default=o.RobotView;exports.RobotSessionProvider=e.RobotSessionProvider;exports.useRobotSession=e.useRobotSession;
|
package/dist/RobotView/index.js
CHANGED
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-Y4NuRInk.cjs");exports.SafetyBar=e.SafetyBar;exports.default=e.SafetyBar;exports.robotSafetyOf=e.robotSafetyOf;
|
package/dist/SafetyBar/index.js
CHANGED
|
@@ -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 { a as S } from "./RobotSessionProvider-TVaKGzqa.js";
|
|
4
|
-
import { C as P } from "./CurrentPoseBar-
|
|
4
|
+
import { C as P } from "./CurrentPoseBar-B3-XLeu2.js";
|
|
5
5
|
import { useState as l } from "react";
|
|
6
6
|
import { useTranslation as b } from "react-i18next";
|
|
7
|
-
import { i as T } from "./externalizeComponent-
|
|
7
|
+
import { i as T } from "./externalizeComponent-TgclPxwg.js";
|
|
8
8
|
import { c as v } from "./coordSystemLabel-Bfy9MUsV.js";
|
|
9
9
|
function h(n) {
|
|
10
10
|
var d, m, p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const P=require("react/jsx-runtime"),S=require("mobx-react-lite"),b=require("./RobotSessionProvider--AekyPqD.cjs"),f=require("./CurrentPoseBar-
|
|
1
|
+
"use strict";const P=require("react/jsx-runtime"),S=require("mobx-react-lite"),b=require("./RobotSessionProvider--AekyPqD.cjs"),f=require("./CurrentPoseBar-CSHQ26mR.cjs"),p=require("react"),q=require("react-i18next"),v=require("./externalizeComponent-BW1UV6Gh.cjs"),x=require("./coordSystemLabel-BThpFG9n.cjs");function m(n){var u,d,l;const e=n.jogging,{t:r}=q.useTranslation(void 0,{i18n:v.i18n}),[o,s]=p.useState(e.selectedTcpId),[i,g]=p.useState(e.selectedCoordSystemId),c=e.tcpsById[o]?o:e.selectedTcpId,a=e.coordSystemsById[i]?i:e.selectedCoordSystemId,C=(l=(d=(u=e.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:u.details)==null?void 0:d.state)==null?void 0:l.kind,y=e.lastJogErrorTranslationKey?r(e.lastJogErrorTranslationKey):e.lastJogError;function I(){const t=e.tcpPoseIn(c,a);return!(t!=null&&t.position)||!t.orientation?null:{position:t.position,orientation:t.orientation}}return{getCurrentPose:I,tcp:e.tcps.length>0?{options:e.tcps.map(t=>({id:t.id,label:t.id})),value:c,onChange:s}:void 0,frame:{options:e.coordSystems.map(t=>({id:t.coordinate_system,label:x.coordSystemLabel(e,t)})),value:a,onChange:g},state:C,error:y}}const T=S.observer(function({session:e,...r}){const o=b.useRobotSessionOf(e),s=m(o);return P.jsx(f.CurrentPoseBar,{...s,...r})});exports.CurrentPose=T;exports.useCurrentPoseProps=m;
|
|
@@ -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-TgclPxwg.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-BW1UV6Gh.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;
|
|
@@ -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-TgclPxwg.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,
|
|
@@ -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-BW1UV6Gh.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;
|
|
@@ -5,7 +5,7 @@ import { useThree as At, useFrame as wt, Canvas as St } from "@react-three/fiber
|
|
|
5
5
|
import { Fragment as Et, useRef as C, useEffect as k, useMemo as B, useState as et } from "react";
|
|
6
6
|
import { useTranslation as vt } from "react-i18next";
|
|
7
7
|
import { Vector3 as A, Quaternion as v, Matrix4 as ot } from "three";
|
|
8
|
-
import { e as Rt } from "./externalizeComponent-
|
|
8
|
+
import { e as Rt } from "./externalizeComponent-TgclPxwg.js";
|
|
9
9
|
import { u as Tt } from "./useWebGLRenderer-BozrbZz-.js";
|
|
10
10
|
import { c as _t, i as It, J as P, a as G, u as Ot } from "./joggingColors-CuT5u0H8.js";
|
|
11
11
|
import { alpha as q, useTheme as rt } from "@mui/material/styles";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const p=require("react/jsx-runtime"),_=require("@mui/material/Box"),pt=require("@mui/material/Typography"),q=require("@react-three/fiber"),M=require("react"),dt=require("react-i18next"),m=require("three"),ft=require("./externalizeComponent-DZTBO-WF.cjs"),xt=require("./useWebGLRenderer-CtddVDDb.cjs"),E=require("./joggingColors-ZDc_2UCp.cjs"),$=require("@mui/material/styles"),Y=new m.Vector3(0,1,0),G=.26,Z=.1,gt={x:"X",y:"Y",z:"Z"};function F(t){var e;return((e=E.cartesianAxisColors[gt[t]].buttonBackgroundColor)==null?void 0:e.default)??"currentColor"}const yt=200;function N(t){const e=t/yt;return{marginPx:30*e,gripPx:30*e,grab:{innerPx:10*e,beyondTipPx:10*e,minTipPx:16*e},labelFontPx:Math.max(10,13*e)}}function mt(t,e,n){return Math.max(1,Math.min(t,e)/2-n)}function bt(t,e){const{gripPx:n,grab:i}=N(t);return{radiusPx:e,gripPx:n,headLength:G,...i}}function St(t,e){const{gripPx:n,grab:i}=N(t);return{radiusPx:e,gripPx:n,beyondTipPx:i.beyondTipPx,headLength:G}}function v(t,e){return n=>{n?t.current.set(e,n):t.current.delete(e)}}const R=t=>`${t.axis}${t.direction}`,tt=t=>`label:${t}`,et=[0,1],nt=(t,e)=>`half:${R(t)}:${e}`,ot=t=>`halo:${R(t)}`,st=t=>`focus:${R(t)}`,C="polygon(0 0, 0 0, 0 0)";function rt(t,{isPressed:e,hovered:n,disabled:i}){const r=e(t),s=!i&&(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 z=t=>({cursor:t?"default":"pointer",touchAction:"none",userSelect:"none"}),it=t=>`2px solid ${t.palette.primary.main}`,J={x:new m.Vector3(1,0,0),y:new m.Vector3(0,1,0),z:new m.Vector3(0,0,1)};function At(t,e,n=new m.Quaternion){return n.copy(t).invert().multiply(e)}const Mt=new m.Quaternion().setFromRotationMatrix(new m.Matrix4().makeBasis(new m.Vector3(1,0,0),new m.Vector3(0,0,-1),new m.Vector3(0,1,0))),H=new m.Quaternion,Et=new m.Quaternion;function jt(t){return t.up.z>.5?Et:Mt}function wt(t,e=new m.Quaternion){return t.getWorldQuaternion(H),At(H,jt(t),e)}function Rt(t,e,n=new m.Quaternion){return n.copy(t).multiply(e)}const Ot=1e-8;function k(t,e){return t?Math.abs(t.dot(e))<1-Ot:!0}function _t(t){const{disabled:e,label:n,overlay:i,size:r}=t,s=$.useTheme(),{gripPx:a}=N(r);return E.JOG_AXES.flatMap(u=>E.JOG_DIRECTIONS.map(o=>{const l={axis:u,direction:o},f=rt(l,t),c=ct(l,t);return p.jsxs(M.Fragment,{children:[p.jsx(_,{component:"span","aria-hidden":!0,ref:v(i,ot(l)),sx:{position:"absolute",inset:0,clipPath:C,pointerEvents:"none",background:at(F(u),f)}}),et.map(h=>p.jsx(_,{component:"span","aria-hidden":!0,ref:v(i,nt(l,h)),...c,sx:{position:"absolute",inset:0,clipPath:C,...z(e)}},h)),p.jsx(_,{component:"button",type:"button",ref:v(i,R(l)),disabled:e,"aria-label":n(l),"aria-pressed":f.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"},...z(e)}}),p.jsx(_,{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:p.jsx("path",{ref:v(i,st(l)),fill:"none",stroke:s.palette.primary.main,strokeWidth:2,strokeLinejoin:"round"})})]},R(l))}))}const P=.8,B=.45,lt=2.25,ut={x:[new m.Vector3(0,1,0),new m.Vector3(0,0,1)],y:[new m.Vector3(-1,0,0),new m.Vector3(0,0,1)],z:[new m.Vector3(1,0,0),new m.Vector3(0,1,0)]};function D(t){const e=t==="+"?B:B+Math.PI,n=e+lt;return{start:e,end:n,head:t==="+"?n:e}}const It=new m.Vector3,V=new m.Vector3,Tt=new m.Vector3;function vt(t,e=24){const n=[];for(const i of E.JOG_AXES){const[r,s]=ut[i],a=o=>It.copy(r).multiplyScalar(Math.cos(o)*P).addScaledVector(s,Math.sin(o)*P).applyQuaternion(t),u=Math.abs(Tt.copy(J[i]).applyQuaternion(t).z);for(const o of E.JOG_DIRECTIONS){const{start:l,end:f,head:c}=D(o),h=[];for(let A=0;A<=e;A++){const w=a(l+(f-l)*A/e);h.push({x:w.x+0,y:-w.y+0,depth:w.z})}const g=a(c),d={x:g.x+0,y:-g.y+0,depth:g.z},x=o==="+"?1:-1;V.copy(r).multiplyScalar(-Math.sin(c)*x).addScaledVector(s,Math.cos(c)*x).applyQuaternion(t);const y=Math.hypot(V.x,V.y),b=y>1e-9?V.x/y:0,S=y>1e-9?-V.y/y:0;n.push({axis:i,direction:o,points:h,head:{...d,dx:b+0,dy:S+0},openness:u})}}return n}function Gt(t,e,n){let i={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)),l=Math.hypot(e-(s.x+o*(a.x-s.x)),n-(s.y+o*(a.y-s.y)));l<i.distance&&(i={distance:l,depth:s.depth+o*(a.depth-s.depth)})}return i}function Pt(t,e){const n=t.length,i=t.map(()=>new Array(n).fill(!1));for(let o=0;o<n;o++)for(let l=o+1;l<n;l++){if(t[o].arc===t[l].arc)continue;let f=0;for(const c of t[o].line){const h=Gt(t[l].line,c.x,c.y);h.distance<e&&(f+=c.depth-h.depth)}f>0?i[o][l]=!0:f<0&&(i[l][o]=!0)}const r=t.map(({line:o})=>o.reduce((l,f)=>l+f.depth,0)/o.length),s=(o,l)=>r[o]-r[l],a=new Array(n).fill(0),u=new Set(t.keys());for(let o=1;u.size>0;o++){const l=[...u],f=l.filter(h=>!l.some(g=>i[h][g])),c=(f.length>0?f:l).sort(s)[0];a[c]=o,u.delete(c)}return a}const Q=8;function L(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 i=-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>i){const u=i/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}i-=a,n.pop()}return n}const U=(t,e)=>L([...t].reverse(),e).reverse();function Vt(t,e){const n=e/2,i=[],r=[],s=[];let a={x:0,y:0};for(const[o,l]of t.entries()){const f=t[Math.max(0,o-1)],c=t[Math.min(t.length-1,o+1)],h=c.x-f.x,g=c.y-f.y,d=Math.hypot(h,g);d>1e-9&&(a={x:-g/d,y:h/d}),s.push(a),i.push({x:l.x+a.x*n,y:l.y+a.y*n}),r.push({x:l.x-a.x*n,y:l.y-a.y*n})}const u=(o,l)=>{const f=s[o],c={x:f.y,y:-f.x},h=l?1:-1;return Array.from({length:Q-1},(g,d)=>{const x=Math.PI*(d+1)/Q,y=Math.cos(x)*h,b=Math.sin(x)*h;return{x:t[o].x+(f.x*y+c.x*b)*n,y:t[o].y+(f.y*y+c.y*b)*n}})};return(o,l)=>[...i.slice(o,l+1),...l===t.length-1?u(l,!0):[],...r.slice(o,l+1).reverse(),...o===0?u(o,!1):[]]}function Ft(t,e){return[{from:0,to:Math.min(t-1,e+1)},{from:Math.max(0,e-1),to:t-1}]}function Nt(t,{radiusPx:e,gripPx:n,beyondTipPx:i,headLength:r}){const s=n/2,a=r/2*e+i-s,u=i-s,o=t.map(d=>{const x=d.points.map(S=>({x:S.x*e,y:S.y*e,depth:S.depth})),y=x[x.length>>1],b=d.direction==="+"?U(L(x,a),u):L(U(x,a),u);return{line:b,middle:b.indexOf(y)}}),l=o.map(({line:d})=>d),f=t.map(d=>2*P*e*d.openness>=n),c=l.flatMap((d,x)=>f[x]?Ft(d.length,o[x].middle).map(({from:y,to:b})=>({arc:x,from:y,to:b,line:d.slice(y,b+1)})):[]),h=Pt(c,n),g=t.map((d,x)=>x).sort((d,x)=>t[d].head.depth-t[x].head.depth);return t.map((d,x)=>{if(!f[x])return null;const y=Vt(l[x],n),b=c.flatMap((S,A)=>S.arc===x?[{...S,layer:h[A]}]:[]);return{band:y(0,l[x].length-1),halves:b.map(({from:S,to:A,layer:w})=>({polygon:y(S,A),layer:w})),head:{x:d.head.x*e,y:d.head.y*e},headLayer:c.length+1+g.indexOf(x)}})}function ht(t,e,n,i){const r=M.useRef(null),s=q.useThree(a=>a.invalidate);M.useEffect(()=>{r.current=null,s()},[i,s]),M.useEffect(()=>{let a=requestAnimationFrame(function u(){const o=t.current;o&&k(r.current,o)&&s(),a=requestAnimationFrame(u)});return()=>cancelAnimationFrame(a)},[t,s]),q.useFrame(()=>{const a=t.current;!a||!e.current||k(r.current,a)&&(e.current.quaternion.copy(a),n(a)&&(r.current=a.clone()))})}const W=.03;function $t({orientation:t,lit:e,disabled:n,size:i,radius:r,overlay:s}){const a=M.useRef(null),u=i/2,o=c=>`${(u+c).toFixed(2)}px`,l=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`;return ht(t,a,c=>{let h=!0;const g=vt(c),d=Nt(g,St(i,r));for(const[x,y]of g.entries()){const b=s.current.get(R(y)),S=s.current.get(ot(y)),A=s.current.get(st(y)),w=et.map(I=>s.current.get(nt(y,I)));if(!b||!S||!A||w.some(I=>!I)){h=!1;continue}const j=d[x];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?l(j.band):C,A.setAttribute("d",j?f(j.band):"");for(const[I,T]of w.entries()){if(!T)continue;const O=j==null?void 0:j.halves[I];T.style.clipPath=O?l(O.polygon):C,T.style.zIndex=O?String(O.layer):"0",T.style.pointerEvents=O?"":"none"}}return h},`${i}:${r}`),p.jsxs("group",{ref:a,children:[p.jsxs("mesh",{children:[p.jsx("sphereGeometry",{args:[.07,16,16]}),p.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(c=>p.jsx(Ct,{axis:c,color:F(c),lit:(e==null?void 0:e.axis)===c?e.direction:null,disabled:n},c))]})}function Ct({axis:t,color:e,lit:n,disabled:i}){const r=M.useMemo(()=>{const[s,a]=ut[t];return new m.Quaternion().setFromRotationMatrix(new m.Matrix4().makeBasis(s,a,J[t]))},[t]);return p.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(s=>{const a=n===s,u=a?1:i?.35:.8,o=a?W*1.5:W;return p.jsxs("group",{children:[p.jsxs("mesh",{rotation:[0,0,D(s).start],children:[p.jsx("torusGeometry",{args:[P,o,12,48,lt]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:u})]}),p.jsx(Jt,{direction:s,color:e,opacity:u,lit:a})]},s)})})}function Jt({direction:t,color:e,opacity:n,lit:i}){const{position:r,rotation:s}=M.useMemo(()=>{const{head:a}=D(t),u=t==="+"?1:-1;return{position:new m.Vector3(Math.cos(a)*P,Math.sin(a)*P,0),rotation:new m.Quaternion().setFromUnitVectors(Y,new m.Vector3(-Math.sin(a)*u,Math.cos(a)*u,0))}},[t]);return p.jsxs("mesh",{position:r,quaternion:s,scale:i?1.2:1,children:[p.jsx("coneGeometry",{args:[Z,G,20]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:n})]})}function qt(t){const{disabled:e,label:n,overlay:i,size:r}=t,s=$.useTheme(),{gripPx:a,labelFontPx:u}=N(r);return p.jsxs(p.Fragment,{children:[E.JOG_AXES.map(o=>p.jsx(_,{component:"span","aria-hidden":!0,ref:v(i,tt(o)),sx:{position:"absolute",transform:"translate(-50%, -50%)",pointerEvents:"none",fontSize:u,color:F(o),opacity:e?.4:1},children:o.toUpperCase()},o)),E.JOG_AXES.flatMap(o=>E.JOG_DIRECTIONS.map(l=>{const f={axis:o,direction:l},c=rt(f,t);return p.jsx(_,{component:"button",type:"button",ref:v(i,R(f)),disabled:e,"aria-label":n(f),"aria-pressed":c.pressed,...ct(f,t),sx:{position:"absolute",height:a,transformOrigin:"0 50%",padding:0,borderRadius:`${a/2}px`,border:"none",background:at(F(o),c),"&:focus-visible":{outline:it(s)},...z(e)}},R(f))}))]})}function zt(t){const e=[];for(const n of E.JOG_AXES)for(const i of E.JOG_DIRECTIONS){const r=J[n].clone().multiplyScalar(i==="+"?1:-1).applyQuaternion(t);e.push({axis:n,direction:i,x:r.x+0,y:-r.y+0,depth:r.z})}return e}function Lt(t,e){const{radiusPx:n,gripPx:i,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 g of o.slice(c+1)){if(!h.grabbed||!g.grabbed)continue;const[d,x]=h.tip<=g.tip?[h,g]:[g,h],y=h.angle-g.angle,b=d.tip*Math.abs(Math.sin(y));if(Math.cos(y)<=0||b>=i)continue;const S=x.tip*(1-u);if(d.tip>S){const A=h.depth<g.depth?h:g;A.grabbed=!1}else{const A=(d.tip+S)/2;d.end=Math.min(d.end,A),x.start=Math.max(x.start,A)}}const l=o.map((c,h)=>h);l.sort((c,h)=>o[c].depth-o[h].depth);const f=new Map(l.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:f.get(h)??0})}const X=.035,K=1.28;function Dt({orientation:t,lit:e,disabled:n,size:i,radius:r,overlay:s}){const a=M.useRef(null),u=i/2;return ht(t,a,o=>{let l=!0;const f=zt(o),c=Lt(f,bt(i,r));for(const[h,g]of f.entries()){const d=s.current.get(R(g)),x=c[h];if(d?x?(d.style.left=`${u+x.x}px`,d.style.top=`${u+x.y}px`,d.style.width=`${x.length}px`,d.style.transform=`translateY(-50%) rotate(${x.angle}rad)`,d.style.zIndex=String(x.layer),d.style.pointerEvents=""):d.style.pointerEvents="none":l=!1,g.direction!=="+")continue;const y=s.current.get(tt(g.axis));y?(y.style.left=`${u+g.x*r*K}px`,y.style.top=`${u+g.y*r*K}px`):l=!1}return l},`${i}:${r}`),p.jsxs("group",{ref:a,children:[p.jsxs("mesh",{children:[p.jsx("sphereGeometry",{args:[.07,16,16]}),p.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(o=>p.jsx(Ht,{axis:o,color:F(o),lit:(e==null?void 0:e.axis)===o?e.direction:null,disabled:n},o))]})}function Ht({axis:t,color:e,lit:n,disabled:i}){const r=M.useMemo(()=>new m.Quaternion().setFromUnitVectors(Y,J[t]),[t]),s=1-G;return p.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(a=>{const u=n===a,o=u?1:i?.35:.8,l=u?X*1.5:X;return p.jsxs("group",{rotation:[a==="+"?0:Math.PI,0,0],children:[p.jsxs("mesh",{position:[0,s/2,0],children:[p.jsx("cylinderGeometry",{args:[l,l,s,12]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]}),p.jsxs("mesh",{position:[0,1-G/2,0],scale:u?1.2:1,children:[p.jsx("coneGeometry",{args:[Z,G,20]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]})]},a)})})}const kt=new m.Quaternion;function Bt(t,e=kt){const n=M.useRef(e);return n.current=e,M.useMemo(()=>{const i=new m.Quaternion;return{get current(){const r=t.current;if(!r)return null;const s=n.current;return Rt(r,typeof s=="function"?s():s,i)}}},[t])}const Qt=3e3;function Ut(t){const[e,n]=M.useState(()=>t.current!==null);return M.useEffect(()=>{if(e)return;let i=requestAnimationFrame(function s(){t.current!==null?n(!0):i=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.")},Qt);return()=>{cancelAnimationFrame(i),clearTimeout(r)}},[e,t]),e}const Wt=ft.externalizeComponent(({orientation:t,frameQuaternion:e,motion:n="translate",onJogStart:i,onJogStop:r,activeHandle:s,disabled:a=!1,size:u=200,onWebGLUnavailable:o})=>{const{t:l}=dt.useTranslation(),{unavailable:f,makeRenderer:c}=xt.useWebGLRenderer({onWebGLUnavailable:o}),h=Ut(t),g=a||!h,d=Bt(t,e),{held:x,handlersFor:y,label:b,isPressed:S}=E.useJogControls({motion:n,onJogStart:i,onJogStop:r,activeHandle:s,disabled:g}),[A,w]=M.useState(null);M.useEffect(()=>w(null),[n]);const j=n==="rotate"?$t:Dt,I=n==="rotate"?_t:qt,T=M.useRef(new Map),O=mt(u,u,N(u).marginPx);return f?p.jsx(_,{"data-testid":"jogging-gizmo-unavailable",sx:{width:u,height:u,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center"},children:p.jsx(pt,{variant:"body2",color:"text.secondary",children:l("JoggingGizmo.WebGLUnavailable.lb")})}):p.jsxs(_,{"data-testid":"jogging-gizmo",sx:{position:"relative",width:u,height:u,flexShrink:0,isolation:"isolate"},children:[p.jsx(q.Canvas,{orthographic:!0,flat:!0,frameloop:"demand",camera:{position:[0,0,10],up:[0,1,0],zoom:O,near:.1,far:100},gl:c,style:{position:"absolute",inset:0,pointerEvents:"none"},children:p.jsx(j,{orientation:d,lit:x??s??A,disabled:g,size:u,radius:O,overlay:T})}),p.jsx(I,{isPressed:S,hovered:A,disabled:g,size:u,onHover:w,handlersFor:y,label:b,overlay:T})]})});exports.JoggingGizmo=Wt;exports.novaAxesSeenBy=wt;
|
|
1
|
+
"use strict";const p=require("react/jsx-runtime"),_=require("@mui/material/Box"),pt=require("@mui/material/Typography"),q=require("@react-three/fiber"),M=require("react"),dt=require("react-i18next"),m=require("three"),ft=require("./externalizeComponent-BW1UV6Gh.cjs"),xt=require("./useWebGLRenderer-CtddVDDb.cjs"),E=require("./joggingColors-ZDc_2UCp.cjs"),$=require("@mui/material/styles"),Y=new m.Vector3(0,1,0),G=.26,Z=.1,gt={x:"X",y:"Y",z:"Z"};function F(t){var e;return((e=E.cartesianAxisColors[gt[t]].buttonBackgroundColor)==null?void 0:e.default)??"currentColor"}const yt=200;function N(t){const e=t/yt;return{marginPx:30*e,gripPx:30*e,grab:{innerPx:10*e,beyondTipPx:10*e,minTipPx:16*e},labelFontPx:Math.max(10,13*e)}}function mt(t,e,n){return Math.max(1,Math.min(t,e)/2-n)}function bt(t,e){const{gripPx:n,grab:i}=N(t);return{radiusPx:e,gripPx:n,headLength:G,...i}}function St(t,e){const{gripPx:n,grab:i}=N(t);return{radiusPx:e,gripPx:n,beyondTipPx:i.beyondTipPx,headLength:G}}function v(t,e){return n=>{n?t.current.set(e,n):t.current.delete(e)}}const R=t=>`${t.axis}${t.direction}`,tt=t=>`label:${t}`,et=[0,1],nt=(t,e)=>`half:${R(t)}:${e}`,ot=t=>`halo:${R(t)}`,st=t=>`focus:${R(t)}`,C="polygon(0 0, 0 0, 0 0)";function rt(t,{isPressed:e,hovered:n,disabled:i}){const r=e(t),s=!i&&(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 z=t=>({cursor:t?"default":"pointer",touchAction:"none",userSelect:"none"}),it=t=>`2px solid ${t.palette.primary.main}`,J={x:new m.Vector3(1,0,0),y:new m.Vector3(0,1,0),z:new m.Vector3(0,0,1)};function At(t,e,n=new m.Quaternion){return n.copy(t).invert().multiply(e)}const Mt=new m.Quaternion().setFromRotationMatrix(new m.Matrix4().makeBasis(new m.Vector3(1,0,0),new m.Vector3(0,0,-1),new m.Vector3(0,1,0))),H=new m.Quaternion,Et=new m.Quaternion;function jt(t){return t.up.z>.5?Et:Mt}function wt(t,e=new m.Quaternion){return t.getWorldQuaternion(H),At(H,jt(t),e)}function Rt(t,e,n=new m.Quaternion){return n.copy(t).multiply(e)}const Ot=1e-8;function k(t,e){return t?Math.abs(t.dot(e))<1-Ot:!0}function _t(t){const{disabled:e,label:n,overlay:i,size:r}=t,s=$.useTheme(),{gripPx:a}=N(r);return E.JOG_AXES.flatMap(u=>E.JOG_DIRECTIONS.map(o=>{const l={axis:u,direction:o},f=rt(l,t),c=ct(l,t);return p.jsxs(M.Fragment,{children:[p.jsx(_,{component:"span","aria-hidden":!0,ref:v(i,ot(l)),sx:{position:"absolute",inset:0,clipPath:C,pointerEvents:"none",background:at(F(u),f)}}),et.map(h=>p.jsx(_,{component:"span","aria-hidden":!0,ref:v(i,nt(l,h)),...c,sx:{position:"absolute",inset:0,clipPath:C,...z(e)}},h)),p.jsx(_,{component:"button",type:"button",ref:v(i,R(l)),disabled:e,"aria-label":n(l),"aria-pressed":f.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"},...z(e)}}),p.jsx(_,{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:p.jsx("path",{ref:v(i,st(l)),fill:"none",stroke:s.palette.primary.main,strokeWidth:2,strokeLinejoin:"round"})})]},R(l))}))}const P=.8,B=.45,lt=2.25,ut={x:[new m.Vector3(0,1,0),new m.Vector3(0,0,1)],y:[new m.Vector3(-1,0,0),new m.Vector3(0,0,1)],z:[new m.Vector3(1,0,0),new m.Vector3(0,1,0)]};function D(t){const e=t==="+"?B:B+Math.PI,n=e+lt;return{start:e,end:n,head:t==="+"?n:e}}const It=new m.Vector3,V=new m.Vector3,Tt=new m.Vector3;function vt(t,e=24){const n=[];for(const i of E.JOG_AXES){const[r,s]=ut[i],a=o=>It.copy(r).multiplyScalar(Math.cos(o)*P).addScaledVector(s,Math.sin(o)*P).applyQuaternion(t),u=Math.abs(Tt.copy(J[i]).applyQuaternion(t).z);for(const o of E.JOG_DIRECTIONS){const{start:l,end:f,head:c}=D(o),h=[];for(let A=0;A<=e;A++){const w=a(l+(f-l)*A/e);h.push({x:w.x+0,y:-w.y+0,depth:w.z})}const g=a(c),d={x:g.x+0,y:-g.y+0,depth:g.z},x=o==="+"?1:-1;V.copy(r).multiplyScalar(-Math.sin(c)*x).addScaledVector(s,Math.cos(c)*x).applyQuaternion(t);const y=Math.hypot(V.x,V.y),b=y>1e-9?V.x/y:0,S=y>1e-9?-V.y/y:0;n.push({axis:i,direction:o,points:h,head:{...d,dx:b+0,dy:S+0},openness:u})}}return n}function Gt(t,e,n){let i={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)),l=Math.hypot(e-(s.x+o*(a.x-s.x)),n-(s.y+o*(a.y-s.y)));l<i.distance&&(i={distance:l,depth:s.depth+o*(a.depth-s.depth)})}return i}function Pt(t,e){const n=t.length,i=t.map(()=>new Array(n).fill(!1));for(let o=0;o<n;o++)for(let l=o+1;l<n;l++){if(t[o].arc===t[l].arc)continue;let f=0;for(const c of t[o].line){const h=Gt(t[l].line,c.x,c.y);h.distance<e&&(f+=c.depth-h.depth)}f>0?i[o][l]=!0:f<0&&(i[l][o]=!0)}const r=t.map(({line:o})=>o.reduce((l,f)=>l+f.depth,0)/o.length),s=(o,l)=>r[o]-r[l],a=new Array(n).fill(0),u=new Set(t.keys());for(let o=1;u.size>0;o++){const l=[...u],f=l.filter(h=>!l.some(g=>i[h][g])),c=(f.length>0?f:l).sort(s)[0];a[c]=o,u.delete(c)}return a}const Q=8;function L(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 i=-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>i){const u=i/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}i-=a,n.pop()}return n}const U=(t,e)=>L([...t].reverse(),e).reverse();function Vt(t,e){const n=e/2,i=[],r=[],s=[];let a={x:0,y:0};for(const[o,l]of t.entries()){const f=t[Math.max(0,o-1)],c=t[Math.min(t.length-1,o+1)],h=c.x-f.x,g=c.y-f.y,d=Math.hypot(h,g);d>1e-9&&(a={x:-g/d,y:h/d}),s.push(a),i.push({x:l.x+a.x*n,y:l.y+a.y*n}),r.push({x:l.x-a.x*n,y:l.y-a.y*n})}const u=(o,l)=>{const f=s[o],c={x:f.y,y:-f.x},h=l?1:-1;return Array.from({length:Q-1},(g,d)=>{const x=Math.PI*(d+1)/Q,y=Math.cos(x)*h,b=Math.sin(x)*h;return{x:t[o].x+(f.x*y+c.x*b)*n,y:t[o].y+(f.y*y+c.y*b)*n}})};return(o,l)=>[...i.slice(o,l+1),...l===t.length-1?u(l,!0):[],...r.slice(o,l+1).reverse(),...o===0?u(o,!1):[]]}function Ft(t,e){return[{from:0,to:Math.min(t-1,e+1)},{from:Math.max(0,e-1),to:t-1}]}function Nt(t,{radiusPx:e,gripPx:n,beyondTipPx:i,headLength:r}){const s=n/2,a=r/2*e+i-s,u=i-s,o=t.map(d=>{const x=d.points.map(S=>({x:S.x*e,y:S.y*e,depth:S.depth})),y=x[x.length>>1],b=d.direction==="+"?U(L(x,a),u):L(U(x,a),u);return{line:b,middle:b.indexOf(y)}}),l=o.map(({line:d})=>d),f=t.map(d=>2*P*e*d.openness>=n),c=l.flatMap((d,x)=>f[x]?Ft(d.length,o[x].middle).map(({from:y,to:b})=>({arc:x,from:y,to:b,line:d.slice(y,b+1)})):[]),h=Pt(c,n),g=t.map((d,x)=>x).sort((d,x)=>t[d].head.depth-t[x].head.depth);return t.map((d,x)=>{if(!f[x])return null;const y=Vt(l[x],n),b=c.flatMap((S,A)=>S.arc===x?[{...S,layer:h[A]}]:[]);return{band:y(0,l[x].length-1),halves:b.map(({from:S,to:A,layer:w})=>({polygon:y(S,A),layer:w})),head:{x:d.head.x*e,y:d.head.y*e},headLayer:c.length+1+g.indexOf(x)}})}function ht(t,e,n,i){const r=M.useRef(null),s=q.useThree(a=>a.invalidate);M.useEffect(()=>{r.current=null,s()},[i,s]),M.useEffect(()=>{let a=requestAnimationFrame(function u(){const o=t.current;o&&k(r.current,o)&&s(),a=requestAnimationFrame(u)});return()=>cancelAnimationFrame(a)},[t,s]),q.useFrame(()=>{const a=t.current;!a||!e.current||k(r.current,a)&&(e.current.quaternion.copy(a),n(a)&&(r.current=a.clone()))})}const W=.03;function $t({orientation:t,lit:e,disabled:n,size:i,radius:r,overlay:s}){const a=M.useRef(null),u=i/2,o=c=>`${(u+c).toFixed(2)}px`,l=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`;return ht(t,a,c=>{let h=!0;const g=vt(c),d=Nt(g,St(i,r));for(const[x,y]of g.entries()){const b=s.current.get(R(y)),S=s.current.get(ot(y)),A=s.current.get(st(y)),w=et.map(I=>s.current.get(nt(y,I)));if(!b||!S||!A||w.some(I=>!I)){h=!1;continue}const j=d[x];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?l(j.band):C,A.setAttribute("d",j?f(j.band):"");for(const[I,T]of w.entries()){if(!T)continue;const O=j==null?void 0:j.halves[I];T.style.clipPath=O?l(O.polygon):C,T.style.zIndex=O?String(O.layer):"0",T.style.pointerEvents=O?"":"none"}}return h},`${i}:${r}`),p.jsxs("group",{ref:a,children:[p.jsxs("mesh",{children:[p.jsx("sphereGeometry",{args:[.07,16,16]}),p.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(c=>p.jsx(Ct,{axis:c,color:F(c),lit:(e==null?void 0:e.axis)===c?e.direction:null,disabled:n},c))]})}function Ct({axis:t,color:e,lit:n,disabled:i}){const r=M.useMemo(()=>{const[s,a]=ut[t];return new m.Quaternion().setFromRotationMatrix(new m.Matrix4().makeBasis(s,a,J[t]))},[t]);return p.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(s=>{const a=n===s,u=a?1:i?.35:.8,o=a?W*1.5:W;return p.jsxs("group",{children:[p.jsxs("mesh",{rotation:[0,0,D(s).start],children:[p.jsx("torusGeometry",{args:[P,o,12,48,lt]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:u})]}),p.jsx(Jt,{direction:s,color:e,opacity:u,lit:a})]},s)})})}function Jt({direction:t,color:e,opacity:n,lit:i}){const{position:r,rotation:s}=M.useMemo(()=>{const{head:a}=D(t),u=t==="+"?1:-1;return{position:new m.Vector3(Math.cos(a)*P,Math.sin(a)*P,0),rotation:new m.Quaternion().setFromUnitVectors(Y,new m.Vector3(-Math.sin(a)*u,Math.cos(a)*u,0))}},[t]);return p.jsxs("mesh",{position:r,quaternion:s,scale:i?1.2:1,children:[p.jsx("coneGeometry",{args:[Z,G,20]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:n})]})}function qt(t){const{disabled:e,label:n,overlay:i,size:r}=t,s=$.useTheme(),{gripPx:a,labelFontPx:u}=N(r);return p.jsxs(p.Fragment,{children:[E.JOG_AXES.map(o=>p.jsx(_,{component:"span","aria-hidden":!0,ref:v(i,tt(o)),sx:{position:"absolute",transform:"translate(-50%, -50%)",pointerEvents:"none",fontSize:u,color:F(o),opacity:e?.4:1},children:o.toUpperCase()},o)),E.JOG_AXES.flatMap(o=>E.JOG_DIRECTIONS.map(l=>{const f={axis:o,direction:l},c=rt(f,t);return p.jsx(_,{component:"button",type:"button",ref:v(i,R(f)),disabled:e,"aria-label":n(f),"aria-pressed":c.pressed,...ct(f,t),sx:{position:"absolute",height:a,transformOrigin:"0 50%",padding:0,borderRadius:`${a/2}px`,border:"none",background:at(F(o),c),"&:focus-visible":{outline:it(s)},...z(e)}},R(f))}))]})}function zt(t){const e=[];for(const n of E.JOG_AXES)for(const i of E.JOG_DIRECTIONS){const r=J[n].clone().multiplyScalar(i==="+"?1:-1).applyQuaternion(t);e.push({axis:n,direction:i,x:r.x+0,y:-r.y+0,depth:r.z})}return e}function Lt(t,e){const{radiusPx:n,gripPx:i,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 g of o.slice(c+1)){if(!h.grabbed||!g.grabbed)continue;const[d,x]=h.tip<=g.tip?[h,g]:[g,h],y=h.angle-g.angle,b=d.tip*Math.abs(Math.sin(y));if(Math.cos(y)<=0||b>=i)continue;const S=x.tip*(1-u);if(d.tip>S){const A=h.depth<g.depth?h:g;A.grabbed=!1}else{const A=(d.tip+S)/2;d.end=Math.min(d.end,A),x.start=Math.max(x.start,A)}}const l=o.map((c,h)=>h);l.sort((c,h)=>o[c].depth-o[h].depth);const f=new Map(l.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:f.get(h)??0})}const X=.035,K=1.28;function Dt({orientation:t,lit:e,disabled:n,size:i,radius:r,overlay:s}){const a=M.useRef(null),u=i/2;return ht(t,a,o=>{let l=!0;const f=zt(o),c=Lt(f,bt(i,r));for(const[h,g]of f.entries()){const d=s.current.get(R(g)),x=c[h];if(d?x?(d.style.left=`${u+x.x}px`,d.style.top=`${u+x.y}px`,d.style.width=`${x.length}px`,d.style.transform=`translateY(-50%) rotate(${x.angle}rad)`,d.style.zIndex=String(x.layer),d.style.pointerEvents=""):d.style.pointerEvents="none":l=!1,g.direction!=="+")continue;const y=s.current.get(tt(g.axis));y?(y.style.left=`${u+g.x*r*K}px`,y.style.top=`${u+g.y*r*K}px`):l=!1}return l},`${i}:${r}`),p.jsxs("group",{ref:a,children:[p.jsxs("mesh",{children:[p.jsx("sphereGeometry",{args:[.07,16,16]}),p.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(o=>p.jsx(Ht,{axis:o,color:F(o),lit:(e==null?void 0:e.axis)===o?e.direction:null,disabled:n},o))]})}function Ht({axis:t,color:e,lit:n,disabled:i}){const r=M.useMemo(()=>new m.Quaternion().setFromUnitVectors(Y,J[t]),[t]),s=1-G;return p.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(a=>{const u=n===a,o=u?1:i?.35:.8,l=u?X*1.5:X;return p.jsxs("group",{rotation:[a==="+"?0:Math.PI,0,0],children:[p.jsxs("mesh",{position:[0,s/2,0],children:[p.jsx("cylinderGeometry",{args:[l,l,s,12]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]}),p.jsxs("mesh",{position:[0,1-G/2,0],scale:u?1.2:1,children:[p.jsx("coneGeometry",{args:[Z,G,20]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]})]},a)})})}const kt=new m.Quaternion;function Bt(t,e=kt){const n=M.useRef(e);return n.current=e,M.useMemo(()=>{const i=new m.Quaternion;return{get current(){const r=t.current;if(!r)return null;const s=n.current;return Rt(r,typeof s=="function"?s():s,i)}}},[t])}const Qt=3e3;function Ut(t){const[e,n]=M.useState(()=>t.current!==null);return M.useEffect(()=>{if(e)return;let i=requestAnimationFrame(function s(){t.current!==null?n(!0):i=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.")},Qt);return()=>{cancelAnimationFrame(i),clearTimeout(r)}},[e,t]),e}const Wt=ft.externalizeComponent(({orientation:t,frameQuaternion:e,motion:n="translate",onJogStart:i,onJogStop:r,activeHandle:s,disabled:a=!1,size:u=200,onWebGLUnavailable:o})=>{const{t:l}=dt.useTranslation(),{unavailable:f,makeRenderer:c}=xt.useWebGLRenderer({onWebGLUnavailable:o}),h=Ut(t),g=a||!h,d=Bt(t,e),{held:x,handlersFor:y,label:b,isPressed:S}=E.useJogControls({motion:n,onJogStart:i,onJogStop:r,activeHandle:s,disabled:g}),[A,w]=M.useState(null);M.useEffect(()=>w(null),[n]);const j=n==="rotate"?$t:Dt,I=n==="rotate"?_t:qt,T=M.useRef(new Map),O=mt(u,u,N(u).marginPx);return f?p.jsx(_,{"data-testid":"jogging-gizmo-unavailable",sx:{width:u,height:u,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center"},children:p.jsx(pt,{variant:"body2",color:"text.secondary",children:l("JoggingGizmo.WebGLUnavailable.lb")})}):p.jsxs(_,{"data-testid":"jogging-gizmo",sx:{position:"relative",width:u,height:u,flexShrink:0,isolation:"isolate"},children:[p.jsx(q.Canvas,{orthographic:!0,flat:!0,frameloop:"demand",camera:{position:[0,0,10],up:[0,1,0],zoom:O,near:.1,far:100},gl:c,style:{position:"absolute",inset:0,pointerEvents:"none"},children:p.jsx(j,{orientation:d,lit:x??s??A,disabled:g,size:u,radius:O,overlay:T})}),p.jsx(I,{isPressed:S,hovered:A,disabled:g,size:u,onHover:w,handlersFor:y,label:b,overlay:T})]})});exports.JoggingGizmo=Wt;exports.novaAxesSeenBy=wt;
|
package/dist/chunks/{JoggingGizmoOrientation-DwGhxKo3.cjs → JoggingGizmoOrientation-D9VS6nag.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-BJ3wDpAJ.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-BW1UV6Gh.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-TgclPxwg.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 +1 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),f=require("three"),I=require("three-stdlib"),A=require("@react-three/drei"),O=require("react"),b=require("./RobotScene-
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),f=require("three"),I=require("three-stdlib"),A=require("@react-three/drei"),O=require("react"),b=require("./RobotScene-BjctJ5z1.cjs");function E(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return o.default=e,Object.freeze(o)}const u=E(f);function k(e){switch(e.shape_type){case"convex_hull":return new I.ConvexGeometry(e.vertices.map(n=>new u.Vector3(n[0]/1e3,n[1]/1e3,n[2]/1e3)));case"box":return new u.BoxGeometry(e.size_x/1e3,e.size_y/1e3,e.size_z/1e3);case"sphere":return new u.SphereGeometry(e.radius/1e3);case"capsule":return new u.CapsuleGeometry(e.radius/1e3,e.cylinder_height/1e3);case"cylinder":return new u.CylinderGeometry(e.radius/1e3,e.radius/1e3,e.height/1e3);case"rectangle":return new u.BoxGeometry(e.size_x/1e3,e.size_y/1e3,0);default:return console.warn(`${e.shape_type} is not supported`),new u.BufferGeometry}}function F({name:e,collider:o,children:n}){var a,s;const r=((a=o.pose)==null?void 0:a.position)??[0,0,0],i=((s=o.pose)==null?void 0:s.orientation)??[0,0,0];return o.margin&&console.warn(`${e} margin is not supported`),c.jsx("mesh",{name:e,position:new u.Vector3(r[0],r[1],r[2]).divideScalar(1e3),rotation:new u.Euler(i[0],i[1],i[2],"XYZ"),geometry:k(o.shape),children:n})}function N({name:e,colliders:o,meshChildrenProvider:n,...r}){return c.jsx("group",{name:e,...r,children:Object.entries(o).map(([i,a])=>c.jsx(F,{name:i,collider:a,children:n(i,a)},i))})}function V({scene:e,meshChildrenProvider:o}){const n=e.colliders;return c.jsx("group",{children:n&&c.jsx(N,{meshChildrenProvider:o,colliders:n})})}function v(e){const o=(e==null?void 0:e.position)??[],n=(e==null?void 0:e.orientation)??[],r=new f.Vector3(n[0]??0,n[1]??0,n[2]??0),i=r.length(),a=i>0?new f.Quaternion().setFromAxisAngle(r.normalize(),i):new f.Quaternion;return new f.Matrix4().compose(new f.Vector3(o[0]??0,o[1]??0,o[2]??0).divideScalar(1e3),a,new f.Vector3(1,1,1))}function q(e,o=null,n=[]){const r=v(o);return e.map((i,a)=>{const s=r.clone(),t=(i.reverse_rotation_direction?-1:1)*(n[a]??0),l=i.type==="PRISMATIC_JOINT",m=(i.theta??0)+(l?0:t),d=(i.d??0)+(l?t:0);return r.multiply(new f.Matrix4().makeRotationZ(m)).multiply(new f.Matrix4().makeTranslation((i.a??0)/1e3,0,d/1e3)).multiply(new f.Matrix4().makeRotationX(i.alpha??0)),s})}const T="#ff4b4b",L="#2fa8ff",Q="#8a8d9e",z=96,H=.15,U=new u.Vector3(0,1,0),B=.2,D=2;function J(e){const{lower_limit:o,upper_limit:n}=e??{};return typeof o!="number"||typeof n!="number"||!Number.isFinite(o)||!Number.isFinite(n)||!(o<n)?null:{lower_limit:o,upper_limit:n}}function j({base:e,direction:o,size:n,color:r,opacity:i}){const a=new u.Quaternion().setFromUnitVectors(U,o.clone().normalize()),s=e.clone().addScaledVector(o.clone().normalize(),n/2);return c.jsxs("mesh",{position:s,quaternion:a,renderOrder:10,children:[c.jsx("coneGeometry",{args:[n*.35,n,16]}),c.jsx("meshBasicMaterial",{color:r,depthTest:!1,transparent:!0,opacity:i})]})}function P({points:e,color:o,width:n,opacity:r}){return c.jsx(A.Line,{points:e,color:o,lineWidth:n,depthTest:!1,transparent:!0,opacity:r,renderOrder:10})}function G(e,o){const n=[...e];let r=o;for(;n.length>1;){const i=n[n.length-1],a=n[n.length-2],s=i.distanceTo(a);if(s>r)return n[n.length-1]=i.clone().lerp(a,r/s),n;r-=s,n.pop()}return n}function W(e,o,n,r){const i=n*e,a=n*o,s=Math.abs(a-i),t=Math.max(2,Math.ceil(s/(2*Math.PI)*z));return Array.from({length:t+1},(l,m)=>{const d=i+(a-i)*m/t,p=s*m/t/(2*Math.PI),h=r*(1+H*p);return new u.Vector3(Math.cos(d)*h,Math.sin(d)*h,0)})}function X(e,o,n,r){const i=e.theta??0,a=e.d??0,s=e.type==="PRISMATIC_JOINT",t=e.reverse_rotation_direction?-1:1,{lower_limit:l,upper_limit:m}=o;return O.useMemo(()=>{const d=new u.Matrix4().makeRotationZ(i).multiply(new u.Matrix4().makeTranslation(0,0,s?a/1e3:0)),p=(M,_,S)=>new u.Vector3(M,_,S).applyMatrix4(d),h=new u.Vector3().applyMatrix4(d),g=p(0,0,n),x=(s?[p(n*.25,0,t*l/1e3),p(n*.25,0,t*m/1e3)]:W(l,m,t,n*.6)).map(M=>s?M:M.applyMatrix4(d)),y=p(s?n*.25:n*.6,0,0),C=x.slice(1).reduce((M,_,S)=>M+_.distanceTo(x[S]),0),R=Math.min(r,C/3),w=G(G(x,R).reverse(),R).reverse();return{axisPoints:[h,g],axisTip:g,origin:h,restPoints:[h,y],range:x,limitPoints:w,rangeStart:w[0],rangeEnd:w[w.length-1]}},[i,a,s,t,n,l,m,r])}function Y({frame:e,dh:o,limit:n,size:r,emphasis:i}){const a=i==="highlighted"?D:1,s=i==="dimmed"?B:1,t=r*.2*(i==="highlighted"?1.4:1),l=2*a,{axisPoints:m,axisTip:d,origin:p,restPoints:h,range:g,limitPoints:x,rangeStart:y,rangeEnd:C}=X(o,n,r,t),{position:R,quaternion:w}=O.useMemo(()=>{const M=new u.Vector3,_=new u.Quaternion;return e.decompose(M,_,new u.Vector3),{position:M,quaternion:_}},[e]);return c.jsxs("group",{position:R,quaternion:w,children:[c.jsx(P,{points:m,color:L,width:l,opacity:s}),c.jsx(j,{base:d,direction:d.clone().sub(p),size:t,color:L,opacity:s}),c.jsx(P,{points:h,color:Q,width:1.5*a,opacity:s}),c.jsx(P,{points:x,color:T,width:l,opacity:s}),c.jsx(j,{base:y,direction:g[0].clone().sub(y),size:y.distanceTo(g[0]),color:T,opacity:s}),c.jsx(j,{base:C,direction:g[g.length-1].clone().sub(C),size:C.distanceTo(g[g.length-1]),color:T,opacity:s})]})}function Z({dhParameters:e,chainOffset:o=null,limits:n,jointPositions:r,size:i=.15,highlightedJoint:a=null}){const s=O.useMemo(()=>q(e,o,r),[e,o,r]);return c.jsx("group",{children:s.map((t,l)=>{const m=J(n[l]);return m?c.jsx(Y,{frame:t,dh:e[l],limit:m,size:i,emphasis:a===null?"normal":a===l?"highlighted":"dimmed"},l):null})})}function $({trajectory:e,...o}){const n=(e==null?void 0:e.map(r=>{if(r.position&&r.position.length>=3){const[i,a,s]=r.position;if(Number.isFinite(i)&&Number.isFinite(a)&&Number.isFinite(s))return new u.Vector3(i/1e3,s/1e3,-a/1e3)}return null}).filter(r=>r!==null))||[];return c.jsx("group",{...o,children:n.length>0&&c.jsx(A.Line,{points:n,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}function K({motionGroup:e,connectedMotionGroup:o,getModel:n,flangeRef:r,transparentColor:i,postModelRender:a,...s}){const t=e??o,l=t==null?void 0:t.nova,m=O.useCallback((g,x,y)=>b.defaultGetModel(g,l,y),[l]),d=n??m;if(!(t!=null&&t.dhParameters))return null;const p=t.modelFromController||"";return p?c.jsx(b.SupportedLinearAxis,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,modelFromController:p,dhParameters:t.dhParameters,serialNumber:t.serialNumber,kinematicChainOffset:t.kinematicChainOffset,getModel:d,flangeRef:r,transparentColor:i,postModelRender:a,chainOffsetPosition:t.mountingPosition,chainOffsetQuaternion:t.mountingQuaternion,...s}):c.jsx(b.DHLinearAxis,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,dhParameters:t.dhParameters,chainOffsetPosition:t.mountingPosition,chainOffsetQuaternion:t.mountingQuaternion,...s})}function ee({motionGroup:e,connectedMotionGroup:o,getModel:n,flangeRef:r,transparentColor:i,postModelRender:a,...s}){const t=e??o,l=t==null?void 0:t.nova,m=O.useCallback((d,p,h)=>b.defaultGetModel(d,l,h),[l]);return t!=null&&t.dhParameters?c.jsx(b.SupportedRobot,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,modelFromController:t.modelFromController||"",dhParameters:t.dhParameters,serialNumber:t.serialNumber,kinematicChainOffset:t.kinematicChainOffset,getModel:n??m,flangeRef:r,transparentColor:i,postModelRender:a,chainOffsetPosition:t.mountingPosition,chainOffsetQuaternion:t.mountingQuaternion,...s}):null}exports.CollisionSceneRenderer=V;exports.JointLimitGizmo=Z;exports.LinearAxis=K;exports.Robot=ee;exports.TrajectoryRenderer=$;
|
|
@@ -4,7 +4,7 @@ import { Matrix4 as T, Vector3 as S, Quaternion as I } from "three";
|
|
|
4
4
|
import { ConvexGeometry as v } from "three-stdlib";
|
|
5
5
|
import { Line as E } from "@react-three/drei";
|
|
6
6
|
import { useMemo as L, useCallback as N } from "react";
|
|
7
|
-
import { j as k, f as V, D as Q, h as H } from "./RobotScene-
|
|
7
|
+
import { j as k, f as V, D as Q, h as H } from "./RobotScene-BS77SUtN.js";
|
|
8
8
|
function U(n) {
|
|
9
9
|
switch (n.shape_type) {
|
|
10
10
|
case "convex_hull":
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const te=require("react/jsx-runtime"),oe=require("mobx-react-lite"),ne=require("./RobotSessionProvider--AekyPqD.cjs"),re=require("./RobotControlPanel-BXUgib6Z.cjs"),s=require("@wandelbots/nova-js"),ae=require("@wandelbots/nova-js/v2"),h=require("mobx"),l=require("react"),ie=require("react-i18next"),ce=require("three"),se=require("./externalizeComponent-BW1UV6Gh.cjs"),I=require("./Pose3-Ch4xVeXV.cjs"),F=require("./coordSystemLabel-BThpFG9n.cjs"),le=require("./useEveryFrame-CHxg25f4.cjs"),N=["Base","Shoulder","Elbow","Forearm","Wrist","Flange"],V="selected-tcp",w="coordinate-system:",k=n=>Math.round(s.radiansToDegrees(n)*1e6)/1e6;function L(n,i){n.targetPose.setDraft(`(${[...i.position,...i.orientation].join(", ")})`),n.targetPose.confirmEdit()}function ue(n,i){switch(n.code){case"disconnected":return i("RobotControl.MoveTo.NotMoveable.Disconnected.lb");case"safety_state":return i("RobotControl.MoveTo.NotMoveable.SafetyState.lb",{value:n.value});case"operation_mode":return i("RobotControl.MoveTo.NotMoveable.OperationMode.lb",{value:n.value});case"deactivated":return i("RobotControl.MoveTo.NotMoveable.Deactivated.lb")}}function de(n){const i=le.useEveryFrame(()=>n.jogger.motionStream.rapidlyChangingMotionState.joint_position.join(" "),!0);return l.useMemo(()=>i?i.split(" ").map(Number):[],[i])}function A(n,i={}){var x;const{disabled:f=!1,gizmoOrientation:T}=i,{t:S}=ie.useTranslation(void 0,{i18n:se.i18n}),e=n.jogging,{trajectory:c,targetPose:R}=n,_=de(e),d=e.jointType===ae.JointTypeEnum.PrismaticJoint,m=(x=e.motionGroupDescription.operation_limits.auto_limits)==null?void 0:x.joints,E=c.trajectoryState==="moving"||c.trajectoryState==="stopping",J=f||E;l.useEffect(()=>{J?e.lock("external"):e.unlock("external")},[e,J]);const[Q,z]=l.useState(!1),B=Q?"moveTo":e.currentTab.id==="joint"?"joint":e.selectedCartesianMotionType;function U(t){z(t==="moveTo"),h.runInAction(()=>{e.selectedTabId=t==="joint"?"joint":"cartesian"}),(t==="translate"||t==="rotate")&&e.setSelectedCartesianMotionType(t)}const K=e.selectedIncrementId==="continuous"?"continuous":"increment",b=l.useRef(e.activeDiscreteIncrement??e.discreteIncrementOptions[0]);e.activeDiscreteIncrement&&(b.current=e.activeDiscreteIncrement);const M=b.current,g=l.useRef(0);async function X(t,o,r){const a=++g.current;e.isLocked||(await e.activate(),a===g.current&&(t==="translate"?await e.jogger.translateTCP({axis:o,direction:r,velocityMmPerSec:e.translationVelocityMmPerSec}):await e.jogger.rotateTCP({axis:o,direction:r,velocityRadsPerSec:e.rotationVelocityRadsPerSec})))}async function G(t,o){const r=++g.current;await e.activate(),r===g.current&&await e.jogger.rotateJoints({joint:t,direction:o,velocityUnit:d?"mm/s":"rad/s",velocityValue:d?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec})}async function O(){const t=++g.current;await e.jogger.stop(),t===g.current&&await e.deactivate()}async function H(t,o,r,a){const p=e.discreteIncrementOptions.find(y=>t==="translate"?Math.abs(y.mm-a)<1e-9:Math.abs(s.degreesToRadians(y.degrees)-a)<1e-9);!p||e.isLocked||await e.withMotionLock(async()=>{try{const j=(await e.activate()).motionStream.rapidlyChangingMotionState;if(!j.tcp_pose)return;e.setCurrentIncrementJog({axis:o,direction:r}),await e.jogger.runIncrementalCartesianMotion({currentTcpPose:j.tcp_pose,currentJoints:j.joint_position,velocityInRelevantUnits:t==="translate"?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec,axis:o,direction:r,motion:t==="translate"?{type:"translate",distanceMm:p.mm}:{type:"rotate",distanceRads:s.degreesToRadians(p.degrees)}})}finally{e.setCurrentIncrementJog(null),await e.deactivate()}})}function W(){if(e.selectedOrientation==="tool"){const o=n.state.rapidlyChangingMotionState.flange_pose,r=o?I.Pose3.fromPose(o).quaternion.clone():new ce.Quaternion,a=e.selectedTcpId?n.description.tcpOffsetsById[e.selectedTcpId]:void 0;return a!=null&&a.pose.orientation&&r.multiply(I.parseRotationToQuaternion(a.pose.orientation,"ROTATION_VECTOR")),r}const t=e.jogCoordSystem;return I.parseRotationToQuaternion(t.orientation??[1,0,0,0],t.orientation_type??"QUATERNION")}function u(t){n.reportError({kind:"jog",message:t instanceof Error?t.message:String(t),cause:t})}const C=l.useRef(!1),[P,Y]=l.useState(null),q=l.useRef(P);q.current=P;function $(t){if(Y(t),!t){R.resetToLive();return}L(n,t)}l.useEffect(()=>h.reaction(()=>n.safety.notMoveableReason===null,t=>{const o=q.current,{staged:r,confirming:a}=n.targetPose;t&&o&&!r&&!a&&L(n,o)}),[n]);const D=n.safety.notMoveableReason;function Z(){c.trajectoryState==="planned"&&c.plannedTrajectory&&(C.current=!0,c.start())}async function ee(){C.current&&(C.current=!1,await h.when(()=>c.trajectoryState!=="planned",{timeout:2e3}).catch(()=>{}),c.trajectoryState==="moving"&&await c.pause())}const v=R.staged;return{disabled:f,jogDisabled:E||e.blocked,cartesian:e.canJogCartesian,tab:B,onTabChange:U,jogMode:K,onJogModeChange:t=>{var o;return e.setSelectedIncrementId(t==="continuous"?"continuous":((o=b.current)==null?void 0:o.id)??"continuous")},gizmoOrientation:T,gizmoFrameQuaternion:W,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(u)}}:void 0,jogFrame:{options:[{id:V,label:S("Jogging.MoveRelativeTo.SelectedTcp.dd")},...e.coordSystems.map(t=>({id:w+t.coordinate_system,label:F.coordSystemLabel(e,t)}))],value:e.selectedOrientation==="tool"?V:w+e.jogCoordSystemId,onChange:t=>t===V?e.setMoveRelativeToSelectedTcp():e.setMoveRelativeToCoordSystem(t.slice(w.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(k(o),!0):e.setVelocityFromSlider(o,!1),onJogStart:(t,o,r)=>{X(t,o,r).catch(u)},onJogStop:()=>{O().catch(u)},increments:{steps:{translate:e.discreteIncrementOptions.map(t=>t.mm),rotate:e.discreteIncrementOptions.map(t=>s.degreesToRadians(t.degrees))},onStep:(t,o,r,a)=>{H(t,o,r,a).catch(u)},running:e.incrementJogInProgress,step:M&&{translate:M.mm,rotate:s.degreesToRadians(M.degrees)},onStepChange:(t,o)=>{const r=e.discreteIncrementOptions.find(a=>t==="translate"?a.mm===o:Math.abs(s.degreesToRadians(a.degrees)-o)<1e-9);r&&e.setSelectedIncrementId(r.id)}},joints:{joints:_.map((t,o)=>{var r,a,p,y;return{value:t,min:(a=(r=m==null?void 0:m[o])==null?void 0:r.position)==null?void 0:a.lower_limit,max:(y=(p=m==null?void 0:m[o])==null?void 0:p.position)==null?void 0:y.upper_limit,name:_.length===N.length&&!d?N[o]:void 0}}),linear:d,velocity:d?{value:e.translationVelocityMmPerSec,min:e.minTranslationVelocityMmPerSec,max:e.maxTranslationVelocityMmPerSec}:{value:e.rotationVelocityRadsPerSec,min:s.degreesToRadians(e.minRotationVelocityDegPerSec),max:s.degreesToRadians(e.maxRotationVelocityDegPerSec)},onVelocityChange:t=>d?e.setVelocityFromSlider(t,!1):e.setVelocityFromSlider(k(t),!0),onJogStart:(t,o)=>{G(t,o).catch(u)},onJogStop:()=>{O().catch(u)}},moveTo:{getCurrentPose:()=>{const t=n.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:F.coordSystemLabel(e,t)})),value:e.selectedCoordSystemId,onChange:t=>e.setSelectedCoordSystemId(t)},onTargetChange:$,state:R.confirming?"planning":c.trajectoryState,error:P&&D?ue(D,S):v!=null&&v.errorKey?S(v.errorKey):null,onMoveStart:Z,onMoveStop:()=>{ee().catch(u)}}}}const me=oe.observer(function({session:i,disabled:f,gizmoOrientation:T,...S}){const e=ne.useRobotSessionOf(i),c=A(e,{disabled:f,gizmoOrientation:T});return te.jsx(re.RobotControlPanel,{...c,...S})});exports.RobotControl=me;exports.useRobotControlProps=A;
|