enh: drag ghost

This commit is contained in:
Timothy J. Baek
2024-10-14 23:55:50 -07:00
parent cf24a65caa
commit 73a251fc49
2 changed files with 91 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
<script lang="ts">
import { onDestroy, onMount } from 'svelte';
export let x;
export let y;
let popupElement = null;
onMount(() => {
document.body.appendChild(popupElement);
document.body.style.overflow = 'hidden';
});
onDestroy(() => {
document.body.removeChild(popupElement);
document.body.style.overflow = 'unset';
});
</script>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
bind:this={popupElement}
class=" absolute text-white z-[99999]"
style="top: {y}px; left: {x}px;"
>
<slot></slot>
</div>