fix: 支持textDecoration宽度自适应
This commit is contained in:
parent
6e789867ed
commit
f49271c89f
@ -518,6 +518,8 @@ export default class Painter {
|
|||||||
this.ctx.fillText(text, x, y, measuredWith);
|
this.ctx.fillText(text, x, y, measuredWith);
|
||||||
}
|
}
|
||||||
if (view.css.textDecoration) {
|
if (view.css.textDecoration) {
|
||||||
|
const fontSize = view.css.fontSize.toPx();
|
||||||
|
this.ctx.lineWidth = fontSize / 13;
|
||||||
this.ctx.beginPath();
|
this.ctx.beginPath();
|
||||||
this.ctx.moveTo(...this.callbackInfo.textDecoration.moveTo);
|
this.ctx.moveTo(...this.callbackInfo.textDecoration.moveTo);
|
||||||
this.ctx.lineTo(...this.callbackInfo.textDecoration.lineTo);
|
this.ctx.lineTo(...this.callbackInfo.textDecoration.lineTo);
|
||||||
@ -612,6 +614,7 @@ export default class Painter {
|
|||||||
}
|
}
|
||||||
const fontSize = view.css.fontSize.toPx();
|
const fontSize = view.css.fontSize.toPx();
|
||||||
if (view.css.textDecoration) {
|
if (view.css.textDecoration) {
|
||||||
|
this.ctx.lineWidth = fontSize / 13;
|
||||||
this.ctx.beginPath();
|
this.ctx.beginPath();
|
||||||
if (/\bunderline\b/.test(view.css.textDecoration)) {
|
if (/\bunderline\b/.test(view.css.textDecoration)) {
|
||||||
this.ctx.moveTo(lineX, y);
|
this.ctx.moveTo(lineX, y);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user