fix(nds): remove all top baselines
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user