@wandelbots/wandelbots-js-react-components 6.3.0 → 6.4.0-pr.chore-public-names.673.cb7ee37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +255 -122
- package/dist/3d.cjs +1 -1
- package/dist/3d.d.ts +7 -3
- package/dist/3d.js +20 -20
- package/dist/CurrentPoseBar/index.cjs +1 -0
- package/dist/CurrentPoseBar/index.d.ts +2 -0
- package/dist/CurrentPoseBar/index.js +5 -0
- package/dist/JoggingButtons/index.cjs +1 -0
- package/dist/JoggingButtons/index.d.ts +3 -0
- package/dist/JoggingButtons/index.js +5 -0
- package/dist/JoggingGizmo/index.cjs +1 -0
- package/dist/JoggingGizmo/index.d.ts +5 -0
- package/dist/JoggingGizmo/index.js +6 -0
- package/dist/JoggingJointSlider/index.cjs +1 -0
- package/dist/JoggingJointSlider/index.d.ts +2 -0
- package/dist/JoggingJointSlider/index.js +5 -0
- package/dist/SafetyBar/index.cjs +1 -1
- package/dist/SafetyBar/index.js +1 -1
- package/dist/chunks/ConnectedMotionGroup-D9JJSyXB.js +1822 -0
- package/dist/chunks/ConnectedMotionGroup-ir7Vf690.cjs +3 -0
- package/dist/chunks/CurrentPoseBar-Cbz4AO36.cjs +1 -0
- package/dist/chunks/CurrentPoseBar-CpwvWpEY.js +619 -0
- package/dist/chunks/JoggingButtons-i8FdMpCx.js +108 -0
- package/dist/chunks/JoggingButtons-paQCBXf4.cjs +1 -0
- package/dist/chunks/JoggingGizmoOrientation-CKZeLcMp.js +893 -0
- package/dist/chunks/JoggingGizmoOrientation-EPtBeAun.cjs +1 -0
- package/dist/chunks/JoggingJointSlider-DQhJOmcc.js +378 -0
- package/dist/chunks/JoggingJointSlider-YcEBMgF1.cjs +1 -0
- package/dist/chunks/Pose3-Ci1bxEvz.js +1373 -0
- package/dist/chunks/Pose3-DwMOSTKO.cjs +1 -0
- package/dist/chunks/SafetyBar-Be1c6Vz9.cjs +1 -0
- package/dist/chunks/{SafetyBar-Cy9DiXp9.js → SafetyBar-WXLP3Yi0.js} +34 -32
- package/dist/chunks/{externalizeComponent-EDymnaGR.js → externalizeComponent-7OVHUIUh.js} +84 -134
- package/dist/chunks/externalizeComponent-B0n_tR3v.cjs +2 -0
- package/dist/chunks/holdSafety-Cbej6-Kc.js +62 -0
- package/dist/chunks/holdSafety-TeMXlYQe.cjs +1 -0
- package/dist/chunks/joggingColors-BKRoSGQu.js +132 -0
- package/dist/chunks/joggingColors-BkPm75Hr.cjs +1 -0
- package/dist/chunks/json-3cqBD7UQ.js +18 -0
- package/dist/chunks/json-Bd6uGfgP.cjs +1 -0
- package/dist/chunks/loadRobotSession-Bt1-Brjp.js +3761 -0
- package/dist/chunks/loadRobotSession-DHVuK_pj.cjs +1 -0
- package/dist/chunks/novaConnection-BTSIgWd1.cjs +1 -0
- package/dist/chunks/novaConnection-J6_ohIQ0.js +14 -0
- package/dist/chunks/poseText-BXUaQWnK.cjs +1 -0
- package/dist/chunks/poseText-CtdXIeT_.js +41 -0
- package/dist/chunks/useSmoothedMotionState-C_Vo0py0.js +202 -0
- package/dist/chunks/useSmoothedMotionState-Ce9NjwBu.cjs +1 -0
- package/dist/components/AppHeader.d.ts +1 -1
- package/dist/components/VelocitySlider.d.ts +6 -1
- package/dist/components/currentPoseBar/CurrentPoseBar.d.ts +48 -0
- package/dist/components/currentPoseBar/OrientationFormatPopover.d.ts +19 -0
- package/dist/components/currentPoseBar/StreamStatus.d.ts +10 -0
- package/dist/components/currentPoseBar/orientation.d.ts +34 -0
- package/dist/components/currentPoseBar/poseValues.d.ts +15 -0
- package/dist/components/jogging/JoggingButtons.d.ts +18 -0
- package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +8 -2
- package/dist/components/jogging/JoggingCartesianTab.d.ts +3 -0
- package/dist/components/jogging/JoggingJointTab.d.ts +4 -1
- package/dist/components/jogging/JoggingJointValueControl.d.ts +7 -1
- package/dist/components/jogging/JoggingPanel.d.ts +6 -3
- package/dist/components/jogging/JoggingRefusedError.d.ts +24 -0
- package/dist/components/jogging/JoggingStore.d.ts +382 -40
- package/dist/components/jogging/gizmo/JoggingGizmo.d.ts +53 -0
- package/dist/components/jogging/gizmo/JoggingGizmoOrientation.d.ts +26 -0
- package/dist/components/jogging/gizmo/RotationHandles.d.ts +7 -0
- package/dist/components/jogging/gizmo/RotationScene.d.ts +6 -0
- package/dist/components/jogging/gizmo/TranslationHandles.d.ts +6 -0
- package/dist/components/jogging/gizmo/TranslationScene.d.ts +6 -0
- package/dist/components/jogging/gizmo/arcGrabAreas.d.ts +58 -0
- package/dist/components/jogging/gizmo/arcs.d.ts +54 -0
- package/dist/components/jogging/gizmo/arrows.d.ts +63 -0
- package/dist/components/jogging/gizmo/gizmoShared.d.ts +135 -0
- package/dist/components/jogging/gizmo/gizmoView.d.ts +42 -0
- package/dist/components/jogging/gizmo/useGizmoTurn.d.ts +11 -0
- package/dist/components/jogging/holdSafety.d.ts +82 -0
- package/dist/components/jogging/jogError.d.ts +9 -0
- package/dist/components/jogging/jogHandle.d.ts +23 -0
- package/dist/components/jogging/joggingColors.d.ts +30 -0
- package/dist/components/jogging/joggingVelocity.d.ts +21 -0
- package/dist/components/jogging/joint/JoggingJointSlider.d.ts +56 -0
- package/dist/components/jogging/joint/JointSliderTrack.d.ts +27 -0
- package/dist/components/jogging/joint/jointJog.d.ts +55 -0
- package/dist/components/jogging/joint/useJointJogHold.d.ts +43 -0
- package/dist/components/jogging/useHold.d.ts +42 -0
- package/dist/components/jogging/useJogControls.d.ts +44 -0
- package/dist/components/robotControl/PanelSelect.d.ts +13 -0
- package/dist/components/robotControl/SmallSelect.d.ts +15 -0
- package/dist/components/robotControl/poseText.d.ts +43 -0
- package/dist/components/robotControl/robotControlTypes.d.ts +36 -0
- package/dist/components/robotControl/useCopyText.d.ts +12 -0
- package/dist/components/robotControl/useEveryFrame.d.ts +6 -0
- package/dist/components/robots/GenericRobot.d.ts +2 -1
- package/dist/components/robots/LinearAxis.d.ts +1 -1
- package/dist/components/robots/LinearAxisAnimator.d.ts +11 -2
- package/dist/components/robots/Robot.d.ts +1 -1
- package/dist/components/robots/robotModelLogic.d.ts +11 -9
- package/dist/components/utils/converters.d.ts +0 -2
- package/dist/components/utils/hooks.d.ts +1 -6
- package/dist/components/utils/json.d.ts +4 -0
- package/dist/components/utils/useSmoothedMotionState.d.ts +11 -2
- package/dist/components/utils/useWebGLRenderer.d.ts +32 -0
- package/dist/components/utils/webglSupport.d.ts +11 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +28 -20
- package/dist/core.js +57 -54
- package/dist/index.cjs +1 -1
- package/dist/index.js +73 -70
- package/dist/lib/ConnectedMotionGroup.d.ts +9 -8
- package/dist/lib/ControllerStateStream.d.ts +125 -0
- package/dist/lib/JoggerConnection.d.ts +172 -27
- package/dist/lib/MotionStreamConnection.d.ts +16 -6
- package/dist/lib/Pose3.d.ts +22 -0
- package/dist/lib/PoseTransformer.d.ts +44 -0
- package/dist/lib/TrajectoryExecutionStore.d.ts +260 -0
- package/dist/lib/connectionLogger.d.ts +9 -0
- package/dist/lib/controllerStateSource.d.ts +38 -0
- package/dist/lib/incrementalCartesianMotion.d.ts +40 -0
- package/dist/lib/motionGroupModelResources.d.ts +1 -0
- package/dist/lib/motionStateUpdate.d.ts +44 -0
- package/dist/lib/nats/natsControllerStateSource.d.ts +27 -0
- package/dist/lib/novaConnection.d.ts +23 -0
- package/dist/lib/planErrorTranslation.d.ts +8 -0
- package/dist/lib/poseMath.d.ts +51 -0
- package/dist/lib/robotSession/RobotActivation.d.ts +90 -0
- package/dist/lib/robotSession/RobotDescription.d.ts +84 -0
- package/dist/lib/robotSession/RobotLiveState.d.ts +65 -0
- package/dist/lib/robotSession/RobotLoadProgress.d.ts +72 -0
- package/dist/lib/robotSession/RobotSafety.d.ts +59 -0
- package/dist/lib/robotSession/RobotSession.d.ts +117 -0
- package/dist/lib/robotSession/RobotTargetPose.d.ts +116 -0
- package/dist/lib/robotSession/loadRobotResources.d.ts +46 -0
- package/dist/lib/robotSession/loadRobotSession.d.ts +81 -0
- package/dist/lib/robotSession/robotPose.d.ts +27 -0
- package/dist/lib/rotation.d.ts +12 -0
- package/dist/nats.cjs +1 -0
- package/dist/nats.d.ts +4 -0
- package/dist/nats.js +131 -0
- package/dist/session.cjs +1 -0
- package/dist/session.d.ts +22 -0
- package/dist/session.js +33 -0
- package/package.json +68 -66
- package/dist/Setup.d.ts +0 -11
- package/dist/chunks/MotionGroupVisualizer-DshWR1wY.js +0 -1653
- package/dist/chunks/MotionGroupVisualizer-eD7yFEcF.cjs +0 -1
- package/dist/chunks/SafetyBar-DPrv_OQA.cjs +0 -1
- package/dist/chunks/externalizeComponent-OO4jcrz5.cjs +0 -2
- package/dist/chunks/theming-DfSy4-Ic.cjs +0 -4
- package/dist/chunks/theming-mF9Rt8SS.js +0 -5542
- package/dist/chunks/useSmoothedMotionState-DyDgSVYX.js +0 -478
- package/dist/chunks/useSmoothedMotionState-VYxEIyfr.cjs +0 -1
- package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +0 -11
- package/dist/components/AdornedTextField.d.ts +0 -7
- package/dist/components/CopyableText.d.ts +0 -6
- package/dist/components/CycleTimer/CycleTimer.d.ts +0 -3
- package/dist/components/CycleTimer/DefaultVariant.d.ts +0 -9
- package/dist/components/CycleTimer/SmallVariant.d.ts +0 -10
- package/dist/components/CycleTimer/index.d.ts +0 -27
- package/dist/components/CycleTimer/types.d.ts +0 -49
- package/dist/components/CycleTimer/useAnimations.d.ts +0 -14
- package/dist/components/CycleTimer/useTimerLogic.d.ts +0 -24
- package/dist/components/CycleTimer/utils.d.ts +0 -21
- package/dist/components/CycleTimer.d.ts +0 -3
- package/dist/components/DataGrid.d.ts +0 -66
- package/dist/components/LogPanel.d.ts +0 -38
- package/dist/components/LogStore.d.ts +0 -12
- package/dist/components/LogViewer.d.ts +0 -46
- package/dist/components/ProgramControl.d.ts +0 -55
- package/dist/components/ProgramStateIndicator.d.ts +0 -26
- package/dist/components/RobotCard.d.ts +0 -98
- package/dist/components/RobotListItem.d.ts +0 -34
- package/dist/components/RobotSetupReadinessIndicator.d.ts +0 -37
- package/dist/components/SelectableFab.d.ts +0 -7
- package/dist/components/TabBar.d.ts +0 -45
- package/dist/components/ThemeSelect.d.ts +0 -6
- package/dist/components/Timer/Timer.d.ts +0 -3
- package/dist/components/Timer/TimerDefaultVariant.d.ts +0 -9
- package/dist/components/Timer/TimerSmallVariant.d.ts +0 -10
- package/dist/components/Timer/index.d.ts +0 -19
- package/dist/components/Timer/types.d.ts +0 -35
- package/dist/components/Timer/useTimerAnimations.d.ts +0 -10
- package/dist/components/Timer/useTimerLogic.d.ts +0 -19
- package/dist/components/Timer/utils.d.ts +0 -17
- package/dist/components/Timer.d.ts +0 -3
- package/dist/components/TransparentOverlay.d.ts +0 -4
- package/dist/components/jogging/JoggingFreedriveTab.d.ts +0 -1
- package/dist/components/jogging/PoseCartesianValues.d.ts +0 -9
- package/dist/components/jogging/PoseJointValues.d.ts +0 -8
- package/dist/components/robots/AxisConfig.d.ts +0 -2
- package/dist/components/robots/manufacturerHomePositions.d.ts +0 -20
- package/dist/icons/DropdownArrowIcon.d.ts +0 -2
- package/dist/icons/index.d.ts +0 -12
- package/dist/lib/novaCompat.d.ts +0 -16
- package/dist/themes/createDarkTheme.d.ts +0 -7
- package/dist/themes/themeTypes.d.ts +0 -40
- package/dist/themes/theming.d.ts +0 -24
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
import { Quaternion } from "three";
|
|
3
|
+
import { type WebGLUnavailableContext } from "../../utils/useWebGLRenderer";
|
|
4
|
+
import { type JogControlsProps } from "../useJogControls";
|
|
5
|
+
/**
|
|
6
|
+
* Props of {@link JoggingGizmo}
|
|
7
|
+
*/
|
|
8
|
+
export type JoggingGizmoProps = JogControlsProps & {
|
|
9
|
+
/**
|
|
10
|
+
* NOVA's axes as the camera of the app's 3D view sees them, read every
|
|
11
|
+
* animation frame. Fill it with a {@link JoggingGizmoOrientation} inside
|
|
12
|
+
* the app's 3D scene. Start it empty (`useRef<Quaternion | null>(null)`):
|
|
13
|
+
* until a first orientation arrives, the gizmo stays disabled rather than
|
|
14
|
+
* point its arrows a way the 3D view does not.
|
|
15
|
+
*/
|
|
16
|
+
orientation: RefObject<Quaternion | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Orientation of the frame the handles jog along, in NOVA's coordinates
|
|
19
|
+
* (those of the group that {@link JoggingGizmoOrientation} sits in).
|
|
20
|
+
* Defaults to NOVA's world frame.
|
|
21
|
+
*
|
|
22
|
+
* A frame that turns, such as the tool's, can be a function: the gizmo
|
|
23
|
+
* calls it every animation frame, so it turns with the tool without
|
|
24
|
+
* re-rendering React.
|
|
25
|
+
*/
|
|
26
|
+
frameQuaternion?: Quaternion | (() => Quaternion);
|
|
27
|
+
/** Side of the square the gizmo takes, in px. Defaults to 200. */
|
|
28
|
+
size?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Called when the browser cannot draw the gizmo (no WebGL), which then
|
|
31
|
+
* says so instead of offering handles nobody sees: jog with
|
|
32
|
+
* `JoggingButtons` then
|
|
33
|
+
*/
|
|
34
|
+
onWebGLUnavailable?: (context: WebGLUnavailableContext) => void;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Jogging by a gizmo drawn in the jog frame's axes as the camera sees them:
|
|
38
|
+
* the handle that points right on screen moves the robot right on screen, and
|
|
39
|
+
* orbiting the scene turns the gizmo with it.
|
|
40
|
+
*
|
|
41
|
+
* `motion` picks the handles. To translate, each axis is an arrow with a
|
|
42
|
+
* handle per direction, grabbed anywhere along its half of the axis. To rotate, each axis has a circle
|
|
43
|
+
* about it with an arc per direction, whose arrowhead shows the way it
|
|
44
|
+
* turns, grabbed anywhere along the arc. A handle is held to jog: the jog
|
|
45
|
+
* stops when the pointer is let go, or leaves the handle (its bar, or its
|
|
46
|
+
* band and arrowhead).
|
|
47
|
+
*
|
|
48
|
+
* The gizmo is drawn in 3D; the handles are laid over it as buttons, so
|
|
49
|
+
* assistive technology and tests find a handle by its name. The keyboard
|
|
50
|
+
* reaches a handle, but does not jog: only a pointer holds one. It draws
|
|
51
|
+
* only when it turns or its state changes, not every frame.
|
|
52
|
+
*/
|
|
53
|
+
export declare const JoggingGizmo: ({ orientation, frameQuaternion, motion, onJogStart, onJogStop, activeHandle, disabled: disabledByApp, size, onWebGLUnavailable, }: JoggingGizmoProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
|
+
import { Quaternion } from "three";
|
|
3
|
+
/**
|
|
4
|
+
* Props of {@link JoggingGizmoOrientation}
|
|
5
|
+
*/
|
|
6
|
+
export type JoggingGizmoOrientationProps = {
|
|
7
|
+
/**
|
|
8
|
+
* Receives NOVA's axes as the camera sees them; pass the same ref to the
|
|
9
|
+
* gizmo as its `orientation`. It may start empty (`null`).
|
|
10
|
+
*/
|
|
11
|
+
target: RefObject<Quaternion | null>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Goes anywhere inside the app's 3D scene and tells a {@link JoggingGizmo}
|
|
15
|
+
* how NOVA's axes look from the scene's camera, every frame the scene
|
|
16
|
+
* renders. The gizmo turns them on to its own jog frame (`frameQuaternion`).
|
|
17
|
+
* Writes into `target` instead of setting state, so orbiting does not
|
|
18
|
+
* re-render React.
|
|
19
|
+
*
|
|
20
|
+
* It follows the camera's up. In a scene that is Y up, like that of this
|
|
21
|
+
* library's robots, it translates NOVA's axes (Z up): NOVA's Z is the
|
|
22
|
+
* scene's Y. In a scene that is Z up like NOVA's world, whose camera has Z
|
|
23
|
+
* up, it takes NOVA's axes as they are. Where it sits in the scene does not
|
|
24
|
+
* matter.
|
|
25
|
+
*/
|
|
26
|
+
export declare function JoggingGizmoOrientation({ target, }: JoggingGizmoOrientationProps): null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type GizmoHandlesProps } from "./gizmoShared";
|
|
2
|
+
/**
|
|
3
|
+
* The rotation handles: a round button on each arrowhead, which names the
|
|
4
|
+
* handle and takes the keyboard's focus, and a band along its arc, so it can
|
|
5
|
+
* be grabbed anywhere along it
|
|
6
|
+
*/
|
|
7
|
+
export declare function RotationHandles(props: GizmoHandlesProps): import("react/jsx-runtime").JSX.Element[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type GizmoSceneProps } from "./gizmoShared";
|
|
2
|
+
/**
|
|
3
|
+
* The rotation gizmo's arcs, turned by `orientation` whenever it turns. Also
|
|
4
|
+
* lays the grab bands and arrowhead circles over them.
|
|
5
|
+
*/
|
|
6
|
+
export declare function RotationScene({ orientation, lit, disabled, size, radius, overlay, }: GizmoSceneProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type GizmoHandlesProps } from "./gizmoShared";
|
|
2
|
+
/**
|
|
3
|
+
* The translation handles: a button per direction, a bar along its half of
|
|
4
|
+
* the axis, so it can be grabbed anywhere along it. And the axis labels.
|
|
5
|
+
*/
|
|
6
|
+
export declare function TranslationHandles(props: GizmoHandlesProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type GizmoSceneProps } from "./gizmoShared";
|
|
2
|
+
/**
|
|
3
|
+
* The translation gizmo's arrows, turned by `orientation` whenever it turns.
|
|
4
|
+
* Also lays the grab bars and labels over them.
|
|
5
|
+
*/
|
|
6
|
+
export declare function TranslationScene({ orientation, lit, disabled, size, radius, overlay, }: GizmoSceneProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ProjectedJogArc } from "./arcs";
|
|
2
|
+
/** The px measures that {@link arcGrabAreasOf} lays the grab areas out by */
|
|
3
|
+
export type JogArcGrabSizes = {
|
|
4
|
+
/** Px per gizmo radius */
|
|
5
|
+
radiusPx: number;
|
|
6
|
+
/** Width of the band along an arc, and diameter of its arrowhead's circle */
|
|
7
|
+
gripPx: number;
|
|
8
|
+
/** How far the band reaches past both ends of the arc as drawn */
|
|
9
|
+
beyondTipPx: number;
|
|
10
|
+
/** Length of an arrowhead, in gizmo radii: it reaches half of it past the arc */
|
|
11
|
+
headLength: number;
|
|
12
|
+
};
|
|
13
|
+
/** Where a rotation handle can be grabbed: a band along its arc and a circle on its arrowhead */
|
|
14
|
+
export type JogArcGrabArea = {
|
|
15
|
+
/**
|
|
16
|
+
* The whole band, as a polygon in px from the gizmo center, y pointing
|
|
17
|
+
* down: where the handle shows as hovered or held
|
|
18
|
+
*/
|
|
19
|
+
band: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}[];
|
|
23
|
+
/**
|
|
24
|
+
* The band in its two halves, which take the presses, each with a layer of
|
|
25
|
+
* its own: the X and Y arcs of a direction meet halfway, right above or
|
|
26
|
+
* below the center, and which of them is nearer flips there
|
|
27
|
+
*/
|
|
28
|
+
halves: {
|
|
29
|
+
polygon: {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
}[];
|
|
33
|
+
layer: number;
|
|
34
|
+
}[];
|
|
35
|
+
/** Center of the arrowhead's circle, in px from the gizmo center */
|
|
36
|
+
head: {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
};
|
|
40
|
+
/** Where grab areas overlap, the one with the higher layer is on top */
|
|
41
|
+
headLayer: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Where each of `arcs` can be grabbed, in the same order: a band along the
|
|
45
|
+
* arc, from its start to past its arrowhead, and a circle on the arrowhead.
|
|
46
|
+
* `null` where a press could not tell which way the handle turns. So a press
|
|
47
|
+
* turns the way the arc drawn there points, never another one:
|
|
48
|
+
*
|
|
49
|
+
* - An axis seen (almost) edge on, where the near and far sides of its circle
|
|
50
|
+
* lie within a grip of each other, draws its arcs over each other with
|
|
51
|
+
* their arrowheads pointing the same way: neither is grabbed.
|
|
52
|
+
* - Where two arcs come within a grip of each other, the one drawn nearer
|
|
53
|
+
* there lies on top.
|
|
54
|
+
* - An arrowhead is the obvious thing to grab: its circle lies above every
|
|
55
|
+
* band, also where another arc passes over it. Of two arrowheads drawn
|
|
56
|
+
* over each other, the nearer lies on top.
|
|
57
|
+
*/
|
|
58
|
+
export declare function arcGrabAreasOf(arcs: readonly ProjectedJogArc[], { radiusPx, gripPx, beyondTipPx, headLength }: JogArcGrabSizes): (JogArcGrabArea | null)[];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Quaternion, Vector3 } from "three";
|
|
2
|
+
import { type JogAxis, type JogDirection } from "../jogHandle";
|
|
3
|
+
/** Radius of the circles, in gizmo radii: an arrow of the translation gizmo is 1 long */
|
|
4
|
+
export declare const ARC_RADIUS = 0.8;
|
|
5
|
+
/** Where the + arc starts on its circle, in radians */
|
|
6
|
+
export declare const ARC_START = 0.45;
|
|
7
|
+
/** How far an arc reaches around its circle, in radians */
|
|
8
|
+
export declare const ARC_SWEEP = 2.25;
|
|
9
|
+
/**
|
|
10
|
+
* The plane of each axis's circle: angle 0 lies along the first vector, a
|
|
11
|
+
* quarter turn along the second. Their cross product is the axis, so a
|
|
12
|
+
* growing angle turns the positive way about it (right-hand rule).
|
|
13
|
+
*/
|
|
14
|
+
export declare const ARC_BASIS: Record<JogAxis, readonly [Vector3, Vector3]>;
|
|
15
|
+
/**
|
|
16
|
+
* Where the arc of `direction` starts and ends on its circle, and where its
|
|
17
|
+
* arrowhead sits, in radians. The − arc is the + arc half a turn on, with its
|
|
18
|
+
* arrowhead at its start, pointing back: the two arrowheads sit beside each
|
|
19
|
+
* other and point apart.
|
|
20
|
+
*/
|
|
21
|
+
export declare function arcAngles(direction: JogDirection): {
|
|
22
|
+
start: number;
|
|
23
|
+
end: number;
|
|
24
|
+
head: number;
|
|
25
|
+
};
|
|
26
|
+
/** A rotation handle's arc where the gizmo draws it */
|
|
27
|
+
export type ProjectedJogArc = {
|
|
28
|
+
axis: JogAxis;
|
|
29
|
+
direction: JogDirection;
|
|
30
|
+
/**
|
|
31
|
+
* Points along the arc from its start to its end: in gizmo radii from the
|
|
32
|
+
* center, y pointing down as on screen, depth toward the viewer
|
|
33
|
+
*/
|
|
34
|
+
points: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
depth: number;
|
|
38
|
+
}[];
|
|
39
|
+
/** The arrowhead, and the way it points on screen (a unit vector, or 0 when it points at the viewer) */
|
|
40
|
+
head: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
depth: number;
|
|
44
|
+
dx: number;
|
|
45
|
+
dy: number;
|
|
46
|
+
};
|
|
47
|
+
/** How open the circle looks: 1 seen face on, 0 edge on */
|
|
48
|
+
openness: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Where the arcs of a gizmo turned by `frameInCamera` appear, each with
|
|
52
|
+
* `samples` + 1 points
|
|
53
|
+
*/
|
|
54
|
+
export declare function projectJogArcs(frameInCamera: Quaternion, samples?: number): ProjectedJogArc[];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Quaternion } from "three";
|
|
2
|
+
import { type JogAxis, type JogDirection } from "../jogHandle";
|
|
3
|
+
/** A jog handle where the gizmo draws it */
|
|
4
|
+
export type ProjectedJogHandle = {
|
|
5
|
+
axis: JogAxis;
|
|
6
|
+
direction: JogDirection;
|
|
7
|
+
/** Screen position of the arrow tip, in gizmo radii from the center */
|
|
8
|
+
x: number;
|
|
9
|
+
/** Like `x`, pointing down as on screen */
|
|
10
|
+
y: number;
|
|
11
|
+
/** Toward the viewer is positive; nearer handles are drawn on top */
|
|
12
|
+
depth: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Where the six handles of a gizmo turned by `frameInCamera` appear. three.js
|
|
16
|
+
* cameras look down −Z with +Y up, so a view-space vector lands on screen at
|
|
17
|
+
* (x, −y); z only decides what is in front.
|
|
18
|
+
*/
|
|
19
|
+
export declare function projectJogHandles(frameInCamera: Quaternion): ProjectedJogHandle[];
|
|
20
|
+
/** Where a handle can be grabbed: a bar along its arrow */
|
|
21
|
+
export type JogGrabArea = {
|
|
22
|
+
/** Start of the bar, in px from the gizmo center, y pointing down */
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
/** Length of the bar in px */
|
|
26
|
+
length: number;
|
|
27
|
+
/** Direction of the bar on screen, in radians, y pointing down */
|
|
28
|
+
angle: number;
|
|
29
|
+
/** Where two bars overlap, the one with the higher layer is on top */
|
|
30
|
+
layer: number;
|
|
31
|
+
};
|
|
32
|
+
/** The px measures that {@link grabAreasOf} lays the grab areas out by */
|
|
33
|
+
export type JogGrabSizes = {
|
|
34
|
+
/** Px per gizmo radius: the length on screen of an arrow across the screen */
|
|
35
|
+
radiusPx: number;
|
|
36
|
+
/** Thickness of a grab bar */
|
|
37
|
+
gripPx: number;
|
|
38
|
+
/** The center, which no handle owns, reaches this far out */
|
|
39
|
+
innerPx: number;
|
|
40
|
+
/** How far a bar reaches past its arrow's tip */
|
|
41
|
+
beyondTipPx: number;
|
|
42
|
+
/** An arrow shorter than this on screen points too nearly at or away from the viewer to grab */
|
|
43
|
+
minTipPx: number;
|
|
44
|
+
/** The arrowhead's share of an arrow's length */
|
|
45
|
+
headLength: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Where each of `handles` can be grabbed, in the same order: a bar along its
|
|
49
|
+
* arrow, from beside the center to past the tip, or `null` where a press
|
|
50
|
+
* could not tell it from another handle. So a press jogs along the arrow that
|
|
51
|
+
* is drawn there, never along another one:
|
|
52
|
+
*
|
|
53
|
+
* - The center belongs to no handle, and no bar reaches across it.
|
|
54
|
+
* - An arrow shorter than `minTipPx` on screen points (almost) at or away
|
|
55
|
+
* from the viewer, where its two halves look the same: neither is grabbed.
|
|
56
|
+
* - Two arrows that point the same way on screen share the line: the shorter
|
|
57
|
+
* bar ends and the longer begins halfway between the shorter tip and the
|
|
58
|
+
* longer arrowhead, so each arrowhead stays on its own bar. Where the two
|
|
59
|
+
* arrowheads are drawn over each other, only the nearer is grabbed.
|
|
60
|
+
* - Where bars still overlap, close to the center, the nearer handle is on
|
|
61
|
+
* top.
|
|
62
|
+
*/
|
|
63
|
+
export declare function grabAreasOf(handles: readonly ProjectedJogHandle[], sizes: JogGrabSizes): (JogGrabArea | null)[];
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { type Theme } from "@mui/material/styles";
|
|
2
|
+
import type { PointerEvent, RefObject } from "react";
|
|
3
|
+
import { type Quaternion, Vector3 } from "three";
|
|
4
|
+
import { type JogAxis, type JogHandle } from "../jogHandle";
|
|
5
|
+
import type { useJogControls } from "../useJogControls";
|
|
6
|
+
import type { JogArcGrabSizes } from "./arcGrabAreas";
|
|
7
|
+
import type { JogGrabSizes } from "./arrows";
|
|
8
|
+
export declare const UP: Vector3;
|
|
9
|
+
/** Length of an arrowhead, in gizmo radii: an arrow is 1 long */
|
|
10
|
+
export declare const ARROW_HEAD_LENGTH = 0.26;
|
|
11
|
+
/** Radius of an arrowhead's base, in gizmo radii */
|
|
12
|
+
export declare const ARROW_HEAD_RADIUS = 0.1;
|
|
13
|
+
/**
|
|
14
|
+
* The color of an axis: the button color of that axis in the cartesian
|
|
15
|
+
* jogging tab, so a gizmo and the jog buttons always agree
|
|
16
|
+
*/
|
|
17
|
+
export declare function axisColor(axis: JogAxis): string;
|
|
18
|
+
/**
|
|
19
|
+
* The px measures of a gizmo `size` px wide, in proportion to it, so that a
|
|
20
|
+
* small gizmo looks like a large one, only smaller: the halo of a held or
|
|
21
|
+
* hovered handle, its grab bar and the room around the gizmo
|
|
22
|
+
*/
|
|
23
|
+
export declare function gizmoMeasures(size: number): {
|
|
24
|
+
/** Room around the gizmo for the labels, arrowheads and grab bars */
|
|
25
|
+
marginPx: number;
|
|
26
|
+
/** Thickness of a handle's grab bar, which shows as its halo */
|
|
27
|
+
gripPx: number;
|
|
28
|
+
grab: {
|
|
29
|
+
innerPx: number;
|
|
30
|
+
beyondTipPx: number;
|
|
31
|
+
minTipPx: number;
|
|
32
|
+
};
|
|
33
|
+
/** The axis labels, which stay readable on a small gizmo */
|
|
34
|
+
labelFontPx: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The gizmo radius, in px, that fits a `width` × `height` canvas whichever
|
|
38
|
+
* way the gizmo is turned, keeping `marginPx` free for the labels and grab
|
|
39
|
+
* areas around the tips. At least 1, so an unmeasured canvas still draws.
|
|
40
|
+
*/
|
|
41
|
+
export declare function fitGizmoRadiusPx(width: number, height: number, marginPx: number): number;
|
|
42
|
+
/**
|
|
43
|
+
* The measures that the grab areas of a gizmo `size` px wide are laid out
|
|
44
|
+
* by, with `radiusPx` px per gizmo radius
|
|
45
|
+
*/
|
|
46
|
+
export declare function gizmoGrabSizes(size: number, radiusPx: number): JogGrabSizes;
|
|
47
|
+
/**
|
|
48
|
+
* The measures that the grab areas of the rotation arcs of a gizmo `size` px
|
|
49
|
+
* wide are laid out by, with `radiusPx` px per gizmo radius
|
|
50
|
+
*/
|
|
51
|
+
export declare function gizmoArcGrabSizes(size: number, radiusPx: number): JogArcGrabSizes;
|
|
52
|
+
/**
|
|
53
|
+
* The elements laid over the gizmo, by key. The 3D scene places them every
|
|
54
|
+
* frame the gizmo turns, directly, so that orbiting does not re-render React.
|
|
55
|
+
*/
|
|
56
|
+
export type GizmoOverlay = Map<string, Element>;
|
|
57
|
+
/** A ref callback that registers an overlay element under `key` */
|
|
58
|
+
export declare function overlayRef(overlay: RefObject<GizmoOverlay>, key: string): (node: Element | null) => void;
|
|
59
|
+
export declare const handleKey: (handle: JogHandle) => string;
|
|
60
|
+
export declare const labelKey: (axis: JogAxis) => string;
|
|
61
|
+
/** A band takes presses in two halves: see JogArcGrabArea */
|
|
62
|
+
export declare const HALVES: readonly [0, 1];
|
|
63
|
+
export declare const halfKey: (handle: JogHandle, half: number) => string;
|
|
64
|
+
export declare const haloKey: (handle: JogHandle) => string;
|
|
65
|
+
export declare const focusKey: (handle: JogHandle) => string;
|
|
66
|
+
/** A clip path that shows nothing and takes no press */
|
|
67
|
+
export declare const NOWHERE = "polygon(0 0, 0 0, 0 0)";
|
|
68
|
+
/** What the 3D half of a gizmo (inside the canvas) gets */
|
|
69
|
+
export type GizmoSceneProps = {
|
|
70
|
+
orientation: RefObject<Quaternion | null>;
|
|
71
|
+
/** The handle to draw highlighted: held, active or hovered */
|
|
72
|
+
lit: JogHandle | null;
|
|
73
|
+
disabled: boolean;
|
|
74
|
+
/** Side of the gizmo, in px */
|
|
75
|
+
size: number;
|
|
76
|
+
/** Px per gizmo unit */
|
|
77
|
+
radius: number;
|
|
78
|
+
overlay: RefObject<GizmoOverlay>;
|
|
79
|
+
};
|
|
80
|
+
/** What the handle half of a gizmo (laid over the canvas) gets */
|
|
81
|
+
export type GizmoHandlesProps = {
|
|
82
|
+
/** Whether a handle shows as pressed: held or shown as active */
|
|
83
|
+
isPressed: (handle: JogHandle) => boolean;
|
|
84
|
+
/** The handle the pointer is over */
|
|
85
|
+
hovered: JogHandle | null;
|
|
86
|
+
disabled: boolean;
|
|
87
|
+
size: number;
|
|
88
|
+
onHover: (handle: JogHandle | null) => void;
|
|
89
|
+
handlersFor: ReturnType<typeof useJogControls>["handlersFor"];
|
|
90
|
+
/** The accessible name of a handle, e.g. "Jog X+" */
|
|
91
|
+
label: (handle: JogHandle) => string;
|
|
92
|
+
overlay: RefObject<GizmoOverlay>;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* How a handle shows: pressed while it is held or shown as active, lit
|
|
96
|
+
* (highlighted) while it is pressed or hovered
|
|
97
|
+
*/
|
|
98
|
+
export declare function handleState(handle: JogHandle, { isPressed, hovered, disabled, }: Pick<GizmoHandlesProps, "isPressed" | "hovered" | "disabled">): {
|
|
99
|
+
pressed: boolean;
|
|
100
|
+
lit: boolean;
|
|
101
|
+
};
|
|
102
|
+
/** The highlight of a handle's grab area, stronger while it is pressed */
|
|
103
|
+
export declare function highlightOf(color: string, { pressed, lit }: ReturnType<typeof handleState>): string;
|
|
104
|
+
/**
|
|
105
|
+
* What each element that grabs a handle gets: hover, and press and hold.
|
|
106
|
+
* The hold goes on while the pointer is on any element of the handle's grab
|
|
107
|
+
* area, e.g. along its band and on to its arrowhead, and ends when the
|
|
108
|
+
* pointer has left them all: a press there would no longer reach the handle.
|
|
109
|
+
*
|
|
110
|
+
* That is asked when the pointer moves. The gizmo can also turn under a
|
|
111
|
+
* pointer that keeps still: jogging about the axes of the tool turns its
|
|
112
|
+
* frame. The hold then ends when the pointer next moves and the handle is
|
|
113
|
+
* no longer under it, or earlier where the browser itself looks again at
|
|
114
|
+
* what lies under the pointer: WebKit sends the pointer's leave as soon as
|
|
115
|
+
* the handle has turned away, Chromium waits for a move.
|
|
116
|
+
*/
|
|
117
|
+
export declare function gripProps(handle: JogHandle, { onHover, handlersFor, overlay, }: Pick<GizmoHandlesProps, "onHover" | "handlersFor" | "overlay">): {
|
|
118
|
+
onPointerEnter: () => void;
|
|
119
|
+
onPointerLeave: (event: PointerEvent<Element>) => void;
|
|
120
|
+
onPointerDown: (event: PointerEvent<Element>) => void;
|
|
121
|
+
onPointerMove: (event: PointerEvent<Element>) => void;
|
|
122
|
+
onPointerUp: () => void;
|
|
123
|
+
onPointerCancel: () => void;
|
|
124
|
+
onLostPointerCapture: () => void;
|
|
125
|
+
onBlur: (_event: import("react").FocusEvent<Element>) => void;
|
|
126
|
+
onContextMenu: typeof import("../holdSafety").preventContextMenu;
|
|
127
|
+
};
|
|
128
|
+
/** The styles of each element that grabs a handle: no browser gesture on it */
|
|
129
|
+
export declare const gripStyle: (disabled: boolean) => {
|
|
130
|
+
readonly cursor: "default" | "pointer";
|
|
131
|
+
readonly touchAction: "none";
|
|
132
|
+
readonly userSelect: "none";
|
|
133
|
+
};
|
|
134
|
+
/** The keyboard's focus outline, in the theme's primary color */
|
|
135
|
+
export declare const focusOutline: (theme: Theme) => string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Object3D, Quaternion, Vector3 } from "three";
|
|
2
|
+
import type { JogAxis } from "../jogHandle";
|
|
3
|
+
/** The unit vector along each axis */
|
|
4
|
+
export declare const UNIT_VECTOR: Record<JogAxis, Vector3>;
|
|
5
|
+
/**
|
|
6
|
+
* The jog frame as the camera sees it, `camera⁻¹ · frame`: what turns the
|
|
7
|
+
* gizmo so that the handle pointing right on screen moves the robot right on
|
|
8
|
+
* screen.
|
|
9
|
+
*
|
|
10
|
+
* Both are world orientations, so this works whichever axis is up in the
|
|
11
|
+
* scene.
|
|
12
|
+
*/
|
|
13
|
+
export declare function jogFrameInCamera(cameraWorldQuaternion: Quaternion, frameWorldQuaternion: Quaternion, target?: Quaternion): Quaternion;
|
|
14
|
+
/**
|
|
15
|
+
* The dictionary from NOVA's axes to the 3D scene's: NOVA has Z up, the
|
|
16
|
+
* scene (as that of this library's robots) Y up. NOVA's X is the scene's X,
|
|
17
|
+
* its Y the scene's -Z, its Z the scene's Y. The teaching app's gizmo uses
|
|
18
|
+
* the same table.
|
|
19
|
+
*/
|
|
20
|
+
export declare const NOVA_AXES_IN_SCENE: Quaternion;
|
|
21
|
+
/**
|
|
22
|
+
* NOVA's axes in the 3D scene of `camera`, by which way its camera has up. A
|
|
23
|
+
* scene that is Z up like NOVA's world (e.g. RobotPad's, whose camera's up is
|
|
24
|
+
* Z) has NOVA's axes as they are. A scene that is Y up (this library's
|
|
25
|
+
* robots, the teaching app) needs the dictionary.
|
|
26
|
+
*/
|
|
27
|
+
export declare function novaAxesInScene(camera: Object3D): Quaternion;
|
|
28
|
+
/** NOVA's axes as `camera` sees them */
|
|
29
|
+
export declare function novaAxesSeenBy(camera: Object3D, target?: Quaternion): Quaternion;
|
|
30
|
+
/**
|
|
31
|
+
* The jog frame as the camera sees it: `view`, NOVA's axes as the camera
|
|
32
|
+
* sees them (see {@link novaAxesSeenBy}), turned by `frame`, the jog frame
|
|
33
|
+
* in NOVA's coordinates
|
|
34
|
+
*/
|
|
35
|
+
export declare function jogFrameInView(view: Quaternion, frame: Quaternion, target?: Quaternion): Quaternion;
|
|
36
|
+
/**
|
|
37
|
+
* Whether `next` is a different rotation from `previous`, so the gizmo has to
|
|
38
|
+
* be drawn anew. A camera orientation computed afresh each frame differs in
|
|
39
|
+
* its last digits without turning, and a quaternion and its negation are the
|
|
40
|
+
* same rotation, so this compares rotations, not numbers.
|
|
41
|
+
*/
|
|
42
|
+
export declare function hasTurned(previous: Quaternion | null, next: Quaternion): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
import type { Group, Quaternion } from "three";
|
|
3
|
+
/**
|
|
4
|
+
* Turns `group` with `orientation`, and has `place` lay the handles over it,
|
|
5
|
+
* whenever it turns. `place` returns whether it found every handle to place.
|
|
6
|
+
*
|
|
7
|
+
* The canvas draws on demand. Looking for a turn every animation frame costs
|
|
8
|
+
* a comparison of two rotations; drawing happens only after a turn or a new
|
|
9
|
+
* `layout` (e.g. a new size), and again until every handle is placed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useGizmoTurn(orientation: RefObject<Quaternion | null>, group: RefObject<Group | null>, place: (orientation: Quaternion) => boolean, layout: string): void;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a pointer press may start a hold: the primary button, and no Ctrl.
|
|
3
|
+
* On macOS a Ctrl+click is a primary press that opens the context menu, and
|
|
4
|
+
* the menu swallows the release.
|
|
5
|
+
*/
|
|
6
|
+
export declare function startsPointerHold(event: {
|
|
7
|
+
button: number;
|
|
8
|
+
ctrlKey: boolean;
|
|
9
|
+
}): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a key press ends a running hold: any new press does, as a key can
|
|
12
|
+
* take the pointer's release away (Cmd, on macOS). Only the auto-repeat of a
|
|
13
|
+
* key that was down before goes on. See {@link useEndHoldWhenUnattended}
|
|
14
|
+
* for where the keys are listened for.
|
|
15
|
+
*/
|
|
16
|
+
export declare function endsHold(event: {
|
|
17
|
+
repeat: boolean;
|
|
18
|
+
}): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether a move of the holding pointer shows that its primary button is up:
|
|
21
|
+
* its release never arrived, or it came while another button stays pressed,
|
|
22
|
+
* when the browser sends no pointerup until the last button is up
|
|
23
|
+
*/
|
|
24
|
+
export declare function primaryReleased(event: {
|
|
25
|
+
buttons: number;
|
|
26
|
+
}): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Takes the capture of a pointer that starts a hold, so that its moves and
|
|
29
|
+
* its release reach the control wherever they happen: a hold ends on a
|
|
30
|
+
* release anywhere, and {@link isPointerOn} needs the moves to see the
|
|
31
|
+
* pointer leave. A touch is captured by the browser anyway.
|
|
32
|
+
*/
|
|
33
|
+
export declare function capturePointer(element: Element, pointerId: number): void;
|
|
34
|
+
/**
|
|
35
|
+
* Gives back the capture of a pointer whose hold is over while it is still
|
|
36
|
+
* down, e.g. after it left the control: the control must not go on taking
|
|
37
|
+
* its moves, and showing as hovered
|
|
38
|
+
*/
|
|
39
|
+
export declare function releasePointer(element: Element, pointerId: number): void;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the pointer of a move is still on the control that holds it: over
|
|
42
|
+
* an element that `isControl` takes for it, by default the element that
|
|
43
|
+
* handles the move or one inside it. Leaving a control ends its hold, as
|
|
44
|
+
* letting go does.
|
|
45
|
+
*
|
|
46
|
+
* The page is asked what lies under the pointer, as for a press there. A
|
|
47
|
+
* captured pointer gets no pointerleave, and a touch is always captured, so
|
|
48
|
+
* this is what tells for a mouse, a pen and a finger alike; it also holds
|
|
49
|
+
* for a control of any shape, or one that another element covers. Where
|
|
50
|
+
* nothing can be asked (no layout, as in jsdom), the pointer counts as on.
|
|
51
|
+
*/
|
|
52
|
+
export declare function isPointerOn(event: {
|
|
53
|
+
clientX: number;
|
|
54
|
+
clientY: number;
|
|
55
|
+
currentTarget: Element;
|
|
56
|
+
}, isControl?: (element: Element) => boolean): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* As {@link isPointerOn}, for a control that is a plain box and lets the
|
|
59
|
+
* holding pointer stray a little: whether the pointer of a move is within
|
|
60
|
+
* `marginPx` of the element that handles it
|
|
61
|
+
*/
|
|
62
|
+
export declare function isPointerWithin(event: {
|
|
63
|
+
clientX: number;
|
|
64
|
+
clientY: number;
|
|
65
|
+
currentTarget: Element;
|
|
66
|
+
}, marginPx: number): boolean;
|
|
67
|
+
/** The context menu of a control would swallow the release of a hold */
|
|
68
|
+
export declare function preventContextMenu(event: {
|
|
69
|
+
preventDefault: () => void;
|
|
70
|
+
}): void;
|
|
71
|
+
/**
|
|
72
|
+
* Ends a hold that the user can no longer end at the control: when the
|
|
73
|
+
* controls become disabled or unmount, and while `holding`, when the window
|
|
74
|
+
* loses focus or the tab is hidden (a release outside the page may never
|
|
75
|
+
* reach the control), and when a key is pressed (see {@link endsHold}).
|
|
76
|
+
* `end` must be stable and do nothing when nothing is held.
|
|
77
|
+
*
|
|
78
|
+
* The keys are listened for on the window, not on the control: a press
|
|
79
|
+
* gives the focus to a button in some browsers only (not in Safari), and
|
|
80
|
+
* never to an element that takes none, e.g. the band of a gizmo handle.
|
|
81
|
+
*/
|
|
82
|
+
export declare function useEndHoldWhenUnattended(holding: boolean, disabled: boolean, end: () => void): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pulls a short, human-readable message out of the various shapes a jogger
|
|
3
|
+
* error can arrive in (raw JSON strings from the continuous jogging socket,
|
|
4
|
+
* `InitializeMovementResponse`/`StartMovementResponse`-like objects, or
|
|
5
|
+
* those wrapped in a `{ result: ... }` envelope from the trajectory socket).
|
|
6
|
+
*/
|
|
7
|
+
export declare function extractJogErrorMessage(err: unknown): string;
|
|
8
|
+
/** The translation key of a friendlier text for a raw jog error, or null */
|
|
9
|
+
export declare function getJogErrorTranslationKey(message: string): string | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An axis of a cartesian jog
|
|
3
|
+
*/
|
|
4
|
+
export type JogAxis = "x" | "y" | "z";
|
|
5
|
+
/**
|
|
6
|
+
* Which way along an axis
|
|
7
|
+
*/
|
|
8
|
+
export type JogDirection = "+" | "-";
|
|
9
|
+
/**
|
|
10
|
+
* One jog control, e.g. +X
|
|
11
|
+
*/
|
|
12
|
+
export type JogHandle = {
|
|
13
|
+
axis: JogAxis;
|
|
14
|
+
direction: JogDirection;
|
|
15
|
+
};
|
|
16
|
+
export declare const JOG_AXES: readonly JogAxis[];
|
|
17
|
+
export declare const JOG_DIRECTIONS: readonly JogDirection[];
|
|
18
|
+
export declare function isSameJogHandle(a: JogHandle | null | undefined, b: JogHandle | null | undefined): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* How a handle is named on screen, as the jog buttons name it: X+, or Rx+
|
|
21
|
+
* when it rotates about X
|
|
22
|
+
*/
|
|
23
|
+
export declare function jogHandleName(handle: JogHandle, motion?: "translate" | "rotate"): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { JogAxis } from "./jogHandle";
|
|
2
|
+
/**
|
|
3
|
+
* The `colors` of `JoggingCartesianAxisControl`
|
|
4
|
+
*
|
|
5
|
+
* @deprecated With `JoggingCartesianAxisControl`. `JoggingButtons` has the
|
|
6
|
+
* axis colors of the design system built in.
|
|
7
|
+
*/
|
|
8
|
+
export interface AxisControlComponentColors {
|
|
9
|
+
color?: string;
|
|
10
|
+
borderColor?: string;
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
buttonBackgroundColor?: {
|
|
13
|
+
default?: string;
|
|
14
|
+
pressed?: string;
|
|
15
|
+
disabled?: string;
|
|
16
|
+
hovered?: string;
|
|
17
|
+
};
|
|
18
|
+
labelColor?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Colors of the X, Y and Z axis controls of the cartesian jogging tab */
|
|
21
|
+
export declare const cartesianAxisColors: Record<"X" | "Y" | "Z", AxisControlComponentColors>;
|
|
22
|
+
/** Color of the arrows of the joint jogging controls */
|
|
23
|
+
export declare const jointArrowColor = "rgba(255, 255, 255, 1)";
|
|
24
|
+
/** Color of the velocity legend of the velocity slider */
|
|
25
|
+
export declare const velocitySliderLegendColor = "rgba(255, 255, 255, 1)";
|
|
26
|
+
/**
|
|
27
|
+
* The color of each axis in the design system: red, green and blue 400, as
|
|
28
|
+
* the axis labels of JoggingButtons show them. New jogging parts use these.
|
|
29
|
+
*/
|
|
30
|
+
export declare const jogAxisColors: Record<JogAxis, string>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OperationLimits } from "@wandelbots/nova-js/v2";
|
|
2
|
+
/**
|
|
3
|
+
* Default rotation jogging velocity in °/s, for cartesian TCP rotation and
|
|
4
|
+
* revolute joint jogging.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_ROTATION_VELOCITY_DEG_PER_SEC = 5;
|
|
7
|
+
/**
|
|
8
|
+
* Upper bound for the TCP velocity in manual reduced-speed mode (T1). ISO 10218-1
|
|
9
|
+
* limits the TCP to 250 mm/s there, and NOVA documents the same for manual mode.
|
|
10
|
+
*/
|
|
11
|
+
export declare const T1_MAX_TCP_VELOCITY_MM_PER_SEC = 250;
|
|
12
|
+
/**
|
|
13
|
+
* Default cartesian translation jogging velocity in mm/s: 10 % of the motion
|
|
14
|
+
* group's T1 max. The T1 max is the lowest valid manual TCP velocity limit the
|
|
15
|
+
* controller reports, capped at {@link T1_MAX_TCP_VELOCITY_MM_PER_SEC}, so
|
|
16
|
+
* most robots start at 25 mm/s.
|
|
17
|
+
*
|
|
18
|
+
* `manual_limits` counts alongside `manual_t1_limits` because controllers
|
|
19
|
+
* without a separate T1 mode (e.g. Yaskawa) report their reduced speed there.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getDefaultTranslationVelocityMmPerSec(operationLimits: OperationLimits | undefined): number;
|