Skip to content

Commit

Permalink
Allow CSS inheritance globally
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmarabeas committed Apr 27, 2016
1 parent 0af12af commit 34f4353
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,26 @@ Because MODULARIZATION, this module doesn't come with debounce functionality inc
module.config(['fitTextConfigProvider', function(fitTextConfigProvider) {
fitTextConfigProvider.config = {
debounce: _.debounce, // include a vender function like underscore or lodash
debounce: function(a,b,c) { // specify your own function
debounce: function(a,b,c) { // OR specify your own function
var d;return function(){var e=this,f=arguments;clearTimeout(d),d=setTimeout(function(){d=null,c||a.apply(e,f)},b),c&&!d&&a.apply(e,f)}
},
delay: 1000, // debounce delay
loadDelay: 10, // global default delay before initial calculation
compressor: 1, // global default calculation multiplier
min: 0, // global default min
min: 'inherit', // OR inherit CSS values globally
max: Number.POSITIVE_INFINITY // global default max
max: 'inherit' // OR inherit CSS values globally
};
}]);
```

### Changelog

#### [v4.2.0](https://github.com/patrickmarabeas/ng-FitText.js/releases/tag/v4.2.0)
+ Globally `inherit` CSS values with `min` and `max` parameters in `fitTextConfigProvider`


#### [v4.1.0](https://github.com/patrickmarabeas/ng-FitText.js/releases/tag/v4.1.0)
+ Replace `'initial'` value with more semantic `'inherit'`
+ Both `data-fittext-min` and `data-fittext-max` can use the inherited CSS value by using `'inherit'`
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngFitText",
"version": "4.1.1",
"version": "4.2.0",
"main": [
"dist/ng-FitText.min.js"
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-fittext",
"version": "4.1.1",
"version": "4.2.0",
"description": "An AngularJS directive for inflating web type",
"homepage": "https://github.com/patrickmarabeas/ng-FitText.js",
"bugs": "https://github.com/patrickmarabeas/ng-FitText.js/issues",
Expand Down
10 changes: 6 additions & 4 deletions src/ng-FitText.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* ng-FitText.js v4.1.1
* ng-FitText.js v4.2.0
* https://github.com/patrickmarabeas/ng-FitText.js
*
* Original jQuery project: https://github.com/davatron5000/FitText.js
Expand All @@ -8,7 +8,7 @@
* Released under the MIT license
* http://opensource.org/licenses/mit-license.php
*
* Date: 23/01/2016
* Date: 27/04/2016
*/

(function(window, document, angular, undefined) {
Expand Down Expand Up @@ -45,8 +45,10 @@
, newlines = element.children().length || 1
, loadDelay = attrs.fittextLoadDelay || config.loadDelay
, compressor = attrs.fittext || config.compressor
, minFontSize = (attrs.fittextMin ==='inherit' ? computed['font-size'] : attrs.fittextMin) || config.min
, maxFontSize = (attrs.fittextMax === 'inherit' ? computed['font-size'] : attrs.fittextMax) || config.max
, min = attrs.fittextMin || config.min
, max = attrs.fittextMax || config.max
, minFontSize = min ==='inherit'? computed['font-size'] : min
, maxFontSize = max ==='inherit'? computed['font-size'] : max
, lineHeight = computed['line-height']
, display = computed['display']
, calcSize = 10
Expand Down

0 comments on commit 34f4353

Please sign in to comment.