提交 5ddcc170 编写于 作者: Q qiang

fix: Android measureText

上级 00579e37
......@@ -336,6 +336,11 @@ export class CanvasContext {
} else {
const webview = plus.webview.getWebviewById(String(this.pageId))
width = webview.evalJSSync(`(${measureText.toString()})(${JSON.stringify(text)},${JSON.stringify(font)})`)
width = Number(width)
// 安卓部分情况会计算失败,进行重试
if (isNaN(width)) {
return this.measureText(text)
}
}
return new TextMetrics(width)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册