Skip to content

Commit

Permalink
calculates the ratio of lineHeight to fontSize and uses it to calcula…
Browse files Browse the repository at this point in the history
…te the new lineHeight if fontResize is true
  • Loading branch information
nbond211 authored and davelandry committed Apr 10, 2018
1 parent f53f77d commit ab8c177
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/TextBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ export default class TextBox extends BaseClass {
if (t === void 0) return arr;

const resize = this._fontResize(d, i);
const lHRatio = this._lineHeight(d, i) / this._fontSize(d, i);

let fS = resize ? this._fontMax(d, i) : this._fontSize(d, i),
lH = resize ? fS * 1.4 : this._lineHeight(d, i),
lH = resize ? fS * lHRatio : this._lineHeight(d, i),
line = 1,
lineData = [],
sizes,
Expand Down Expand Up @@ -125,7 +126,7 @@ export default class TextBox extends BaseClass {
else if (fS > fMax) fS = fMax;

if (resize) {
lH = fS * 1.4;
lH = fS * lHRatio;
wrapper
.fontSize(fS)
.lineHeight(lH);
Expand Down

0 comments on commit ab8c177

Please sign in to comment.