small fixes

This commit is contained in:
2025-01-06 15:52:40 +01:00
parent b99f1129a9
commit 6b1d3952c5
+11 -6
View File
@@ -122,7 +122,7 @@ let app = {
margin: 0.1, margin: 0.1,
grid: 4, grid: 4,
seed: utils.randomSeed(), seed: utils.randomSeed(),
title: "Bingo", title: "",
color: utils.randomColor(), color: utils.randomColor(),
}, },
data: [], data: [],
@@ -214,12 +214,17 @@ let app = {
ctx.strokeRect(startX, startY, gridSize, gridSize); ctx.strokeRect(startX, startY, gridSize, gridSize);
ctx.fillStyle = this.config.color;
if (this.config.title) { if (this.config.title) {
ctx.font = `bold ${gridSize * 0.1}px serif`; utils.fitText(
ctx.textAlign = "center"; ctx,
ctx.textBaseline = "middle"; startX,
ctx.fillStyle = this.config.color; (height - gridSize) / 4,
ctx.fillText(this.config.title, width / 2, (height - gridSize) / 3); gridSize,
(height - gridSize) / 3,
this.config.title
);
} }
if (this.data.length) { if (this.data.length) {