Skip to content

Commit

Permalink
Merge branch 'refs/heads/pr/32'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	src/ng-FitText.js
  • Loading branch information
patrickmarabeas committed Jan 17, 2016
2 parents 66c6240 + ebffb34 commit 3a86573
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ The FitText directive will also watch the `ng-model` placed on the element, so g

The `data-fittext-max=""` and `data-fittext-min=""` attributes respectfully limit the font size. This can also be set globally in the `fitTextConfigProvider` via `min` and `max`.

You may set `data-fittext-max` to the special value `"initial"` in order to prevent the font size from increasing beyond the CSS-computed style. This requires the `font-size` property to have been either inherited, or applied via a CSS selector. It does not work for inline `font-size` set via an inline `style` attribute. It also requires support for `window.getComputedStyle()` (IE 9+).

#### Preserving line height

The `data-fittext-preserve-line-height` attribute gets the `line-height` set to the original `font-size` value once the resizing has happened. This can also be set globally in the `fitTextConfigProvider` via `preserveLineHeight`.
Expand Down
14 changes: 7 additions & 7 deletions src/ng-FitText.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@

var parent = element.parent()
, computed = window.getComputedStyle(element[0], null)
, newlines = element.children().length || 1
, loadDelay = attrs.fittextLoadDelay || config.loadDelay
, compressor = attrs.fittext || config.compressor
, minFontSize = attrs.fittextMin || config.min
, maxFontSize = attrs.fittextMax || config.max
, lineHeight = computed.getPropertyValue('line-height')
, display = computed.getPropertyValue('display')
, newlines = element.children().length || 1
, loadDelay = attrs.fittextLoadDelay || config.loadDelay
, compressor = attrs.fittext || config.compressor
, minFontSize = attrs.fittextMin || config.min
, maxFontSize = (attrs.fittextMax === 'initial' ? computed['font-size'] : attrs.fittextMax) || config.max
, lineHeight = computed['line-height']
, display = computed['display']
;

function calculate() {
Expand Down

0 comments on commit 3a86573

Please sign in to comment.