feat(home): update projects button text and image
This commit is contained in:
@@ -82,6 +82,40 @@ onRender((ctx) => {
|
|||||||
87,
|
87,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// game
|
||||||
|
ctx.font = "10px NDS10";
|
||||||
|
ctx.fillStyle = "#282828";
|
||||||
|
const projectsText = $t("home.projectsAndExperiences");
|
||||||
|
const lines = projectsText.split("\n");
|
||||||
|
|
||||||
|
ctx.textBaseline = "top";
|
||||||
|
|
||||||
|
if (lines.length == 1) {
|
||||||
|
fillTextHCentered(
|
||||||
|
ctx,
|
||||||
|
projectsText,
|
||||||
|
79,
|
||||||
|
42 + getButtonOffset("projects"),
|
||||||
|
140,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
fillTextHCentered(
|
||||||
|
ctx,
|
||||||
|
lines[0]!,
|
||||||
|
82,
|
||||||
|
36 + getButtonOffset("projects"),
|
||||||
|
140,
|
||||||
|
);
|
||||||
|
fillTextHCentered(
|
||||||
|
ctx,
|
||||||
|
lines[1]!,
|
||||||
|
82,
|
||||||
|
36 + getButtonOffset("projects") + 13,
|
||||||
|
140,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
ctx.textBaseline = "alphabetic";
|
||||||
|
|
||||||
// gba thing
|
// gba thing
|
||||||
ctx.font = "10px NDS10";
|
ctx.font = "10px NDS10";
|
||||||
ctx.fillStyle = "#a2a2a2";
|
ctx.fillStyle = "#a2a2a2";
|
||||||
|
|||||||
@@ -13,6 +13,18 @@ export const fillTextCentered = (
|
|||||||
return measure.actualBoundingBoxAscent + measure.actualBoundingBoxDescent + 1;
|
return measure.actualBoundingBoxAscent + measure.actualBoundingBoxDescent + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const fillTextHCentered = (
|
||||||
|
ctx: CanvasRenderingContext2D,
|
||||||
|
text: string,
|
||||||
|
x: number,
|
||||||
|
y: number,
|
||||||
|
width: number,
|
||||||
|
) => {
|
||||||
|
const measure = ctx.measureText(text);
|
||||||
|
const textX = Math.floor(x + width / 2 - measure.actualBoundingBoxRight / 2);
|
||||||
|
ctx.fillText(text, textX, y);
|
||||||
|
};
|
||||||
|
|
||||||
export const fillTextWordWrapped = (
|
export const fillTextWordWrapped = (
|
||||||
ctx: CanvasRenderingContext2D,
|
ctx: CanvasRenderingContext2D,
|
||||||
text: string,
|
text: string,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"home": {
|
"home": {
|
||||||
|
"projectsAndExperiences": "Projects and\nExperiences",
|
||||||
"greeting": "Welcome to my website!",
|
"greeting": "Welcome to my website!",
|
||||||
"photoGallery": "Photo Gallery"
|
"photoGallery": "Photo Gallery"
|
||||||
},
|
},
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 264 B |
Reference in New Issue
Block a user