@viamrobotics/motion-tools 1.7.0 → 1.9.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/App.svelte +11 -6
- package/dist/components/CameraControls.svelte +1 -1
- package/dist/components/Focus.svelte +1 -1
- package/dist/components/Frame.svelte +1 -1
- package/dist/components/Geometry2.svelte +8 -5
- package/dist/components/HoveredEntities.svelte +19 -0
- package/dist/components/HoveredEntities.svelte.d.ts +3 -0
- package/dist/components/HoveredEntityTooltip.svelte +242 -0
- package/dist/components/HoveredEntityTooltip.svelte.d.ts +7 -0
- package/dist/components/Label.svelte +1 -1
- package/dist/components/{DotSprite.svelte → MeasureTool/MeasurePoint.svelte} +8 -18
- package/dist/components/MeasureTool/MeasurePoint.svelte.d.ts +8 -0
- package/dist/components/MeasureTool/MeasureTool.svelte +176 -0
- package/dist/components/Scene.svelte +1 -1
- package/dist/components/{Details.svelte → overlay/Details.svelte} +10 -10
- package/dist/components/{LiveUpdatesBanner.svelte → overlay/LiveUpdatesBanner.svelte} +2 -2
- package/dist/components/overlay/Popover.svelte +28 -0
- package/dist/components/overlay/Popover.svelte.d.ts +9 -0
- package/dist/components/overlay/ToggleGroup.svelte +60 -0
- package/dist/components/overlay/ToggleGroup.svelte.d.ts +13 -0
- package/dist/components/{__tests__ → overlay/__tests__}/__fixtures__/entity.js +1 -1
- package/dist/components/{dashboard → overlay/dashboard}/Button.svelte +8 -4
- package/dist/components/{dashboard → overlay/dashboard}/Button.svelte.d.ts +3 -2
- package/dist/components/{dashboard → overlay/dashboard}/Dashboard.svelte +2 -2
- package/dist/components/{Tree → overlay/left-pane}/AddFrames.svelte +2 -2
- package/dist/components/{Tree → overlay/left-pane}/Logs.svelte +1 -1
- package/dist/components/{RefreshRate.svelte → overlay/left-pane/RefreshRate.svelte} +1 -1
- package/dist/components/{Tree → overlay/left-pane}/Settings.svelte +12 -7
- package/dist/components/{Tree → overlay/left-pane}/Tree.svelte +3 -3
- package/dist/components/{Tree → overlay/left-pane}/TreeContainer.svelte +8 -8
- package/dist/components/{Tree → overlay/left-pane}/Widgets.svelte +3 -3
- package/dist/components/{Tree → overlay/left-pane}/buildTree.js +1 -1
- package/dist/components/{widgets → overlay/widgets}/ArmPositions.svelte +4 -4
- package/dist/components/{widgets → overlay/widgets}/Camera.svelte +5 -5
- package/dist/ecs/traits.d.ts +19 -12
- package/dist/ecs/traits.js +18 -11
- package/dist/ecs/useQuery.svelte.js +10 -10
- package/dist/hooks/useDrawAPI.svelte.js +1 -1
- package/dist/hooks/useFrames.svelte.js +1 -0
- package/dist/hooks/useGeometries.svelte.js +1 -1
- package/dist/hooks/useObjectEvents.svelte.d.ts +1 -0
- package/dist/hooks/useObjectEvents.svelte.js +24 -0
- package/dist/hooks/usePointcloudObjects.svelte.js +1 -1
- package/dist/hooks/usePointclouds.svelte.js +28 -41
- package/dist/hooks/usePose.svelte.js +1 -1
- package/dist/hooks/useSettings.svelte.d.ts +4 -0
- package/dist/hooks/useSettings.svelte.js +4 -0
- package/dist/hooks/useWorldState.svelte.js +1 -1
- package/dist/three/InstancedArrows/raycast.js +2 -6
- package/package.json +6 -2
- package/dist/components/DotSprite.svelte.d.ts +0 -10
- package/dist/components/MeasureTool.svelte +0 -123
- package/dist/components/null-states/Connection.svelte +0 -0
- package/dist/components/null-states/Connection.svelte.d.ts +0 -26
- /package/dist/components/{MeasureTool.svelte.d.ts → MeasureTool/MeasureTool.svelte.d.ts} +0 -0
- /package/dist/components/{Details.svelte.d.ts → overlay/Details.svelte.d.ts} +0 -0
- /package/dist/components/{LiveUpdatesBanner.svelte.d.ts → overlay/LiveUpdatesBanner.svelte.d.ts} +0 -0
- /package/dist/components/{shared → overlay}/Table.svelte +0 -0
- /package/dist/components/{shared → overlay}/Table.svelte.d.ts +0 -0
- /package/dist/components/{__tests__ → overlay/__tests__}/__fixtures__/entity.d.ts +0 -0
- /package/dist/components/{__tests__ → overlay/__tests__}/__fixtures__/resource.d.ts +0 -0
- /package/dist/components/{__tests__ → overlay/__tests__}/__fixtures__/resource.js +0 -0
- /package/dist/components/{dashboard → overlay/dashboard}/Dashboard.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/AddFrames.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/Drawer.svelte +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/Drawer.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/Logs.svelte.d.ts +0 -0
- /package/dist/components/{RefreshRate.svelte.d.ts → overlay/left-pane/RefreshRate.svelte.d.ts} +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/Settings.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/Tree.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/TreeContainer.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/Widgets.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/buildTree.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/useExpanded.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/useExpanded.svelte.js +0 -0
- /package/dist/components/{widgets → overlay/widgets}/ArmPositions.svelte.d.ts +0 -0
- /package/dist/components/{widgets → overlay/widgets}/Camera.svelte.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Button, Icon } from '@viamrobotics/prime-core'
|
|
3
|
-
import { usePartConfig } from '
|
|
3
|
+
import { usePartConfig } from '../../hooks/usePartConfig.svelte'
|
|
4
4
|
|
|
5
5
|
const partConfig = usePartConfig()
|
|
6
6
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
{#if partConfig.isDirty}
|
|
27
27
|
<div
|
|
28
|
-
class="absolute bottom-8 z-
|
|
28
|
+
class="absolute bottom-8 z-4 flex w-full justify-center gap-2"
|
|
29
29
|
{...rest}
|
|
30
30
|
>
|
|
31
31
|
<div
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as popover from '@zag-js/popover'
|
|
3
|
+
import { portal, useMachine, normalizeProps } from '@zag-js/svelte'
|
|
4
|
+
import type { Snippet } from 'svelte'
|
|
5
|
+
import type { HTMLButtonAttributes } from 'svelte/elements'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
trigger: Snippet<[HTMLButtonAttributes]>
|
|
9
|
+
children: Snippet
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let { children, trigger }: Props = $props()
|
|
13
|
+
|
|
14
|
+
const id = $props.id()
|
|
15
|
+
const service = useMachine(popover.machine, { id })
|
|
16
|
+
const api = $derived(popover.connect(service, normalizeProps))
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
{@render trigger(api.getTriggerProps())}
|
|
20
|
+
|
|
21
|
+
<div
|
|
22
|
+
use:portal={{ disabled: !api.portalled }}
|
|
23
|
+
{...api.getPositionerProps()}
|
|
24
|
+
>
|
|
25
|
+
<div {...api.getContentProps()}>
|
|
26
|
+
{@render children()}
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props {
|
|
4
|
+
trigger: Snippet<[HTMLButtonAttributes]>;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
}
|
|
7
|
+
declare const Popover: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Popover = ReturnType<typeof Popover>;
|
|
9
|
+
export default Popover;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { normalizeProps, useMachine } from '@zag-js/svelte'
|
|
3
|
+
import * as toggle from '@zag-js/toggle-group'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
multiple: boolean
|
|
7
|
+
buttons: {
|
|
8
|
+
on?: boolean
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
label?: string
|
|
11
|
+
value: string
|
|
12
|
+
}[]
|
|
13
|
+
onclick: (details: string[]) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let { multiple, buttons, onclick }: Props = $props()
|
|
17
|
+
|
|
18
|
+
const id = $props.id()
|
|
19
|
+
const service = useMachine(toggle.machine, () => ({
|
|
20
|
+
id,
|
|
21
|
+
value: buttons.filter((button) => button.on).map((button) => button.value),
|
|
22
|
+
multiple,
|
|
23
|
+
onValueChange(details) {
|
|
24
|
+
onclick(details.value)
|
|
25
|
+
},
|
|
26
|
+
}))
|
|
27
|
+
const api = $derived(toggle.connect(service, normalizeProps))
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<div
|
|
31
|
+
class="flex items-center"
|
|
32
|
+
{...api.getRootProps()}
|
|
33
|
+
>
|
|
34
|
+
{#each buttons as button (button.value)}
|
|
35
|
+
<button
|
|
36
|
+
class="-ml-px flex h-5 w-5 items-center justify-center border text-xs"
|
|
37
|
+
{...api.getItemProps({ value: button.value })}
|
|
38
|
+
>
|
|
39
|
+
{button.label ?? button.value}
|
|
40
|
+
</button>
|
|
41
|
+
{/each}
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<style>
|
|
45
|
+
button[data-state='on'] {
|
|
46
|
+
background: green;
|
|
47
|
+
border-color: black;
|
|
48
|
+
color: white;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
button[data-disabled] {
|
|
52
|
+
opacity: 0.5;
|
|
53
|
+
|
|
54
|
+
filter: grayscale(100%);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
button[data-focus] {
|
|
58
|
+
outline: none;
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
multiple: boolean;
|
|
3
|
+
buttons: {
|
|
4
|
+
on?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
label?: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}[];
|
|
9
|
+
onclick: (details: string[]) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const ToggleGroup: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type ToggleGroup = ReturnType<typeof ToggleGroup>;
|
|
13
|
+
export default ToggleGroup;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Icon, type IconName, Tooltip } from '@viamrobotics/prime-core'
|
|
3
3
|
import { Ruler } from 'lucide-svelte'
|
|
4
|
-
import type { ClassValue, MouseEventHandler } from 'svelte/elements'
|
|
4
|
+
import type { ClassValue, HTMLButtonAttributes, MouseEventHandler } from 'svelte/elements'
|
|
5
5
|
|
|
6
|
-
interface Props {
|
|
6
|
+
interface Props extends HTMLButtonAttributes {
|
|
7
7
|
icon: IconName | 'ruler'
|
|
8
8
|
active?: boolean
|
|
9
9
|
description: string
|
|
10
10
|
hotkey?: string
|
|
11
11
|
class?: ClassValue | null | undefined
|
|
12
|
+
tooltipLocation?: 'bottom' | 'right'
|
|
12
13
|
onclick?: MouseEventHandler<HTMLButtonElement> | null | undefined
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -18,19 +19,21 @@
|
|
|
18
19
|
description,
|
|
19
20
|
hotkey = '',
|
|
20
21
|
class: className = '',
|
|
22
|
+
tooltipLocation,
|
|
21
23
|
onclick,
|
|
24
|
+
...rest
|
|
22
25
|
}: Props = $props()
|
|
23
26
|
</script>
|
|
24
27
|
|
|
25
28
|
<Tooltip
|
|
26
29
|
let:tooltipID
|
|
27
|
-
location=
|
|
30
|
+
location={tooltipLocation ?? 'bottom'}
|
|
28
31
|
>
|
|
29
32
|
<label
|
|
30
33
|
class={[
|
|
31
34
|
className,
|
|
32
35
|
'relative block border',
|
|
33
|
-
active ? 'border-gray-5 text-gray-8 z-
|
|
36
|
+
active ? 'border-gray-5 text-gray-8 z-4 bg-white' : 'bg-light border-medium text-disabled',
|
|
34
37
|
]}
|
|
35
38
|
aria-describedby={tooltipID}
|
|
36
39
|
>
|
|
@@ -40,6 +43,7 @@
|
|
|
40
43
|
aria-label={description}
|
|
41
44
|
aria-checked={active}
|
|
42
45
|
{onclick}
|
|
46
|
+
{...rest}
|
|
43
47
|
>
|
|
44
48
|
{#if icon === 'ruler'}
|
|
45
49
|
<Ruler size="16" />
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type IconName } from '@viamrobotics/prime-core';
|
|
2
|
-
import type { ClassValue, MouseEventHandler } from 'svelte/elements';
|
|
3
|
-
interface Props {
|
|
2
|
+
import type { ClassValue, HTMLButtonAttributes, MouseEventHandler } from 'svelte/elements';
|
|
3
|
+
interface Props extends HTMLButtonAttributes {
|
|
4
4
|
icon: IconName | 'ruler';
|
|
5
5
|
active?: boolean;
|
|
6
6
|
description: string;
|
|
7
7
|
hotkey?: string;
|
|
8
8
|
class?: ClassValue | null | undefined;
|
|
9
|
+
tooltipLocation?: 'bottom' | 'right';
|
|
9
10
|
onclick?: MouseEventHandler<HTMLButtonElement> | null | undefined;
|
|
10
11
|
}
|
|
11
12
|
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { useSettings } from '
|
|
2
|
+
import { useSettings } from '../../../hooks/useSettings.svelte'
|
|
3
3
|
import { PortalTarget } from '@threlte/extras'
|
|
4
4
|
import Button from './Button.svelte'
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<div
|
|
12
|
-
class="absolute top-2 z-
|
|
12
|
+
class="absolute top-2 z-4 flex w-full justify-center gap-2"
|
|
13
13
|
{...rest}
|
|
14
14
|
>
|
|
15
15
|
<!-- camera view -->
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { IconButton } from '@viamrobotics/prime-core'
|
|
3
3
|
import Drawer from './Drawer.svelte'
|
|
4
|
-
import { usePartConfig } from '
|
|
5
|
-
import { useFramelessComponents } from '
|
|
4
|
+
import { usePartConfig } from '../../../hooks/usePartConfig.svelte'
|
|
5
|
+
import { useFramelessComponents } from '../../../hooks/useFramelessComponents.svelte'
|
|
6
6
|
|
|
7
7
|
const framelessComponents = useFramelessComponents()
|
|
8
8
|
const partConfig = usePartConfig()
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
<script lang="ts">
|
|
19
19
|
import { Select, IconButton } from '@viamrobotics/prime-core'
|
|
20
|
-
import { useMachineSettings } from '
|
|
20
|
+
import { useMachineSettings } from '../../../hooks/useMachineSettings.svelte'
|
|
21
21
|
import type { Snippet } from 'svelte'
|
|
22
22
|
|
|
23
23
|
interface Props {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Select, Switch, Input } from '@viamrobotics/prime-core'
|
|
3
|
-
import RefreshRate from '
|
|
3
|
+
import RefreshRate from './RefreshRate.svelte'
|
|
4
4
|
import Drawer from './Drawer.svelte'
|
|
5
|
-
import { useSettings } from '
|
|
5
|
+
import { useSettings } from '../../../hooks/useSettings.svelte'
|
|
6
6
|
import { useResourceNames } from '@viamrobotics/svelte-sdk'
|
|
7
|
-
import { usePartID } from '
|
|
8
|
-
import { RefreshRates, useMachineSettings } from '
|
|
9
|
-
import { useGeometries } from '
|
|
10
|
-
import { usePointClouds } from '
|
|
7
|
+
import { usePartID } from '../../../hooks/usePartID.svelte'
|
|
8
|
+
import { RefreshRates, useMachineSettings } from '../../../hooks/useMachineSettings.svelte'
|
|
9
|
+
import { useGeometries } from '../../../hooks/useGeometries.svelte'
|
|
10
|
+
import { usePointClouds } from '../../../hooks/usePointclouds.svelte'
|
|
11
11
|
import { useThrelte } from '@threlte/core'
|
|
12
|
-
import { useRefetchPoses } from '
|
|
12
|
+
import { useRefetchPoses } from '../../../hooks/useRefetchPoses'
|
|
13
13
|
|
|
14
14
|
const { invalidate } = useThrelte()
|
|
15
15
|
const partID = usePartID()
|
|
@@ -193,6 +193,11 @@
|
|
|
193
193
|
<label class="flex items-center justify-between gap-2">
|
|
194
194
|
Render stats <Switch bind:on={settings.current.renderStats} />
|
|
195
195
|
</label>
|
|
196
|
+
<label class="flex items-center justify-between gap-2">
|
|
197
|
+
Render sub-entity hover detail <Switch
|
|
198
|
+
bind:on={settings.current.renderSubEntityHoverDetail}
|
|
199
|
+
/>
|
|
200
|
+
</label>
|
|
196
201
|
<label class="flex items-center justify-between gap-2">
|
|
197
202
|
Render Arm Models
|
|
198
203
|
<Select
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import * as tree from '@zag-js/tree-view'
|
|
3
3
|
import { useMachine, normalizeProps } from '@zag-js/svelte'
|
|
4
4
|
import { ChevronRight, Eye, EyeOff } from 'lucide-svelte'
|
|
5
|
-
import { useVisibility } from '
|
|
5
|
+
import { useVisibility } from '../../../hooks/useVisibility.svelte'
|
|
6
6
|
import type { TreeNode } from './buildTree'
|
|
7
7
|
import { VirtualList } from 'svelte-virtuallists'
|
|
8
8
|
import { Icon } from '@viamrobotics/prime-core'
|
|
9
|
-
import { traits } from '
|
|
10
|
-
import { useSelectedEntity } from '
|
|
9
|
+
import { traits } from '../../../ecs'
|
|
10
|
+
import { useSelectedEntity } from '../../../hooks/useSelection.svelte'
|
|
11
11
|
import { SvelteSet } from 'svelte/reactivity'
|
|
12
12
|
|
|
13
13
|
const selected = useSelectedEntity()
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { draggable } from '@neodrag/svelte'
|
|
3
3
|
import Tree from './Tree.svelte'
|
|
4
|
-
import { useSelectedEntity } from '
|
|
4
|
+
import { useSelectedEntity } from '../../../hooks/useSelection.svelte'
|
|
5
5
|
import { provideTreeExpandedContext } from './useExpanded.svelte'
|
|
6
6
|
import Settings from './Settings.svelte'
|
|
7
7
|
import Logs from './Logs.svelte'
|
|
8
8
|
import Widgets from './Widgets.svelte'
|
|
9
9
|
import AddFrames from './AddFrames.svelte'
|
|
10
|
-
import { useEnvironment } from '
|
|
11
|
-
import { usePartID } from '
|
|
12
|
-
import { usePartConfig } from '
|
|
13
|
-
import { useFrames } from '
|
|
14
|
-
import { traits, useQuery, useWorld } from '
|
|
10
|
+
import { useEnvironment } from '../../../hooks/useEnvironment.svelte'
|
|
11
|
+
import { usePartID } from '../../../hooks/usePartID.svelte'
|
|
12
|
+
import { usePartConfig } from '../../../hooks/usePartConfig.svelte'
|
|
13
|
+
import { useFrames } from '../../../hooks/useFrames.svelte'
|
|
14
|
+
import { traits, useQuery, useWorld } from '../../../ecs'
|
|
15
15
|
import { IsExcluded, type Entity } from 'koota'
|
|
16
16
|
import { buildTreeNodes, type TreeNode } from './buildTree'
|
|
17
|
-
import { MIN_DIMENSIONS, useResizable } from '
|
|
17
|
+
import { MIN_DIMENSIONS, useResizable } from '../../../hooks/useResizable.svelte'
|
|
18
18
|
|
|
19
19
|
const { ...rest } = $props()
|
|
20
20
|
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
|
|
60
60
|
<div
|
|
61
61
|
bind:this={container}
|
|
62
|
-
class="bg-extralight border-medium absolute top-0 left-0 z-
|
|
62
|
+
class="bg-extralight border-medium absolute top-0 left-0 z-4 m-2 resize overflow-y-auto border text-xs"
|
|
63
63
|
style:min-width="{MIN_DIMENSIONS.width}px"
|
|
64
64
|
style:min-height="{MIN_DIMENSIONS.height}px"
|
|
65
65
|
style:width={resizable.current ? `${resizable.current.width}px` : undefined}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Switch } from '@viamrobotics/prime-core'
|
|
3
3
|
import Drawer from './Drawer.svelte'
|
|
4
|
-
import { useSettings } from '
|
|
5
|
-
import { useResourceByName } from '
|
|
6
|
-
import { usePartID } from '
|
|
4
|
+
import { useSettings } from '../../../hooks/useSettings.svelte'
|
|
5
|
+
import { useResourceByName } from '../../../hooks/useResourceByName.svelte'
|
|
6
|
+
import { usePartID } from '../../../hooks/usePartID.svelte'
|
|
7
7
|
|
|
8
8
|
const settings = useSettings()
|
|
9
9
|
const resourceByName = useResourceByName()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { draggable } from '@neodrag/svelte'
|
|
3
|
-
import { formatNumeric } from '
|
|
4
|
-
import Table from '../
|
|
5
|
-
import { useArmClient } from '
|
|
3
|
+
import { formatNumeric } from '../../../format'
|
|
4
|
+
import Table from '../Table.svelte'
|
|
5
|
+
import { useArmClient } from '../../../hooks/useArmClient.svelte'
|
|
6
6
|
import { Icon, Label, Select } from '@viamrobotics/prime-core'
|
|
7
7
|
|
|
8
8
|
const { ...rest } = $props()
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
19
|
<div
|
|
20
|
-
class="bg-extralight border-medium absolute top-0 left-0 z-
|
|
20
|
+
class="bg-extralight border-medium absolute top-0 left-0 z-4 m-2 overflow-y-auto border text-xs"
|
|
21
21
|
use:draggable={{
|
|
22
22
|
bounds: 'body',
|
|
23
23
|
handle: dragElement,
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { Icon, Select } from '@viamrobotics/prime-core'
|
|
4
4
|
import { CameraStream, useRobotClient } from '@viamrobotics/svelte-sdk'
|
|
5
5
|
import { StreamClient } from '@viamrobotics/sdk'
|
|
6
|
-
import { useSettings } from '
|
|
7
|
-
import { usePartID } from '
|
|
8
|
-
import { useEnvironment } from '
|
|
6
|
+
import { useSettings } from '../../../hooks/useSettings.svelte'
|
|
7
|
+
import { usePartID } from '../../../hooks/usePartID.svelte'
|
|
8
|
+
import { useEnvironment } from '../../../hooks/useEnvironment.svelte'
|
|
9
9
|
|
|
10
10
|
interface Resolution {
|
|
11
11
|
width: number
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
</script>
|
|
108
108
|
|
|
109
109
|
<div
|
|
110
|
-
class="bg-extralight border-medium absolute top-0 left-0 z-
|
|
110
|
+
class="bg-extralight border-medium absolute top-0 left-0 z-4 m-2 flex resize-x flex-col overflow-hidden border text-xs"
|
|
111
111
|
style:width="320px"
|
|
112
112
|
style:height="auto !important"
|
|
113
113
|
use:draggable={{
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
<!-- FPS Pill -->
|
|
177
177
|
{#if fps > 0}
|
|
178
178
|
<div
|
|
179
|
-
class="absolute bottom-2 left-2 z-
|
|
179
|
+
class="absolute bottom-2 left-2 z-4 rounded-[3px] bg-black/30 px-1 py-0.5 text-right font-mono text-xs text-white"
|
|
180
180
|
>
|
|
181
181
|
{fps.toFixed(1)}fps
|
|
182
182
|
</div>
|
package/dist/ecs/traits.d.ts
CHANGED
|
@@ -30,11 +30,17 @@ export declare const Center: import("koota").Trait<{
|
|
|
30
30
|
oZ: number;
|
|
31
31
|
theta: number;
|
|
32
32
|
}>;
|
|
33
|
+
export declare const Hover: import("koota").Trait<{
|
|
34
|
+
index: number;
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
z: number;
|
|
38
|
+
}>;
|
|
33
39
|
/**
|
|
34
40
|
* Represents that an entity is composed of many instances, so that the treeview and
|
|
35
41
|
* details panel may display all instances
|
|
36
42
|
*/
|
|
37
|
-
export declare const Instanced: import("koota").
|
|
43
|
+
export declare const Instanced: import("koota").Trait<() => boolean>;
|
|
38
44
|
export declare const Instance: import("koota").Trait<{
|
|
39
45
|
meshID: number;
|
|
40
46
|
instanceID: number;
|
|
@@ -49,7 +55,7 @@ export declare const Color: import("koota").Trait<{
|
|
|
49
55
|
g: number;
|
|
50
56
|
b: number;
|
|
51
57
|
}>;
|
|
52
|
-
export declare const Arrow: import("koota").
|
|
58
|
+
export declare const Arrow: import("koota").Trait<() => boolean>;
|
|
53
59
|
export declare const Positions: import("koota").Trait<() => Float32Array<ArrayBuffer>>;
|
|
54
60
|
export declare const Colors: import("koota").Trait<() => Uint8Array<ArrayBuffer>>;
|
|
55
61
|
export declare const Instances: import("koota").Trait<{
|
|
@@ -61,7 +67,7 @@ export declare const Arrows: import("koota").Trait<{
|
|
|
61
67
|
/**
|
|
62
68
|
* Render entity as points
|
|
63
69
|
*/
|
|
64
|
-
export declare const Points: import("koota").
|
|
70
|
+
export declare const Points: import("koota").Trait<() => boolean>;
|
|
65
71
|
/**
|
|
66
72
|
* A box, in mm
|
|
67
73
|
*/
|
|
@@ -108,15 +114,16 @@ export declare const Scale: import("koota").Trait<{
|
|
|
108
114
|
y: number;
|
|
109
115
|
z: number;
|
|
110
116
|
}>;
|
|
111
|
-
export declare const FramesAPI: import("koota").
|
|
112
|
-
export declare const GeometriesAPI: import("koota").
|
|
113
|
-
export declare const DrawAPI: import("koota").
|
|
114
|
-
export declare const WorldStateStoreAPI: import("koota").
|
|
115
|
-
export declare const SnapshotAPI: import("koota").
|
|
117
|
+
export declare const FramesAPI: import("koota").Trait<() => boolean>;
|
|
118
|
+
export declare const GeometriesAPI: import("koota").Trait<() => boolean>;
|
|
119
|
+
export declare const DrawAPI: import("koota").Trait<() => boolean>;
|
|
120
|
+
export declare const WorldStateStoreAPI: import("koota").Trait<() => boolean>;
|
|
121
|
+
export declare const SnapshotAPI: import("koota").Trait<() => boolean>;
|
|
116
122
|
/**
|
|
117
123
|
* Marker trait for entities created from user-dropped files (PLY, PCD, etc.)
|
|
118
124
|
*/
|
|
119
|
-
export declare const DroppedFile: import("koota").
|
|
125
|
+
export declare const DroppedFile: import("koota").Trait<() => boolean>;
|
|
126
|
+
export declare const ShowAxesHelper: import("koota").Trait<() => boolean>;
|
|
120
127
|
/**
|
|
121
128
|
* Point size, in mm
|
|
122
129
|
*/
|
|
@@ -125,12 +132,12 @@ export declare const PointSize: import("koota").Trait<() => number>;
|
|
|
125
132
|
* Line width, in mm
|
|
126
133
|
*/
|
|
127
134
|
export declare const LineWidth: import("koota").Trait<() => number>;
|
|
128
|
-
export declare const ReferenceFrame: import("koota").
|
|
135
|
+
export declare const ReferenceFrame: import("koota").Trait<() => boolean>;
|
|
129
136
|
/**
|
|
130
137
|
* This entity can be safetly removed from the scene by the user
|
|
131
138
|
*/
|
|
132
|
-
export declare const Removable: import("koota").
|
|
133
|
-
export declare const Geometry: (geometry: ViamGeometry) => import("koota").
|
|
139
|
+
export declare const Removable: import("koota").Trait<() => boolean>;
|
|
140
|
+
export declare const Geometry: (geometry: ViamGeometry) => import("koota").Trait<() => boolean> | [import("koota").Trait<{
|
|
134
141
|
x: number;
|
|
135
142
|
y: number;
|
|
136
143
|
z: number;
|
package/dist/ecs/traits.js
CHANGED
|
@@ -8,11 +8,17 @@ export const Parent = trait(() => 'world');
|
|
|
8
8
|
export const Pose = trait({ x: 0, y: 0, z: 0, oX: 0, oY: 0, oZ: 1, theta: 0 });
|
|
9
9
|
export const EditedPose = trait({ x: 0, y: 0, z: 0, oX: 0, oY: 0, oZ: 1, theta: 0 });
|
|
10
10
|
export const Center = trait({ x: 0, y: 0, z: 0, oX: 0, oY: 0, oZ: 1, theta: 0 });
|
|
11
|
+
export const Hover = trait({
|
|
12
|
+
index: -1, // Sub-entity index, -1 if not applicable
|
|
13
|
+
x: 0, // World position X in meters
|
|
14
|
+
y: 0, // World position Y in meters
|
|
15
|
+
z: 0, // World position Z in meters
|
|
16
|
+
});
|
|
11
17
|
/**
|
|
12
18
|
* Represents that an entity is composed of many instances, so that the treeview and
|
|
13
19
|
* details panel may display all instances
|
|
14
20
|
*/
|
|
15
|
-
export const Instanced = trait();
|
|
21
|
+
export const Instanced = trait(() => true);
|
|
16
22
|
export const Instance = trait({
|
|
17
23
|
meshID: -1,
|
|
18
24
|
instanceID: -1,
|
|
@@ -23,7 +29,7 @@ export const Opacity = trait(() => 1);
|
|
|
23
29
|
* @default { r: 1, g: 0, b: 0 }
|
|
24
30
|
*/
|
|
25
31
|
export const Color = trait({ r: 0, g: 0, b: 0 });
|
|
26
|
-
export const Arrow = trait();
|
|
32
|
+
export const Arrow = trait(() => true);
|
|
27
33
|
export const Positions = trait(() => new Float32Array());
|
|
28
34
|
export const Colors = trait(() => new Uint8Array());
|
|
29
35
|
export const Instances = trait({
|
|
@@ -35,7 +41,7 @@ export const Arrows = trait({
|
|
|
35
41
|
/**
|
|
36
42
|
* Render entity as points
|
|
37
43
|
*/
|
|
38
|
-
export const Points = trait();
|
|
44
|
+
export const Points = trait(() => true);
|
|
39
45
|
/**
|
|
40
46
|
* A box, in mm
|
|
41
47
|
*/
|
|
@@ -59,15 +65,16 @@ export const GLTF = trait(() => ({
|
|
|
59
65
|
animationName: '',
|
|
60
66
|
}));
|
|
61
67
|
export const Scale = trait({ x: 1, y: 1, z: 1 });
|
|
62
|
-
export const FramesAPI = trait();
|
|
63
|
-
export const GeometriesAPI = trait();
|
|
64
|
-
export const DrawAPI = trait();
|
|
65
|
-
export const WorldStateStoreAPI = trait();
|
|
66
|
-
export const SnapshotAPI = trait();
|
|
68
|
+
export const FramesAPI = trait(() => true);
|
|
69
|
+
export const GeometriesAPI = trait(() => true);
|
|
70
|
+
export const DrawAPI = trait(() => true);
|
|
71
|
+
export const WorldStateStoreAPI = trait(() => true);
|
|
72
|
+
export const SnapshotAPI = trait(() => true);
|
|
67
73
|
/**
|
|
68
74
|
* Marker trait for entities created from user-dropped files (PLY, PCD, etc.)
|
|
69
75
|
*/
|
|
70
|
-
export const DroppedFile = trait();
|
|
76
|
+
export const DroppedFile = trait(() => true);
|
|
77
|
+
export const ShowAxesHelper = trait(() => true);
|
|
71
78
|
// === Shape Properties ===
|
|
72
79
|
/**
|
|
73
80
|
* Point size, in mm
|
|
@@ -77,11 +84,11 @@ export const PointSize = trait(() => 10);
|
|
|
77
84
|
* Line width, in mm
|
|
78
85
|
*/
|
|
79
86
|
export const LineWidth = trait(() => 5);
|
|
80
|
-
export const ReferenceFrame = trait();
|
|
87
|
+
export const ReferenceFrame = trait(() => true);
|
|
81
88
|
/**
|
|
82
89
|
* This entity can be safetly removed from the scene by the user
|
|
83
90
|
*/
|
|
84
|
-
export const Removable = trait();
|
|
91
|
+
export const Removable = trait(() => true);
|
|
85
92
|
export const Geometry = (geometry) => {
|
|
86
93
|
if (geometry.geometryType.case === 'box') {
|
|
87
94
|
return Box(createBox(geometry.geometryType.value));
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { untrack } from 'svelte';
|
|
2
|
-
import { $internal as internal,
|
|
2
|
+
import { $internal as internal, createQuery } from 'koota';
|
|
3
3
|
import { useWorld } from './useWorld';
|
|
4
4
|
export function useQuery(...parameters) {
|
|
5
5
|
const world = useWorld();
|
|
6
|
-
const
|
|
6
|
+
const createdQuery = createQuery(...parameters);
|
|
7
7
|
// Using internals to get the query data.
|
|
8
|
-
const query = world[internal].queriesHashMap.get(hash);
|
|
8
|
+
const query = world[internal].queriesHashMap.get(createdQuery.hash);
|
|
9
9
|
const initialQueryVersion = query?.version;
|
|
10
10
|
let version = $state.raw(0);
|
|
11
|
-
let entities = $state.raw(world.query(
|
|
11
|
+
let entities = $state.raw(world.query(createdQuery));
|
|
12
12
|
$effect(() => {
|
|
13
13
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
14
14
|
version;
|
|
15
15
|
// Compare the initial version to the current version to
|
|
16
16
|
// see it the query has changed.
|
|
17
|
-
const query = world[internal].queriesHashMap.get(hash);
|
|
17
|
+
const query = world[internal].queriesHashMap.get(createdQuery.hash);
|
|
18
18
|
if (query?.version !== initialQueryVersion) {
|
|
19
|
-
entities = world.query(
|
|
19
|
+
entities = world.query(createdQuery);
|
|
20
20
|
}
|
|
21
21
|
return untrack(() => {
|
|
22
|
-
const unsubAdd = world.onQueryAdd(
|
|
23
|
-
entities = world.query(
|
|
22
|
+
const unsubAdd = world.onQueryAdd(createdQuery, () => {
|
|
23
|
+
entities = world.query(createdQuery);
|
|
24
24
|
});
|
|
25
|
-
const unsubRemove = world.onQueryRemove(
|
|
26
|
-
entities = world.query(
|
|
25
|
+
const unsubRemove = world.onQueryRemove(createdQuery, () => {
|
|
26
|
+
entities = world.query(createdQuery);
|
|
27
27
|
});
|
|
28
28
|
return () => {
|
|
29
29
|
unsubAdd();
|
|
@@ -149,7 +149,7 @@ export const provideDrawAPI = () => {
|
|
|
149
149
|
if (frame.geometry) {
|
|
150
150
|
entityTraits.push(geometryTrait());
|
|
151
151
|
}
|
|
152
|
-
entityTraits.push(traits.Name(name), traits.Pose(pose), traits.DrawAPI, traits.ReferenceFrame, traits.Removable);
|
|
152
|
+
entityTraits.push(traits.Name(name), traits.Pose(pose), traits.DrawAPI, traits.ReferenceFrame, traits.Removable, traits.ShowAxesHelper);
|
|
153
153
|
const entity = world.spawn(...entityTraits);
|
|
154
154
|
entities.set(name, entity);
|
|
155
155
|
}
|
|
@@ -9,7 +9,7 @@ import { useResourceByName } from './useResourceByName.svelte';
|
|
|
9
9
|
import { traits, useWorld } from '../ecs';
|
|
10
10
|
import {} from 'koota';
|
|
11
11
|
import { createPose } from '../transform';
|
|
12
|
-
import { RefetchRates } from '../components/RefreshRate.svelte';
|
|
12
|
+
import { RefetchRates } from '../components/overlay/left-pane/RefreshRate.svelte';
|
|
13
13
|
import { useEnvironment } from './useEnvironment.svelte';
|
|
14
14
|
const key = Symbol('geometries-context');
|
|
15
15
|
const colorUtil = new Color();
|
|
@@ -3,6 +3,7 @@ import type { Entity } from 'koota';
|
|
|
3
3
|
export declare const useObjectEvents: (entity: () => Entity | undefined) => {
|
|
4
4
|
readonly visible: boolean;
|
|
5
5
|
onpointerenter: (event: IntersectionEvent<MouseEvent>) => void;
|
|
6
|
+
onpointermove: (event: IntersectionEvent<MouseEvent>) => void;
|
|
6
7
|
onpointerleave: (event: IntersectionEvent<MouseEvent>) => void;
|
|
7
8
|
ondblclick: (event: IntersectionEvent<MouseEvent>) => void;
|
|
8
9
|
onpointerdown: (event: IntersectionEvent<MouseEvent>) => void;
|