Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions components/painter/lib/pen.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,20 @@ export default class Painter {
// 取出文字
let text = subView.text.substr(start, alreadyCount - start);

if (text === "") {
// 重置数据
start = alreadyCount;
leftWidth -= currentUsedWidth;
x += currentUsedWidth;
// 如果剩余宽度 小于等于0 或者小于一个字的平均宽度,换行
if (leftWidth <= 0 || leftWidth < preWidth) {
leftWidth = width;
x = staticX;
lineIndex++;
}
continue
}

const y = -(height / 2) + subView.css.fontSize.toPx() + lineIndex * lineHeight;

// 设置文字样式
Expand Down