Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug: 修复inlineText在特定情况下会卡崩开发者工具的bug #398

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
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