File size: 1,866 Bytes
6ce4ca6
 
 
 
 
 
2d0da8c
 
6ce4ca6
 
 
 
 
 
 
2d0da8c
 
6ce4ca6
 
 
 
 
 
 
2d0da8c
 
 
6ce4ca6
 
 
2d0da8c
 
 
 
 
 
 
6ce4ca6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2d0da8c
 
 
 
6ce4ca6
3cdf7b9
 
 
 
 
6ce4ca6
 
 
 
3cdf7b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<script lang="ts">
	import { T } from "@threlte/core";
	import { Billboard, interactivity } from "@threlte/extras";
	import { Root, Container } from "threlte-uikit";
	import ComputeConnectionFlowBoxUIKit from "./ComputeConnectionFlowBoxUIKit.svelte";
	import type { RemoteCompute } from "$lib/elements/compute//RemoteCompute.svelte";
	import { Tween } from "svelte/motion";
	import { cubicOut } from "svelte/easing";	

	interface Props {
		compute: RemoteCompute;
		visible?: boolean;
		onVideoInputBoxClick: (compute: RemoteCompute) => void;
		onRobotInputBoxClick: (compute: RemoteCompute) => void;
		onRobotOutputBoxClick: (compute: RemoteCompute) => void;
		duration?: number;
		delay?: number;
	}

	let {
		compute,
		visible = true,
		onVideoInputBoxClick,
		onRobotInputBoxClick,
		onRobotOutputBoxClick,
		duration = 100,
		delay = 0
	}: Props = $props();

	interactivity();

	const tweenedScale = Tween.of(() => {
		return visible ? 1 : 0;
	}, { duration: duration, easing: cubicOut, delay: delay });
	const tweenedOpacity = Tween.of(() => {
		return visible ? 1 : 0;
	}, { duration: duration, easing: cubicOut, delay: delay });
</script>

<T.Group
	onclick={(e) => e.stopPropagation()}
	position.z={0.4}
	padding={10}
	rotation={[-Math.PI / 2, 0, 0]}
	scale={[0.1, 0.1, 0.1]}
	pointerEvents="listener"
>
	<Billboard>
		<Root name={`compute-status-billboard-${compute.id}`}>
			<Container
				width="100%"
				height="100%"
				alignItems="center"
				justifyContent="center"
				padding={20}
				transformScaleX={tweenedScale.current}
				transformScaleY={tweenedScale.current}
				transformScaleZ={tweenedScale.current}
				opacity={tweenedOpacity.current}
			>
				<ComputeConnectionFlowBoxUIKit
					{compute}
					{onVideoInputBoxClick}
					{onRobotInputBoxClick}
					{onRobotOutputBoxClick}
				/>
			</Container>
		</Root>
	</Billboard>
</T.Group>