Skip to content

Commit

Permalink
sets default lineHeight to 1.2 times the fontSize
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Apr 10, 2018
1 parent ab8c177 commit f4e6f03
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/TextBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default class TextBox extends BaseClass {
this._fontWeight = constant(400);
this._height = accessor("height", 200);
this._id = (d, i) => d.id || `${i}`;
this._lineHeight = (d, i) => this._fontSize(d, i) * 1.2;
this._on = {};
this._overflow = constant(false);
this._padding = constant(0);
Expand All @@ -69,7 +70,7 @@ export default class TextBox extends BaseClass {
render(callback) {

if (this._select === void 0) this.select(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.4;

const that = this;

const boxes = this._select.selectAll(".d3plus-textBox").data(this._data.reduce((arr, d, i) => {
Expand Down Expand Up @@ -153,7 +154,7 @@ export default class TextBox extends BaseClass {

}

if (w > fMin && (h > lH || resize && h > fMin * 1.4)) {
if (w > fMin && (h > lH || resize && h > fMin * lHRatio)) {

if (resize) {

Expand Down Expand Up @@ -451,7 +452,7 @@ function(d, i) {

/**
@memberof TextBox
@desc Sets the line height to the specified accessor function or static number, which is 1.4 times the [font size](#textBox.fontSize) by default.
@desc Sets the line height to the specified accessor function or static number, which is 1.2 times the [font size](#textBox.fontSize) by default.
@param {Function|Number} [*value*]
*/
lineHeight(_) {
Expand Down

0 comments on commit f4e6f03

Please sign in to comment.