fix: userInfo position
This commit is contained in:
@@ -1207,13 +1207,16 @@ function drawUserBubble(ctx, options) {
|
|||||||
|
|
||||||
// 3️⃣ 绘制文字
|
// 3️⃣ 绘制文字
|
||||||
const textX = avatarX + avatarSize + padding;
|
const textX = avatarX + avatarSize + padding;
|
||||||
const textY = drawY + padding;
|
const totalTextHeight = fontSizeName + fontSizeDesc + 4;
|
||||||
|
const textStartY = drawY + (bubbleHeight - totalTextHeight) / 2;
|
||||||
|
|
||||||
ctx.fillStyle = textColor;
|
ctx.fillStyle = textColor;
|
||||||
ctx.font = `${fontSizeName}px 'PingFang SC'`;
|
ctx.font = `${fontSizeName}px 'PingFang SC'`;
|
||||||
ctx.fillText(username, textX, textY);
|
ctx.fillText(username, textX, textStartY);
|
||||||
|
|
||||||
ctx.font = `${fontSizeDesc}px 'PingFang SC'`;
|
ctx.font = `${fontSizeDesc}px 'PingFang SC'`;
|
||||||
ctx.globalAlpha = 0.6;
|
ctx.globalAlpha = 0.6;
|
||||||
ctx.fillText(desc, textX, textY + fontSizeName + 4);
|
ctx.fillText(desc, textX, textStartY + fontSizeName + 4);
|
||||||
ctx.globalAlpha = 1;
|
ctx.globalAlpha = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user