UI优化
This commit is contained in:
16
src/util.js
16
src/util.js
@@ -33,7 +33,7 @@ export function renderScores(ctx, arrows = []) {
|
||||
item.ring,
|
||||
18,
|
||||
"#fed847",
|
||||
30 + (i % 9) * 30,
|
||||
29.5 + (i % 9) * 30,
|
||||
310 + Math.ceil((i + 1) / 9) * 30,
|
||||
"center"
|
||||
);
|
||||
@@ -171,22 +171,22 @@ export function generateCanvasImage(canvasId, type, user, data) {
|
||||
} else if (type == 3) {
|
||||
titleImage = "../static/practise-two-title.png";
|
||||
}
|
||||
ctx.drawImage(titleImage, (width - 160) / 2 - 5, 160, 160, 40);
|
||||
ctx.drawImage(titleImage, (width - 160) / 2, 160, 160, 40);
|
||||
const subTitleWidth = ctx.measureText(subTitle).width;
|
||||
renderText(
|
||||
ctx,
|
||||
subTitle,
|
||||
18,
|
||||
"#fff",
|
||||
width / 2 - subTitleWidth - (type > 1 ? 15 : 13),
|
||||
width / 2 - subTitleWidth - (type > 1 ? 15 : 9),
|
||||
220
|
||||
);
|
||||
renderText(ctx, "共", 14, "#fff", 124, 300);
|
||||
renderText(ctx, "共", 14, "#fff", 122, 300);
|
||||
const totalRing = data.arrows.reduce((last, next) => last + next.ring, 0);
|
||||
renderText(ctx, totalRing, 14, "#fed847", 150, 300, "center");
|
||||
renderText(ctx, "环", 14, "#fff", 163, 300);
|
||||
renderLine(ctx, 80);
|
||||
renderLine(ctx, 187);
|
||||
renderText(ctx, totalRing, 14, "#fed847", 148, 300, "center");
|
||||
renderText(ctx, "环", 14, "#fff", 161, 300);
|
||||
renderLine(ctx, 77);
|
||||
renderLine(ctx, 185);
|
||||
renderScores(ctx, data.arrows);
|
||||
ctx.drawImage(
|
||||
"../static/device-icon.png",
|
||||
|
||||
Reference in New Issue
Block a user