Skip to content

Commit

Permalink
fixes textBox truncation w/ ellipsis
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Aug 18, 2016
1 parent 817c26d commit 6675920
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/TextBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default class TextBox extends BaseClass {

if (this._select === void 0) this.select(d3.select("body").append("svg").style("width", `${window.innerWidth}px`).style("height", `${window.innerHeight}px`).node());
if (this._lineHeight === void 0) this._lineHeight = (d, i) => this._fontSize(d, i) * 1.1;
const that = this;

const boxes = this._select.selectAll(".d3plus-textBox").data(this._data.reduce((arr, d, i) => {

Expand Down Expand Up @@ -126,7 +127,10 @@ export default class TextBox extends BaseClass {
else checkSize();
}
else if (line === 2 && !lineData[line - 2].length) lineData = [];
else lineData[line - 2] = this._ellipsis(lineData[line - 2]);
else {
lineData[line - 2] = that._ellipsis(lineData[line - 2]);
lineData = lineData.slice(0, line - 1);
}

}

Expand Down Expand Up @@ -197,8 +201,6 @@ export default class TextBox extends BaseClass {

}

const that = this;

function rotate(text) {
text.attr("transform", (d, i) => `rotate(${that._rotate(d, i)} ${d.x + d.w / 2} ${d.y + d.lH / 4 + d.lH * d.data.length / 2})`);
}
Expand Down

0 comments on commit 6675920

Please sign in to comment.