File size: 884 Bytes
70b8e47
 
1d701d3
 
 
70b8e47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1d701d3
70b8e47
 
1d701d3
70b8e47
 
 
 
 
 
 
 
 
 
 
 
 
1d701d3
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
<script lang="ts">
	import { spring } from 'svelte/motion';
	import type { ZoomTransform } from 'd3-zoom';

	export let transform: ZoomTransform;

	export let color = '';
	export let x = 0;
	export let y = 0;

	// Spring animation for cursor
	const coords = spring(
		{ x, y },
		{
			stiffness: 0.07,
			damping: 0.35
		}
	);
	// Update spring when x and y change
	$: coords.set({ x, y });
</script>

<svg
	class="block cursor z-0"
	fill="none"
	height="36"
	style={`transform: translateX(${$coords.x}px) translateY(${$coords.y}px) scale(${transform.k})`}
	viewBox="0 0 24 36"
	width="24"
	xmlns="http://www.w3.org/2000/svg"
>
	<path
		d="M5.65376 12.3673H5.46026L5.31717 12.4976L0.500002 16.8829L0.500002 1.19841L11.7841 12.3673H5.65376Z"
		fill={color}
	/>
</svg>

<style lang="postcss" scoped>
	.cursor {
		@apply absolute top-0 left-0;
		/* transform-origin: 0 0; */
	}
</style>