fix: 文字放大缩小bug,P20 文字点击消失问题

This commit is contained in:
dongqing 2019-12-27 17:18:45 +08:00
parent 78068111bc
commit e0f65f76d6
2 changed files with 6 additions and 2 deletions

View File

@ -222,8 +222,11 @@ export default class Painter {
const linesArray = [];
for (let i = 0; i < textArray.length; ++i) {
const textLength = this.ctx.measureText(textArray[i]).width;
const minWidth = view.css.fontSize.toPx() + paddings[1] + paddings[3];
let partWidth = view.css.width ? view.css.width.toPx(false, this.style.width) - paddings[1] - paddings[3] : textLength;
// partWidth = partWidth > fontSize ? partWidth - partWidth % fontSize + fontSize : fontSize
if (partWidth < minWidth) {
partWidth = minWidth;
}
const calLines = Math.ceil(textLength / partWidth);
// 取最长的作为 width
width = partWidth > width ? partWidth : width;

View File

@ -314,7 +314,8 @@ Component({
}, true, this.movingCache);
} else {
// 某些机型(华为 P20非移动场景下只绘制一遍会偶然性图片绘制失败目前采用再绘一遍的方法
if (!isMoving && doView.type === 'image') {
// 文字也会出现
if (!isMoving && (doView.type === 'image' || doView.type === 'text')) {
pen.paint()
}
pen.paint((callbackInfo) => {