File size: 983 Bytes
70b8e47
32561d8
 
 
70b8e47
304976c
32561d8
70b8e47
7cb7420
e5b9b7e
 
7cb7420
70b8e47
 
304976c
e5b9b7e
7cb7420
70b8e47
304976c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70b8e47
 
e5b9b7e
 
 
 
70b8e47
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
<script lang="ts">
	import type { ZoomTransform } from 'd3-zoom';

	export let transform: ZoomTransform;
	export let color = '';
	export let emoji = '';
	export let position = { x: 0, y: 0 };

	$: coord = {
		x: transform.applyX(position.x),
		y: transform.applyY(position.y)
	};
</script>

<div
	class="cursor"
	style={`transform: translateX(${coord.x}px) translateY(${coord.y}px) scale(${transform.k});`}
>
	<svg
		class="block z-0 col-span-2 row-span-2"
		width="40"
		viewBox="0 0 15 15"
		fill="currentColor"
		xmlns="http://www.w3.org/2000/svg"
	>
		<path
			d="M0.91603 0.916054L7.09131 14.9234L8.89871 8.89873L14.9234 7.09133L0.91603 0.916054Z"
			fill="#FFB800"
		/>
	</svg>
	<div
		class="absolute right-0 text-4xl col-start-2 row-start-2"
		style={`text-shadow: 0px 5px 5px ${color}`}
	>
		{emoji}
	</div>
</div>

<style lang="postcss" scoped>
	.cursor {
		@apply absolute top-0 left-0 grid grid-cols-3 touch-none pointer-events-none;
		transform-origin: 0 0;
	}
</style>