diff options
| author | Mistivia <i@mistivia.com> | 2025-02-20 13:26:43 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-02-20 13:26:43 +0800 |
| commit | 2ebdfe109bbff27b35a5e9ae208dabddd266191e (patch) | |
| tree | ed63233177008c7bef134606fbf0254754e91fb2 /src/components/card_thumb.svelte | |
| parent | a7488d695b3f647d657f6b3482d5333e1e869771 (diff) | |
change project layout
Diffstat (limited to 'src/components/card_thumb.svelte')
| -rw-r--r-- | src/components/card_thumb.svelte | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/components/card_thumb.svelte b/src/components/card_thumb.svelte new file mode 100644 index 0000000..8e701ea --- /dev/null +++ b/src/components/card_thumb.svelte @@ -0,0 +1,33 @@ +<script lang="js"> + + import { setLeftPanelCard } from '../left_panel'; + import { cardImageUrl } from '../utils'; + + let {id, area, idx} = $props(); + + function onhover() { + setLeftPanelCard(id); + } + + function onDragStart(e) { + e.dataTransfer.setData('text', JSON.stringify({id, area, idx})) + } + +</script> + +{#if id} + <img + style="margin:2px;" + draggable="true" + onmouseover={onhover} + onfocus={onhover} + ondragstart={onDragStart} + height="100%" + src={cardImageUrl(id)} + alt="yugioh card {id}" + /> +{/if} + +<style> + +</style> |
