@viamrobotics/motion-tools 1.31.0 → 1.33.0
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/App.svelte +64 -53
- package/dist/components/App.svelte.d.ts +14 -7
- package/dist/components/Entities/Arrows/Arrows.svelte +4 -7
- package/dist/components/Entities/hooks/useEntityEvents.svelte.d.ts +0 -1
- package/dist/components/Entities/hooks/useEntityEvents.svelte.js +30 -16
- package/dist/components/InputBindings.svelte +0 -43
- package/dist/components/KeyboardBindings.svelte +38 -0
- package/dist/components/KeyboardBindings.svelte.d.ts +18 -0
- package/dist/components/PointerMissBox.svelte +6 -3
- package/dist/components/Scene.svelte +43 -61
- package/dist/components/SceneProviders.svelte +2 -7
- package/dist/components/SceneProviders.svelte.d.ts +1 -3
- package/dist/components/Selected.svelte +20 -27
- package/dist/components/SelectedTransformControls.svelte +8 -7
- package/dist/components/StaticGeometries.svelte +3 -5
- package/dist/components/hover/HoveredEntities.svelte +15 -14
- package/dist/components/hover/HoveredEntities.svelte.d.ts +17 -2
- package/dist/components/hover/HoveredEntity.svelte +8 -5
- package/dist/components/hover/HoveredEntity.svelte.d.ts +5 -1
- package/dist/components/hover/LinkedHoveredEntity.svelte +7 -11
- package/dist/components/hover/LinkedHoveredEntity.svelte.d.ts +1 -0
- package/dist/components/overlay/Details.svelte +22 -37
- package/dist/components/overlay/Details.svelte.d.ts +3 -1
- package/dist/components/overlay/controls/Controls.svelte +0 -2
- package/dist/components/overlay/dashboard/Button.svelte +5 -3
- package/dist/components/overlay/dashboard/Button.svelte.d.ts +1 -1
- package/dist/components/overlay/left-pane/Tree.svelte +13 -10
- package/dist/components/overlay/left-pane/TreeContainer.svelte +9 -4
- package/dist/components/overlay/left-pane/TreeNode.svelte +6 -4
- package/dist/components/overlay/settings/ConnectionSettings.svelte +42 -0
- package/dist/components/overlay/settings/ConnectionSettings.svelte.d.ts +18 -0
- package/dist/components/overlay/settings/DebugSettings.svelte +13 -0
- package/dist/components/{xr/frame-configure/Controllers.svelte.d.ts → overlay/settings/DebugSettings.svelte.d.ts} +3 -3
- package/dist/components/overlay/settings/PointcloudSettings.svelte +61 -0
- package/dist/components/overlay/settings/PointcloudSettings.svelte.d.ts +3 -0
- package/dist/components/overlay/settings/SceneSettings.svelte +110 -0
- package/dist/components/overlay/settings/SceneSettings.svelte.d.ts +18 -0
- package/dist/components/overlay/settings/Settings.svelte +27 -312
- package/dist/components/overlay/settings/Settings.svelte.d.ts +8 -1
- package/dist/components/overlay/settings/Tabs.svelte +5 -3
- package/dist/components/overlay/settings/Tabs.svelte.d.ts +3 -3
- package/dist/components/overlay/settings/VisionSettings.svelte +31 -0
- package/dist/components/overlay/settings/VisionSettings.svelte.d.ts +3 -0
- package/dist/components/overlay/settings/WeblabSettings.svelte +27 -0
- package/dist/components/overlay/settings/WeblabSettings.svelte.d.ts +18 -0
- package/dist/components/overlay/settings/WidgetSettings.svelte +49 -0
- package/dist/components/overlay/settings/WidgetSettings.svelte.d.ts +3 -0
- package/dist/components/overlay/widgets/FramePov.svelte +1 -12
- package/dist/draw.d.ts +1 -0
- package/dist/draw.js +1 -1
- package/dist/ecs/index.d.ts +1 -0
- package/dist/ecs/index.js +1 -0
- package/dist/ecs/traits.d.ts +22 -5
- package/dist/ecs/traits.js +33 -4
- package/dist/ecs/useTag.svelte.d.ts +5 -0
- package/dist/ecs/useTag.svelte.js +43 -0
- package/dist/hooks/useEnvironment.svelte.d.ts +1 -1
- package/dist/hooks/useLinked.svelte.js +7 -8
- package/dist/hooks/useMouseRaycaster.svelte.d.ts +4 -3
- package/dist/hooks/useMouseRaycaster.svelte.js +1 -0
- package/dist/hooks/useSettings.svelte.d.ts +1 -1
- package/dist/plugins/Focus/Focus.svelte +45 -0
- package/dist/plugins/Focus/Focus.svelte.d.ts +3 -0
- package/dist/plugins/Focus/FocusBox.svelte +75 -0
- package/dist/plugins/Focus/FocusBox.svelte.d.ts +3 -0
- package/dist/plugins/Focus/provideFocus.svelte.d.ts +1 -0
- package/dist/plugins/Focus/provideFocus.svelte.js +61 -0
- package/dist/{components → plugins}/MeasureTool/MeasureTool.svelte +6 -8
- package/dist/plugins/Selection/SelectionTool.svelte +10 -3
- package/dist/{components/xr → plugins/XR}/ArmTeleop.svelte +3 -5
- package/dist/plugins/XR/DebugPanel.svelte +29 -0
- package/dist/plugins/XR/DebugPanel.svelte.d.ts +3 -0
- package/dist/plugins/XR/OriginMarker.svelte +341 -0
- package/dist/plugins/XR/PendingEditsPanel.svelte +60 -0
- package/dist/plugins/XR/PendingEditsPanel.svelte.d.ts +18 -0
- package/dist/plugins/XR/WristDisplay.svelte +60 -0
- package/dist/plugins/XR/WristDisplay.svelte.d.ts +19 -0
- package/dist/{components/xr → plugins/XR}/XR.svelte +69 -23
- package/dist/plugins/XR/XRPlugins.svelte +9 -0
- package/dist/plugins/XR/XRPlugins.svelte.d.ts +26 -0
- package/dist/plugins/XR/XRSettings.svelte +240 -0
- package/dist/plugins/XR/XRSettings.svelte.d.ts +3 -0
- package/dist/{components/xr → plugins/XR}/XRToast.svelte +6 -9
- package/dist/plugins/XR/debug.svelte.d.ts +7 -0
- package/dist/plugins/XR/debug.svelte.js +13 -0
- package/dist/plugins/XR/frame-configure/Controllers.svelte +413 -0
- package/dist/plugins/XR/teleop/Controllers.svelte.d.ts +3 -0
- package/dist/{components/xr → plugins/XR}/useAnchors.svelte.d.ts +4 -0
- package/dist/{components/xr → plugins/XR}/useAnchors.svelte.js +22 -0
- package/dist/plugins/XR/useOrigin.svelte.d.ts +24 -0
- package/dist/plugins/XR/useOrigin.svelte.js +50 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.js +4 -0
- package/dist/three/OBBHelper.js +1 -0
- package/dist/three/arrow.d.ts +2 -0
- package/dist/three/arrow.js +3 -1
- package/package.json +16 -4
- package/dist/components/Focus.svelte +0 -46
- package/dist/components/Focus.svelte.d.ts +0 -7
- package/dist/components/xr/OriginMarker.svelte +0 -151
- package/dist/components/xr/XRControllerSettings.svelte +0 -242
- package/dist/components/xr/XRControllerSettings.svelte.d.ts +0 -3
- package/dist/components/xr/frame-configure/Controllers.svelte +0 -6
- package/dist/components/xr/useOrigin.svelte.d.ts +0 -9
- package/dist/components/xr/useOrigin.svelte.js +0 -27
- package/dist/hooks/useSelection.svelte.d.ts +0 -33
- package/dist/hooks/useSelection.svelte.js +0 -94
- /package/dist/{components → plugins}/MeasureTool/MeasurePoint.svelte +0 -0
- /package/dist/{components → plugins}/MeasureTool/MeasurePoint.svelte.d.ts +0 -0
- /package/dist/{components → plugins}/MeasureTool/MeasureTool.svelte.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/ArmTeleop.svelte.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/BentPlaneGeometry.svelte +0 -0
- /package/dist/{components/xr → plugins/XR}/BentPlaneGeometry.svelte.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/CameraFeed.svelte +0 -0
- /package/dist/{components/xr → plugins/XR}/CameraFeed.svelte.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/JointLimitsWidget.svelte +0 -0
- /package/dist/{components/xr → plugins/XR}/JointLimitsWidget.svelte.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/OriginMarker.svelte.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/PointDistance.svelte +0 -0
- /package/dist/{components/xr → plugins/XR}/PointDistance.svelte.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/XR.svelte.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/XRConfigPanel.svelte +0 -0
- /package/dist/{components/xr → plugins/XR}/XRConfigPanel.svelte.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/XRToast.svelte.d.ts +0 -0
- /package/dist/{components/xr/teleop → plugins/XR/frame-configure}/Controllers.svelte.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/math.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/math.js +0 -0
- /package/dist/{components/xr → plugins/XR}/teleop/Controllers.svelte +0 -0
- /package/dist/{components/xr → plugins/XR}/toasts.svelte.d.ts +0 -0
- /package/dist/{components/xr → plugins/XR}/toasts.svelte.js +0 -0
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { T } from '@threlte/core'
|
|
3
|
-
import { Gizmo, TrackballControls } from '@threlte/extras'
|
|
4
|
-
import { Box3, type Object3D, Vector3 } from 'three'
|
|
5
|
-
|
|
6
|
-
import { useCameraControls } from '../hooks/useControls.svelte'
|
|
7
|
-
|
|
8
|
-
import Camera from './Camera.svelte'
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
object3d: Object3D
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
let { object3d }: Props = $props()
|
|
15
|
-
|
|
16
|
-
const cameraControls = useCameraControls()
|
|
17
|
-
|
|
18
|
-
const box = new Box3()
|
|
19
|
-
const vec = new Vector3()
|
|
20
|
-
|
|
21
|
-
let center = $state.raw<[number, number, number]>([0, 0, 0])
|
|
22
|
-
let size = $state.raw<[number, number, number]>([0, 0, 0])
|
|
23
|
-
|
|
24
|
-
$effect.pre(() => {
|
|
25
|
-
box.setFromObject(object3d)
|
|
26
|
-
size = box.getSize(vec).toArray()
|
|
27
|
-
center = box.getCenter(vec).toArray()
|
|
28
|
-
})
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<Camera position={[size[0] + 1, size[0] + 1, size[0] + 1]}>
|
|
32
|
-
<TrackballControls
|
|
33
|
-
target={center}
|
|
34
|
-
oncreate={(ref) => cameraControls.set(ref)}
|
|
35
|
-
>
|
|
36
|
-
<Gizmo placement="bottom-right" />
|
|
37
|
-
</TrackballControls>
|
|
38
|
-
</Camera>
|
|
39
|
-
|
|
40
|
-
<T is={object3d} />
|
|
41
|
-
|
|
42
|
-
<T.BoxHelper
|
|
43
|
-
args={[object3d, 'red']}
|
|
44
|
-
bvh={{ enabled: false }}
|
|
45
|
-
raycast={() => null}
|
|
46
|
-
/>
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { useTask, useThrelte } from '@threlte/core'
|
|
3
|
-
import { Grid, useGamepad } from '@threlte/extras'
|
|
4
|
-
import { Hand, useHand, useXR } from '@threlte/xr'
|
|
5
|
-
import { Group, Quaternion, Vector2, Vector3 } from 'three'
|
|
6
|
-
|
|
7
|
-
import { useAnchors } from './useAnchors.svelte'
|
|
8
|
-
import { useOrigin } from './useOrigin.svelte'
|
|
9
|
-
|
|
10
|
-
const origin = useOrigin()
|
|
11
|
-
const anchors = useAnchors()
|
|
12
|
-
|
|
13
|
-
const anchorObject = new Group()
|
|
14
|
-
|
|
15
|
-
const leftPad = useGamepad({ xr: true, hand: 'left' })
|
|
16
|
-
const rightPad = useGamepad({ xr: true, hand: 'right' })
|
|
17
|
-
|
|
18
|
-
let speed = $state(0.05)
|
|
19
|
-
|
|
20
|
-
const vec2 = new Vector2()
|
|
21
|
-
const target = new Vector2()
|
|
22
|
-
|
|
23
|
-
leftPad.squeeze.on('change', () => {
|
|
24
|
-
speed = leftPad.squeeze.pressed ? 0.005 : 0.05
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
leftPad.thumbstick.on('change', ({ value }) => {
|
|
28
|
-
if (typeof value === 'number') {
|
|
29
|
-
return
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const { x: vx, y: vy } = value
|
|
33
|
-
const [x, y, z] = origin.position
|
|
34
|
-
const r = origin.rotation
|
|
35
|
-
|
|
36
|
-
vec2.set(z, r).lerp(target.set(z + vy * speed, r + vx * speed), 0.5)
|
|
37
|
-
|
|
38
|
-
origin.set([x, y, z + vy * speed], r + vx * speed)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
rightPad.thumbstick.on('change', ({ value }) => {
|
|
42
|
-
if (typeof value === 'number') {
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const { x: vx, y: vy } = value
|
|
47
|
-
const [x, y, z] = origin.position
|
|
48
|
-
const r = origin.rotation
|
|
49
|
-
|
|
50
|
-
vec2.set(x, y).lerp(target.set(x + vx * speed, y + vy * speed), 0.5)
|
|
51
|
-
|
|
52
|
-
origin.set([vec2.x, vec2.y, z], r)
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
const vec3 = new Vector3()
|
|
56
|
-
const quaternion = new Quaternion()
|
|
57
|
-
|
|
58
|
-
$effect(() => {
|
|
59
|
-
vec3.fromArray(origin.position)
|
|
60
|
-
|
|
61
|
-
anchors.createAnchor(vec3, quaternion)?.then((anchor) => {
|
|
62
|
-
anchors.bindAnchorObject(anchor, anchorObject)
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
let startLeftPinchTranslation = new Vector3()
|
|
67
|
-
let leftPinchTranslation = new Vector3()
|
|
68
|
-
let startRightPinchTranslation = new Vector3()
|
|
69
|
-
let rightPinchTranslation = new Vector3()
|
|
70
|
-
|
|
71
|
-
const leftHand = useHand('left')
|
|
72
|
-
const rightHand = useHand('right')
|
|
73
|
-
|
|
74
|
-
let translating = $state(false)
|
|
75
|
-
let rotating = $state(false)
|
|
76
|
-
|
|
77
|
-
const { renderer } = useThrelte()
|
|
78
|
-
const { isPresenting } = useXR()
|
|
79
|
-
|
|
80
|
-
$effect(() => {
|
|
81
|
-
if (!$isPresenting) {
|
|
82
|
-
return
|
|
83
|
-
}
|
|
84
|
-
renderer.xr.getHand(0).addEventListener('pinchstart', () => {
|
|
85
|
-
if (leftHand.current?.targetRay.position) {
|
|
86
|
-
translating = true
|
|
87
|
-
startLeftPinchTranslation.copy(leftHand.current.targetRay.position)
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
useTask(
|
|
93
|
-
() => {
|
|
94
|
-
if (leftHand.current?.targetRay && translating) {
|
|
95
|
-
leftPinchTranslation
|
|
96
|
-
.copy(leftHand.current.targetRay.position)
|
|
97
|
-
.sub(startLeftPinchTranslation)
|
|
98
|
-
origin.set(leftPinchTranslation.toArray(), origin.rotation)
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
running: () => translating,
|
|
103
|
-
}
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
useTask(
|
|
107
|
-
() => {
|
|
108
|
-
if (rightHand.current?.targetRay && rotating) {
|
|
109
|
-
rightPinchTranslation.copy(rightHand.current.targetRay.position)
|
|
110
|
-
const rotation =
|
|
111
|
-
origin.rotation + rightPinchTranslation.distanceTo(startRightPinchTranslation)
|
|
112
|
-
origin.set(leftPinchTranslation.toArray(), rotation)
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
running: () => rotating,
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
</script>
|
|
120
|
-
|
|
121
|
-
<Grid
|
|
122
|
-
plane="xy"
|
|
123
|
-
fadeDistance={5}
|
|
124
|
-
fadeOrigin={new Vector3()}
|
|
125
|
-
cellSize={0.1}
|
|
126
|
-
cellColor="#fff"
|
|
127
|
-
sectionColor="#fff"
|
|
128
|
-
/>
|
|
129
|
-
|
|
130
|
-
<Hand
|
|
131
|
-
left
|
|
132
|
-
onpinchstart={() => {
|
|
133
|
-
console.log('pinchstart')
|
|
134
|
-
if (leftHand.current?.targetRay.position) {
|
|
135
|
-
translating = true
|
|
136
|
-
startLeftPinchTranslation.copy(leftHand.current.targetRay.position)
|
|
137
|
-
}
|
|
138
|
-
}}
|
|
139
|
-
onpinchend={() => (translating = false)}
|
|
140
|
-
/>
|
|
141
|
-
|
|
142
|
-
<Hand
|
|
143
|
-
right
|
|
144
|
-
onpinchstart={() => {
|
|
145
|
-
if (rightHand.current?.targetRay.position) {
|
|
146
|
-
rotating = true
|
|
147
|
-
startRightPinchTranslation.copy(rightHand.current.targetRay.position)
|
|
148
|
-
}
|
|
149
|
-
}}
|
|
150
|
-
onpinchend={() => (rotating = false)}
|
|
151
|
-
/>
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Select, Switch } from '@viamrobotics/prime-core'
|
|
3
|
-
import { useResourceNames } from '@viamrobotics/svelte-sdk'
|
|
4
|
-
|
|
5
|
-
import { useArmClient } from '../../hooks/useArmClient.svelte'
|
|
6
|
-
import { usePartID } from '../../hooks/usePartID.svelte'
|
|
7
|
-
import { useSettings } from '../../hooks/useSettings.svelte'
|
|
8
|
-
|
|
9
|
-
const settings = useSettings()
|
|
10
|
-
const armClient = useArmClient()
|
|
11
|
-
const partID = usePartID()
|
|
12
|
-
const resources = useResourceNames(() => partID.current, 'gripper')
|
|
13
|
-
|
|
14
|
-
const armNames = $derived(armClient.names || [])
|
|
15
|
-
const gripperNames = $derived(
|
|
16
|
-
resources.current
|
|
17
|
-
.filter((r) => r.subtype === 'gripper' && r.type === 'component')
|
|
18
|
-
.map((r) => r.name)
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
const config = $derived(settings.current.xrController)
|
|
22
|
-
|
|
23
|
-
// Filter available arms/grippers - exclude what the other controller has selected
|
|
24
|
-
const leftAvailableArms = $derived(
|
|
25
|
-
armNames.filter((name) => name === config.left.armName || name !== config.right.armName)
|
|
26
|
-
)
|
|
27
|
-
const rightAvailableArms = $derived(
|
|
28
|
-
armNames.filter((name) => name === config.right.armName || name !== config.left.armName)
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
const leftAvailableGrippers = $derived(
|
|
32
|
-
gripperNames.filter(
|
|
33
|
-
(name) => name === config.left.gripperName || name !== config.right.gripperName
|
|
34
|
-
)
|
|
35
|
-
)
|
|
36
|
-
const rightAvailableGrippers = $derived(
|
|
37
|
-
gripperNames.filter(
|
|
38
|
-
(name) => name === config.right.gripperName || name !== config.left.gripperName
|
|
39
|
-
)
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
function updateConfig(
|
|
43
|
-
hand: 'left' | 'right',
|
|
44
|
-
key: string,
|
|
45
|
-
value: string | number | boolean | undefined
|
|
46
|
-
) {
|
|
47
|
-
settings.current.xrController[hand] = {
|
|
48
|
-
...settings.current.xrController[hand],
|
|
49
|
-
[key]: value,
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
{#snippet SectionTitle(title: string)}
|
|
55
|
-
<h3 class="border-gray-3 border-b py-1 text-sm"><strong>{title}</strong></h3>
|
|
56
|
-
{/snippet}
|
|
57
|
-
|
|
58
|
-
<div class="flex flex-col gap-2.5">
|
|
59
|
-
<label class="flex items-center justify-between gap-2">
|
|
60
|
-
Enable VR / AR mode <Switch bind:on={settings.current.enableXR} />
|
|
61
|
-
</label>
|
|
62
|
-
|
|
63
|
-
<!-- Left Controller -->
|
|
64
|
-
{@render SectionTitle('Left Controller')}
|
|
65
|
-
|
|
66
|
-
<label class="flex items-center justify-between gap-2">
|
|
67
|
-
Arm
|
|
68
|
-
<Select
|
|
69
|
-
value={config.left.armName || ''}
|
|
70
|
-
onchange={(event: Event) => {
|
|
71
|
-
if (event.target instanceof HTMLSelectElement) {
|
|
72
|
-
updateConfig('left', 'armName', event.target.value || undefined)
|
|
73
|
-
}
|
|
74
|
-
}}
|
|
75
|
-
>
|
|
76
|
-
<option value="">None</option>
|
|
77
|
-
{#each leftAvailableArms as armName (armName)}
|
|
78
|
-
<option value={armName}>{armName}</option>
|
|
79
|
-
{/each}
|
|
80
|
-
</Select>
|
|
81
|
-
</label>
|
|
82
|
-
|
|
83
|
-
<label class="flex items-center justify-between gap-2">
|
|
84
|
-
Gripper
|
|
85
|
-
<Select
|
|
86
|
-
value={config.left.gripperName || ''}
|
|
87
|
-
onchange={(event: Event) => {
|
|
88
|
-
if (event.target instanceof HTMLSelectElement) {
|
|
89
|
-
updateConfig('left', 'gripperName', event.target.value || undefined)
|
|
90
|
-
}
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
<option value="">None</option>
|
|
94
|
-
{#each leftAvailableGrippers as gripperName (gripperName)}
|
|
95
|
-
<option value={gripperName}>{gripperName}</option>
|
|
96
|
-
{/each}
|
|
97
|
-
</Select>
|
|
98
|
-
</label>
|
|
99
|
-
|
|
100
|
-
<label class="flex items-center justify-between gap-2">
|
|
101
|
-
Scale: {config.left.scaleFactor.toFixed(1)}
|
|
102
|
-
<input
|
|
103
|
-
class="w-20"
|
|
104
|
-
type="range"
|
|
105
|
-
min="0.1"
|
|
106
|
-
max="3.0"
|
|
107
|
-
step="0.1"
|
|
108
|
-
value={config.left.scaleFactor}
|
|
109
|
-
style="--value: {((config.left.scaleFactor - 0.1) / (3 - 0.1)) * 100}%"
|
|
110
|
-
oninput={(e) => updateConfig('left', 'scaleFactor', Number.parseFloat(e.currentTarget.value))}
|
|
111
|
-
/>
|
|
112
|
-
</label>
|
|
113
|
-
|
|
114
|
-
<label class="flex items-center justify-between gap-2">
|
|
115
|
-
Rotation
|
|
116
|
-
<Switch
|
|
117
|
-
on={config.left.rotationEnabled}
|
|
118
|
-
on:change={(event) => {
|
|
119
|
-
updateConfig('left', 'rotationEnabled', event.detail)
|
|
120
|
-
}}
|
|
121
|
-
/>
|
|
122
|
-
</label>
|
|
123
|
-
|
|
124
|
-
<!-- Right Controller -->
|
|
125
|
-
{@render SectionTitle('Right Controller')}
|
|
126
|
-
|
|
127
|
-
<label class="flex items-center justify-between gap-2">
|
|
128
|
-
Arm
|
|
129
|
-
<Select
|
|
130
|
-
value={config.right.armName || ''}
|
|
131
|
-
onchange={(event: Event) => {
|
|
132
|
-
if (event.target instanceof HTMLSelectElement) {
|
|
133
|
-
updateConfig('right', 'armName', event.target.value || undefined)
|
|
134
|
-
}
|
|
135
|
-
}}
|
|
136
|
-
>
|
|
137
|
-
<option value="">None</option>
|
|
138
|
-
{#each rightAvailableArms as armName (armName)}
|
|
139
|
-
<option value={armName}>{armName}</option>
|
|
140
|
-
{/each}
|
|
141
|
-
</Select>
|
|
142
|
-
</label>
|
|
143
|
-
|
|
144
|
-
<label class="flex items-center justify-between gap-2">
|
|
145
|
-
Gripper
|
|
146
|
-
<Select
|
|
147
|
-
value={config.right.gripperName || ''}
|
|
148
|
-
onchange={(event: Event) => {
|
|
149
|
-
if (event.target instanceof HTMLSelectElement) {
|
|
150
|
-
updateConfig('right', 'gripperName', event.target.value || undefined)
|
|
151
|
-
}
|
|
152
|
-
}}
|
|
153
|
-
>
|
|
154
|
-
<option value="">None</option>
|
|
155
|
-
{#each rightAvailableGrippers as gripperName (gripperName)}
|
|
156
|
-
<option value={gripperName}>{gripperName}</option>
|
|
157
|
-
{/each}
|
|
158
|
-
</Select>
|
|
159
|
-
</label>
|
|
160
|
-
|
|
161
|
-
<label class="flex items-center justify-between gap-2">
|
|
162
|
-
Scale: {config.right.scaleFactor.toFixed(1)}
|
|
163
|
-
<input
|
|
164
|
-
class="w-20"
|
|
165
|
-
type="range"
|
|
166
|
-
min="0.1"
|
|
167
|
-
max="3.0"
|
|
168
|
-
step="0.1"
|
|
169
|
-
value={config.right.scaleFactor}
|
|
170
|
-
style="--value: {((config.right.scaleFactor - 0.1) / (3 - 0.1)) * 100}%"
|
|
171
|
-
oninput={(e) =>
|
|
172
|
-
updateConfig('right', 'scaleFactor', Number.parseFloat(e.currentTarget.value))}
|
|
173
|
-
/>
|
|
174
|
-
</label>
|
|
175
|
-
|
|
176
|
-
<label class="flex items-center justify-between gap-2">
|
|
177
|
-
Rotation
|
|
178
|
-
<Switch
|
|
179
|
-
on={config.right.rotationEnabled}
|
|
180
|
-
on:change={(event) => {
|
|
181
|
-
updateConfig('right', 'rotationEnabled', event.detail)
|
|
182
|
-
}}
|
|
183
|
-
/>
|
|
184
|
-
</label>
|
|
185
|
-
</div>
|
|
186
|
-
|
|
187
|
-
<style>
|
|
188
|
-
input[type='range'] {
|
|
189
|
-
-webkit-appearance: none;
|
|
190
|
-
appearance: none;
|
|
191
|
-
width: 100%;
|
|
192
|
-
background: linear-gradient(
|
|
193
|
-
to right,
|
|
194
|
-
#3d7d3f 0%,
|
|
195
|
-
#3d7d3f var(--value),
|
|
196
|
-
#d1d5db var(--value),
|
|
197
|
-
#d1d5db 100%
|
|
198
|
-
);
|
|
199
|
-
border-radius: 0.25rem;
|
|
200
|
-
height: 0.5rem;
|
|
201
|
-
cursor: pointer;
|
|
202
|
-
outline: none;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/* Webkit browsers (Chrome, Safari, Edge) */
|
|
206
|
-
input[type='range']::-webkit-slider-track {
|
|
207
|
-
background: transparent;
|
|
208
|
-
height: 0.5rem;
|
|
209
|
-
border-radius: 0.25rem;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
input[type='range']::-webkit-slider-thumb {
|
|
213
|
-
-webkit-appearance: none;
|
|
214
|
-
appearance: none;
|
|
215
|
-
background: #3d7d3f;
|
|
216
|
-
height: 1.25rem;
|
|
217
|
-
width: 1.25rem;
|
|
218
|
-
border-radius: 50%;
|
|
219
|
-
border: 2px solid white;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/* Firefox */
|
|
223
|
-
input[type='range']::-moz-range-track {
|
|
224
|
-
background: transparent;
|
|
225
|
-
height: 0.5rem;
|
|
226
|
-
border-radius: 0.25rem;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
input[type='range']::-moz-range-thumb {
|
|
230
|
-
background: #3d7d3f;
|
|
231
|
-
height: 1.25rem;
|
|
232
|
-
width: 1.25rem;
|
|
233
|
-
border-radius: 50%;
|
|
234
|
-
border: 2px solid white;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
input[type='range']::-moz-range-progress {
|
|
238
|
-
background: #3d7d3f;
|
|
239
|
-
height: 0.5rem;
|
|
240
|
-
border-radius: 0.25rem;
|
|
241
|
-
}
|
|
242
|
-
</style>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Vector3Tuple } from 'three';
|
|
2
|
-
interface Context {
|
|
3
|
-
position: Vector3Tuple;
|
|
4
|
-
rotation: number;
|
|
5
|
-
set: (pos?: Vector3Tuple, rot?: number) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare const provideOrigin: () => void;
|
|
8
|
-
export declare const useOrigin: () => Context;
|
|
9
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { getContext, setContext } from 'svelte';
|
|
2
|
-
const key = Symbol('origin-context');
|
|
3
|
-
export const provideOrigin = () => {
|
|
4
|
-
const position = $state([0, 0, 0]);
|
|
5
|
-
let rotation = $state(0);
|
|
6
|
-
setContext(key, {
|
|
7
|
-
get position() {
|
|
8
|
-
return position;
|
|
9
|
-
},
|
|
10
|
-
get rotation() {
|
|
11
|
-
return rotation;
|
|
12
|
-
},
|
|
13
|
-
set(pos, rot) {
|
|
14
|
-
if (pos) {
|
|
15
|
-
position[0] = pos[0];
|
|
16
|
-
position[1] = pos[1];
|
|
17
|
-
position[2] = pos[2];
|
|
18
|
-
}
|
|
19
|
-
if (rot !== undefined) {
|
|
20
|
-
rotation = rot;
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
export const useOrigin = () => {
|
|
26
|
-
return getContext(key);
|
|
27
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Entity } from 'koota';
|
|
2
|
-
import { Object3D } from 'three';
|
|
3
|
-
interface SelectedEntityContext {
|
|
4
|
-
readonly current: Entity | undefined;
|
|
5
|
-
readonly instance: number | undefined;
|
|
6
|
-
set(entity?: Entity, instance?: number): void;
|
|
7
|
-
}
|
|
8
|
-
interface FocusedEntityContext {
|
|
9
|
-
readonly current: Entity | undefined;
|
|
10
|
-
readonly instance: number | undefined;
|
|
11
|
-
set(entity?: Entity, instance?: number): void;
|
|
12
|
-
}
|
|
13
|
-
export declare const provideSelection: () => {
|
|
14
|
-
selection: {
|
|
15
|
-
readonly current: Entity | undefined;
|
|
16
|
-
readonly instance: number | undefined;
|
|
17
|
-
set(entity: Entity, instance?: number): void;
|
|
18
|
-
};
|
|
19
|
-
focus: {
|
|
20
|
-
readonly current: Entity | undefined;
|
|
21
|
-
readonly instance: number | undefined;
|
|
22
|
-
set(entity: Entity, instance?: number): void;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export declare const useFocusedEntity: () => FocusedEntityContext;
|
|
26
|
-
export declare const useSelectedEntity: () => SelectedEntityContext;
|
|
27
|
-
export declare const useFocusedObject3d: () => {
|
|
28
|
-
current: Object3D | undefined;
|
|
29
|
-
};
|
|
30
|
-
export declare const useSelectedObject3d: () => {
|
|
31
|
-
current: Object3D | undefined;
|
|
32
|
-
};
|
|
33
|
-
export {};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { useThrelte } from '@threlte/core';
|
|
2
|
-
import { getContext, setContext, untrack } from 'svelte';
|
|
3
|
-
import { Object3D } from 'three';
|
|
4
|
-
import { traits, useWorld } from '../ecs';
|
|
5
|
-
import { useEnvironment } from './useEnvironment.svelte';
|
|
6
|
-
const selectedKey = Symbol('selected-frame-context');
|
|
7
|
-
const focusedKey = Symbol('focused-frame-context');
|
|
8
|
-
const focusedObject3dKey = Symbol('focused-object-3d-context');
|
|
9
|
-
export const provideSelection = () => {
|
|
10
|
-
const world = useWorld();
|
|
11
|
-
const { scene } = useThrelte();
|
|
12
|
-
const environment = useEnvironment();
|
|
13
|
-
let selected = $state.raw();
|
|
14
|
-
let selectedInstance = $state();
|
|
15
|
-
let focused = $state.raw();
|
|
16
|
-
let focusedInstance = $state();
|
|
17
|
-
$effect(() => {
|
|
18
|
-
return world.onRemove(traits.Name, (entity) => {
|
|
19
|
-
if (entity === selected)
|
|
20
|
-
selected = undefined;
|
|
21
|
-
if (entity === focused)
|
|
22
|
-
focused = undefined;
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
const selectedEntityContext = {
|
|
26
|
-
get current() {
|
|
27
|
-
return selected;
|
|
28
|
-
},
|
|
29
|
-
get instance() {
|
|
30
|
-
return selectedInstance;
|
|
31
|
-
},
|
|
32
|
-
set(entity, instance) {
|
|
33
|
-
selected = entity;
|
|
34
|
-
selectedInstance = instance;
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
setContext(selectedKey, selectedEntityContext);
|
|
38
|
-
const focusedEntityContext = {
|
|
39
|
-
get current() {
|
|
40
|
-
return focused;
|
|
41
|
-
},
|
|
42
|
-
get instance() {
|
|
43
|
-
return focusedInstance;
|
|
44
|
-
},
|
|
45
|
-
set(entity, instance) {
|
|
46
|
-
focused = entity;
|
|
47
|
-
focusedInstance = instance;
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
setContext(focusedKey, focusedEntityContext);
|
|
51
|
-
const focusedObject3d = $derived(focused ? scene.getObjectByName(focused)?.clone() : undefined);
|
|
52
|
-
$effect(() => {
|
|
53
|
-
const previousMode = untrack(() => environment.current.viewerMode);
|
|
54
|
-
if (focusedObject3d) {
|
|
55
|
-
environment.current.viewerMode = 'focus';
|
|
56
|
-
return () => {
|
|
57
|
-
environment.current.viewerMode = previousMode;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
setContext(focusedObject3dKey, {
|
|
62
|
-
get current() {
|
|
63
|
-
return focusedObject3d;
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
return {
|
|
67
|
-
selection: selectedEntityContext,
|
|
68
|
-
focus: focusedEntityContext,
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
export const useFocusedEntity = () => {
|
|
72
|
-
return getContext(focusedKey);
|
|
73
|
-
};
|
|
74
|
-
export const useSelectedEntity = () => {
|
|
75
|
-
return getContext(selectedKey);
|
|
76
|
-
};
|
|
77
|
-
export const useFocusedObject3d = () => {
|
|
78
|
-
return getContext(focusedObject3dKey);
|
|
79
|
-
};
|
|
80
|
-
export const useSelectedObject3d = () => {
|
|
81
|
-
const selectedEntity = useSelectedEntity();
|
|
82
|
-
const { scene } = useThrelte();
|
|
83
|
-
const object = $derived.by(() => {
|
|
84
|
-
if (!selectedEntity.current) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
return scene.getObjectByName(selectedEntity.current);
|
|
88
|
-
});
|
|
89
|
-
return {
|
|
90
|
-
get current() {
|
|
91
|
-
return object;
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|