File size: 1,994 Bytes
6ce4ca6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<script lang="ts">
	import { Root, Container } from "threlte-uikit";
	import { T } from "@threlte/core";
	import { Billboard, interactivity } from "@threlte/extras";
	import ConnectionFlowBoxUIkit from "./ConnectionFlowBoxUIkit.svelte";
	import type { Robot } from "$lib/elements/robot/Robot.svelte.js";

	interface Props {
		robot: Robot;
		visible: boolean;
		onInputBoxClick: (robot: Robot) => void;
		onRobotBoxClick: (robot: Robot) => void;
		onOutputBoxClick: (robot: Robot) => void;
		offset?: number;
	}

	let {
		robot,
		visible = true,
		onInputBoxClick,
		onRobotBoxClick,
		onOutputBoxClick,
		offset = 0.26
	}: Props = $props();

	interactivity();
</script>

{#if visible}
	<T.Group
		position.z={0.35}
		rotation={[Math.PI / 2, 0, 0]}
		scale={[0.12, 0.12, 0.12]}
		padding={10}
		pointerEvents="listener"
	>
		<Billboard>
			<Root name={`robot-status-billboard-${robot.id}`}>
				<Container
					width="100%"
					height="100%"
					alignItems="center"
					justifyContent="center"
					padding={20}
				>
					<ConnectionFlowBoxUIkit {robot} {onInputBoxClick} {onRobotBoxClick} {onOutputBoxClick} />
				</Container>
			</Root>
		</Billboard>

		<!-- <Billboard>
		<HTML
			transform
			autoRender={true}
			center={true}
			distanceFactor={3}
			pointerEvents="auto"
			style="
				pointer-events: auto !important;
				image-rendering: auto;
				image-rendering: smooth;
				text-rendering: optimizeLegibility;
				-webkit-font-smoothing: subpixel-antialiased;
				-moz-osx-font-smoothing: auto;
				backface-visibility: hidden;
				transform-style: preserve-3d;
				will-change: transform;
			"
		>
			<div
				class="pointer-events-auto select-none"
				style="pointer-events: auto !important;"
				in:scale={{ duration: 200, start: 0.5 }}
			>
				{#if showManualControl}
					<ManualControlBox {robot} {robotStatus} {onBoxClick} />
				{:else}
					<ConnectionFlowBox {robot} {robotStatus} {onBoxClick} />
				{/if}
			</div>
		</HTML>
	</Billboard> -->
	</T.Group>
{/if}