@viamrobotics/motion-tools 1.12.0 → 1.12.2
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/FileDrop/file-dropper.d.ts +1 -1
- package/dist/components/Lasso/Lasso.svelte +4 -2
- package/dist/components/Lasso/Tool.svelte +14 -2
- package/dist/components/overlay/FloatingPanel.svelte +3 -2
- package/dist/components/overlay/FloatingPanel.svelte.d.ts +1 -0
- package/dist/loaders/pcd/index.d.ts +1 -1
- package/dist/loaders/pcd/index.js +4 -1
- package/dist/loaders/pcd/messages.d.ts +9 -0
- package/dist/loaders/pcd/messages.js +1 -0
- package/dist/loaders/pcd/worker.d.ts +1 -9
- package/dist/loaders/pcd/worker.inline.d.ts +1 -0
- package/dist/loaders/pcd/worker.inline.js +3580 -0
- package/package.json +5 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Snapshot } from '../../buf/draw/v1/snapshot_pb';
|
|
2
|
-
import type { SuccessMessage } from '../../loaders/pcd/
|
|
2
|
+
import type { SuccessMessage } from '../../loaders/pcd/messages';
|
|
3
3
|
import type { BufferGeometry } from 'three';
|
|
4
4
|
interface FileDropSuccess {
|
|
5
5
|
success: true;
|
|
@@ -39,8 +39,10 @@
|
|
|
39
39
|
const point = new Vector3()
|
|
40
40
|
|
|
41
41
|
const raycast = (event: PointerEvent) => {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const element = event.target as HTMLElement
|
|
43
|
+
const rect = element.getBoundingClientRect()
|
|
44
|
+
mouse.x = ((event.clientX - rect.left) / rect.width) * 2 - 1
|
|
45
|
+
mouse.y = -((event.clientY - rect.top) / rect.height) * 2 + 1
|
|
44
46
|
|
|
45
47
|
raycaster.setFromCamera(mouse, camera.current)
|
|
46
48
|
raycaster.ray.intersectPlane(plane, point)
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
import { BufferGeometryUtils } from 'three/examples/jsm/Addons.js'
|
|
11
11
|
import { createBinaryPCD } from '../../pcd'
|
|
12
12
|
import type { BufferGeometry } from 'three'
|
|
13
|
+
import { useThrelte } from '@threlte/core'
|
|
14
|
+
import { ElementRect } from 'runed'
|
|
13
15
|
|
|
14
16
|
interface Props {
|
|
15
17
|
/** Whether to auto-enable lasso mode when the component mounts */
|
|
@@ -21,6 +23,7 @@
|
|
|
21
23
|
|
|
22
24
|
let { enabled = false, onSelection }: Props = $props()
|
|
23
25
|
|
|
26
|
+
const { dom } = useThrelte()
|
|
24
27
|
const world = useWorld()
|
|
25
28
|
const settings = useSettings()
|
|
26
29
|
const isLassoMode = $derived(settings.current.interactionMode === 'lasso')
|
|
@@ -51,11 +54,19 @@
|
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
|
|
57
|
+
$effect(() => {
|
|
58
|
+
if (isLassoMode) {
|
|
59
|
+
settings.current.cameraMode = 'orthographic'
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
|
|
54
63
|
$effect(() => {
|
|
55
64
|
if (enabled) {
|
|
56
65
|
settings.current.interactionMode = 'lasso'
|
|
57
66
|
}
|
|
58
67
|
})
|
|
68
|
+
|
|
69
|
+
const rect = new ElementRect(() => dom)
|
|
59
70
|
</script>
|
|
60
71
|
|
|
61
72
|
<Portal id="dashboard">
|
|
@@ -71,7 +82,7 @@
|
|
|
71
82
|
</fieldset>
|
|
72
83
|
</Portal>
|
|
73
84
|
|
|
74
|
-
{#if isLassoMode}
|
|
85
|
+
{#if isLassoMode && rect.height > 0 && rect.width > 0}
|
|
75
86
|
<Lasso />
|
|
76
87
|
|
|
77
88
|
<Portal id="dom">
|
|
@@ -79,8 +90,9 @@
|
|
|
79
90
|
isOpen
|
|
80
91
|
exitable={false}
|
|
81
92
|
title="Lasso"
|
|
93
|
+
strategy="absolute"
|
|
82
94
|
defaultSize={{ width: 445, height: 100 }}
|
|
83
|
-
defaultPosition={{ x:
|
|
95
|
+
defaultPosition={{ x: rect.width / 2 - 200, y: rect.height - 10 - 100 }}
|
|
84
96
|
>
|
|
85
97
|
<div class="flex items-center gap-4 p-4 text-xs">
|
|
86
98
|
Shift + click and drag to make a lasso selection.
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
defaultSize?: { width: number; height: number }
|
|
11
11
|
defaultPosition?: { x: number; y: number }
|
|
12
12
|
exitable?: boolean
|
|
13
|
+
strategy?: 'absolute' | 'fixed'
|
|
13
14
|
isOpen?: boolean
|
|
14
15
|
children: Snippet
|
|
15
16
|
}
|
|
@@ -17,20 +18,20 @@
|
|
|
17
18
|
let {
|
|
18
19
|
title = '',
|
|
19
20
|
defaultSize = { width: 700, height: 500 },
|
|
20
|
-
defaultPosition,
|
|
21
21
|
exitable = true,
|
|
22
22
|
isOpen = $bindable(false),
|
|
23
23
|
children,
|
|
24
|
+
...props
|
|
24
25
|
}: Props = $props()
|
|
25
26
|
|
|
26
27
|
const id = $props.id()
|
|
27
28
|
const floatingPanelService = useMachine(floatingPanel.machine, () => ({
|
|
28
29
|
id,
|
|
29
30
|
defaultSize,
|
|
30
|
-
defaultPosition,
|
|
31
31
|
resizable: false,
|
|
32
32
|
allowOverflow: false,
|
|
33
33
|
open: isOpen,
|
|
34
|
+
...props,
|
|
34
35
|
}))
|
|
35
36
|
|
|
36
37
|
const api = $derived(floatingPanel.connect(floatingPanelService, normalizeProps))
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { SuccessMessage } from './
|
|
1
|
+
import type { SuccessMessage } from './messages';
|
|
2
2
|
export declare const parsePcdInWorker: (data: Uint8Array<ArrayBufferLike>) => Promise<SuccessMessage>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { workerCode } from './worker.inline';
|
|
2
|
+
const blob = new Blob([workerCode], { type: 'text/javascript' });
|
|
3
|
+
const url = URL.createObjectURL(blob);
|
|
4
|
+
const worker = new Worker(url);
|
|
2
5
|
let requestId = 0;
|
|
3
6
|
const pending = new Map();
|
|
4
7
|
worker.addEventListener('message', (event) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|