Skip to content

Commit

Permalink
fix: if text shape's x or y is NaN, there will be a drawing error in …
Browse files Browse the repository at this point in the history
…webchart mini program. Related to antvis/wx-f2#81.
  • Loading branch information
simaQ committed Aug 29, 2018
1 parent 3c55a3b commit 4f0ca52
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/graphic/shape/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ class Text extends Shape {
const self = this;
const attrs = self._attrs.attrs;
const text = attrs.text;
if (Util.isNil(text)) { // text will be 0
let x = attrs.x;
let y = attrs.y;
if (Util.isNil(text) || isNaN(x) || isNaN(y)) { // text will be 0
return;
}
const textArr = attrs.textArr;
const fontSize = attrs.fontSize * 1;
const spaceingY = self._getSpaceingY();
let x = attrs.x;
let y = attrs.y;

if (attrs.rotate) { // do rotation
context.translate(x, y);
Expand Down

0 comments on commit 4f0ca52

Please sign in to comment.