refactor: relocate constants in screen stores
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user