Skip to content

Commit

Permalink
Merge pull request #210 from antvis/fix-lint-error
Browse files Browse the repository at this point in the history
fix lint error
  • Loading branch information
paleface001 committed Nov 13, 2019
2 parents 37742ec + 40ab245 commit cf15bc1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class TextDescription {
* 1. 注意初始text带换行符的场景
*/
private _textWrapper(width: number, style) {
const text: string = this.text;
const textContent: string = this.text;
const tShape = new Text({
attrs: {
text: '',
Expand All @@ -89,7 +89,7 @@ export default class TextDescription {
...style,
},
});
const textArr = text.split('\n');
const textArr = textContent.split('\n');
const wrappedTextArr = textArr.map((wrappedText) => {
let currentWidth = 0;
const chars = wrappedText.split('');
Expand All @@ -101,7 +101,9 @@ export default class TextDescription {
const textWidth = Math.floor(tShape.measureText());
currentWidth += textWidth;
if (currentWidth > width) {
if (i === 0) break;
if (i === 0) {
break;
}
breakIndex.push(i);
currentWidth = 0;
text = '';
Expand Down

0 comments on commit cf15bc1

Please sign in to comment.