Skip to content

Commit

Permalink
use original line-height instead of original font-size for line-heigh…
Browse files Browse the repository at this point in the history
…t preservation
  • Loading branch information
trumbitta committed Jun 21, 2015
1 parent 44d0cd4 commit b73d429
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion demo/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ body {
font-size: 50px;
text-align: center;
margin-top: 10px;
margin-bottom: 10px; }
margin-bottom: 10px;
line-height: 1.5; }
#plh-container p {
text-transform: uppercase; }

Expand Down
1 change: 1 addition & 0 deletions demo/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ body {
text-align: center;
margin-top: 10px;
margin-bottom: 10px;
line-height: 1.5;
}

p {
Expand Down
4 changes: 2 additions & 2 deletions src/ng-FitText.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
var minFontSize = attrs.fittextMin || config.min || Number.NEGATIVE_INFINITY;
var maxFontSize = attrs.fittextMax || config.max || Number.POSITIVE_INFINITY;
var preserveLineHeight = attrs.fittextPreserveLineHeight !== undefined ? attrs.fittextPreserveLineHeight : config.preserveLineHeight;
var originalFontSize = window.getComputedStyle(element[0],null).getPropertyValue('font-size');
var originalLineHeight = window.getComputedStyle(element[0],null).getPropertyValue('line-height');

var resizer = function() {
element[0].style.lineHeight = '1';
Expand All @@ -53,7 +53,7 @@
parseFloat(minFontSize)
) + 'px';
if ( preserveLineHeight !== undefined ) {
element[0].style.lineHeight = originalFontSize;
element[0].style.lineHeight = originalLineHeight;
}
};

Expand Down

0 comments on commit b73d429

Please sign in to comment.