fix: 文字放大缩小bug,P20 文字点击消失问题
This commit is contained in:
parent
78068111bc
commit
e0f65f76d6
@ -222,8 +222,11 @@ export default class Painter {
|
|||||||
const linesArray = [];
|
const linesArray = [];
|
||||||
for (let i = 0; i < textArray.length; ++i) {
|
for (let i = 0; i < textArray.length; ++i) {
|
||||||
const textLength = this.ctx.measureText(textArray[i]).width;
|
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;
|
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);
|
const calLines = Math.ceil(textLength / partWidth);
|
||||||
// 取最长的作为 width
|
// 取最长的作为 width
|
||||||
width = partWidth > width ? partWidth : width;
|
width = partWidth > width ? partWidth : width;
|
||||||
|
|||||||
@ -314,7 +314,8 @@ Component({
|
|||||||
}, true, this.movingCache);
|
}, true, this.movingCache);
|
||||||
} else {
|
} else {
|
||||||
// 某些机型(华为 P20)非移动场景下,只绘制一遍会偶然性图片绘制失败,目前采用再绘一遍的方法
|
// 某些机型(华为 P20)非移动场景下,只绘制一遍会偶然性图片绘制失败,目前采用再绘一遍的方法
|
||||||
if (!isMoving && doView.type === 'image') {
|
// 文字也会出现
|
||||||
|
if (!isMoving && (doView.type === 'image' || doView.type === 'text')) {
|
||||||
pen.paint()
|
pen.paint()
|
||||||
}
|
}
|
||||||
pen.paint((callbackInfo) => {
|
pen.paint((callbackInfo) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user