File size: 744 Bytes
8766bc5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<script lang="ts">
	export let text: string;
	export let x: number;
	export let y: number;
	export let color: string;

	let w: number;
	let h: number;
</script>

<div
	bind:offsetWidth={w}
	bind:offsetHeight={h}
	style="
		top: {y - h / 2}px;
		left: {x - w - 7}px;"
>
	<span style="background: {color}" />
	{text}
</div>

<style>
	div {
		display: flex;
		position: absolute;
		justify-content: center;
		align-items: center;
		border-radius: var(--radius-sm);
		background-color: rgba(0, 0, 0, 0.8);
		padding: var(--size-1) 0.4rem;
		color: white;
		font-size: var(--text-sm);
	}

	span {
		display: inline-block;
		margin-right: var(--size-1);
		border-radius: var(--radius-xs);
		width: var(--size-3);
		height: var(--size-3);
	}
</style>