@wandelbots/wandelbots-js-react-components 5.1.0 → 5.1.1
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/components/VelocitySlider.d.ts +2 -1
- package/dist/components/VelocitySlider.d.ts.map +1 -1
- package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingJointTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingOptions.d.ts +2 -1
- package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
- package/dist/components/jogging/JoggingStore.d.ts +8 -12
- package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
- package/dist/components/jogging/JoggingVelocitySlider.d.ts +2 -1
- package/dist/components/jogging/JoggingVelocitySlider.d.ts.map +1 -1
- package/dist/core.cjs.js +1 -1
- package/dist/core.es.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/{theming-B5Q8EK1c.cjs → theming-BgAu1ds7.cjs} +38 -38
- package/dist/{theming-B5Q8EK1c.cjs.map → theming-BgAu1ds7.cjs.map} +1 -1
- package/dist/{theming-Bt0cspr6.js → theming-DouElHKD.js} +996 -982
- package/dist/{theming-Bt0cspr6.js.map → theming-DouElHKD.js.map} +1 -1
- package/package.json +1 -1
- package/src/components/VelocitySlider.tsx +3 -2
- package/src/components/jogging/JoggingCartesianTab.tsx +10 -2
- package/src/components/jogging/JoggingJointTab.tsx +11 -2
- package/src/components/jogging/JoggingOptions.tsx +4 -4
- package/src/components/jogging/JoggingStore.ts +22 -36
- package/src/components/jogging/JoggingVelocitySlider.tsx +20 -17
package/package.json
CHANGED
|
@@ -10,9 +10,10 @@ type VelocitySliderProps = {
|
|
|
10
10
|
min: number
|
|
11
11
|
max: number
|
|
12
12
|
velocity: number
|
|
13
|
-
onVelocityChange: (newVelocity: number) => void
|
|
13
|
+
onVelocityChange: (newVelocity: number, useDegree: boolean) => void
|
|
14
14
|
disabled?: boolean
|
|
15
15
|
renderValue?: (value: number) => ReactNode
|
|
16
|
+
useDegree: boolean
|
|
16
17
|
store: JoggingStore
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -25,7 +26,7 @@ export const VelocitySlider = observer((props: VelocitySliderProps) => {
|
|
|
25
26
|
function onSliderChange(_event: Event, newVelocity: number | number[]) {
|
|
26
27
|
if (newVelocity === props.velocity || !isNumber(newVelocity)) return
|
|
27
28
|
|
|
28
|
-
props.onVelocityChange(newVelocity)
|
|
29
|
+
props.onVelocityChange(newVelocity, props.useDegree)
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
return (
|
|
@@ -194,8 +194,16 @@ export const JoggingCartesianTab = observer(
|
|
|
194
194
|
return (
|
|
195
195
|
<Stack flexGrow={1} gap={2} sx={{ padding: "18px 24px" }}>
|
|
196
196
|
<Stack gap={2}>
|
|
197
|
-
<JoggingOptions
|
|
198
|
-
|
|
197
|
+
<JoggingOptions
|
|
198
|
+
store={store}
|
|
199
|
+
useDegree={store.selectedCartesianMotionType === "rotate"}
|
|
200
|
+
/>
|
|
201
|
+
|
|
202
|
+
<JoggingVelocitySlider
|
|
203
|
+
store={store}
|
|
204
|
+
useDegree={store.selectedCartesianMotionType === "rotate"}
|
|
205
|
+
/>
|
|
206
|
+
|
|
199
207
|
<Divider />
|
|
200
208
|
</Stack>
|
|
201
209
|
|
|
@@ -37,7 +37,13 @@ export const JoggingJointTab = observer(
|
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<Stack flexGrow={1} gap={2} sx={{ padding: "18px 24px" }}>
|
|
40
|
-
<JoggingVelocitySlider
|
|
40
|
+
<JoggingVelocitySlider
|
|
41
|
+
store={store}
|
|
42
|
+
useDegree={
|
|
43
|
+
store.jointCategory === JointCategory.REVOLUTE
|
|
44
|
+
}
|
|
45
|
+
/>
|
|
46
|
+
|
|
41
47
|
<Divider />
|
|
42
48
|
|
|
43
49
|
<Stack
|
|
@@ -76,7 +82,10 @@ export const JoggingJointTab = observer(
|
|
|
76
82
|
disabled={store.isLocked}
|
|
77
83
|
lowerLimit={jointLimits?.lower_limit}
|
|
78
84
|
upperLimit={jointLimits?.upper_limit}
|
|
79
|
-
useDegree={
|
|
85
|
+
useDegree={
|
|
86
|
+
store.jointCategory === JointCategory.REVOLUTE
|
|
87
|
+
}
|
|
88
|
+
|
|
80
89
|
getValue={() => {
|
|
81
90
|
const value =
|
|
82
91
|
store.jogger.motionStream.rapidlyChangingMotionState
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
type OrientationId,
|
|
11
11
|
} from "./JoggingStore"
|
|
12
12
|
|
|
13
|
-
export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => {
|
|
13
|
+
export const JoggingOptions = observer(({ store, useDegree }: { store: JoggingStore, useDegree: boolean }) => {
|
|
14
14
|
const { t } = useTranslation()
|
|
15
15
|
const componentId = useId()
|
|
16
16
|
const joggingOptions: React.ReactElement[] = []
|
|
@@ -118,9 +118,9 @@ export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => {
|
|
|
118
118
|
? null
|
|
119
119
|
: store.discreteIncrementOptions.map((inc) => (
|
|
120
120
|
<MenuItem key={inc.id} value={inc.id}>
|
|
121
|
-
{
|
|
122
|
-
? `${inc.
|
|
123
|
-
: `${inc.
|
|
121
|
+
{useDegree
|
|
122
|
+
? `${inc.degrees}°`
|
|
123
|
+
: `${inc.mm}mm`}
|
|
124
124
|
</MenuItem>
|
|
125
125
|
))}
|
|
126
126
|
</AdornedSelect>,
|
|
@@ -46,7 +46,7 @@ export enum JointCategory {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
type TabType = "cartesian" | "joint" | "debug";
|
|
49
|
-
|
|
49
|
+
export type CartesianMotionType = "translate" | "rotate"
|
|
50
50
|
|
|
51
51
|
export class JoggingStore {
|
|
52
52
|
selectedTabId: TabType = "cartesian";
|
|
@@ -96,7 +96,7 @@ export class JoggingStore {
|
|
|
96
96
|
* When on the cartesian tab, jogging can be either translating or rotating
|
|
97
97
|
* around the TCP.
|
|
98
98
|
*/
|
|
99
|
-
selectedCartesianMotionType:
|
|
99
|
+
selectedCartesianMotionType: CartesianMotionType = "translate"
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
102
|
* If the jogger is busy running an incremental jog, this will be set
|
|
@@ -379,41 +379,26 @@ export class JoggingStore {
|
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
/** Selected velocity in mm/sec or deg/sec */
|
|
382
|
-
|
|
383
|
-
return
|
|
384
|
-
? this.
|
|
385
|
-
: this.
|
|
382
|
+
velocityInDisplayUnits(useDegree: boolean) {
|
|
383
|
+
return useDegree
|
|
384
|
+
? this.rotationVelocityDegPerSec
|
|
385
|
+
: this.translationVelocityMmPerSec
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
+
|
|
388
389
|
/** Minimum selectable velocity in mm/sec or deg/sec */
|
|
389
|
-
|
|
390
|
-
return
|
|
391
|
-
? this.
|
|
392
|
-
: this.
|
|
390
|
+
minVelocityInDisplayUnits(useDegree: boolean) {
|
|
391
|
+
return useDegree
|
|
392
|
+
? this.minRotationVelocityDegPerSec
|
|
393
|
+
: this.minTranslationVelocityMmPerSec
|
|
393
394
|
}
|
|
394
395
|
|
|
395
|
-
/** Maximum selectable velocity in mm/sec or deg/sec */
|
|
396
|
-
get maxVelocityInDisplayUnits() {
|
|
397
|
-
return this.currentMotionType === "translate"
|
|
398
|
-
? this.maxTranslationVelocityMmPerSec
|
|
399
|
-
: this.maxRotationVelocityDegPerSec
|
|
400
|
-
}
|
|
401
396
|
|
|
402
|
-
/**
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
if (
|
|
408
|
-
(
|
|
409
|
-
this.selectedTabId === "cartesian" &&
|
|
410
|
-
this.selectedCartesianMotionType === "translate"
|
|
411
|
-
) || this.jointCategory === JointCategory.PRISMATIC
|
|
412
|
-
) {
|
|
413
|
-
return "translate"
|
|
414
|
-
} else {
|
|
415
|
-
return "rotate"
|
|
416
|
-
}
|
|
397
|
+
/** Maximum selectable velocity in mm/sec or deg/sec */
|
|
398
|
+
maxVelocityInDisplayUnits(useDegree: boolean) {
|
|
399
|
+
return useDegree
|
|
400
|
+
? this.maxRotationVelocityDegPerSec
|
|
401
|
+
: this.maxTranslationVelocityMmPerSec
|
|
417
402
|
}
|
|
418
403
|
|
|
419
404
|
|
|
@@ -459,15 +444,16 @@ export class JoggingStore {
|
|
|
459
444
|
this.incrementJogInProgress = incrementJog
|
|
460
445
|
}
|
|
461
446
|
|
|
462
|
-
setVelocityFromSlider(velocity: number) {
|
|
463
|
-
if (
|
|
464
|
-
this.translationVelocityMmPerSec = velocity
|
|
465
|
-
} else {
|
|
447
|
+
setVelocityFromSlider(velocity: number,useDegree : boolean ) {
|
|
448
|
+
if (useDegree) {
|
|
466
449
|
this.rotationVelocityDegPerSec = velocity
|
|
450
|
+
} else {
|
|
451
|
+
this.translationVelocityMmPerSec = velocity
|
|
467
452
|
}
|
|
468
453
|
}
|
|
469
454
|
|
|
470
|
-
|
|
455
|
+
|
|
456
|
+
setSelectedCartesianMotionType(type: CartesianMotionType) {
|
|
471
457
|
this.selectedCartesianMotionType = type
|
|
472
458
|
}
|
|
473
459
|
|
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
import { observer
|
|
1
|
+
import { observer} from "mobx-react-lite"
|
|
2
2
|
import { useTranslation } from "react-i18next"
|
|
3
3
|
import { VelocitySlider, VelocitySliderLabel } from "../VelocitySlider"
|
|
4
4
|
import type { JoggingStore } from "./JoggingStore"
|
|
5
5
|
|
|
6
6
|
export const JoggingVelocitySlider = observer(
|
|
7
|
-
({
|
|
7
|
+
({
|
|
8
|
+
store,
|
|
9
|
+
useDegree,
|
|
10
|
+
}: {
|
|
11
|
+
store: JoggingStore
|
|
12
|
+
useDegree: boolean
|
|
13
|
+
}) => {
|
|
14
|
+
|
|
8
15
|
const { t } = useTranslation()
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return (value: number) =>
|
|
17
|
-
`ω = ${t("Jogging.Cartesian.Rotation.velocityDegPerSec.lb", { amount: value })}`
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
}))
|
|
17
|
+
function valueLabelFormat(value: number, useDegree: boolean): string {
|
|
18
|
+
return useDegree
|
|
19
|
+
? `ω = ${t("Jogging.Cartesian.Rotation.velocityDegPerSec.lb", { amount: value })}`
|
|
20
|
+
: `v = ${t("Jogging.Cartesian.Translation.velocityMmPerSec.lb", { amount: value })}`
|
|
21
|
+
}
|
|
22
|
+
|
|
21
23
|
|
|
22
24
|
return (
|
|
23
25
|
<VelocitySlider
|
|
24
26
|
store={store}
|
|
25
|
-
velocity={store.velocityInDisplayUnits}
|
|
26
|
-
min={store.minVelocityInDisplayUnits}
|
|
27
|
-
max={store.maxVelocityInDisplayUnits}
|
|
27
|
+
velocity={store.velocityInDisplayUnits(useDegree)}
|
|
28
|
+
min={store.minVelocityInDisplayUnits(useDegree)}
|
|
29
|
+
max={store.maxVelocityInDisplayUnits(useDegree)}
|
|
28
30
|
onVelocityChange={store.setVelocityFromSlider}
|
|
31
|
+
useDegree={useDegree}
|
|
29
32
|
disabled={store.isLocked}
|
|
30
33
|
renderValue={(value) => (
|
|
31
34
|
<VelocitySliderLabel
|
|
32
|
-
value={
|
|
35
|
+
value={valueLabelFormat(value, useDegree)}
|
|
33
36
|
sx={{
|
|
34
37
|
minWidth: "111px",
|
|
35
38
|
span: {
|