Wait for fonts to load

This commit is contained in:
Dylan Pizzo
2025-01-07 23:07:20 -08:00
parent 03fff8576e
commit 7a752a92cb
6 changed files with 48 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
import { drawCard, loadImages } from "../draw.ts";
import { drawCard, loadImages, loadFonts } from "../draw.ts";
import { DominionCard } from "../types.ts";
const sizeMap = {
@@ -19,9 +19,9 @@ export const Card = (props: {card: DominionCard}) => {
if (canvasElement) {
const context = canvasElement.getContext("2d");
if (context) {
await loadFonts();
await loadImages();
// await loadFonts();
drawCard(context, card);
await drawCard(context, card);
}
}
}}></canvas>