Bubble or stop hover events depending on if the card button is visible.

This commit is contained in:
Oliver Akins 2022-07-25 23:54:59 -06:00
parent b44417084c
commit dd3662560d
No known key found for this signature in database
GPG key ID: 3C2014AF9457AF99

View file

@ -1,13 +1,27 @@
<script lang="ts">
import { createEventDispatcher } from "svelte";
import Card from "./Card.svelte";
import { hand } from "../stores";
const emit = createEventDispatcher();
let canChooseFuel = true;
// Prevent rendering of a board preview when the player isn't allowed to select
// a card.
function filterHoverEvents(e: any) {
if (canChooseFuel) {
emit(`hover`, e.detail);
};
};
</script>
<div id="hand">
{#each $hand as card (card.symbol)}
<Card
on:hover="{filterHoverEvents}"
hidden="{false}"
button="{canChooseFuel}"
{card}
/>
{/each}