refactor: relocate constants in screen stores

This commit is contained in:
2026-01-31 00:52:56 +01:00
parent 962b075837
commit 7d90166eb7
13 changed files with 74 additions and 90 deletions

View File

@@ -56,6 +56,28 @@ export const fillTextHCenteredMultiline = (
}
};
export const CHECKBOX_SIZE = 7;
export const CHECKBOX_TEXT_GAP = 5;
export const drawCheckbox = (
ctx: CanvasRenderingContext2D,
x: number,
y: number,
checked: boolean,
) => {
ctx.fillRect(x, y, CHECKBOX_SIZE, 1);
ctx.fillRect(x, y + CHECKBOX_SIZE - 1, CHECKBOX_SIZE, 1);
ctx.fillRect(x, y + 1, 1, CHECKBOX_SIZE - 2);
ctx.fillRect(x + CHECKBOX_SIZE - 1, y + 1, 1, CHECKBOX_SIZE - 2);
if (checked) {
for (let i = 2; i < CHECKBOX_SIZE - 2; i++) {
ctx.fillRect(x + i, y + i, 1, 1);
ctx.fillRect(x + CHECKBOX_SIZE - 1 - i, y + i, 1, 1);
}
}
};
export const fillTextWordWrapped = (
ctx: CanvasRenderingContext2D,
text: string,