[Mod] 绘制文字时有bg和borderRadius时圆角在bg上并且文字不圆角

This commit is contained in:
Chester Fu (付泓程) 2019-05-13 09:56:58 +08:00
parent a9db40a1ea
commit 723162443f

View File

@ -250,13 +250,14 @@ export default class Painter {
} }
const width = rawWidth + pd[1] + pd[3]; const width = rawWidth + pd[1] + pd[3];
const height = rawHeight + pd[0] + pd[2]; const height = rawHeight + pd[0] + pd[2];
this._doClip(view.css.borderRadius, width, height)
if (GD.api.isGradient(background)) { if (GD.api.isGradient(background)) {
GD.api.doGradient(background, width, height, this.ctx); GD.api.doGradient(background, width, height, this.ctx);
} else { } else {
this.ctx.setFillStyle(background); this.ctx.setFillStyle(background);
} }
this.ctx.fillRect(-(width / 2), -(height / 2), width, height); this.ctx.fillRect(-(width / 2), -(height / 2), width, height);
this.ctx.restore(); this.ctx.restore();
} }
@ -318,7 +319,7 @@ export default class Painter {
width, width,
height, height,
extra, extra,
} = this._preProcess(view); } = this._preProcess(view, view.css.background && view.css.borderRadius);
this.ctx.setFillStyle(view.css.color || 'black'); this.ctx.setFillStyle(view.css.color || 'black');
const { const {