提交 a1b9912f 编写于 作者: Q qiang

fix: 修复部分设备 canvasContext.fillText 多次调用失败的问题

上级 cf40fb71
...@@ -106,8 +106,9 @@ if (pixelRatio !== 1) { ...@@ -106,8 +106,9 @@ if (pixelRatio !== 1) {
args[1] *= pixelRatio args[1] *= pixelRatio
args[2] *= pixelRatio args[2] *= pixelRatio
this.font = this.font.replace( var font = this.font
/(\d+)(px|em|rem|pt)/g, this.font = font.replace(
/(\d+\.?\d*)(px|em|rem|pt)/g,
function (w, m, u) { function (w, m, u) {
return (m * pixelRatio) + u return (m * pixelRatio) + u
} }
...@@ -115,12 +116,7 @@ if (pixelRatio !== 1) { ...@@ -115,12 +116,7 @@ if (pixelRatio !== 1) {
_super.apply(this, args) _super.apply(this, args)
this.font = this.font.replace( this.font = font
/(\d+)(px|em|rem|pt)/g,
function (w, m, u) {
return (m / pixelRatio) + u
}
)
} }
})(proto.fillText) })(proto.fillText)
...@@ -134,21 +130,16 @@ if (pixelRatio !== 1) { ...@@ -134,21 +130,16 @@ if (pixelRatio !== 1) {
args[1] *= pixelRatio // x args[1] *= pixelRatio // x
args[2] *= pixelRatio // y args[2] *= pixelRatio // y
this.font = this.font.replace( var font = this.font
/(\d+)(px|em|rem|pt)/g, this.font = font.replace(
/(\d+\.?\d*)(px|em|rem|pt)/g,
function (w, m, u) { function (w, m, u) {
return (m * pixelRatio) + u return (m * pixelRatio) + u
} }
) )
_super.apply(this, args) _super.apply(this, args)
this.font = this.font.replace( this.font = font
/(\d+)(px|em|rem|pt)/g,
function (w, m, u) {
return (m / pixelRatio) + u
}
)
} }
})(proto.strokeText) })(proto.strokeText)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册