fix(nds): use fillTextHCentered instead of fillTextCentered (caused alignment issues in different langs)

This commit is contained in:
2026-02-26 20:01:09 +01:00
parent ec75f4777b
commit 4141580ac1
2 changed files with 6 additions and 8 deletions

View File

@@ -87,11 +87,11 @@ onRender((ctx) => {
// gallery // gallery
ctx.font = "7px NDS7"; ctx.font = "7px NDS7";
ctx.fillStyle = pressed.value === "gallery" ? "#2c2c2c" : "#282828"; ctx.fillStyle = pressed.value === "gallery" ? "#2c2c2c" : "#282828";
fillTextCentered( fillTextHCentered(
ctx, ctx,
$t("home.photoGallery"), $t("home.photoGallery"),
132, 132,
78 + getButtonOffset("gallery"), 85 + getButtonOffset("gallery"),
87, 87,
); );
@@ -127,12 +127,12 @@ onRender((ctx) => {
140, 140,
); );
} }
ctx.textBaseline = "alphabetic"; ctx.textBaseline = "top";
// gba thing // gba thing
ctx.font = "10px NDS10"; ctx.font = "10px NDS10";
ctx.fillStyle = "#a2a2a2"; ctx.fillStyle = "#a2a2a2";
fillTextCentered(ctx, $t("home.greeting"), 79, 135, 140); fillTextHCentered(ctx, $t("home.greeting"), 79, 137, 140);
}); });
</script> </script>

View File

@@ -201,13 +201,11 @@ onRender((ctx) => {
ctx.font = "10px NDS10"; ctx.font = "10px NDS10";
ctx.fillStyle = "#000000"; ctx.fillStyle = "#000000";
ctx.letterSpacing = "0px"; ctx.letterSpacing = "0px";
fillTextCentered( fillTextHCentered(
ctx, ctx,
props.title, props.title,
props.x + 1, props.x + 1,
// TODO: -10 is needed because fillTextCentered isn't using top baseline Y + ARROW_IMAGE_HEIGHT * 2 + SQUARE_HEIGHT + 3,
// i will change that in the future (maybe)
Y + ARROW_IMAGE_HEIGHT * 2 + SQUARE_HEIGHT - 6,
downImage.value.rect.width, downImage.value.rect.width,
); );
}, 10); }, 10);