fix(nds): remove all top baselines

This commit is contained in:
2026-02-27 02:03:48 +01:00
parent 6dcf03a38a
commit 6264ad41f8
20 changed files with 57 additions and 71 deletions

View File

@@ -72,7 +72,11 @@ export const fillImageTextHCentered = (
const groupX = Math.floor(x + width / 2 - totalWidth / 2);
image.draw(ctx, groupX, y);
ctx.fillText(text, groupX + gap + image.rect.width, y);
ctx.fillText(
text,
groupX + gap + image.rect.width,
y + (ctx.font === "10px NDS10" ? 9 : 7),
);
};
export const fillTextHCentered = (
@@ -96,8 +100,8 @@ export const fillTextHCenteredMultiline = (
lineHeight: number,
) => {
const lines = text.split("\n");
for (let i = 0, y = 20; i < lines.length; i += 1, y += lineHeight) {
fillTextHCentered(ctx, lines[i]!, 0, y, width);
for (let i = 0; i < lines.length; i += 1, y += lineHeight) {
fillTextHCentered(ctx, lines[i]!, x, y, width);
}
};
@@ -237,11 +241,10 @@ export const drawButton = (
0,
);
ctx.textBaseline = "top";
ctx.font = "10px NDS10";
ctx.fillStyle = "#494118";
fillTextHCentered(ctx, text, 1, 4, width);
fillTextHCentered(ctx, text, 1, 4 + 9, width);
ctx.restore();
};