Skip to content

Commit afbbc65

Browse files
committed
Merge commit 'e0f65f76d623ff7e2c3d6eed36715f403d8836ea' into dev
2 parents e7e3b58 + e0f65f7 commit afbbc65

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

components/painter/lib/pen.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,11 @@ export default class Painter {
222222
const linesArray = [];
223223
for (let i = 0; i < textArray.length; ++i) {
224224
const textLength = this.ctx.measureText(textArray[i]).width;
225+
const minWidth = view.css.fontSize.toPx() + paddings[1] + paddings[3];
225226
let partWidth = view.css.width ? view.css.width.toPx(false, this.style.width) - paddings[1] - paddings[3] : textLength;
226-
// partWidth = partWidth > fontSize ? partWidth - partWidth % fontSize + fontSize : fontSize
227+
if (partWidth < minWidth) {
228+
partWidth = minWidth;
229+
}
227230
const calLines = Math.ceil(textLength / partWidth);
228231
// 取最长的作为 width
229232
width = partWidth > width ? partWidth : width;

components/painter/painter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ Component({
314314
}, true, this.movingCache);
315315
} else {
316316
// 某些机型(华为 P20)非移动场景下,只绘制一遍会偶然性图片绘制失败,目前采用再绘一遍的方法
317-
if (!isMoving && doView.type === 'image') {
317+
// 文字也会出现
318+
if (!isMoving && (doView.type === 'image' || doView.type === 'text')) {
318319
pen.paint()
319320
}
320321
pen.paint((callbackInfo) => {

0 commit comments

Comments
 (0)