Commit 31963fed by doszhang

dos

parent bb1d8f7d
......@@ -867,11 +867,12 @@ function flagNoDraw(ctx, content, fontsize, color, x, y) {
function flagTextDraw(ctx, content, fontsize, color, x, y) {
let length = calculateStringLength(content);
let lineTop = 0;
if (length <= 28) {
ctx.font = fontsize + 'px normal';
ctx.fillStyle = color;
ctx.fillText(content, x, y);
lineTop = y + 20;
} else {
let lineArr = [];
let lineNo = 0;
......@@ -883,8 +884,12 @@ function flagTextDraw(ctx, content, fontsize, color, x, y) {
ctx.fillStyle = color;
ctx.fillText(lineArr[i], x, y + (lineNo * (fontsize + 10)));
lineNo++;
if (i == lineArr.length - 1) {
lineTop = y + (lineNo * (fontsize + 10)) + 20;
}
}
}
return lineTop
}
function calculateStringLength(str) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment