Commit fbd27c9d by doszhang

dos

parent e62d7b36
......@@ -396,7 +396,7 @@ function drawFlagItem(initialPosition) {
for (let i = 0; i < flagStack.length; i++) {
let top = initialPosition + $(nodeList[i]).offset().top;
posterCtx.drawImage(noBg, pxToRem(105), top, pxToRem(44), pxToRem(39));
flagNoDraw(posterCtx, i + 1, 14, 'normal', '#222222', pxToRem(129), top + pxToRem(28));
flagNoDraw(posterCtx, i + 1, 14, '#222222', pxToRem(129), top + pxToRem(28));
}
}
}
......@@ -853,7 +853,7 @@ function pxToRem(px) {
return (px / 20) * fontSize;
}
function flagNoDraw(ctx, content, fontsize, fontweight, color, x, y) {
function flagNoDraw(ctx, content, fontsize, color, x, y) {
ctx.font = fontsize + 'px normal';
console.log(fontsize);
......@@ -862,6 +862,20 @@ function flagNoDraw(ctx, content, fontsize, fontweight, color, x, y) {
ctx.fillStyle = color;
ctx.fillText(content, cx, y);
}
flagTextDraw(posterCtx, '测试测试测试测试测试测试测试测试', 12, '#fff', 0, 0);
function flagTextDraw(ctx, content, fontsize, color, x, y) {
let length = calculateStringLength(content);
let lineArr = [];
for (let i = 0; i < content.length; i += 14) {
lineArr.push(content.substr(i, 14));
}
console.log(lineArr);
if (length < 14) {
}
}
function calculateStringLength(str) {
var len = 0; //中英字符长度计数
......
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