Align grid numbers.

This commit is contained in:
yukirij 2024-09-05 23:52:28 -07:00
parent 010713f503
commit 69af74102d

View File

@ -599,23 +599,25 @@ const INTERFACE = {
ctx.fillText(letters[i + 5], x, y); ctx.fillText(letters[i + 5], x, y);
} }
let number_offset_x = -1.15 * radius;
let number_offset_y = -0.75 * gui_scale;
ctx.textAlign = "center"; ctx.textAlign = "center";
for(let i = 0; i < 5; ++i) { for(let i = 0; i < 5; ++i) {
let x = basis_x - (1.15 * radius); let y = basis_y - (gui_scale * 2 * i);
let y = basis_y - (gui_scale * (0.75 + (2 * i)));
ctx.save(); ctx.save();
ctx.translate(x, y); ctx.translate(basis_x + number_offset_x, y + number_offset_y);
ctx.rotate(-Math.PI / 3); ctx.rotate(-Math.PI / 3);
ctx.fillText(numbers[i], 0, 0); ctx.fillText(numbers[i], 0, 0);
ctx.restore(); ctx.restore();
} }
for(let i = 0; i < 4; ++i) { for(let i = 0; i < 4; ++i) {
let x = basis_x + (1.5 * radius * (i + 0.25)); let x = basis_x + (1.5 * radius * (1 + i));
let y = basis_y - (gui_scale * (9.75 + i)); let y = basis_y - (gui_scale * (9 + i));
ctx.save(); ctx.save();
ctx.translate(x, y); ctx.translate(x + number_offset_x, y + number_offset_y);
ctx.rotate(-Math.PI / 3); ctx.rotate(-Math.PI / 3);
ctx.fillText(numbers[i + 5], 0, 0); ctx.fillText(numbers[i + 5], 0, 0);
ctx.restore(); ctx.restore();