@wandelbots/wandelbots-js-react-components 2.34.1-pr.feature-robot-precondition-list.372.cbfbec1 → 2.34.1-pr.feature-robot-precondition-list.372.a300caa
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/RobotCard.d.ts.map +1 -1
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +367 -362
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/RobotCard.tsx +17 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wandelbots/wandelbots-js-react-components",
|
|
3
|
-
"version": "2.34.1-pr.feature-robot-precondition-list.372.
|
|
3
|
+
"version": "2.34.1-pr.feature-robot-precondition-list.372.a300caa",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,14 +15,17 @@ import { PresetEnvironment } from "./3d-viewport/PresetEnvironment"
|
|
|
15
15
|
import { CycleTimer } from "./CycleTimer"
|
|
16
16
|
import { useAutorun } from "./utils/hooks"
|
|
17
17
|
|
|
18
|
-
// Component that handles bounds refreshing when motion state changes
|
|
18
|
+
// Component that handles bounds refreshing when motion state changes or model renders
|
|
19
19
|
function BoundsRefresher({
|
|
20
20
|
connectedMotionGroup,
|
|
21
|
+
modelRenderTrigger,
|
|
21
22
|
}: {
|
|
22
23
|
connectedMotionGroup: ConnectedMotionGroup
|
|
24
|
+
modelRenderTrigger: number
|
|
23
25
|
}) {
|
|
24
26
|
const bounds = useBounds()
|
|
25
27
|
|
|
28
|
+
// Trigger bounds fit when robot motion state changes
|
|
26
29
|
useAutorun(() => {
|
|
27
30
|
// Ensure rapidlyChangingMotionState exists before accessing its properties
|
|
28
31
|
if (!connectedMotionGroup.rapidlyChangingMotionState?.state) {
|
|
@@ -33,10 +36,17 @@ function BoundsRefresher({
|
|
|
33
36
|
connectedMotionGroup.rapidlyChangingMotionState.state.joint_position
|
|
34
37
|
connectedMotionGroup.rapidlyChangingMotionState.tcp_pose
|
|
35
38
|
|
|
36
|
-
//
|
|
37
|
-
bounds.
|
|
39
|
+
// Fit bounds when robot pose/position changes
|
|
40
|
+
bounds.fit()
|
|
38
41
|
})
|
|
39
42
|
|
|
43
|
+
// Trigger bounds fit when model renders
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (modelRenderTrigger > 0) {
|
|
46
|
+
bounds.fit()
|
|
47
|
+
}
|
|
48
|
+
}, [modelRenderTrigger, bounds])
|
|
49
|
+
|
|
40
50
|
return null
|
|
41
51
|
}
|
|
42
52
|
|
|
@@ -326,9 +336,10 @@ export const RobotCard = externalizeComponent(
|
|
|
326
336
|
gl={{ alpha: true, antialias: true }}
|
|
327
337
|
>
|
|
328
338
|
<PresetEnvironment />
|
|
329
|
-
<Bounds fit margin={1} maxDuration={1}>
|
|
339
|
+
<Bounds fit observe clip margin={1} maxDuration={1}>
|
|
330
340
|
<BoundsRefresher
|
|
331
341
|
connectedMotionGroup={connectedMotionGroup}
|
|
342
|
+
modelRenderTrigger={modelRenderTrigger}
|
|
332
343
|
/>
|
|
333
344
|
<RobotComponent
|
|
334
345
|
connectedMotionGroup={connectedMotionGroup}
|
|
@@ -508,9 +519,10 @@ export const RobotCard = externalizeComponent(
|
|
|
508
519
|
gl={{ alpha: true, antialias: true }}
|
|
509
520
|
>
|
|
510
521
|
<PresetEnvironment />
|
|
511
|
-
<Bounds fit clip margin={1} maxDuration={1}>
|
|
522
|
+
<Bounds fit observe clip margin={1} maxDuration={1}>
|
|
512
523
|
<BoundsRefresher
|
|
513
524
|
connectedMotionGroup={connectedMotionGroup}
|
|
525
|
+
modelRenderTrigger={modelRenderTrigger}
|
|
514
526
|
/>
|
|
515
527
|
<RobotComponent
|
|
516
528
|
connectedMotionGroup={connectedMotionGroup}
|