@viamrobotics/motion-tools 1.15.1 → 1.15.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.
@@ -93,7 +93,6 @@
93
93
  isOpen
94
94
  exitable={false}
95
95
  title="Lasso"
96
- strategy="absolute"
97
96
  defaultSize={{ width: 445, height: 100 }}
98
97
  defaultPosition={{ x: rect.width / 2 - 200, y: rect.height - 10 - 100 }}
99
98
  >
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte'
3
3
 
4
+ import { useThrelte } from '@threlte/core'
4
5
  import { Icon } from '@viamrobotics/prime-core'
5
6
  import * as floatingPanel from '@zag-js/floating-panel'
6
7
  import { normalizeProps, useMachine } from '@zag-js/svelte'
@@ -12,7 +13,6 @@
12
13
  exitable?: boolean
13
14
  resizable?: boolean
14
15
  persistRect?: boolean
15
- strategy?: 'absolute' | 'fixed'
16
16
  isOpen?: boolean
17
17
  children: Snippet
18
18
  }
@@ -20,10 +20,7 @@
20
20
  let {
21
21
  title = '',
22
22
  defaultSize = { width: 700, height: 500 },
23
- defaultPosition = {
24
- x: globalThis.innerWidth / 2 - defaultSize.width / 2,
25
- y: globalThis.innerHeight / 2 - defaultSize.height / 2,
26
- },
23
+ defaultPosition,
27
24
  exitable = true,
28
25
  resizable = false,
29
26
  persistRect = true,
@@ -32,13 +29,19 @@
32
29
  ...props
33
30
  }: Props = $props()
34
31
 
32
+ const { dom } = useThrelte()
33
+
35
34
  const id = $props.id()
36
35
  const floatingPanelService = useMachine(floatingPanel.machine, () => ({
37
36
  id,
38
37
  defaultSize,
39
- defaultPosition,
38
+ defaultPosition: defaultPosition ?? {
39
+ x: dom.clientWidth / 2 - defaultSize.width / 2 + dom.clientLeft,
40
+ y: dom.clientHeight / 2 - defaultSize.width / 2 + dom.clientTop,
41
+ },
40
42
  resizable,
41
43
  allowOverflow: false,
44
+ strategy: 'absolute' as const,
42
45
  persistRect,
43
46
  open: isOpen,
44
47
  ...props,
@@ -12,7 +12,6 @@ interface Props {
12
12
  exitable?: boolean;
13
13
  resizable?: boolean;
14
14
  persistRect?: boolean;
15
- strategy?: 'absolute' | 'fixed';
16
15
  isOpen?: boolean;
17
16
  children: Snippet;
18
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/motion-tools",
3
- "version": "1.15.1",
3
+ "version": "1.15.2",
4
4
  "description": "Motion visualization with Viam",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",